/* Игра «Карта снов» — только на /igra/karta-snov/ (assets/js/dreamboard.js) */
.db { margin: 8px auto 40px; }
.db h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html.db-lock { overflow: hidden; }
body.db-on .vk-sticky, body.db-playing .to-top { display: none !important; }

/* ---------- подготовка */
.db-resume { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 20px; }
.db-resume p { margin: 0 0 .5em; font-family: var(--ui); }
.db-form { display: grid; gap: 18px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.db-form h2 { margin: 0; }
.db-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.db-form legend { font: 700 .8rem/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; padding: 0; }
:root[data-theme="light"] .db-form legend { color: var(--violet); }
.db-form .pr-note { margin: 0; }
.db-form input[type=text], .db-field textarea {
  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);
}
:root[data-theme="light"] .db-form input[type=text], :root[data-theme="light"] .db-field textarea { background: #fff; }
:root[data-theme="night"] .db-form input[type=text], :root[data-theme="night"] .db-field textarea { background: rgba(18, 7, 5, .6); }
.db-prows { display: grid; gap: 12px; }
.db-prow { display: grid; gap: 8px; padding: 10px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.db-prow__line { display: flex; gap: 8px; align-items: center; }
.db-prow__tok { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.6rem; }
.db-prow__tok .db-ti { width: 40px; height: 40px; }
.db-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; }
.db-toks { display: flex; gap: 5px; flex-wrap: wrap; }
.db-toks button { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; display: grid; place-items: center; font-size: 1.35rem; cursor: pointer; padding: 0; }
.db-toks button[aria-pressed="true"] { border-color: var(--gold); background: rgba(232, 200, 114, .18); box-shadow: 0 0 0 2px rgba(232, 200, 114, .35); }
.db-toks .db-ti { width: 34px; height: 34px; }
.db-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.db-seg button { flex: 1 1 140px; min-height: 46px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--text); font: 700 .95rem/1.2 var(--ui); cursor: pointer; }
.db-seg button[aria-pressed="true"] { background: var(--gold); color: var(--btn-text); border-color: var(--gold); }
.db-check { display: flex; gap: 10px; align-items: center; font: 600 .95rem/1.35 var(--ui); cursor: pointer; min-height: 44px; }
.db-check input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; }

