/* шрифты из пакетов: Epilepsy Sans (пиксельный, Kreative Software, free use) — интерфейс, Preciosa (Gophmann) — заголовки */
@font-face { font-family: "Epilepsy Sans"; src: url(../assets/fonts/EpilepsySans.ttf) format("truetype"); font-weight: 400; font-display: block; }
@font-face { font-family: "Epilepsy Sans"; src: url(../assets/fonts/EpilepsySansBold.ttf) format("truetype"); font-weight: 700; font-display: block; }
@font-face { font-family: "Preciosa"; src: url(../assets/fonts/Preciosa.ttf) format("truetype"); font-weight: 400; font-display: block; }
/* Стиль Bug Quest: ночной интерфейс, пиксельная карта, один красный акцент. */
:root {
  color-scheme: dark;
  --bg: #0e0f10;
  --panel: #161719;
  --panel-2: #1e1f22;
  --line: rgba(236, 235, 229, .14);
  --line-2: rgba(236, 235, 229, .3);
  --fg: #ecebe5;
  --muted: rgba(236, 235, 229, .6);
  --faint: rgba(236, 235, 229, .4);
  --red: #e0412f;
  --scrim: rgba(8, 9, 10, .66);
  --font-ui: "Epilepsy Sans", system-ui, -apple-system, "Segoe UI", sans-serif; /* пиксельный шрифт интерфейса */
  --font-px: "Epilepsy Sans", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-logo: "Preciosa", Georgia, "Times New Roman", serif; /* красивый шрифт заголовков */
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 19px/1.45 var(--font-ui); overflow: hidden; }
p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.err { margin: 0; color: var(--red); font-size: 18px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .btn.big { flex: 1 1 160px; }
.logo { font-family: var(--font-logo); font-size: 44px; line-height: .9; letter-spacing: .01em; }
.logo.small { font-size: 36px; }
.logo.huge { font-size: 80px; }
.week { font-family: var(--font-px); font-size: 17px; line-height: 1.4; color: var(--muted); }
/* сцена боя не должна двигаться, когда меняется текст вокруг: у меняющихся надписей шапки — фиксированная ширина */
#hud-phase { display: inline-block; min-width: 10ch; }
#hud-time { display: inline-block; min-width: 4ch; }
.stat b { display: block; min-width: 4ch; }
.stat.boss.off { visibility: hidden; }
#btn-ability { min-width: 200px; }
#btn-ability .cd { min-width: 10ch; }

.screen { position: fixed; inset: 0; overflow: auto; scrollbar-gutter: stable; } /* появление полосы прокрутки не сужает страницу и не дёргает карту */
.screen.center { display: grid; place-items: center; padding: 16px; }

.btn { font: 500 18px/1.2 var(--font-ui); color: var(--fg); background: transparent; border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 14px; cursor: pointer; text-align: center; }
.btn:hover { border-color: var(--fg); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { background: #fff; }
.btn.big { font-size: 24px; padding: 16px 20px; font-weight: 600; }
a.btn { text-decoration: none; }
.btn.link { border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.btn.bag { border-color: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.btn .cd { display: block; font-size: 15px; font-weight: 400; opacity: .7; }
.btn.attack { border-color: var(--line-2); min-width: 120px; } /* «Удар» и «Оглушён» — одна ширина */
.btn.attack.ready { border-color: var(--red); color: var(--fg); }
.btn.attack.stunned { border-color: var(--red); background: var(--red); color: #fff; animation: stun-blink .5s steps(2) infinite; }
@keyframes stun-blink { to { opacity: .55; } }
.pad { display: none; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); gap: 6px; justify-content: center; }
.pad button { font: 22px var(--font-ui); color: var(--fg); background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; touch-action: none; }
.pad button[data-d="U"] { grid-column: 2; } .pad button[data-d="L"] { grid-column: 1; grid-row: 2; } .pad button[data-d="D"] { grid-column: 2; grid-row: 2; } .pad button[data-d="R"] { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .pad { display: grid; } }
input[type="text"], input[type="password"] { width: 100%; min-width: 0; font: 20px/1.3 var(--font-ui); color: var(--fg); background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 11px 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 16px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.x { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { color: var(--fg); }

/* Модалки */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--scrim); padding: 16px; }
.modal { width: min(460px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.modal.wide { width: min(860px, 100%); }
.modal.start { width: min(520px, 100%); }
.modal.start .m-body { padding: 28px; gap: 16px; }
.modal.start p { color: var(--muted); }
.m-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.m-title { font-size: 22px; font-weight: 600; }
.m-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.demo-note { font-size: 17px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 12px; }
.chip { font-size: 15px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 100px; padding: 1px 7px; white-space: nowrap; }
.chip.cls { color: var(--bg); border-color: transparent; font-weight: 600; }
/* уведомления — связь, общий тост внизу и тост над картой в бою — вдвое крупнее, чтобы их замечали;
   длинная фраза переносится на вторую строку, а не обрезается многоточием */
/* тестовое приключение: плашка внизу посередине (сверху — шапка боя), клики проходят насквозь */
.test-badge { position: fixed; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); z-index: 55; pointer-events: none;
  background: #ffd43d; color: #1b1a17; font-size: 15px; font-weight: 600; padding: 4px 12px; border-radius: 100px; text-align: center; }
.conn { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: var(--red); color: #fff; padding: 16px 28px; border-radius: 16px; z-index: 60; font-size: 30px; line-height: 1.25; text-align: center; text-wrap: balance; }
.toast { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: var(--fg); color: var(--bg); border-radius: 18px; padding: 16px 32px; font-size: 32px; line-height: 1.25; font-weight: 500; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); pointer-events: none; text-align: center; text-wrap: balance; z-index: 8; }
@media (max-width: 640px) { .conn, .toast { font-size: 22px; padding: 10px 18px; border-radius: 12px; } }
.toast.global { position: fixed; top: auto; bottom: 24px; z-index: 50; }
.toast.alert { background: var(--red); color: #fff; }

/* Ожидание */
/* слайдшоу фонов (js/waiting.js): новая сцена проявляется поверх прежней, камера медленно движется;
   снизу затемнение, чтобы читались название, текст и кнопка */
.waiting-bg { position: absolute; inset: 0; overflow: hidden; background: #141516; isolation: isolate; }
.waiting-bg .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: wait-in var(--fade) ease both, kb-wait var(--dur) linear both; will-change: transform; }
.waiting-bg::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(14, 15, 16, .35) 0%, rgba(14, 15, 16, 0) 28%, rgba(14, 15, 16, .2) 55%, rgba(14, 15, 16, .85) 100%); }
@keyframes wait-in { from { opacity: 0; } }
@keyframes kb-wait { from { transform: translateX(var(--x0)) scale(var(--s0)); } to { transform: translateX(var(--x1)) scale(var(--s1)); } }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.waiting-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px; padding-bottom: 7vh; text-align: center; }
.waiting-ui .logo { text-shadow: 0 3px 14px rgba(0, 0, 0, .7); }
.waiting-text { font-family: var(--font-px); font-size: 19px; line-height: 1.8; color: var(--fg); text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
.counter { font-size: 18px; color: var(--fg); text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
.counter b { color: var(--red); }
.waiting-ui .btn { background: rgba(14, 15, 16, .7); }
.waiting-ui .btn.primary { background: var(--fg); }
.waiting-ui .main-actions { justify-content: center; }
.waiting-ui .main-actions .btn.big { flex: 0 1 300px; min-width: 0; white-space: nowrap; }
#btn-start-test { flex-basis: 390px; } /* «Начать тестовое приключение» длиннее остальных */
@media (max-width: 640px) { .waiting-ui .main-actions #btn-start-test { white-space: normal; } }

/* Онбординг */
#screen-onboarding .modal.wide { width: min(1120px, 100%, calc((100dvh - 250px) * 16 / 9)); min-width: min(560px, 100%); }
/* после боя под текстом ещё исход или список свитков — картинка меньше, чтобы кнопки ведущего не уезжали за экран */
#screen-onboarding .modal.wide:has(.slide-extra:not([hidden])) { width: min(1120px, 100%, calc((100dvh - 440px) * 16 / 9)); }
.slide-art { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; display: flex; align-items: flex-end; padding: 16px; background: #141516; isolation: isolate; }
/* сцена из пакета: медленный наезд камеры туда и обратно (точка и масштаб — DATA.SLIDES[i].cam), смена кадра — растворение */
.slide-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: var(--ox) var(--oy);
  animation: kb 24s ease-in-out infinite alternate, scene-in 1s ease; transition: opacity 1s ease; will-change: transform; z-index: -2; }
.slide-art .scene.out { opacity: 0; }
@keyframes kb { from { transform: translateX(var(--x0)) scale(var(--s0)); } to { transform: translateX(var(--x1)) scale(var(--s1)); } }
@keyframes scene-in { from { opacity: 0; } }
/* свет поверх сцены: тёплые фонари базара, пульс красного разрыва, пожар, золотое сияние вокруг пса; пала застава — серый
   холодный полусвет (сцена чёрно-белая, тёплый свет её бы раскрасил) */
.slide-art .glow { position: absolute; inset: 0; z-index: -1; pointer-events: none; mix-blend-mode: screen; animation: flicker 3.4s ease-in-out infinite;
  background: radial-gradient(45% 40% at 22% 55%, rgba(255, 150, 60, .2), transparent 70%), radial-gradient(40% 40% at 88% 50%, rgba(255, 150, 60, .16), transparent 70%); }
.slide-art[data-mood="rift"] .glow { animation-duration: 2.2s; background: radial-gradient(38% 60% at 78% 40%, rgba(255, 40, 40, .36), transparent 72%), radial-gradient(30% 35% at 10% 75%, rgba(255, 150, 60, .2), transparent 70%); }
.slide-art[data-mood="fire"] .glow { animation-duration: 1.8s; background: radial-gradient(60% 55% at 70% 70%, rgba(255, 110, 40, .26), transparent 72%), radial-gradient(35% 40% at 15% 30%, rgba(255, 170, 60, .2), transparent 70%); }
.slide-art[data-mood="holy"] .glow { animation-duration: 4.6s; background: radial-gradient(34% 44% at 54% 48%, rgba(255, 214, 120, .34), transparent 72%); }
.slide-art[data-mood="ash"] .glow { animation-duration: 6s; background: radial-gradient(60% 50% at 60% 35%, rgba(190, 200, 215, .12), transparent 75%); }
.slide-art::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, rgba(14, 15, 16, .45), transparent 22%, transparent 70%, rgba(14, 15, 16, .35)); } /* тень под номером и заголовком */
@keyframes flicker { 0%, 100% { opacity: .65; } 18% { opacity: .95; } 34% { opacity: .7; } 52% { opacity: 1; } 76% { opacity: .75; } }
/* искры поднимаются от низа кадра; у сияния пса — медленные золотые пылинки */
.embers { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.embers span { position: absolute; top: 102%; width: 3px; height: 3px; background: #ffc46b; box-shadow: 0 0 6px 2px rgba(255, 130, 40, .65); opacity: 0;
  animation: ember var(--d) linear var(--w) infinite; scale: var(--z); }
.slide-art[data-mood="rift"] .embers span { background: #ff6a5a; box-shadow: 0 0 6px 2px rgba(255, 40, 40, .65); }
.slide-art[data-mood="holy"] .embers span { background: #fff1b8; box-shadow: 0 0 6px 2px rgba(255, 214, 120, .6); animation-duration: calc(var(--d) * 1.6); }
/* пала застава: вместо искр сверху медленно падает серый пепел */
.slide-art[data-mood="ash"] .embers span { background: #b8b6b0; box-shadow: 0 0 3px 1px rgba(200, 200, 200, .3); animation-name: ash; animation-duration: calc(var(--d) * 1.8); }
@keyframes ash { 0% { top: -4%; transform: translateX(0); opacity: 0; } 15% { opacity: .75; } 80% { opacity: .55; } 100% { top: 102%; transform: translateX(var(--dx)); opacity: 0; } }
@keyframes ember { 0% { top: 102%; transform: translateX(0); opacity: 0; } 12% { opacity: .9; } 70% { opacity: .7; } 100% { top: -4%; transform: translateX(var(--dx)); opacity: 0; } }
/* номер и заголовок кадра поверх сцены убраны по просьбе пользователя — заголовки остались только в данных */
.slide-num { position: absolute; top: 14px; left: 18px; font-family: var(--font-px); font-size: 32px; color: rgba(236,235,229,.85); text-shadow: 0 1px 0 #141516, 0 2px 8px rgba(0,0,0,.9); }
.slide-title { position: absolute; top: 18px; right: 18px; font-family: var(--font-logo); font-size: 34px; color: var(--fg); text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.slide-title.enter { animation: title-in .9s ease both; }
.slide-text.enter { animation: text-in .8s ease .25s both; }
@keyframes title-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes text-in { from { opacity: 0; transform: translateY(8px); } }
.slide-caption { position: relative; font-size: 16px; color: rgba(236,235,229,.85); background: rgba(14,15,16,.6); padding: 6px 10px; border-radius: 6px; }
.slide-text { font-size: 26px; line-height: 1.4; text-align: center; text-wrap: balance; padding: 4px 8px; }
.slide-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-right: 6px; }
.dots span.on { background: var(--red); }
.hint-line { font-size: 17px; color: var(--muted); }
.btn.voice { min-width: 7.5em; } /* «Слушать» и «Пауза» — одна ширина */
.btn.voice.nudge { border-color: var(--red); animation: pulse 1.2s ease-in-out infinite; } /* браузер не дал звук сам — нажмите */
/* после боя: исход и счёт героя, его свитки */
.slide-extra { display: flex; flex-direction: column; gap: 10px; }
.slide-extra .center, .row.center { justify-content: center; text-align: center; }
.stat-chip { font-size: 18px; border: 1px solid var(--line-2); border-radius: 100px; padding: 3px 12px; color: var(--muted); }
.stat-chip b { color: var(--fg); }

/* раздел «Свитки»: слева герои (у кого есть свитки — ярче, с числом), справа свитки выбранного */
.scrolls-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 520px); gap: 14px; align-items: start; }
.scrolls-heroes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.scrolls-heroes button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); font: inherit; font-size: 15px; cursor: pointer; opacity: .5; }
.scrolls-heroes button.has { opacity: 1; }
.scrolls-heroes button.on { border-color: var(--red); opacity: 1; }
.scrolls-heroes img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; image-rendering: pixelated; }
.scrolls-heroes b { position: absolute; top: 6px; right: 8px; font-family: var(--font-px); font-size: 15px; color: var(--bg); background: #ecc04e; border-radius: 100px; padding: 0 6px; }
.scrolls-heroes span { line-height: 1.2; text-align: center; }
.scrolls-book { position: sticky; top: 12px; }
#scrolls-hero-list li { cursor: pointer; }
#scrolls-hero-list li:hover span:nth-child(2) { text-decoration: underline; }
#scrolls-hero-list time { font-size: 14px; color: var(--faint); }
@media (max-width: 860px) { .scrolls-view { grid-template-columns: 1fr; } .scrolls-book { position: static; } }

/* свитки героя: панель «Мои свитки» в бою и список после боя */
.scroll-list { list-style: none; margin: 0; padding: 0; }
.scroll-list li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.35; }
.scroll-list li:first-child { border-top: 0; }
#my-scrolls .scroll-list { max-height: 260px; overflow: auto; }
#my-scrolls p { margin: 0; font-size: 16px; }
#my-scrolls kbd { font-family: var(--font-mono); font-size: 14px; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }
.scroll-list.big { max-height: 22vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; }
.scroll-list.big li { flex-direction: row; align-items: baseline; gap: 10px; font-size: 19px; }

/* Приложение: шапка, сцена, боковая панель */
.app { display: flex; flex-direction: column; gap: 12px; min-height: 100%; max-width: 1600px; margin-inline: auto; padding: 12px 16px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.stats { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; }
.stat .k { display: block; font-size: 15px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .track { display: block; width: 140px; height: 6px; margin-top: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.stat .fill { display: block; height: 100%; width: 100%; background: var(--fg); transition: width .3s; }
.stat .fill.red { background: var(--red); }
.stat.boss .k { color: var(--red); }
.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stage { position: relative; width: 100%; max-width: calc((100svh - 250px) * 16 / 9); min-width: 0; margin-inline: auto; } /* svh, не dvh: на телефоне высота не плавает, когда прячется адресная строка */
/* кнопка предмета поверх сцены: появляется и исчезает, не меняя раскладку */
.stage-use { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 7; max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(14, 15, 16, .88); font-size: 20px; padding: 12px 22px; border-radius: 12px; }
#battle-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 10px; border: 1px solid var(--line); background: #9a8f52; touch-action: manipulation; cursor: crosshair; }
.overlay-stage { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: var(--scrim); border-radius: 10px; pointer-events: none; z-index: 6; }
#overlay-text { font-family: var(--font-logo); font-size: 114px; line-height: 1; color: var(--fg); text-shadow: 0 4px 20px rgba(0,0,0,.8); }
#overlay-sub { font-family: var(--font-px); font-size: 17px; color: var(--muted); margin-top: 10px; }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel); }
.panel h2 { margin: 0 0 6px; font-size: 15px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.panel h2 span { letter-spacing: 0; text-transform: none; color: var(--faint); }
.panel.me { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.panel.me img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; image-rendering: pixelated; border: 1px solid var(--line-2); }
.panel.me div { display: flex; flex-direction: column; line-height: 1.25; }
.panel.me b { font-size: 19px; }
.panel.me span { font-size: 16px; }
#board { list-style: none; margin: 0; padding: 0; }
#board li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 28px; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 18px; }
#board li:first-child { border-top: 0; }
#board .n { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 16px; }
#board .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board .nm i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
#board .me .nm::after { content: " · ты"; color: var(--muted); }
#board .off { opacity: .45; }
#board .sc { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
#feed { list-style: none; margin: 0; padding: 0; }
#feed li { font-size: 17px; color: var(--muted); padding: 7px 0; border-top: 1px solid var(--line); }
#feed li:first-child { border-top: 0; color: var(--fg); }
#feed li.fresh { animation: fade .5s ease; }
.hint { font-size: 16px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.hint kbd { font-family: var(--font-mono); font-size: 15px; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.say { display: grid; gap: 8px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick .chip-btn { font: 500 16px/1.2 var(--font-ui); color: var(--fg); background: var(--panel); border: 1px solid var(--line-2); border-radius: 100px; padding: 5px 11px; cursor: pointer; }
.quick .chip-btn:hover { border-color: var(--fg); }
#say-form { display: flex; gap: 8px; }
#say-form input { flex: 1; padding: 9px 12px; font-size: 18px; }

/* Выбор героя */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding-bottom: 24px; }
.hero { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; text-align: center; position: relative; transition: transform .1s, border-color .1s; }
.hero:hover { transform: translateY(-2px); border-color: var(--fg); }
.hero img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; image-rendering: pixelated; }
.hero b { display: block; margin-top: 8px; font-size: 17px; }
.hero .muted { display: block; font-size: 15px; min-height: 28px; margin-bottom: 6px; }
.hero.taken { opacity: .35; cursor: default; }
.hero.taken:hover { transform: none; border-color: var(--line); }
.hero.mine { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 65, 47, .25); }
.hero .tag { position: absolute; top: 12px; left: 12px; font-family: var(--font-px); font-size: 14px; padding: 4px 6px; border-radius: 4px; background: rgba(14,15,16,.85); color: var(--fg); }
.hero.mine .tag { background: var(--red); }

/* Карточка героя */
.modal.card .m-body { align-items: center; text-align: center; }
.modal.card img { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; image-rendering: pixelated; }
/* попап свитка: баг крупно, скриншот — обычная картинка (не пиксельная), под него выделено место 16:9 */
.modal.scroll { width: min(640px, 100%); }
.modal.scroll .m-body { align-items: flex-start; }
.modal.scroll .chip { align-self: flex-start; }
.scroll-bug { font-size: 24px; line-height: 1.4; margin: 0; }
.scroll-desc { margin: 0; font-size: 18px; line-height: 1.5; color: var(--muted); white-space: pre-line; max-height: 30vh; overflow: auto; }
.scroll-tags { gap: 6px; }
.chip.id { font-family: var(--font-mono); color: var(--fg); }
.chip.demo { color: #ecc04e; border-color: rgba(236, 192, 78, .5); }
#scroll-img-link { display: block; align-self: stretch; }
.modal.scroll img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.modal.scroll .scroll-actions { align-self: stretch; justify-content: flex-end; }
.modal.scroll .scroll-actions .muted { margin-right: auto; font-size: 15px; }
#scroll-link { text-decoration: none; }

@keyframes fade { from { transform: translateY(-4px); } to { transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 65, 47, .5); } 50% { box-shadow: 0 0 0 6px rgba(224, 65, 47, 0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 1060px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .stage { max-width: min(100%, calc((100svh - 200px) * 16 / 9)); }
  .side { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 640px) {
  .logo { font-size: 36px; }
  .logo.huge { font-size: 56px; }
  .stats { gap: 14px; }
  .stat b { font-size: 22px; }
  .actions { margin-left: 0; }
  #overlay-text { font-size: 76px; }
  .slide-text { font-size: 21px; }
}

/* панель ведущего в бою */
.panel.admin .row { margin-top: 8px; gap: 6px; }
.btn.small { padding: 6px 10px; font-size: 17px; }
.btn.small kbd { margin-left: 4px; font-size: 14px; opacity: .6; }
.btn.side.on { border-color: var(--red); color: var(--fg); }

/* пиксельная сетка поверх всей игры — экранов, боя, модалок и экрана загрузки: тонкие тёмные линии через каждые
   --grid px, как на пиксельном экране. Обычная прозрачность без режимов наложения — слой статичный и не тормозит бой.
   ?grid=4 — клетка крупнее, ?grid=off — без сетки (app.js) */
:root { --grid: 3px; --grid-line: rgba(0, 0, 0, .32); }
.pixel-grid { position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px), linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid) var(--grid); }

/* экран загрузки: закрывает всё, пока картинки грузятся, потом растворяется (js/loader.js) */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 20px; padding: 16px; text-align: center;
  background: radial-gradient(70% 60% at 50% 55%, #2a1a12 0%, var(--bg) 70%); transition: opacity .7s ease; }
.loader.done { opacity: 0; pointer-events: none; }
.loader .logo { text-shadow: 0 3px 14px rgba(0, 0, 0, .7); }
#loader-canvas { width: min(960px, 92vw); height: auto; aspect-ratio: 4 / 1; image-rendering: pixelated; image-rendering: crisp-edges; }
.loader-text { font-family: var(--font-px); font-size: 19px; color: var(--muted); min-height: 1.5em; }
.loader-text b { color: var(--fg); font-weight: 400; }

/* экраны входа — выбор роли, пароль ведущего и выбор героя: заставка из пакета (public/assets/splash.webp)
   с затемнением, чтобы читался текст. Фон не прокручивается вместе с сеткой героев */
#screen-role, #screen-password { background: linear-gradient(180deg, rgba(14, 15, 16, .25), rgba(14, 15, 16, .55)), #141516 url(../assets/splash.webp) center / cover no-repeat; image-rendering: pixelated; }
#screen-pick { background: linear-gradient(180deg, rgba(14, 15, 16, .3), rgba(14, 15, 16, .6)), #141516 url(../assets/splash.webp) center / cover no-repeat; image-rendering: pixelated; }
#screen-role .modal.start, #screen-password .modal.start { position: relative; background: rgba(14, 15, 16, .82); backdrop-filter: blur(2px); }
#screen-pick .bar { background: rgba(14, 15, 16, .72); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; backdrop-filter: blur(2px); }
#screen-pick .hero { background: rgba(22, 23, 25, .9); }

/* заголовки панелей и модалок — Preciosa; длинное название в шапке боя — компактнее */
.panel h2, .m-title { font-family: var(--font-logo); font-weight: 400; letter-spacing: .03em; text-transform: none; font-size: 21px; } /* декоративный шрифт читается только в строчных и покрупнее */
.bar .logo { font-size: 34px; }

/* кнопка ждёт второго нажатия для подтверждения */
.btn.armed { border-color: #e0533d; color: #fff; background: #8a2a1c; }
