/* «Карта мира снов» — только на /instrumenty/karta-mira-snov/ (assets/js/dreammap.js) */
.dm { margin: 8px auto 36px; }
.dm h2 { font-size: clamp(1.25rem, 1.1rem + .7vw, 1.6rem); margin: 0 0 .4em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dm .file-vh, .dm-sheet .file-vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
html.dm-lock { overflow: hidden; }
.dm-card { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 16px; }
.dm-card p { font-family: var(--ui); font-size: .95rem; line-height: 1.5; }
.dm .pr-note, .dm-sheet .pr-note { font-family: var(--ui); }
.dm-sub { margin: .5em 0; color: var(--muted); font: 500 .85rem/1.45 var(--ui); }
.dm-lab { margin: 0 0 8px; font: 700 .78rem/1.3 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.dm-lab small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }
:root[data-theme="light"] .dm-lab { color: var(--violet); }

/* ---------- первый вход */
.dm-start .btns { margin-top: 18px; }
.dm-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
@media (min-width: 560px) { .dm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dm-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 92px; padding: 12px 8px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: 600 .9rem/1.25 var(--ui); text-align: center; cursor: pointer; }
.dm-tile i { font-style: normal; font-size: 1.8rem; line-height: 1; }
.dm-tile.is-on { border-color: var(--gold); box-shadow: inset 0 0 0 1.5px var(--gold); }
.dm-field { display: grid; gap: 6px; margin: 10px 0; font: 600 .85rem/1.3 var(--ui); color: var(--muted); }
.dm-field input, .dm-field textarea, .dm-field select, .dm-newrow input, .dm-listbar input, .dm-pop select {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(11, 14, 32, .45);
  color: var(--text); font: 500 1rem/1.4 var(--ui);
}
.dm-field textarea { min-height: 80px; resize: vertical; }
:root[data-theme="light"] .dm-field input, :root[data-theme="light"] .dm-field textarea, :root[data-theme="light"] .dm-field select, :root[data-theme="light"] .dm-newrow input, :root[data-theme="light"] .dm-listbar input, :root[data-theme="light"] .dm-pop select { background: #fff; }
:root[data-theme="night"] .dm-field input, :root[data-theme="night"] .dm-field textarea, :root[data-theme="night"] .dm-field select, :root[data-theme="night"] .dm-newrow input, :root[data-theme="night"] .dm-listbar input, :root[data-theme="night"] .dm-pop select { background: rgba(18, 7, 5, .6); }
.dm-field--date input { max-width: 220px; }
.dm-newrow { display: flex; gap: 8px; align-items: center; margin: 10px 0 4px; }
.dm-newrow input { flex: 1; min-width: 0; }
.dm-newrow .btn { flex: none; }
.dm-newrow--odd { flex-wrap: wrap; }
.dm-newrow--odd input { flex-basis: 100%; }
.dm-ac { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.dm-ac:empty { display: none; }

/* ---------- чипы и отметки */
.dm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.dm-chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 .9rem/1.2 var(--ui); cursor: pointer; text-align: left; }
.dm-chip.is-on { border-color: var(--gold); background: rgba(232, 200, 114, .14); }
:root[data-theme="light"] .dm-chip.is-on { background: rgba(232, 200, 114, .3); border-color: #b88a1c; }
.dm-chip--maybe { border-style: dashed; }
.dm-chip--more { color: var(--muted); }
.dm-chip--ac { min-height: 40px; font-size: .85rem; }
.dm-chip.is-open { box-shadow: 0 0 0 2px var(--gold); }
.dm-chip small { color: var(--muted); font-weight: 500; }
.dm-checks { display: grid; gap: 6px; margin: 12px 0; }
.dm-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font: 500 .95rem/1.35 var(--ui); cursor: pointer; }
.dm-check input { width: 20px; height: 20px; flex: none; accent-color: var(--gold); }
.dm-check small { color: var(--muted); }
.dm-check--sm { min-height: 36px; font-size: .82rem; color: var(--muted); }
.dm-check--sm input { width: 18px; height: 18px; }

/* ---------- верх: вкладки и главная кнопка */
.dm-top { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dm-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); max-width: 100%; overflow-x: auto; }
.dm-tab { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 700 .9rem/1 var(--ui); cursor: pointer; white-space: nowrap; }
.dm-tab.is-on { background: var(--gold); color: var(--btn-text); }
.dm-addbtn { flex: 1 1 220px; max-width: 360px; }
@media (max-width: 559px) { .dm-addbtn { max-width: none; order: -1; } .dm-tabs { width: 100%; justify-content: space-between; } .dm-tab { flex: 1; padding: 6px 8px; } }
.dm-banner { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--gold); background: rgba(232, 200, 114, .1); margin-bottom: 12px; }
.dm-banner p { margin: 0 0 8px; font: 500 .9rem/1.45 var(--ui); }
.dm-banner .btns { margin: 0; }
.dm-stat { margin: 8px 0 0; color: var(--muted); font: 500 .85rem/1.4 var(--ui); }

