/* Секция «Игра» (#game) — KINETIK RUN. Рамка-аркада: тёмное стекло, моно-подписи заглавными, квадратные углы,
   метки обреза акцентом #f2b380, индикатор #f93f28. Холст 16:9 на широких экранах, 4:5 на телефоне.
   Экраны поверх холста (заставка, выбор героя, пауза, итог) — HTML, чтобы работали фокус и чтение с экрана. */

.sec-game{
  --game-accent:#f93f28;
  --game-peach:#f2b380;
  --game-frame:rgba(10,22,48,.62);
  overflow-x:clip;
}
.sec-game .game-bg{
  position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:
    radial-gradient(40% 36% at 78% 30%,rgba(249,63,40,.10),rgba(2,8,22,0) 70%),
    radial-gradient(46% 42% at 16% 64%,rgba(23,62,113,.45),rgba(2,8,22,0) 72%);
}
.sec-game .game-sq{background:linear-gradient(180deg,#0066ff 0 25%,#e8262d 25% 50%,#ff8a00 50% 75%,#7eb8d4 75%)}
.sec-game .game-title{font-size:clamp(44px,7vw,92px)}
@media (min-width:960px){
  .sec-game .game-head{grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:clamp(48px,7vw,120px);align-items:end}
  .sec-game .game-head .eyebrow{grid-column:1/-1}
  .sec-game .game-lede{justify-self:end;max-width:44ch}
}

/* ---------- Раскладка: аркада + боковая колонка ---------- */
.sec-game .game-layout{display:grid;gap:24px;align-items:start}
@media (min-width:1100px){.sec-game .game-layout{grid-template-columns:minmax(0,1fr) 300px;gap:28px}}

/* ---------- Рамка-аркада ---------- */
.sec-game .game-arcade{
  position:relative;background:var(--game-frame);
  -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05),inset 0 0 0 1px var(--line),0 40px 80px -40px rgba(0,4,16,.9);
  padding:0 10px 10px;
}
/* Метки обреза по углам */
.sec-game .game-arcade::before,.sec-game .game-arcade::after{
  content:"";position:absolute;width:18px;height:18px;pointer-events:none;
  border:solid var(--game-peach);
}
.sec-game .game-arcade::before{left:-1px;top:-1px;border-width:2px 0 0 2px}
.sec-game .game-arcade::after{right:-1px;bottom:-1px;border-width:0 2px 2px 0}

.sec-game .game-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:56px;padding:0 2px 0 8px}
.sec-game .game-bar-title{display:flex;align-items:center;gap:12px;color:var(--body)}
.sec-game .game-led{width:8px;height:8px;background:var(--game-accent);box-shadow:0 0 0 3px rgba(249,63,40,.18)}
.sec-game.is-playing .game-led{animation:game-led 1.2s steps(2,end) infinite}
@keyframes game-led{50%{opacity:.25}}
.sec-game .game-tools{display:flex;gap:6px}
.sec-game .game-tool{
  width:44px;height:44px;display:grid;place-items:center;color:#fff;
  background:rgba(51,52,74,.6);transition:background-color .2s,color .2s;
}
@media (hover:hover){.sec-game .game-tool:not([disabled]):hover{background:rgba(66,66,96,.66)}}
.sec-game .game-tool[disabled]{opacity:.4;cursor:not-allowed}
.sec-game .game-tool svg{width:16px;height:16px;fill:currentColor;stroke:currentColor;stroke-width:1.4;stroke-linecap:square}
.sec-game .game-tool[aria-pressed="true"]{color:var(--peach-ink);background:var(--game-peach)}
.sec-game [data-game-sound] .i-wave{display:none}
.sec-game [data-game-sound][aria-pressed="true"] .i-wave{display:inline}
.sec-game [data-game-sound][aria-pressed="true"] .i-mute{display:none}
.sec-game [data-game-fullscreen] .i-exit{display:none}
.sec-game .is-fullscreen [data-game-fullscreen] .i-exit{display:inline}
.sec-game .is-fullscreen [data-game-fullscreen] .i-enter{display:none}

/* ---------- Сцена и холст ---------- */
.sec-game .game-stage{
  position:relative;aspect-ratio:16/9;background:#020816;overflow:hidden;
  box-shadow:inset 0 0 0 1px var(--line-strong);
}
@media (max-width:640px){.sec-game .game-stage{aspect-ratio:4/5}}
/* Заставка, пока модули игры не подгружены (sec-game.js грузит их на подходе к секции): цвета сцены холста —
   небо темнеет кверху, трибуны до 80 % высоты, линия #f93f28 и дорожка. Холст после подгрузки закрывает фон целиком. */
.js .sec-game:not(.game-ready) .game-stage{
  background:linear-gradient(180deg,#020e23 0%,#08183b 40%,#0b1a43 44%,#0c1a41 80%,#f93f28 80% calc(80% + 1.5px),#081530 calc(80% + 1.5px));
}
.sec-game .game-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:pan-y;outline:none}
.sec-game.is-playing .game-canvas{touch-action:none;cursor:pointer}
.sec-game .game-stage:focus-within .game-canvas:focus-visible{outline:2px solid var(--game-peach);outline-offset:-2px}

