/* «Где я?» (/games/where; public/where.js): игровой экран серии мини-игр, родня «Угадай танк».
   Классы .wh-*, общие куски (.mg-hero, .mg-panel, .mg-tabs, .mg-row) — из minigames.css.
   Над холстом WebGL нет backdrop-filter (фризы): подложки — сплошной полупрозрачный цвет.
   Анимации только украшают: таймер живёт в JS на setInterval. */
.where-page [hidden] { display: none !important; }
.wh-hero .mg-hero-inner { max-width: 1240px; padding-top: 14px; padding-bottom: 12px; }

.wh {
  --wh-plate: rgba(15, 14, 20, .84);
  --wh-solid: rgba(17, 16, 22, .96);
  --wh-line: rgba(255, 255, 255, .09);
  --wh-ok: var(--green, #8fd13f);
  --wh-bad: #ff5a5a;
  --wh-truth: #6fe08a;
  --wh-w: min(100%, 1200px);
  max-width: 1240px; margin: 0 auto; padding: 14px 20px 34px;
  display: flex; flex-direction: column; gap: 18px;
}

/* --- игровое поле ---------------------------------------------------------- */
.wh-game {
  position: relative; isolation: isolate; width: var(--wh-w); margin: 0 auto; box-sizing: border-box;
  height: clamp(480px, calc(100svh - 190px), 760px);
  /* clip, а не hidden: спрятанная за край панель не делает поле прокручиваемым */
  border-radius: 12px; overflow: hidden; overflow: clip;
  background: radial-gradient(130% 90% at 50% 0%, #24232b 0%, #141319 60%, #0f0e13 100%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px var(--line);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.wh-view { position: absolute; inset: 0; overflow: hidden; }
.wh-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.wh-canvas:active { cursor: grabbing; }
.wh-game[data-state=intro] .wh-canvas, .wh-game[data-state=loading] .wh-canvas { cursor: default; }

.wh-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 18px; border-radius: 12px; background: rgba(10, 10, 14, .62); color: #fff; font-size: 14px; font-weight: 700; pointer-events: none;
  transition: opacity .4s; }
.wh-hint svg { width: 34px; height: 34px; fill: none; stroke: var(--amber); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; animation: wh-sway 1.6s ease-in-out infinite; }
.wh-hint.gone, .wh-game:not([data-state=playing]) .wh-hint { opacity: 0; }

.wh-loading { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; text-align: center;
  background: rgba(14, 13, 19, .7); color: var(--text); font-size: 14px; font-weight: 600; }
.wh-loading i { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--amber); animation: wh-spin .8s linear infinite; }

/* --- HUD ------------------------------------------------------------------- */
.wh-top { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px; pointer-events: none; }
.wh-top > * { pointer-events: auto; }
.wh-plate { background: var(--wh-plate); border: 1px solid var(--wh-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .28); color: var(--text); }
.wh-round { justify-self: start; padding: 8px 12px 10px; min-width: 130px; }
.wh-round span, .wh-score span { display: block; font-size: 12px; color: var(--text-dim); }
.wh-round strong, .wh-score strong { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wh-round strong small { font-size: 14px; color: var(--text-faint); font-weight: 700; }
.wh-pips { display: flex; gap: 4px; margin-top: 6px; }
.wh-pips i { width: 20px; height: 5px; border-radius: 2px; background: rgba(255, 255, 255, .14); }
.wh-pips i.now { background: var(--amber); box-shadow: 0 0 6px rgba(255, 201, 77, .6); }
.wh-pips i.ok { background: var(--wh-ok); }
.wh-pips i.mid { background: #e2b94a; }
.wh-pips i.bad { background: var(--wh-bad); }
.wh-score { justify-self: end; padding: 8px 12px 10px; min-width: 130px; text-align: right; }
.wh-score strong.pop { animation: wh-pop .5s ease-out; }
/* На ПК справа открыта панель — счёт уезжает левее неё */
.wh-game[data-panel=open] .wh-top { padding-right: calc(var(--wh-panel-w) + 24px); }

.wh-clock { position: relative; width: 68px; height: 68px; border-radius: 50%; background: var(--wh-plate); box-shadow: 0 8px 24px rgba(0, 0, 0, .3), inset 0 0 0 1px var(--wh-line); }
.wh-clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.wh-clock circle { fill: none; stroke-width: 5; }
.wh-clock-bg { stroke: rgba(255, 255, 255, .08); }
.wh-clock-arc { stroke: var(--amber); stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 0; transition: stroke-dashoffset .1s linear, stroke .2s; }
.wh-clock b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.wh-clock.low .wh-clock-arc { stroke: var(--wh-bad); }
.wh-clock.low b { color: #ffb0a6; animation: wh-beat 1s ease-in-out infinite; }

/* Кнопка ответа поверх панорамы (видна, пока панель свёрнута) */
.wh-open { position: absolute; z-index: 5; right: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 18px;
  border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800; color: var(--accent-ink);
  background: var(--accent-grad, linear-gradient(135deg, #ffd166, #f2a93b)); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.wh-open svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.wh-open kbd, .wh-answer kbd, .wh-next kbd { font: inherit; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; color: rgba(0, 0, 0, .6); background: rgba(0, 0, 0, .12); }
.wh-open:disabled { display: none; }
.wh-game[data-panel=open] .wh-open { display: none; }

/* --- панель ответа: справа на ПК, шторка на телефоне -------------------------- */
.wh-game { --wh-panel-w: clamp(360px, 40%, 500px); }
.wh-panel { position: absolute; z-index: 6; top: 12px; right: 12px; bottom: 12px; width: var(--wh-panel-w); box-sizing: border-box;
  display: flex; flex-direction: column; border-radius: 12px; background: var(--wh-solid); border: 1px solid var(--wh-line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5); transform: translateX(calc(100% + 24px)); transition: transform .28s cubic-bezier(.2, .7, .2, 1); }
.wh-game[data-panel=open] .wh-panel { transform: none; }
/* На ПК панель — отдельное окно справа: панорама сужается до её левого края,
   а не прячется под ней (выбор карты закрывал половину обзора). */
@media (min-width: 761px) {
  /* Под окно справа поле шире обычного, панель уже — обзор почти не теряет. */
  .wh { max-width: 1520px; --wh-w: min(100%, 1480px); }
  .wh > :not(.wh-game) { width: min(100%, 1200px); margin-left: auto; margin-right: auto; box-sizing: border-box; }
  .wh-game { --wh-panel-w: clamp(320px, 30%, 430px); }
  .wh-game[data-panel=open] .wh-view { right: calc(var(--wh-panel-w) + 24px); top: 12px; left: 12px; bottom: 12px; border-radius: 10px; }
  .wh-game[data-panel=open] .wh-top { padding: 24px calc(var(--wh-panel-w) + 36px) 24px 24px; }
}
.wh-grip { display: none; }
.wh-step { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 14px 14px; gap: 10px; }
.wh-panel-head { display: flex; align-items: center; gap: 8px; }
.wh-panel-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 8px; cursor: pointer; font: inherit; font-size: 22px; line-height: 1; color: var(--text-dim); background: rgba(255, 255, 255, .06); }
.wh-x:hover { color: var(--text); background: rgba(255, 255, 255, .12); }
.wh-back { flex: none; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--amber); background: rgba(255, 201, 77, .1); }
.wh-back:hover { background: rgba(255, 201, 77, .18); }

.wh-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 8px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--wh-line); }
.wh-search:focus-within { box-shadow: inset 0 0 0 1px rgba(255, 201, 77, .6); }
.wh-search svg { flex: none; width: 17px; height: 17px; fill: none; stroke: var(--text-faint); stroke-width: 2; stroke-linecap: round; }
.wh-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 15px; color: var(--text); }
.wh-maps { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; align-content: start; padding: 2px 2px 4px; overscroll-behavior: contain; }
.wh-map { display: flex; flex-direction: column; gap: 5px; padding: 5px; border: 0; border-radius: 9px; cursor: pointer; text-align: left; font: inherit; color: var(--text);
  background: rgba(255, 255, 255, .045); box-shadow: inset 0 0 0 1px var(--wh-line); transition: background .12s, box-shadow .12s, transform .12s; }
.wh-map:hover { background: rgba(255, 201, 77, .1); box-shadow: inset 0 0 0 1px rgba(255, 201, 77, .6); }
.wh-map:active { transform: translateY(1px); }
.wh-map.on { box-shadow: inset 0 0 0 2px var(--amber); }
.wh-map-art { display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: linear-gradient(135deg, #2a2932, #17161c); }
.wh-map-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.wh-map-name { padding: 0 3px 2px; font-size: 13px; font-weight: 700; line-height: 1.2; }
.wh-none { margin: 10px 2px; font-size: 13.5px; color: var(--text-dim); grid-column: 1 / -1; }

/* Мини-карта: квадрат, вписанный в свободное место панели */
.wh-mm-wrap { flex: 1; min-height: 160px; container-type: size; display: flex; align-items: center; justify-content: center; }
.wh-mm { position: relative; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); border-radius: 8px; overflow: hidden; background: radial-gradient(120% 120% at 50% 40%, #2a3036, #171a1e); box-shadow: inset 0 0 0 1px var(--wh-line); }
.wh-mm.pickable { cursor: crosshair; }
.wh-panel { touch-action: manipulation; }
.wh-mm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.wh-mm-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); font-size: 14px; }
.wh-mm-grid { position: absolute; inset: 0; pointer-events: none; opacity: .25;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .1) 0 1px, transparent 1px 10%), repeating-linear-gradient(0deg, rgba(255, 255, 255, .1) 0 1px, transparent 1px 10%); }
.wh-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wh-line line { stroke: #fff; stroke-width: 2.5; stroke-dasharray: 7 5; stroke-linecap: round; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .9)); }
.wh-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; pointer-events: none; box-sizing: border-box;
  border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 3px 8px rgba(0, 0, 0, .6); }
.wh-dot.guess { background: var(--amber); }
.wh-dot.truth { background: var(--wh-truth); }
.wh-dot b { position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%); padding: 1px 6px; border-radius: 4px; white-space: nowrap;
  font-size: 11.5px; font-weight: 800; color: #111; background: inherit; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
/* Подпись правды — под точкой, чтобы не наезжать на «Ты» рядом */
.wh-dot.truth b { bottom: auto; top: calc(100% + 5px); }
.wh-pin-foot { display: flex; align-items: center; gap: 10px; }
.wh-pin-tip { flex: 1; min-width: 0; font-size: 13px; color: var(--text-dim); }
.wh-answer, .wh-next { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 150px; height: 46px; padding: 0 18px;
  border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800; color: var(--accent-ink); background: var(--accent-grad, linear-gradient(135deg, #ffd166, #f2a93b)); }
.wh-answer:disabled { opacity: .4; cursor: default; }
.wh-answer.busy { opacity: .7; cursor: progress; }

/* Разбор раунда */
.wh-rv-top { display: flex; align-items: flex-end; gap: 12px; }
.wh-rv-top > div:first-child { flex: 1; min-width: 0; }
.wh-verdict { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.wh-review.ok .wh-verdict { color: var(--wh-ok); }
.wh-review.mid .wh-verdict { color: var(--amber); }
.wh-review.bad .wh-verdict { color: #ff8475; }
.wh-rv-map { margin-top: 2px; font-size: 26px; font-weight: 800; letter-spacing: -.015em; line-height: 1.1; color: #fff; }
.wh-gain { font-size: 38px; font-weight: 800; line-height: 1; color: var(--amber); font-variant-numeric: tabular-nums; animation: wh-pop .5s ease-out; }
.wh-review.bad .wh-gain { color: var(--text-faint); }
.wh-rv-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13.5px; color: var(--text-dim); }
.wh-rv-stats > span:first-child b { font-size: 18px; color: #fff; font-variant-numeric: tabular-nums; }
.wh-rv-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.wh-rv-line .wh-plus { color: var(--amber); }
.wh-review .wh-next { align-self: stretch; }

/* Видимость частей по состоянию */
.wh-game[data-state=intro] .wh-top, .wh-game[data-state=intro] .wh-open, .wh-game[data-state=intro] .wh-panel { visibility: hidden; }
.wh-game[data-state=final] { height: auto; }
.wh-game[data-state=final] .wh-top, .wh-game[data-state=final] .wh-view, .wh-game[data-state=final] .wh-panel, .wh-game[data-state=final] .wh-open { display: none; }

/* --- интро и итог -------------------------------------------------------------- */
.wh-screen { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; overflow: auto;
  background: linear-gradient(90deg, rgba(14, 13, 19, .97) 0%, rgba(14, 13, 19, .9) 40%, rgba(14, 13, 19, .4) 72%, rgba(14, 13, 19, .15) 100%); }
.wh-intro { background:
  linear-gradient(90deg, rgba(14, 13, 19, .97) 0%, rgba(14, 13, 19, .9) 40%, rgba(14, 13, 19, .4) 72%, rgba(14, 13, 19, .15) 100%),
  url('/img/maps/himmelsdorf.webp') center / cover no-repeat, #141319; }
.wh-screen-body { width: min(520px, 100%); padding: 34px 44px; box-sizing: border-box; }
.wh-kicker { font-size: 13px; font-weight: 700; color: var(--amber); }
.wh-screen h2 { margin: 6px 0 16px; font-size: 38px; font-weight: 800; letter-spacing: -.025em; line-height: 1.05; color: #fff; }
.wh-rules { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 9px; }
.wh-rules li { position: relative; padding-left: 22px; font-size: 15px; line-height: 1.45; color: var(--text-dim); }
.wh-rules li::before { content: ''; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border-radius: 2px; background: var(--amber); transform: rotate(45deg); }
.wh-rules b { color: var(--text); }
.wh-scale { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 22px 22px; }
.wh-scale span { padding: 3px 8px; border-radius: 5px; background: rgba(255, 201, 77, .1); font-size: 12.5px; font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; }
.wh-scale span:nth-child(2) { opacity: .8; } .wh-scale span:nth-child(3) { opacity: .6; }
.wh-go { display: inline-flex; align-items: center; justify-content: center; min-width: 220px; min-height: 56px; padding: 0 32px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 20px; font-weight: 800; color: var(--accent-ink); background: var(--accent-grad, linear-gradient(135deg, #ffd166, #f2a93b));
  box-shadow: 0 10px 30px rgba(242, 169, 59, .35); transition: transform .12s, filter .12s; text-decoration: none; }
.wh-go:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.wh-go:disabled { opacity: .55; cursor: default; box-shadow: none; }
.wh-go-ghost { color: var(--text); background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; font-size: 16px; }
.wh-auth { margin: 16px 0 0; font-size: 13px; color: var(--text-dim); }
.wh-auth a, .wh-final-note a { color: var(--amber); }
.wh-keys-intro { margin: 8px 0 0; font-size: 12px; color: var(--text-faint); }

.wh-final { position: static; display: block; background: none; }
.wh-final-body { width: min(720px, 100%); margin: 0 auto; text-align: center; padding: 34px 24px 30px; box-sizing: border-box; }
.wh-final-score { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.wh-final-score strong { font-size: 64px; font-weight: 800; line-height: 1; color: var(--amber); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.wh-final-score span { font-size: 16px; color: var(--text-dim); }
.wh-final-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.wh-final-stats span { padding: 7px 12px; border-radius: 7px; background: rgba(255, 255, 255, .06); font-size: 13px; color: var(--text-dim); }
.wh-final-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.wh-strip { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 4px; max-width: 460px; margin: 6px auto 16px; }
.wh-strip i { height: 34px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 12.5px; font-weight: 800; background: rgba(255, 255, 255, .06); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.wh-strip i.ok { color: #14200a; background: var(--wh-ok); }
.wh-strip i.mid { color: #2a1d00; background: #e2b94a; }
.wh-strip i.bad { color: rgba(0, 0, 0, .6); background: var(--wh-bad); }
.wh-final-note { margin: 0 0 18px; font-size: 14px; color: var(--text-dim); }
.wh-final-note b { color: var(--text); }
.wh-final-note .wh-record { color: var(--amber); }
.wh-final-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.wh-final-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.wh-final-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 64px; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 6px; background: rgba(255, 255, 255, .04); font-size: 13px; }
.wh-final-list li span { color: var(--text-faint); font-weight: 700; }
.wh-final-list li b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-final-list li em { font-style: normal; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wh-final-list li strong { text-align: right; font-variant-numeric: tabular-nums; }
.wh-final-list li.ok { box-shadow: inset 2px 0 0 var(--wh-ok); }
.wh-final-list li.bad { box-shadow: inset 2px 0 0 var(--wh-bad); }
.wh-final-list li.ok strong { color: var(--amber); }

/* --- сообщения -------------------------------------------------------------- */
.wh-alert { position: absolute; z-index: 20; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 24px)); box-sizing: border-box;
  padding: 18px 20px; border-radius: 12px; background: rgba(20, 16, 18, .97); border: 1px solid rgba(255, 90, 90, .45); box-shadow: 0 20px 50px rgba(0, 0, 0, .55); text-align: center; }
.wh-alert p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.5; color: var(--text); }
.wh-alert div { display: flex; justify-content: center; gap: 8px; }
.wh-btn, .wh-btn-ghost { min-height: 40px; padding: 0 18px; border: 0; border-radius: 7px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 800; }
.wh-btn { color: var(--accent-ink); background: var(--accent-grad, linear-gradient(135deg, #ffd166, #f2a93b)); }
.wh-btn-ghost { color: var(--text); background: rgba(255, 255, 255, .08); }

/* --- таблица лидеров -------------------------------------------------------- */
.wh-board { width: var(--wh-w); margin: 0 auto; box-sizing: border-box; }
.wh-row-head, .wh-row { grid-template-columns: 38px minmax(0, 1fr) 64px 76px 86px; }
.wh-row-head { display: grid; gap: 10px; padding: 0 12px 4px; font-size: 12px; color: var(--text-faint); }
.wh-row-head span:nth-child(n+3) { text-align: right; }
.wh-row .mg-row-time { color: var(--amber); }
.wh-row-ms { font-size: 12.5px; color: var(--text-dim); text-align: right; }
.wh-row.top1 { background: linear-gradient(90deg, rgba(255, 209, 102, .16), rgba(255, 255, 255, .035) 60%); box-shadow: inset 3px 0 0 #ffd166; }
.wh-row.top2 { background: linear-gradient(90deg, rgba(207, 216, 220, .12), rgba(255, 255, 255, .035) 60%); box-shadow: inset 3px 0 0 #cfd8dc; }
.wh-row.top3 { background: linear-gradient(90deg, rgba(224, 160, 112, .13), rgba(255, 255, 255, .035) 60%); box-shadow: inset 3px 0 0 #e0a070; }
.wh-row.top1 .mg-row-place { color: #ffd166; } .wh-row.top2 .mg-row-place { color: #cfd8dc; } .wh-row.top3 .mg-row-place { color: #e0a070; }
.wh-row.is-me { box-shadow: inset 0 0 0 1px rgba(255, 201, 77, .6); }
a.wh-row .mg-row-name { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .18); text-underline-offset: 3px; }
a.wh-row:hover .mg-row-name { color: var(--amber); text-decoration-color: currentColor; }

/* --- движение ------------------------------------------------------------------ */
@keyframes wh-pop { 0% { transform: scale(1); } 35% { transform: scale(1.18); color: var(--amber); } 100% { transform: scale(1); } }
@keyframes wh-beat { 50% { transform: scale(1.08); } }
@keyframes wh-spin { to { transform: rotate(360deg); } }
@keyframes wh-sway { 0%, 100% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
.wh-game :focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

@media (hover: none) and (pointer: coarse) {
  .wh-open kbd, .wh-answer kbd, .wh-next kbd, .wh-keys-intro { display: none; }
}

/* Узкий экран: панорама на весь экран, панель — шторка снизу */
@media (max-width: 760px) {
  .wh-hero .mg-hero-inner { padding: 10px 14px 8px; }
  .wh { padding: 8px 8px 26px; gap: 14px; }
  .wh-game { border-radius: 10px; height: clamp(440px, calc(100svh - 165px), 820px); }
  .wh-top { gap: 6px; padding: 8px; }
  .wh-round, .wh-score { min-width: 0; padding: 6px 9px 7px; }
  .wh-round strong, .wh-score strong { font-size: 19px; }
  .wh-round span, .wh-score span { font-size: 11px; }
  .wh-pips i { width: 14px; height: 4px; }
  .wh-clock { width: 56px; height: 56px; }
  .wh-clock b { font-size: 20px; }
  .wh-game[data-panel=open] .wh-top { padding-right: 8px; }
  .wh-open { left: 50%; right: auto; bottom: 14px; transform: translateX(-50%); height: 52px; white-space: nowrap; }
  .wh-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 84%; border-radius: 16px 16px 0 0; border-bottom: 0;
    transform: translateY(calc(100% + 10px)); }
  .wh-grip { display: flex; justify-content: center; padding: 8px 0 2px; cursor: pointer; }
  .wh-grip i { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
  .wh-step { padding: 6px 10px 12px; }
  .wh-maps { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .wh-map-name { font-size: 12px; }
  .wh-search input { font-size: 16px; } /* без автоприближения iOS */
  .wh-pin-foot { flex-wrap: wrap; }
  .wh-answer { flex: 1; }
  .wh-rv-map { font-size: 21px; }
  .wh-gain { font-size: 30px; }
  .wh-screen { background: linear-gradient(180deg, rgba(14, 13, 19, .97) 0%, rgba(14, 13, 19, .92) 70%, rgba(14, 13, 19, .8) 100%); align-items: flex-start; }
  .wh-screen-body { padding: 20px 16px; }
  /* Интро на телефоне — обычный блок: кнопка «В бой» видна без прокрутки внутри */
  .wh-game[data-state=intro] { height: auto; }
  .wh-game[data-state=intro] .wh-view, .wh-game[data-state=intro] .wh-top { display: none; }
  .wh-intro { position: static; display: block; }
  .wh-screen h2 { font-size: 27px; margin-bottom: 12px; }
  .wh-rules li { font-size: 14px; }
  .wh-go { width: 100%; min-height: 52px; font-size: 18px; }
  .wh-final-body { padding: 22px 12px 18px; }
  .wh-final-score strong { font-size: 48px; }
  .wh-row-head, .wh-row { grid-template-columns: 28px minmax(0, 1fr) 40px 64px; gap: 8px; }
  .wh-row-ms, .wh-row-head span:nth-child(4) { display: none; }
}
/* --- телефон: забег на весь экран -------------------------------------------
   where.js ставит .wh-imm на поле и body.wh-immersive на время забега, когда совпадает
   запрос compact (портрет до 760px или лёжа ниже 500px). Поле встаёт поверх шапки,
   нижнего меню и плавающих кнопок, страница не прокручивается. На ПК ничего не меняется. */
.wh-exit { display: none; }
body.wh-immersive { overflow: hidden; overscroll-behavior: none; }
html:has(body.wh-immersive) { overflow: hidden; }
body.wh-immersive .bottom-tabs, body.wh-immersive .nav-sheet, body.wh-immersive .nav-sheet-scrim,
body.wh-immersive .ai-fab, body.wh-immersive .feedback-fab, body.wh-immersive .chat-fab,
body.wh-immersive .scroll-top, body.wh-immersive .a2hs, body.wh-immersive .sticky-ad-bar, body.wh-immersive .gp-sticky { display: none !important; }

.wh-game.wh-imm { position: fixed; inset: 0; z-index: 200; width: auto; height: auto; margin: 0; border-radius: 0; box-shadow: none;
  overscroll-behavior: none; --wh-sheet-h: min(60%, calc(100% - 150px)); }
.wh-game.wh-imm .wh-exit { position: absolute; z-index: 6; top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left));
  display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--wh-line); border-radius: 10px; cursor: pointer;
  color: var(--text); background: var(--wh-plate); box-shadow: 0 8px 24px rgba(0, 0, 0, .28); }
.wh-exit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.wh-game.wh-imm .wh-top, .wh-game.wh-imm[data-panel=open] .wh-top {
  padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 8px calc(58px + env(safe-area-inset-left)); gap: 6px; }
.wh-game.wh-imm .wh-open { bottom: calc(16px + env(safe-area-inset-bottom)); }
.wh-game.wh-imm .wh-step { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.wh-game.wh-imm .wh-loading { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* Портрет: шторка снизу, панорама сжимается до места над ней — смотреть можно и при открытом выборе.
   На метке и разборе шторка выше: мини-карта квадратом во всю ширину. */
.wh-game.wh-imm[data-step=pin], .wh-game.wh-imm[data-step=review] {
  --wh-sheet-h: min(calc(100% - 96px - env(safe-area-inset-top)), calc(100vw + 140px)); }
.wh-game.wh-imm .wh-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--wh-sheet-h);
  border-radius: 16px 16px 0 0; border-bottom: 0; transform: translateY(calc(100% + 10px)); }
.wh-game.wh-imm[data-panel=open] .wh-panel { transform: none; }
.wh-game.wh-imm[data-panel=open] .wh-view { top: 0; left: 0; right: 0; bottom: calc(var(--wh-sheet-h) - 14px); border-radius: 0; }
.wh-game.wh-imm .wh-grip { display: flex; justify-content: center; padding: 8px 0 2px; cursor: pointer; }
.wh-game.wh-imm .wh-grip i { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.wh-game.wh-imm .wh-review { overflow-y: auto; overscroll-behavior: contain; }
.wh-game.wh-imm .wh-review .wh-mm-wrap { min-height: 140px; }

/* Лёжа: панель — колонка справа, панорама слева от неё; интро обычным блоком. */
@media (orientation: landscape) and (max-height: 500px) {
  .wh-game[data-state=intro] { height: auto; }
  .wh-game[data-state=intro] .wh-view, .wh-game[data-state=intro] .wh-top { display: none; }
  .wh-intro { position: static; display: block;
    background: linear-gradient(90deg, rgba(14, 13, 19, .96), rgba(14, 13, 19, .84)), url('/img/maps/himmelsdorf.webp') center / cover no-repeat, #141319; }
  /* Лёжа экран низкий: заголовок и «В бой» слева, правила справа — кнопка видна сразу. */
  .wh-intro .wh-screen-body { width: 100%; padding: 16px 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); column-gap: 24px; align-items: start; }
  .wh-intro .wh-kicker, .wh-intro h2, .wh-intro .wh-go, .wh-intro .wh-keys-intro { grid-column: 1; }
  .wh-intro h2 { font-size: 28px; margin: 4px 0 12px; }
  .wh-intro .wh-go { min-height: 50px; font-size: 18px; justify-self: start; }
  .wh-intro .wh-rules { grid-column: 2; grid-row: 1 / span 3; margin: 0 0 12px; gap: 6px; }
  .wh-intro .wh-rules li { font-size: 13.5px; }
  .wh-intro .wh-scale { grid-column: 2; grid-row: 4; margin: 0 0 0 22px; }

  .wh-game.wh-imm,.wh-game.wh-imm[data-step] { --wh-panel-w: min(46%, 400px); }
  .wh-game.wh-imm .wh-top { gap: 6px; }
  .wh-game.wh-imm[data-panel=open] .wh-top { padding-right: calc(var(--wh-panel-w) + 8px + env(safe-area-inset-right)); }
  .wh-game.wh-imm .wh-round, .wh-game.wh-imm .wh-score { min-width: 0; padding: 5px 9px 6px; }
  .wh-game.wh-imm .wh-round strong, .wh-game.wh-imm .wh-score strong { font-size: 18px; }
  .wh-game.wh-imm .wh-round span, .wh-game.wh-imm .wh-score span { font-size: 11px; }
  .wh-game.wh-imm .wh-pips i { width: 14px; height: 4px; }
  .wh-game.wh-imm .wh-clock { width: 52px; height: 52px; }
  .wh-game.wh-imm .wh-clock b { font-size: 19px; }
  .wh-game.wh-imm .wh-open { left: auto; right: calc(16px + env(safe-area-inset-right)); transform: none; height: 50px; white-space: nowrap; }
  .wh-game.wh-imm .wh-panel { top: 0; bottom: 0; left: auto; right: 0; height: auto; width: calc(var(--wh-panel-w) + env(safe-area-inset-right));
    padding-right: env(safe-area-inset-right); border: 0; border-left: 1px solid var(--wh-line); border-radius: 14px 0 0 14px; transform: translateX(calc(100% + 10px)); }
  .wh-game.wh-imm[data-panel=open] .wh-view { top: 0; left: 0; bottom: 0; right: calc(var(--wh-panel-w) - 14px + env(safe-area-inset-right)); }
  .wh-game.wh-imm .wh-grip { display: none; }
  .wh-game.wh-imm .wh-step { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
  .wh-game.wh-imm .wh-panel-head h2 { font-size: 16px; }
  .wh-game.wh-imm .wh-search { height: 38px; }
  .wh-game.wh-imm .wh-search input { font-size: 16px; }
  .wh-game.wh-imm .wh-maps { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .wh-game.wh-imm .wh-map-name { font-size: 12px; }
  .wh-game.wh-imm .wh-mm-wrap { min-height: 110px; }
  .wh-game.wh-imm .wh-review .wh-mm-wrap { min-height: 120px; }
  .wh-game.wh-imm .wh-answer, .wh-game.wh-imm .wh-next { height: 44px; }
  .wh-game.wh-imm .wh-answer { flex: 1; min-width: 0; }
  .wh-game.wh-imm .wh-rv-map { font-size: 18px; }
  .wh-game.wh-imm .wh-gain { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .wh-panel { transition: none; }
  .wh-hint svg, .wh-gain, .wh-score strong.pop { animation: none; }
}