/* ---------- карта */
.dm-mapbox { position: relative; height: min(62vh, 560px); min-height: 340px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, rgba(75, 46, 131, .35), rgba(11, 14, 32, .2) 70%), var(--bg1); }
:root[data-theme="light"] .dm-mapbox { background: radial-gradient(ellipse at 50% 45%, #fff 0, #f4eedf 75%); }
:root[data-theme="night"] .dm-mapbox { background: radial-gradient(ellipse at 50% 45%, rgba(106, 42, 20, .35), #160906 75%), #160906; }
.dm-svg { display: block; width: 100%; height: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.dm-mapbox.is-full { position: fixed; inset: 0; z-index: 70; height: 100%; min-height: 0; border-radius: 0; border: 0; background-color: var(--bg0); }
.dm-mapbox.is-full .dm-svg { touch-action: none; }
.dm-map-empty { position: absolute; inset: 40% 16px auto; text-align: center; margin: 0; color: var(--muted); font: 500 .95rem/1.4 var(--ui); pointer-events: none; }
.dm-ctl { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; }
.dm-ctl button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 700 1.15rem/1 var(--ui); cursor: pointer; box-shadow: var(--shadow); }
:root[data-theme="light"] .dm-ctl button { background: #fff; }
.dm-find { position: absolute; left: 10px; top: 10px; width: min(220px, calc(100% - 80px)); min-height: 40px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 500 .9rem/1.3 var(--ui); }
:root[data-theme="light"] .dm-find { background: #fff; }
.dm-fulladd { display: none; position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); box-shadow: var(--shadow); }
.dm-mapbox.is-full .dm-fulladd { display: inline-flex; }
.dm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 2px 0; color: var(--muted); font: 500 .8rem/1.35 var(--ui); }
.dm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dm-lg { display: inline-block; width: 26px; height: 0; border-top: 3px solid var(--gold); }
.dm-lg--d { border-top: 2px dashed var(--muted); }
.dm-lg--t { width: 14px; height: 14px; border: 2.5px solid #ff8a7a; border-radius: 50%; }
.dm-star { color: var(--gold); font-weight: 700; }
.dm-hint { margin: 6px 2px 0; color: var(--muted); font: 500 .8rem/1.4 var(--ui); }
@media (hover: hover) and (pointer: fine) { .dm-hint { display: none; } }

.dm-e--s { stroke: var(--gold); stroke-opacity: .7; stroke-linecap: round; }
.dm-e--d { stroke: var(--muted); stroke-opacity: .8; stroke-dasharray: 6 7; }
:root[data-theme="light"] .dm-e--s { stroke: #b88a1c; }
.dm-n { cursor: pointer; outline: none; }
.dm-n__c { fill: var(--bg2); stroke: var(--line); stroke-width: 1.5; }
:root[data-theme="light"] .dm-n__c { fill: #fff; stroke: rgba(75, 46, 131, .3); }
:root[data-theme="night"] .dm-n__c { fill: #2a110a; }
.dm-n.is-often .dm-n__c { stroke-dasharray: 3 4; }
.dm-n__c--trap { stroke: #ff8a7a; stroke-width: 3.5; stroke-dasharray: none !important; }
:root[data-theme="light"] .dm-n__c--trap { stroke: #d2513f; }
.dm-n__home { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-opacity: .85; }
.dm-n__e { text-anchor: middle; pointer-events: none; }
.dm-n__l { text-anchor: middle; fill: var(--text); font-family: var(--ui); font-weight: 600; paint-order: stroke; stroke: var(--bg0); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
:root[data-theme="light"] .dm-n__l { stroke: #f7f2e7; }
:root[data-theme="night"] .dm-n__l { stroke: #120705; }
.dm-n__sb, .dm-n__kb { pointer-events: none; }
.dm-n__sb circle { fill: var(--bg0); stroke: var(--gold); stroke-width: 1.5; }
.dm-n__sb text { fill: var(--gold); font-family: var(--ui); font-weight: 700; text-anchor: middle; }
.dm-n__kb circle { fill: var(--bg2); stroke: var(--line); stroke-width: 1; }
.dm-n__kb text { fill: var(--text); font-family: var(--ui); font-weight: 700; text-anchor: middle; }
:root[data-theme="light"] .dm-n__sb circle { fill: #fff; stroke: #a77b10; }
:root[data-theme="light"] .dm-n__sb text { fill: #8a6200; }
:root[data-theme="light"] .dm-n__kb circle { fill: #f3efe6; }
:root[data-theme="night"] .dm-n__sb circle { fill: #120705; }
.dm-n:focus-visible .dm-n__c, .dm-n:hover .dm-n__c { stroke: var(--gold); stroke-width: 3; }
.dm-n.is-new .dm-n__c { animation: dm-pulse 1.2s ease-in-out 2; }
@keyframes dm-pulse { 50% { stroke: var(--gold); stroke-width: 6; } }
@media (prefers-reduced-motion: reduce) { .dm-n.is-new .dm-n__c { animation: none; stroke: var(--gold); stroke-width: 4; } }

/* ---------- списки */
.dm-listbar { display: grid; gap: 8px; margin-bottom: 10px; }
.dm-plist, .dm-vlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dm-plist button, .dm-vlist button { width: 100%; min-height: 52px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; text-align: left; padding: 10px 14px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 .95rem/1.3 var(--ui); cursor: pointer; }
.dm-plist i { grid-row: span 2; font-style: normal; font-size: 1.5rem; }
.dm-plist small, .dm-vlist small { grid-column: 2; color: var(--muted); font-weight: 500; font-size: .82rem; }
.dm-vlist button { grid-template-columns: auto 1fr; }
.dm-vlist button > span { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.dm-vlist--all small { grid-column: 1 / -1; }
.dm-mark { grid-column: 1 / -1; color: var(--gold); font-size: .85rem; }

/* ---------- шторка */
.dm-sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.dm-sheet__bg { position: absolute; inset: 0; background: rgba(5, 6, 16, .62); }
.dm-sheet__box { position: relative; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 0;
  border-radius: 22px 22px 0 0; background: var(--bg1); box-shadow: var(--shadow); outline: none; animation: dm-up .22s ease-out; }
:root[data-theme="light"] .dm-sheet__box { background: #fff; }
:root[data-theme="night"] .dm-sheet__box { background: #1c0b07; }
@keyframes dm-up { from { transform: translateY(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dm-sheet__box { animation: none; } }
@media (min-width: 700px) { .dm-sheet { align-items: center; padding: 20px; } .dm-sheet__box { border-radius: 22px; padding: 24px 26px 0; } }
.dm-sh__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dm-sh__head h2 { flex: 1; margin: 0; overflow-wrap: anywhere; }
.dm-x { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 1.4rem/1 var(--ui); cursor: pointer; }
.dm-x--sm { width: 36px; height: 36px; font-size: 1.1rem; }
.dm-emo { flex: none; width: 48px; height: 48px; border-radius: 14px; border: 1px dashed var(--line); background: transparent; font-size: 1.7rem; cursor: pointer; }
.dm-emos { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; margin-bottom: 10px; }
.dm-emos button { height: 44px; border: 1px solid var(--line-2); border-radius: 10px; background: transparent; font-size: 1.4rem; cursor: pointer; }
.dm-sec { padding: 12px 0; border-top: 1px solid var(--line-2); }
.dm-sec:first-of-type { border-top: 0; }
.dm-sh__foot { position: sticky; bottom: 0; display: grid; gap: 8px; margin: 8px -18px 0; padding: 12px 18px max(14px, env(safe-area-inset-bottom)); background: inherit; border-top: 1px solid var(--line-2); }
@media (min-width: 700px) { .dm-sh__foot { margin: 8px -26px 0; padding: 14px 26px 18px; } }
.dm-which { display: flex; gap: 10px; align-items: center; justify-content: space-between; font: 600 .95rem/1.35 var(--ui); }
.dm-link { border: 0; background: none; color: var(--link); font: 700 .9rem/1 var(--ui); text-decoration: underline; cursor: pointer; padding: 10px 4px; flex: none; }
.dm-text summary { cursor: pointer; color: var(--muted); font: 600 .85rem/1.3 var(--ui); padding: 8px 0; }
.dm-text p { margin: 0; white-space: pre-wrap; font-size: .95rem; line-height: 1.55; max-height: 40vh; overflow-y: auto; }
.dm-picks { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; }
.dm-pick { display: grid; gap: 2px; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 .92rem/1.3 var(--ui); cursor: pointer; }
.dm-pick small { color: var(--muted); font-weight: 500; }
.dm-pick.is-on { border-color: var(--gold); }
.dm-pick:disabled { opacity: .5; cursor: default; }
.dm-seq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; min-height: 64px; border-radius: 14px; border: 1px dashed var(--line); margin: 8px 0; }
.dm-seq__empty { color: var(--muted); font: 500 .9rem/1.3 var(--ui); padding: 0 6px; }
.dm-how { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px dashed var(--line); background: transparent; color: var(--muted); font: 700 1rem/1 var(--ui); cursor: pointer; }
.dm-how.is-set { border-style: solid; border-color: var(--gold); color: var(--text); }
.dm-how.is-open { box-shadow: 0 0 0 2px var(--gold); }
.dm-pop { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); margin: 6px 0 10px; }
.dm-pop p { margin: 0 0 8px; font: 600 .9rem/1.35 var(--ui); }
.dm-pop .dm-sub { margin: 8px 0 0; font-weight: 500; }
.dm-pop--row { display: flex; flex-wrap: wrap; gap: 8px; }
.dm-hows { display: grid; gap: 6px; }
@media (min-width: 520px) { .dm-hows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dm-hw { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 .88rem/1.25 var(--ui); text-align: left; cursor: pointer; }
.dm-hw i { font-style: normal; font-size: 1.2rem; width: 24px; text-align: center; }
.dm-hw.is-on { border-color: var(--gold); background: rgba(232, 200, 114, .14); }
.dm-rev { margin-top: 2px; }
.dm-new { margin: 10px 0; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; }
.dm-new summary { cursor: pointer; padding: 12px 0; font: 700 .9rem/1.35 var(--ui); }
.dm-pf { padding-bottom: 8px; }
.dm-pf .dm-lab { margin-top: 12px; }
.dm-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-sg { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 .88rem/1.2 var(--ui); cursor: pointer; }
.dm-sg.is-on { border-color: var(--gold); background: rgba(232, 200, 114, .14); }
.dm-odd { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font: 500 .92rem/1.35 var(--ui); }
.dm-odd > span { flex: 1 1 100%; }
.dm-moods { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.dm-mood { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 .88rem/1 var(--ui); cursor: pointer; }
.dm-mood i { font-style: normal; font-size: 1.2rem; }
.dm-mood.is-on { border-color: var(--gold); background: rgba(232, 200, 114, .14); }
.dm-note { padding: 10px 12px; border-radius: 12px; background: var(--surface); font: 500 .88rem/1.45 var(--ui); margin: 8px 0; }
.dm-note--sign { border-left: 3px solid var(--gold); }
.dm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.dm-tags span { padding: 4px 10px; border-radius: 999px; background: var(--surface); font: 600 .8rem/1.3 var(--ui); color: var(--muted); }
.dm-btns { gap: 8px; }
.dm-btns .btn { flex: 1 1 auto; }
.dm-danger { color: #ff9a8a; }
:root[data-theme="light"] .dm-danger { color: #b3402f; }

/* ---------- всплывающее сообщение */
.dm-toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: flex; gap: 12px; align-items: center;
  width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: var(--bg2); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--line); font: 600 .9rem/1.4 var(--ui); }
:root[data-theme="light"] .dm-toast { background: #1d2350; color: #f3efe6; }
.dm-toast__act { flex: none; min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--gold); background: transparent; color: var(--gold); font: 700 .85rem/1 var(--ui); cursor: pointer; }

/* на странице карты липкая плашка ВК закрывала бы карту и кнопку «Сохранить» */
body.dm-on .vk-sticky { display: none !important; }
.dm-legend--full { display: none; position: absolute; left: 10px; right: 10px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px); margin: 0; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); pointer-events: none; }
.dm-mapbox.is-full .dm-legend--full { display: flex; }
.dm-about { margin: 6px 2px 0; font: 500 .82rem/1.45 var(--ui); color: var(--muted); }
.dm-about summary { cursor: pointer; color: var(--text); font-weight: 600; padding: 6px 0; }
.dm-closeq { border-color: var(--gold); }
.dm-closeq .btns { margin: 0; }
.dm-toast.is-top { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
.dm-banner--warn { border-color: #ff8a7a; background: rgba(255, 138, 122, .12); }
.dm-sheet__box, .dm-odd > span, .dm-chip, .dm-pick b, .dm-plist b, .dm-which span, .dm-tags span { overflow-wrap: anywhere; }
.dm-start .dm-link { padding: 0; display: inline; }
.dm-sh__foot .btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }

.dm-seqlab { margin: 14px 0 6px; color: var(--text); }