/* Кнопка удара ракеткой у теннисиста (касание и мышь) */
.sec-game .game-punch{
  position:absolute;right:12px;bottom:12px;z-index:3;min-width:76px;height:52px;padding:0 14px;
  background:rgba(51,52,74,.72);color:#fff;box-shadow:inset 0 0 0 1px var(--game-peach);
  -webkit-user-select:none;user-select:none;touch-action:manipulation;
}
.sec-game .game-punch[aria-disabled="true"]{opacity:.45}

/* ---------- Экраны поверх холста ---------- */
.sec-game .game-screen{
  position:absolute;inset:0;z-index:4;display:grid;place-items:center;align-content:center;gap:16px;padding:16px;
  background:rgba(2,8,22,.66);overflow:auto;text-align:center;
}
.sec-game .game-screen[hidden]{display:none}
/* Заставка: кнопка над трибунами, герои внизу остаются на виду */
.sec-game .game-screen.is-intro{background:radial-gradient(46% 36% at 50% 30%,rgba(2,8,22,.6),rgba(2,8,22,0) 75%);align-content:start;padding-top:14%}
.sec-game .game-play{height:60px;font-size:15px;padding-inline:34px 38px}
.sec-game .game-intro-note{color:var(--body)}
.sec-game .game-screen-title{font-family:var(--f-display);color:var(--display);font-size:clamp(24px,3vw,36px);line-height:1.1}
.sec-game .game-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;align-items:center}

/* Выбор героя */
.sec-game .game-select{display:grid;gap:clamp(10px,2vw,18px);justify-items:center;width:min(100%,860px)}
.sec-game .game-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:100%}
.sec-game .game-card{
  position:relative;display:grid;justify-items:center;align-content:start;gap:4px;padding:8px 8px 12px;
  background:rgba(10,22,48,.82);box-shadow:inset 0 0 0 1px var(--line-strong);text-align:center;
  transition:box-shadow .2s,background-color .2s;
}
@media (hover:hover){.sec-game .game-card:hover{background:rgba(23,40,80,.85)}}
.sec-game .game-card[aria-checked="true"]{box-shadow:inset 0 0 0 2px var(--game-peach);background:rgba(23,40,80,.9)}
.sec-game .game-card[aria-checked="true"]::before{content:"";position:absolute;left:0;right:0;top:0;height:3px;background:var(--game-accent)}
.sec-game .game-card-art{width:100%;aspect-ratio:1/1;max-height:150px}
.sec-game .game-card-name{font-family:var(--f-display);font-size:20px;color:var(--display);line-height:1.1}
.sec-game .game-card-role{color:var(--game-peach)}
.sec-game .game-card-perk{font-size:13px;line-height:1.35;color:var(--body)}
.sec-game .game-select-hint{flex-basis:100%;margin-top:4px}
@media (max-width:640px){
  .sec-game .game-screen.is-select{align-content:start;padding:10px}
  .sec-game .game-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .sec-game .game-card{grid-template-columns:52px minmax(0,1fr);justify-items:start;text-align:left;column-gap:8px;row-gap:0;padding:6px 8px 8px 6px}
  .sec-game .game-card-art{grid-row:1/4;width:52px;height:52px}
  .sec-game .game-card-name{font-size:16px}
  .sec-game .game-card-role{font-size:10px}
  .sec-game .game-card-perk{grid-column:1/-1;font-size:12px;margin-top:4px}
  .sec-game .game-select-hint{display:none}
  .sec-game .game-card-name{max-width:100%;overflow-wrap:anywhere}
}
/* Узкий телефон: длинное имя («Дооронбек») помещается в карточку — портрет и шрифт чуть меньше */
@media (max-width:400px){
  .sec-game .game-card{grid-template-columns:42px minmax(0,1fr);column-gap:6px}
  .sec-game .game-card-art{width:42px;height:42px}
  .sec-game .game-card-name{font-size:15px}
}
@media (max-width:340px){
  .sec-game .game-card{grid-template-columns:32px minmax(0,1fr);column-gap:5px;padding-right:6px}
  .sec-game .game-card-art{width:32px;height:32px}
  .sec-game .game-card-name{font-size:13px}
}
@media (hover:none) and (pointer:coarse){.sec-game .game-select-hint{display:none}}