/* ---------- экран игры */
.db__top { display: grid; gap: 8px; margin-bottom: 10px; }
.db__players { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px; }
.db__players::-webkit-scrollbar { display: none; }
.db-pl { flex: none; display: flex; align-items: center; gap: 5px; min-height: 38px; padding: 3px 10px 3px 5px; border-radius: 999px; border: 1.5px solid var(--line); font: 600 .9rem/1.2 var(--ui); background: var(--surface); }
.db-pl .db-ti { font-size: 1.2rem; width: 28px; height: 28px; display: inline-grid; place-items: center; }
.db-pl b { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-pl.is-cur { border-color: var(--tc, var(--gold)); box-shadow: 0 0 0 2px var(--tc, var(--gold)); }
.db-pl.is-done { opacity: .75; }
@media (max-width: 699px) {   /* на телефоне у ожидающих игроков — только фишка и звёзды, имя и клетка — у того, чей ход */
  .db-pl:not(.is-cur) b, .db-pl:not(.is-cur) .db-pl__n { display: none; }
  .db-pl:not(.is-cur) { padding-right: 8px; }
}
.db-pl__s { color: var(--gold); }
.db-pl__n { color: var(--muted); font-size: .8rem; }
.db-pl.is-gain { animation: db-gain 1s ease; }
@keyframes db-gain { 0% { transform: scale(1); } 30% { transform: scale(1.12); background: rgba(232, 200, 114, .35); } 100% { transform: scale(1); } }
.db__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.db__status { font: 600 .85rem/1.3 var(--ui); color: var(--muted); }
.db__tools { display: flex; gap: 6px; }
.db__tools .chip { min-height: 40px; font-size: .85rem; padding: 6px 12px; }

.db__main { display: grid; gap: 12px; }
@media (min-width: 960px) {
  .db__main { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .db__side { position: sticky; top: 80px; }
}
.db__boardwrap { position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); background: rgba(11, 14, 32, .5); }
:root[data-theme="light"] .db__boardwrap { background: #fffaf0; }
.db__boardwrap.is-zoom { overflow: auto; max-height: max(260px, calc(100svh - 360px)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 960px) { .db__boardwrap.is-zoom { max-height: calc(100vh - 220px); } }
.db-board { --cs: 30px; position: relative; display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(12, 1fr); aspect-ratio: 1; width: 100%; margin: 0 auto; }
.db-board__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.db-cell {
  position: relative; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; cursor: pointer; color: var(--text);
  background: rgba(127, 127, 160, .18); background: color-mix(in srgb, var(--c) 30%, transparent);
  box-shadow: inset 0 0 0 .5px rgba(11, 14, 32, .55); display: grid; place-items: center; font-family: var(--ui);
}
.db-cell--odd { background: color-mix(in srgb, var(--c) 22%, transparent); }
:root[data-theme="light"] .db-cell { background: color-mix(in srgb, var(--c) 34%, #fff); box-shadow: inset 0 0 0 .5px rgba(29, 35, 80, .2); }
:root[data-theme="light"] .db-cell--odd { background: color-mix(in srgb, var(--c) 24%, #fff); }
.db-board--art .db-cell { background: color-mix(in srgb, var(--c) 14%, transparent); }
.db-cell:hover { box-shadow: inset 0 0 0 2px var(--c); }
.db-cell__n { position: absolute; top: 2px; left: 3px; font: 700 calc(var(--cs) * .22)/1 var(--ui); opacity: .75; }
.db-cell__e { font-size: calc(var(--cs) * .46); line-height: 1; }
.db-cell__e .db-ki { width: calc(var(--cs) * .5); height: calc(var(--cs) * .5); }
.db-cell__j { position: absolute; bottom: 2px; right: 3px; font: 800 calc(var(--cs) * .2)/1 var(--ui); }
.db-cell--bridge { background: color-mix(in srgb, #e8c872 40%, transparent); }
.db-cell--bridge .db-cell__j { color: #f5dea0; }
.db-cell--fog { background: color-mix(in srgb, #8d84a2 45%, transparent); }
.db-cell--fog .db-cell__j { color: #d8d1e8; }
:root[data-theme="light"] .db-cell--bridge .db-cell__j { color: #6b4a00; }
:root[data-theme="light"] .db-cell--fog .db-cell__j { color: #4e4866; }
.db-cell--start, .db-cell--finish { background: color-mix(in srgb, #e8c872 55%, transparent); }
@media (max-width: 559px) { .db__boardwrap:not(.is-zoom) .db-cell__n, .db__boardwrap:not(.is-zoom) .db-cell__j { display: none; } }
.db-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.db-link { fill: none; stroke-width: .07; stroke-linecap: round; opacity: .8; }
.db-link--bridge { stroke: #e8c872; stroke-dasharray: .22 .12; }
.db-link--fog { stroke: #c4bcdb; stroke-dasharray: .05 .12; stroke-width: .08; }
:root[data-theme="light"] .db-link--bridge { stroke: #a77b10; }
:root[data-theme="light"] .db-link--fog { stroke: #6d6590; }
.db-ar-b { fill: #e8c872; }
.db-ar-f { fill: #c4bcdb; }
:root[data-theme="light"] .db-ar-b { fill: #a77b10; }
:root[data-theme="light"] .db-ar-f { fill: #6d6590; }
.db-toklayer { position: absolute; inset: 0; pointer-events: none; }
.db-tok {
  position: absolute; width: calc(var(--cs) * .62); height: calc(var(--cs) * .62); min-width: 18px; min-height: 18px; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 50%; background: #0b0e20; border: 2px solid var(--tc, #e8c872);
  font-size: calc(var(--cs) * .4); line-height: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  transition: left .14s ease, top .14s ease; z-index: 2;
}
.db-tok .db-ti { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; object-fit: cover; }
.db-tok.is-cur { z-index: 3; animation: db-pulse 1.6s ease-in-out infinite; }
.db-tok.is-jump { transition: left .75s cubic-bezier(.5, -.2, .4, 1.3), top .75s cubic-bezier(.5, -.2, .4, 1.3); }
@keyframes db-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--tc, #e8c872); } 50% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .db-tok, .db-tok.is-jump { transition: none; } .db-tok.is-cur, .db-pl.is-gain { animation: none; } }

.db__act { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 10px; }
.db-act__who { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 600 1.05rem/1.3 var(--ui); }
.db-act__who .db-ti { font-size: 1.5rem; width: 34px; height: 34px; display: inline-grid; place-items: center; }
.db-act__pos { color: var(--muted); font-size: .85rem; }
.db-act__q { margin: 0; font: 600 .95rem/1.3 var(--ui); }
.db-roll { width: 100%; }
.db-nums { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.db-nums--1 { grid-template-columns: repeat(6, 1fr); }
.db-nums button { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: var(--text); font: 800 1.15rem/1 var(--ui); cursor: pointer; }
.db-nums button:hover { border-color: var(--gold); }
.db-link-btn { justify-self: start; background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--link); font: 600 .9rem/1.3 var(--ui); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; text-align: left; }
.db-dice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-dice.is-old { opacity: .7; }
.db-dice.is-old .db-die { width: 28px; height: 28px; padding: 4px; }
.db-dice__s { font: 600 .85rem/1.3 var(--ui); color: var(--muted); }
.db-die { width: 40px; height: 40px; border-radius: 10px; background: #f3efe6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 6px; gap: 2px; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.db-die i { border-radius: 50%; }
.db-die i.on { background: #1d2350; }
.db-dice.is-spin .db-die { animation: db-spin .14s linear infinite; }
@keyframes db-spin { 50% { transform: rotate(12deg) scale(.94); } }
.db-act__msg { margin: 0; font: 600 .9rem/1.4 var(--ui); }
.db__legend { margin-top: 12px; border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 14px; }
.db__legend summary { cursor: pointer; font: 700 .9rem/1.3 var(--ui); min-height: 32px; display: flex; align-items: center; }
.db__legend ol { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.db__legend li { display: flex; gap: 10px; align-items: flex-start; font: 500 .85rem/1.35 var(--ui); padding-left: 8px; border-left: 4px solid var(--c); }
.db__legend li small { display: block; color: var(--muted); font-weight: 500; }
.db-li { flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center; font-size: 1.2rem; border-radius: 8px; }
img.db-li, img.db-ki { object-fit: cover; }
.db-ki { display: inline-grid; place-items: center; width: 28px; height: 28px; font-size: 1.2rem; }

/* ---------- карточка (снизу на телефоне, по центру на компьютере) */
.db-sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.db-sheet__bg { position: absolute; inset: 0; background: rgba(5, 6, 16, .62); }
.db-sheet__box {
  position: relative; width: 100%; max-width: 620px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg1); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); animation: db-up .22s ease-out; outline: none;
}
:root[data-theme="light"] .db-sheet__box { background: #fff; }
:root[data-theme="night"] .db-sheet__box { background: #1c0b07; }
@media (min-width: 700px) { .db-sheet { align-items: center; padding: 20px; } .db-sheet__box { border-radius: 22px; padding: 28px 30px; } }
@keyframes db-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .db-sheet__box { animation: none; } }
.db-card { display: grid; gap: 12px; }
.db-card > * { margin: 0; }
.db-card__land { display: flex; align-items: center; gap: 8px; font: 700 .8rem/1.3 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.db-card__land .db-li { border: 2px solid var(--c, var(--line)); }
.db-card__title { display: flex; align-items: center; gap: 12px; }
.db-card__title h2 { margin: 0; font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2rem); }
.db-card__e { font-size: 2.6rem; line-height: 1; flex: none; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: color-mix(in srgb, var(--c, #e8c872) 30%, transparent); }
.db-card__task { font-size: 1.2rem; line-height: 1.55; }
.db-card__qh { font: 700 .78rem/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
:root[data-theme="light"] .db-card__qh { color: var(--violet); }
.db-card__q { padding-left: 1.2em; display: grid; gap: 4px; font-size: 1.05rem; }
.db-card__more { font: 600 .9rem/1.3 var(--ui); }
.db-card__who { font: 600 .95rem/1.5 var(--ui); color: var(--muted); }
.db-card__who .db-ti, .db-map__sum .db-ti { vertical-align: middle; margin-right: 3px; }
.db-again { padding: 10px 14px; border-radius: 12px; background: rgba(232, 200, 114, .1); border: 1px solid var(--line); font: 500 .95rem/1.45 var(--ui); }
#db-step2 > .db-card__btns { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 0 -18px calc(-20px - env(safe-area-inset-bottom)); padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--bg1); border-top: 1px solid var(--line-2); z-index: 1; }
:root[data-theme="light"] #db-step2 > .db-card__btns { background: #fff; }
:root[data-theme="night"] #db-step2 > .db-card__btns { background: #1c0b07; }
@media (min-width: 700px) { #db-step2 > .db-card__btns { bottom: -28px; margin: 0 -30px -28px; padding: 14px 30px 20px; } }
.db-card__who b { color: var(--text); }
.db-card__btns { display: grid; gap: 8px; }
@media (min-width: 520px) { .db-card__btns { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } .db-card__btns .db-link-btn { grid-column: 1 / -1; } }
.db-card__hint { font-size: .88rem; }
.db-got { font: 700 1.05rem/1.3 var(--ui); color: var(--gold); }
:root[data-theme="light"] .db-got { color: #8a6200; }
.db-field { display: grid; gap: 6px; font: 600 .9rem/1.3 var(--ui); }
.db-field textarea { resize: vertical; min-height: 64px; }
.db-transfer-menu { margin-bottom: 16px; }
.db-transfer-menu summary { cursor: pointer; width: fit-content; }
.db-transfer-menu .btns { margin-top: 12px; }
#db-transfer-code { display: block; width: 100%; box-sizing: border-box; margin: 8px 0 16px; padding: 12px; font: inherit; color: inherit; background: var(--bg); border: 1px solid currentColor; border-radius: 12px; resize: vertical; overflow-wrap: anywhere; }
#db-transfer-code[hidden] { display: none; }
#db-transfer-file { display: block; width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 8px 0; margin: 0 0 12px; font: inherit; }
.db-echo { padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line); display: grid; gap: 8px; }
.db-echo p { margin: 0; font: 500 .95rem/1.4 var(--ui); }
.db-echo__list { display: flex; flex-wrap: wrap; gap: 6px; }
.db-echo__p { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; max-width: 100%; min-width: 0; }
.db-echo__p b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.db-card { min-width: 0; }
.db-card > * { min-width: 0; }
.db-echo__p[aria-pressed="true"] { background: var(--gold); color: var(--btn-text); border-color: var(--gold); }
.db-echo__p[aria-pressed="true"]::after { content: " ✨"; }
.db-echo__p .db-ti { font-size: 1.1rem; width: 24px; height: 24px; display: inline-grid; place-items: center; }
.db-tip { padding: 12px 16px; border-radius: 14px; background: rgba(79, 209, 197, .1); border: 1px solid rgba(79, 209, 197, .3); }
.db-tip b { font: 700 .85rem/1.3 var(--ui); }
.db-tip p { margin: .3em 0 0; }
.db-intents ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.db-intents li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 1rem; }
.db-ti { display: inline-grid; place-items: center; }
img.db-ti { border-radius: 50%; object-fit: cover; }
.db-card__who .db-ti, .db-intents .db-ti, .db-map__sum .db-ti { font-size: 1.2rem; width: 28px; height: 28px; }

/* ---------- итог: карта мест */
.db__end { padding: 22px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
@media (min-width: 700px) { .db__end { padding: 30px; } }
.db-end__head h2 { margin-bottom: .4em; }
.db-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.db-tabs .chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden; }
.db-tabs .chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.db-tabs .chip[aria-selected="true"] { background: var(--gold); color: var(--btn-text); border-color: var(--gold); }
.db-tabs .db-ti { font-size: 1.1rem; width: 24px; height: 24px; }
.db-map__sum { font: 600 1rem/1.6 var(--ui); }
.db-lands { list-style: none; padding: 0; margin: 14px 0 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 700px) { .db-lands { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.db-lands span { overflow-wrap: anywhere; hyphens: auto; }
.db-lands li { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1.5px solid var(--line-2); opacity: .45; text-align: center; font: 600 .68rem/1.2 var(--ui); }
.db-lands li.is-on { opacity: 1; border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, transparent); }
.db-lands li b { position: absolute; top: 4px; right: 6px; font-size: .8rem; }
.db-signs { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--gold); background: rgba(232, 200, 114, .08); margin-bottom: 18px; }
.db-signs h3 { margin-top: 0; }
.db-signs ul { margin: 8px 0 0; padding-left: 1.1em; }
.db-signs small { color: var(--muted); font-family: var(--ui); }
.db-mland { border-left: 4px solid var(--c); padding: 2px 0 2px 12px; margin: 0 0 14px; }
.db-mland__h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-family: var(--ui); }
.db-mland ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.db-mland li { font-size: 1rem; }
.db-tag { display: inline-block; margin: 0 4px 0 0; padding: 1px 8px; border-radius: 999px; font: 600 .72rem/1.6 var(--ui); background: var(--surface); border: 1px solid var(--line); vertical-align: middle; }
.db-tag--sign { border-color: var(--gold); color: var(--gold); }
:root[data-theme="light"] .db-tag--sign { color: #8a6200; }
.db-note { display: block; color: var(--muted); font-style: italic; font-size: .95rem; }
.db-maybe { padding-left: 1.1em; color: var(--muted); }
.db-map__act { margin-top: 22px; display: grid; gap: 10px; }
.db-map__act .pr-note { margin: 0; }
.db-share { margin-top: 0; }
.db-end__again { margin-top: 24px; }
