/* Mini App: карта сцены и карта мира. */
/* ---------- карта ---------- */
.mapbox { flex: 1; position: relative; overflow: hidden; background: radial-gradient(90% 70% at 50% 40%, #232a3d 0%, var(--night-3) 100%); }
.mapbox svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
/* подложка под картой (map.js placeUnder): запечённый фон всей карты; виден только в жесте, когда карта едет готовой картинкой и у неё открываются края */
#mapunder { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; visibility: hidden; }
#mapunder img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; } #mapunder .lt-glow { mix-blend-mode: screen; }
.mapbox.drag #mapunder { visibility: visible; will-change: transform; }
.mapbox .empty { position: absolute; inset: 0; display: grid; place-items: center; }
.t-shade { fill: var(--shadow); opacity: .08; } .props { filter: drop-shadow(1px 2px 1.5px rgb(5 7 13 / .6)); }
/* карта отдалена (клетка мельче 30 px, класс ставит map.js paintVB): узоры плиток — ровным цветом, стены и предметы — без теней-фильтров, свет — без наложения.
   При таком масштабе их не разглядеть, а рисуются они дольше всего: на телефоне из-за них отдалённая карта отставала от пальца на секунды. */
#mapsvg.far #bgl g { filter: none; } #mapsvg.far .lt-glow { mix-blend-mode: normal; }
#mapsvg.far rect[fill="url(#pat-floor)"] { fill: #4a4033; } #mapsvg.far rect[fill="url(#pat-wall)"] { fill: #2a231c; } #mapsvg.far rect[fill="url(#pat-grass)"] { fill: #3d4a2e; }
#mapsvg.far rect[fill="url(#pat-water)"] { fill: #24485a; } #mapsvg.far rect[fill="url(#pat-fog)"] { fill: #1e1b17; }
.gl { stroke: var(--parch); stroke-opacity: .09; stroke-width: 1; }
.gl.img { stroke: var(--white-ish); stroke-opacity: .16; }
.coord { fill: var(--parch-dim); font: 700 12px "PT Sans"; text-anchor: middle; dominant-baseline: middle; opacity: .7; }
.p-wood { fill: #7a5a3a; stroke: var(--wood-ink); stroke-width: 1.5; } .p-line { stroke: var(--wood-ink); stroke-width: 1.5; fill: none; }
.p-cloth { fill: #6b3b3b; stroke: #2a1414; } .p-pillow { fill: #d9c9a5; } .p-stone { fill: #8a8a8a; stroke: #333; } .p-gleam { fill: var(--candle); }
.p-tree { fill: #2f4a26; stroke: #18260f; stroke-width: 2; } .p-tree-hi { fill: #4c6e38; } .p-metal { stroke: #9aa3ad; stroke-width: 2; }
.p-door { fill: #9a6a35; stroke: var(--wood-ink); stroke-width: 1.5; } .p-window { fill: #9fc3cf; }
.p-fire { fill: #ffb347; } .p-fire-glow { fill: var(--hot); opacity: .35; } .p-hazard { fill: none; stroke: #e0a03a; stroke-width: 2.5; }
/* свет и тьма (фаза 5): тёмные клетки темнее, полумрак — слабее, магическая тьма — почти чёрная, туман — серый; круги света */
#lightl { pointer-events: none; }
.lt-glow { mix-blend-mode: screen; } .lt-src { fill: var(--candle); stroke: var(--ink); stroke-width: 2; } .lt-src.magic { fill: var(--info); }
.obj-bg { fill: color-mix(in srgb, var(--night-3) 70%, transparent); stroke: var(--candle); stroke-opacity: .6; stroke-width: 1.5; }
.obj-ic { color: var(--candle); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.zone-t { opacity: .75; } .zone-f { fill: var(--info); fill-opacity: .2; } .zone-b { stroke: var(--parch); stroke-width: 1.5; fill: rgb(5 7 13 / .55); }
/* подписи объектов и фишек: всегда 12 px на экране (--ls — единиц карты на пиксель), показывает relabel() — без наложений */
.obj-nm, .tnm { font: 700 12px "PT Sans"; font-size: calc(12px * var(--ls, 1)); fill: var(--candle); paint-order: stroke; stroke: rgb(5 7 13 / .8); stroke-width: calc(3px * var(--ls, 1)); text-anchor: middle; pointer-events: none; }
.tok .tnm { font: 700 12px "PT Sans"; font-size: calc(12px * var(--ls, 1)); fill: var(--parch); dominant-baseline: auto; }   /* перебивает .tok text */
.sel-cell { fill: var(--candle); fill-opacity: .24; stroke: var(--candle); stroke-width: 3; pointer-events: none; }   /* клетка, по которой открыт лист */
#mapsvg [data-cell]:focus, #mapsvg .wpt:focus { outline: none; }   /* фокус с клавиатуры — свечное кольцо вокруг фишки, места, точки мира */
.fring { fill: none; stroke: var(--candle); stroke-width: 3.5; visibility: hidden; pointer-events: none; filter: drop-shadow(0 0 2px #05070d); }
#mapsvg [data-cell]:focus-visible > .fring, #mapsvg .wpt:focus-visible > .fring { visibility: visible; }
.obj-tag rect { fill: var(--night-3); stroke: var(--candle); stroke-width: 1.5; } .obj-tag text { font: 700 11px "PT Sans"; fill: var(--candle); text-anchor: middle; dominant-baseline: central; pointer-events: none; }   /* буквы у одинаковых значков рядом */
.mlabel { font: 700 13px "Cormorant SC", serif; fill: var(--parch); paint-order: stroke; stroke: rgb(5 7 13 / .6); stroke-width: 3px; text-anchor: middle; pointer-events: none; }
.side-pc { --c: var(--side-pc); } .side-ally { --c: var(--side-ally); } .side-npc { --c: var(--side-npc); } .side-foe { --c: var(--side-foe); }
.tok { transition: transform .35s ease-out; }
.tok.ghost { opacity: .4; } .tok.ghost .disc { stroke-dasharray: 5 4; }   /* призрак тумана: где видели в последний раз */
.tok .disc { stroke-width: 3; fill: color-mix(in srgb, var(--c) 70%, var(--shadow)); stroke: var(--c); }
.tok text { font: 700 15px "PT Sans"; fill: var(--white-ish); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.tok .hp { font: 700 12px "PT Sans"; fill: var(--parch); paint-order: stroke; stroke: rgb(5 7 13 / .73); stroke-width: 3px; }
.tok .hpb rect { fill: rgb(5 7 13 / .85); stroke: var(--c); stroke-width: 1.5; } .tok .hpb text { font: 700 11px "PT Sans"; fill: var(--parch); }   /* HP — плашка на нижнем краю фишки */
.tok .afk { font-size: 10px; fill: var(--ochre); letter-spacing: .04em; }
.tok .turn { fill: none; stroke: var(--candle); stroke-width: 2.5; stroke-dasharray: 4 4; transform-origin: center; transform-box: fill-box; }
@media (prefers-reduced-motion: no-preference) { #mapsvg.fight .tok .turn { animation: spin 6s linear infinite; } }   /* вне боя кольцо стоит: ноль работы на кадр */
#bgl { pointer-events: none; }   /* фон (и SVG карты внутри) нажатия не ловит: клетку считаем по координатам */
@keyframes spin { to { transform: rotate(360deg); } }
.mapbar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.mapbar button { flex: none; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--night-3) 80%, transparent); border: 1px solid var(--line); font-size: 13px; }
.mapbar button i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.mapbar .fit { padding: 0 12px; }
/* карта мира: точки-кампании поверх campaigns/world/sword-coast.svg; размеры в единицах карты (1600×1200) */
.mapmode { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(240px, calc(100% - 20px)); z-index: 4; background: color-mix(in srgb, var(--night-3) 88%, transparent); }
.wpt .dot { stroke-width: 5; }
.wpt .wic { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; color: var(--parch); }
.wpt.st-open { --c: var(--candle); } .wpt.st-open .dot { fill: var(--candle); stroke: var(--ink); }
.wpt.st-current { --c: var(--candle); } .wpt.st-current .dot { fill: var(--wine-2); stroke: var(--candle); } .wpt.st-current .wic { color: var(--white-ish); }
.wpt.st-prep { --c: var(--ochre); } .wpt.st-prep .dot { fill: var(--night-3); stroke: var(--ochre); stroke-dasharray: 7 6; }
.wpt.st-locked { --c: var(--parch-dim); opacity: .75; } .wpt.st-locked .dot { fill: var(--card); stroke: var(--parch-dim); }
.wpt.st-done { --c: var(--moss); } .wpt.st-done .dot { fill: var(--moss); stroke: var(--parch-dim); }
.wpt.st-back { --c: var(--candle); } .wpt.st-back .dot { fill: var(--moss); stroke: var(--candle); }
.wroad b { color: var(--candle); font-weight: 700; }
.wpt.sel .dot { stroke: var(--white-ish); stroke-width: 8; }
.wpt .pulse { fill: none; stroke: var(--candle); stroke-width: 4; transform-box: fill-box; transform-origin: center; animation: wpulse 2.6s ease-out infinite; }
@keyframes wpulse { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.wlabel { font: 700 30px "Cormorant SC", Georgia, serif; fill: var(--parch); paint-order: stroke; stroke: rgb(5 7 13 / .8); stroke-width: 8px; text-anchor: middle; pointer-events: none; }
.wpt.st-locked .wlabel { fill: var(--parch-dim); } .wpt.st-current .wlabel { fill: var(--candle); }
.whome circle { fill: var(--night-3); stroke: var(--candle); stroke-width: 3; } .whome use { color: var(--candle); fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.whome.bad circle { stroke: var(--danger-soft); } .whome.bad use { color: var(--danger-soft); } .whname { font: 700 22px "PT Sans", sans-serif; fill: var(--candle); paint-order: stroke; stroke: rgb(5 7 13 / .8); stroke-width: 6px; text-anchor: middle; }
/* карточка точки: анимированная сцена места (campaigns/world/cards/<id>.svg), название и приглашение поверх затемнения */
.asheet:has(.wcard) .grab { display: none; }
.wcard { position: relative; flex: none; height: 188px; margin: -8px -14px 12px; border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; background: var(--night-3); }
.wart, .wart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wshade { position: absolute; inset: 0; background: linear-gradient(180deg, rgb(16 20 31 / .05) 0%, rgb(16 20 31 / .2) 35%, rgb(16 20 31 / .78) 62%, rgb(16 20 31 / .95) 100%); }
.wcard.st-locked .wart { filter: grayscale(1) brightness(.55); }
.wcard.st-locked .wart *, .wcard.st-done .wart * { animation-play-state: paused !important; }
.wcard .x { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--white-ish); background: rgb(16 20 31 / .5); }
.wbadge { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--c, var(--parch)); background: rgb(16 20 31 / .75); border: 1px solid var(--c, var(--line)); }
.wbadge .i { width: 14px; height: 14px; }
.wtxt { position: absolute; left: 14px; right: 14px; bottom: 10px; text-shadow: 0 1px 3px var(--shadow); }
.wtxt b { display: block; font: 700 23px/1.1 "Cormorant SC", Georgia, serif; color: var(--candle); }
.wpitch { font: italic 400 15px/1.4 "PT Serif", Georgia, serif; color: var(--parch); margin: 4px 0 0; }
.wmeta { font-size: 12px; color: var(--parch-dim); }
.whouse { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 14px; } .whouse .i { width: 18px; height: 18px; color: var(--candle); flex: none; } .whouse.bad .i { color: var(--danger-soft); }
.wroad { margin: 0 0 12px; font-size: 14px; } .wroad > span { display: flex; align-items: center; gap: 6px; } .wroad .i { width: 18px; height: 18px; color: var(--ochre); flex: none; }
.wroad.sea .i { color: var(--info); } .wroad.sea .why .i { color: var(--danger-soft); } .xhint { color: var(--info); }
.wsea { stroke: var(--info); stroke-width: 4; stroke-dasharray: 14 10; stroke-linecap: round; opacity: .7; pointer-events: none; } .wsea.open { stroke-dasharray: 4 14; }
.wport circle { fill: var(--night-3); stroke: var(--info); stroke-width: 3; } .wport use { color: var(--info); fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.wport.ship circle { stroke: var(--candle); } .wport.ship use { color: var(--candle); } .wport.bad circle { stroke: var(--danger-soft); } .wport.bad use { color: var(--danger-soft); }
.wroad .why { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--danger-soft); } .wroad .why .i { color: var(--danger-soft); }
.whook { font: 400 16px/1.5 "PT Serif", Georgia, serif; margin: 0 0 12px; }
.wrumor { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--ochre); background: #c8913a14; border-radius: 0 var(--r-sm) var(--r-sm) 0; font: italic 400 16px/1.5 "PT Serif", Georgia, serif; }
.wrumor small { display: block; font: 700 12px "PT Sans", sans-serif; color: var(--ochre); text-transform: uppercase; letter-spacing: .04em; font-style: normal; margin-bottom: 2px; }