/* Итог */
.sec-game .game-over{display:grid;gap:12px;justify-items:center;width:min(100%,560px)}
.sec-game .game-over-reason{color:var(--game-peach)}
.sec-game .game-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1px;width:100%;margin:0;background:var(--line);box-shadow:0 0 0 1px var(--line)}
.sec-game .game-stat{display:grid;gap:6px;padding:12px 8px;background:rgba(5,13,32,.92)}
.sec-game .game-stat dt{color:var(--muted);font-size:11px}
.sec-game .game-stat dd{margin:0;font-family:var(--f-display);font-size:clamp(20px,2.4vw,28px);color:var(--display);line-height:1}
.sec-game .game-stat.is-main dd{color:var(--game-peach)}
.sec-game .game-newbest{color:#331200;background:var(--game-peach);padding:6px 10px}
.sec-game .game-refuel{margin-top:2px}
.sec-game .game-share-status{min-height:1.2em;font-size:13px;color:var(--body);overflow-wrap:anywhere}
@media (max-width:640px){
  .sec-game .game-screen.is-over{align-content:start;padding:12px 10px}
  .sec-game .game-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sec-game .game-over{gap:9px}
  .sec-game .game-stat{padding:8px}
}
.sec-game .game-noscript{position:absolute;inset:0;display:grid;place-items:center;color:var(--body);padding:24px}

/* ---------- Подсказка управления ---------- */
.sec-game .game-foot{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 18px;padding:14px 8px 4px}
.sec-game .game-keys{display:flex;flex-wrap:wrap;gap:6px 18px;margin:0;padding:0;list-style:none;font-size:14px;color:var(--body)}
.sec-game .game-keys.is-touch{display:none}
@media (hover:none) and (pointer:coarse){
  .sec-game .game-keys.is-touch{display:flex}
  .sec-game .game-keys.is-keys{display:none}
}

/* ---------- Боковая колонка: легенда и рекорды ---------- */
.sec-game .game-side{display:grid;gap:12px}
@media (min-width:700px) and (max-width:1099.98px){.sec-game .game-side{grid-template-columns:1fr 1fr}}
.sec-game .game-legend,.sec-game .game-records{padding:20px 20px 22px}
.sec-game .game-side-title{color:var(--game-peach);margin-bottom:14px;text-align:left}
.sec-game .game-legend ul{display:grid;gap:12px;margin:0;padding:0;list-style:none;font-size:14px;line-height:1.45;color:var(--body)}
.sec-game .game-legend li{display:grid;grid-template-columns:14px minmax(0,1fr);gap:12px;align-items:start}
.sec-game .game-dot{width:10px;height:10px;margin-top:5px}
.sec-game .game-dot.is-bottles{background:linear-gradient(90deg,#0066ff 0 25%,#e8262d 25% 50%,#ff8a00 50% 75%,#7eb8d4 75%)}
.sec-game .game-dot.is-mix{background:#FF67E0}
.sec-game .game-dot.is-jump{background:#ff6a1f}
.sec-game .game-dot.is-ball{background:#f07a22;border-radius:50%}
.sec-game .game-dot.is-puddle{background:#958c6c}
.sec-game .game-table{width:100%;border-collapse:collapse;font-size:15px}
.sec-game .game-table th,.sec-game .game-table td{padding:10px 0;border-top:1px solid var(--line);text-align:left;font-weight:400}
.sec-game .game-table thead th{color:var(--muted);border-top:0;padding-top:0}
.sec-game .game-table td,.sec-game .game-table thead th:last-child{text-align:right}
.sec-game .game-table tbody th{color:var(--display)}
.sec-game .game-table tbody th .mono{font-size:10px;margin-left:6px}
.sec-game .game-table td{font-family:var(--f-display);font-size:18px;color:var(--game-peach)}
.sec-game .game-table tr.is-current th{color:var(--game-peach)}
.sec-game .game-records-note{margin-top:12px;font-size:13px;color:var(--muted)}

/* ---------- Полноэкранный режим (и запасной вариант без Fullscreen API) ---------- */
.sec-game .game-arcade.is-fullscreen{
  display:flex;flex-direction:column;justify-content:center;width:100%;height:100%;padding:0 12px 12px;background:#020816;
}
.sec-game .game-arcade.is-pseudo-fs{position:fixed;inset:0;z-index:calc(var(--z-toast) + 2)}
.sec-game .game-arcade.is-fullscreen .game-stage{
  width:min(100%,calc((100vh - 120px) * 16 / 9));margin-inline:auto;
}
@media (max-width:640px){
  .sec-game .game-arcade.is-fullscreen .game-stage{width:min(100%,calc((100vh - 120px) * 4 / 5))}
}
.sec-game .game-arcade.is-fullscreen .game-foot{justify-content:center}
html.game-locked,html.game-locked body{overflow:hidden}

/* ---------- Лист персонажей (?sheet=1) — служебный режим проверки рисовки ---------- */
.game-sheet body > :not(main):not(script),.game-sheet .site-end{display:none}
.game-sheet .sec-game{padding-block:24px}
.game-sheet .sec-game .game-head,.game-sheet .sec-game .game-layout{display:none}
.sec-game .game-sheet-host{display:grid;justify-items:center;overflow-x:auto}
.sec-game .game-sheet-canvas{display:block;max-width:none}

@media (prefers-reduced-motion:reduce){
  .sec-game.is-playing .game-led{animation:none}
}
