/* Фирменный шрифт ЮБуста — Open Runde (скруглённый Inter), self-hosted woff2.
   4 веса под единым семейством; запросы 800/900 в коде маппятся на ближайший 700.
   font-display: swap — текст виден сразу системным фоллбэком, без блокировки старта
   (важно для Telegram WebApp на медленной сети). Лицензия: assets/fonts/OpenRunde-LICENSE.txt */
@font-face {
  font-family: 'Open Runde'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/OpenRunde-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Runde'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/OpenRunde-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Runde'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../assets/fonts/OpenRunde-Semibold.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Runde'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../assets/fonts/OpenRunde-Bold.woff2') format('woff2');
}

:root {
  --red: #ff2f3d;
  --red-bright: #ff5a64;
  --red-deep: #c20e1a;
  --hot: #ff8a93;
  --cyan: #16e0ff;          /* структура/нейтральная информация */
  --gold: #ffd24a;          /* удвоитель очков X2 */
  --magenta: #ff2e97;       /* атмосфера/закат */
  --ok: #00ff9d;            /* подтверждено (✓ на доске); зелень зоны «Даркнет» */
  --bg: #05010a;
  --surface: rgba(16, 6, 8, 0.74);
  --text: #ffffff;
  --muted: #c9ced6;
  --ui-scale: 1; /* настройка размера HUD (доступность) */
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Runde', 'Segoe UI', system-ui, sans-serif;
  touch-action: manipulation;
}

#game-container { position: fixed; inset: 0; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }

#ui-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---- Экраны ---- */
.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 16px) 18px calc(env(safe-area-inset-bottom) + 16px);
  pointer-events: auto;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
  /* Было полностью opaque — на game-over/settings живой canvas (world.update()
     продолжает рисовать сцену под этими экранами) полностью перекрывался
     плоским градиентом ровно перед CTA-кнопкой. Полупрозрачный скрим вместо
     этого пропускает настоящую сцену — текст всё равно читается, он живёт
     внутри .panel с собственным непрозрачным фоном. */
  background:
    radial-gradient(circle at 50% 36%, rgba(255,46,151,0.14), rgba(176,38,255,0.05) 40%, rgba(0,0,0,0) 66%),
    linear-gradient(180deg, rgba(15,4,26,0.56) 0%, rgba(15,4,26,0.64) 40%, rgba(5,1,10,0.78) 100%);
  /* мягкое появление экрана вместо мгновенного display-переключения */
  animation: screenin .22s ease-out;
}
@keyframes screenin { from { opacity: 0; transform: scale(.975); } to { opacity: 1; transform: scale(1); } }
#start-screen {
  align-items: flex-start;
  padding-top: calc(env(safe-area-inset-top) + clamp(86px, 14vh, 154px));
  background:
    linear-gradient(180deg, rgba(5,1,10,0.26) 0%, rgba(5,1,10,0.10) 44%, rgba(5,1,10,0.52) 100%),
    radial-gradient(circle at 50% 22%, rgba(255,255,255,0.10), transparent 34%),
    image-set(
      url('../assets/start/start-bg-wide.webp') type('image/webp')
    ),
    linear-gradient(180deg, #16072d 0%, #05010a 100%);
  background-size: cover;
  background-position: center center;
}
#start-screen::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  display: block;
  background:
    linear-gradient(180deg, rgba(5,1,10,0.22) 0%, rgba(5,1,10,0.12) 44%, rgba(5,1,10,0.60) 100%),
    radial-gradient(circle at 50% 23%, rgba(255,255,255,0.10), transparent 36%);
}
#start-screen > .start-bg-video {
  position: absolute !important; inset: 0; z-index: -2; flex: none;
  display: block; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: center center;
  pointer-events: none;
  filter: saturate(1.08) contrast(1.02) brightness(0.78);
}
.start-panel-compact { gap: 10px; }
.start-panel-compact .tagline { max-width: 32rem; margin-bottom: 8px; }
.start-panel-compact .btn.start-board-btn {
  min-height: 44px; margin-top: 0; border-color: rgba(255,90,100,.55); color: #fff;
  background: rgba(255,41,55,.13); box-shadow: inset 0 0 18px rgba(255,41,55,.08);
}
.gameover-panel-compact { max-width: 440px; }
.gameover-panel-compact .final { margin-bottom: 18px; }
.gameover-panel-compact .gameover-actions { margin-top: 0; }
/* анимированный синтвейв-фон: перспективная циан-сетка + закатное солнце */
.screen::before {
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(22,224,255,0.30) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,224,255,0.18) 1px, transparent 1px);
  background-size: 100% 38px, 42px 100%;
  background-position: center bottom;
  transform: perspective(340px) rotateX(68deg) scale(2.4) translateY(22%);
  transform-origin: center bottom;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,0.35) 36%, transparent 60%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,0.35) 36%, transparent 60%);
  animation: gridscroll 1.6s linear infinite;
}
@keyframes gridscroll { to { background-position: center calc(100% + 38px); } }
/* солнце-диск над сеткой */
.screen::after {
  content: ''; position: absolute; left: 50%; top: 30%; z-index: -2; pointer-events: none;
  width: 230px; height: 230px; transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    repeating-linear-gradient(180deg, transparent 0 9px, rgba(0,0,0,0.55) 9px 13px),
    linear-gradient(180deg, #ffe66d 0%, #ff7e5f 36%, #ff2e97 64%, #6a0f4a 100%);
  filter: drop-shadow(0 0 60px rgba(255,46,151,0.55));
  opacity: 0.9;
  animation: sunpulse 3.4s ease-in-out infinite;
}
#start-screen::after {
  display: none;
}
/* Теперь, когда сквозь полупрозрачный .screen виден настоящий canvas (сетка,
   солнце, горы, частицы), декоративные CSS-заглушки того же самого больше не
   нужны — иначе получается дублирующая, конфликтующая по перспективе сетка. */
#game-over-screen::before, #game-over-screen::after,
#pause-screen::before, #pause-screen::after,
#settings-screen::before, #settings-screen::after,
#dashboard-screen::before, #dashboard-screen::after {
  display: none;
}
@keyframes sunpulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.04); } }
.hidden { display: none !important; }

.panel {
  position: relative;
  width: 100%; max-width: 384px; text-align: center;
  background: linear-gradient(180deg, rgba(28,8,12,0.82), rgba(10,3,5,0.86));
  border: 1px solid rgba(255,41,55,0.42);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow:
    0 24px 70px rgba(0,0,0,0.7),
    0 0 60px rgba(255,41,55,0.28),
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 0 30px rgba(255,41,55,0.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
}
#start-screen .panel {
  z-index: 1;
  max-width: min(384px, calc(100vw - 36px));
  background: linear-gradient(180deg, rgba(28,8,12,0.76), rgba(10,3,5,0.80));
}

#game-over-screen {
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(env(safe-area-inset-top) + 58px);
}
#game-over-screen .panel {
  margin: 0 auto calc(env(safe-area-inset-bottom) + 18px);
  max-width: 420px;
  padding: 22px 20px;
}
#game-over-screen h1 { font-size: 1.85rem; margin-bottom: 7px; }
#game-over-screen .death { margin-bottom: 5px; }
#game-over-screen .final { margin-bottom: 8px; }
#game-over-screen .rank-line { margin: 0 0 8px; }
.gameover-actions { margin: 4px 0 12px; }
.gameover-actions .btn { margin-top: 8px; padding-top: 13px; padding-bottom: 13px; }
.gameover-actions .btn.cta { margin-top: 10px; }
/* тонкая бегущая скан-линия поверх панели для CRT-настроения */
.panel::after {
  content: ''; position: absolute; inset: 0; border-radius: 20px; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ---- Лого ---- */
.logo { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(160deg, #ff6b73 0%, var(--red) 48%, #d60f1d 100%);
  color: #fff; font-weight: 900; font-size: 1.18rem; font-style: italic; line-height: 1;
  letter-spacing: -0.08em; text-transform: lowercase;
  box-shadow:
    0 0 20px rgba(255,41,55,0.74),
    inset 0 1px 0 rgba(255,255,255,0.42),
    inset -5px -7px 12px rgba(130,0,10,0.26);
  transform: skewX(-7deg);
  animation: markglow 2.2s ease-in-out infinite;
}
@keyframes markglow { 0%,100% { box-shadow: 0 0 16px rgba(255,41,55,0.55), inset 0 1px 0 rgba(255,255,255,0.4); } 50% { box-shadow: 0 0 30px rgba(255,41,55,0.95), inset 0 1px 0 rgba(255,255,255,0.4); } }
.logo-word { font-weight: 800; font-size: 1.05rem; letter-spacing: .5px; color: #fff; }

h1 {
  font-weight: 900; font-size: 2.25rem; letter-spacing: -0.5px; line-height: 1.0;
  color: #fff;
  text-shadow: 0 0 22px rgba(255,41,55,0.55);
  margin-bottom: 12px;
}

.tagline { font-size: 1rem; font-weight: 600; color: var(--muted); margin-bottom: 22px; line-height: 1.4; }
.challenge {
  display: inline-block; margin: -10px 0 18px; padding: 6px 14px; border-radius: 999px;
  background: rgba(22,224,255,0.12); border: 1px solid var(--cyan);
  color: var(--cyan); font-weight: 800; font-size: .85rem;
}
.challenge.hidden { display: none; }
.hint { font-size: .82rem; color: #9aa1ab; margin-top: 14px; font-weight: 600; line-height: 1.4; }
/* Управление теперь показано ДО кнопки старта (F-паттерн взгляда — иначе
   игрок жмёт заметную CTA и не читает инструкцию ниже неё). */
.hint-pre { margin-top: 0; margin-bottom: 14px; }
.privacy-note { margin: 9px 0 -2px; color: rgba(201,206,214,.72); font-size: .66rem; font-weight: 600; line-height: 1.3; }

.mission-preview {
  margin: -6px 0 12px; padding: 7px 11px; border-radius: 10px;
  background: rgba(22,224,255,0.08); border: 1px solid rgba(22,224,255,0.32);
  color: #dffbff; font-size: .8rem; font-weight: 700; line-height: 1.3;
}
#pause-mission-preview { margin: 0 0 8px; }
.death { color: var(--red-bright); font-weight: 800; font-size: 1.02rem; margin-bottom: 8px; }
.final { font-size: 1rem; margin-bottom: 16px; color: var(--muted); }
.final b { color: #fff; font-size: 1.6rem; }

.badge {
  display: inline-block; margin-bottom: 10px; padding: 5px 15px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 800; font-size: .82rem;
  box-shadow: 0 0 24px rgba(255,41,55,0.75); animation: pop 1.2s ease infinite;
}
@keyframes pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* ---- Кнопки ---- */
.btn {
  pointer-events: auto;
  width: 100%; margin-top: 10px; padding: 15px 18px;
  font-family: inherit; font-weight: 800; font-size: 1rem; letter-spacing: .3px;
  color: #fff; background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.18); border-radius: 14px; cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s; text-transform: uppercase;
}
.btn:active { transform: scale(.96); }
.btn.primary {
  position: relative; overflow: hidden;
  color: #160205; background: linear-gradient(180deg, #fff, #ffe3e6); border: none; font-size: 1.18rem;
  box-shadow: 0 0 30px rgba(255,255,255,0.25), 0 6px 18px rgba(255,41,55,0.35);
}
/* бегущий блик по главной кнопке */
.btn.primary::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.7), transparent);
  transform: skewX(-20deg); animation: sheen 2.6s ease-in-out infinite;
}
@keyframes sheen { 0% { left: -60%; } 55%,100% { left: 130%; } }
.btn.cta {
  margin-top: 16px; color: #fff;
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  border: none; display: flex; flex-direction: column; gap: 3px;
  box-shadow: 0 0 34px rgba(255,41,55,0.5); animation: ctapulse 1.7s ease infinite;
}
@keyframes ctapulse { 0%,100% { box-shadow: 0 0 22px rgba(255,41,55,0.4); } 50% { box-shadow: 0 0 44px rgba(255,41,55,0.75); } }
.cta-sub { font-size: .68rem; font-weight: 600; text-transform: none; opacity: .9; }

/* ---- Статистика ---- */
#stats { margin: 16px 0 4px; text-align: left; }
.stats-head { font-weight: 800; color: var(--red-bright); margin-bottom: 8px; }
#stats-list { list-style: none; }
#stats-list li { font-size: .92rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
#stats-list li span { color: #fff; font-weight: 900; font-size: 1.1rem; margin-right: 6px; }

.card-preview {
  /* Было 132px — плотный текст карточки 1080×1080 (звание/очки/бренд) сжимался
     до пятна с одной читаемой цифрой прямо перед кнопкой «ПОХВАСТАТЬСЯ». */
  width: min(220px, 62%); margin: 8px auto 14px;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 22px rgba(22,224,255,0.16);
}
.card-preview canvas { width: 100% !important; height: auto; display: block; }

/* ---- Мета-прогрессия: звание / миссии / бейджи ---- */
.rank-line {
  font-size: .85rem; font-weight: 800; color: var(--cyan);
  text-shadow: 0 0 10px rgba(22,224,255,0.5);
  margin: -8px 0 16px;
}
.rank-line-start {
  margin: 10px 0 -8px;
  font-size: .72rem;
  color: rgba(201,206,214,0.82);
  text-shadow: none;
}
.rank-line.rank-up {
  color: var(--red-bright);
  text-shadow: 0 0 14px rgba(255,41,55,0.7);
  animation: pop 1.2s ease infinite;
}
/* near-miss рычаг: «до следующего звания — N очков», второй строкой под званием */
.rank-gap { display: inline-block; margin-top: 3px; font-size: .78rem; font-weight: 700; color: var(--muted); }
#missions-block { margin: 16px 0 4px; text-align: left; }
#missions-list { list-style: none; }
#missions-list li {
  font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 5px;
}
#missions-list li.done { color: var(--cyan); text-decoration: line-through; opacity: .85; }
.missions-bonus {
  margin-top: 6px; font-weight: 800; font-size: .88rem; color: var(--red-bright);
}
#badges-toast:empty { display: none; }
.badge-toast {
  margin-top: 10px; padding: 8px 12px; border-radius: 10px; text-align: left;
  background: rgba(22,224,255,0.08); border: 1px solid rgba(22,224,255,0.4);
  font-size: .82rem; font-weight: 700; color: #fff;
}
.badge-toast b { color: var(--cyan); }
.badge-toast span { font-weight: 600; color: var(--muted); font-size: .78rem; }

/* ---- HUD ---- */
#hud { position: absolute; inset: 0; pointer-events: none; padding: calc(env(safe-area-inset-top) + 14px) 18px; font-size: calc(1rem * var(--ui-scale)); }
.hud-top { display: flex; justify-content: space-between; align-items: baseline; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
#score-display { font-size: 2.1em; font-weight: 900; color: #fff; text-shadow: 0 0 18px rgba(255,41,55,0.6); }
/* «тик» счёта при заметной прибавке (near-miss/бонус) и пульс смены жизней */
#score-display.tick { animation: scoretick .18s ease-out; }
@keyframes scoretick { 0% { transform: scale(1); } 45% { transform: scale(1.12); } 100% { transform: scale(1); } }
#lives-display.bump { animation: livesbump .3s ease; }
@keyframes livesbump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
#dist-display { font-size: 1.1em; font-weight: 800; color: var(--cyan); text-shadow: 0 0 12px rgba(22,224,255,0.6); }
#lives-display { font-size: 1.3em; color: #ff2937; text-shadow: 0 0 10px rgba(255,41,55,0.9); letter-spacing: 3px; }

#combo-display { margin-top: 8px; font-weight: 900; font-size: 1.3em; color: var(--red); opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; text-shadow: 0 0 18px rgba(255,41,55,0.95), 0 0 6px rgba(255,41,55,0.6); letter-spacing: 0.03em; }
#combo-display.show { opacity: 1; transform: translateY(0); }
#combo-display.bump { animation: combobump .28s ease; }
@keyframes combobump { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* Бейдж удвоителя очков (×2) — золото, пульсация пока активен */
#mult-display {
  display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 8px;
  font-weight: 900; font-size: 1.05em; color: #1a1200; background: var(--gold, #ffd24a);
  box-shadow: 0 0 14px rgba(255,210,74,0.8); animation: multpulse .8s ease infinite;
}
@keyframes multpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

#boost-indicator { position: absolute; left: 18px; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px); font-size: calc(1rem * var(--ui-scale)); }
.boost-label { font-weight: 900; color: #fff; font-size: .9em; text-shadow: 0 0 12px rgba(255,41,55,0.9); }
.boost-track { height: 8px; margin-top: 5px; border-radius: 6px; background: rgba(255,41,55,0.15); overflow: hidden; box-shadow: inset 0 0 8px rgba(255,41,55,0.3); }
#boost-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #fff, var(--red)); box-shadow: 0 0 14px var(--red); transition: width .1s linear; }

/* ---- FTUE: подсказки первого забега ---- */
#tutorial-overlay {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 130px);
  transform: translateX(-50%); width: max-content; max-width: min(86%, 380px);
  padding: 10px 18px; border-radius: 10px; text-align: center;
  font-weight: 800; font-size: calc(0.95rem * var(--ui-scale)); color: #fff;
  background: rgba(16,6,8,0.72); border: 1.5px solid rgba(22,224,255,0.5);
  box-shadow: 0 0 16px rgba(22,224,255,0.35);
  pointer-events: none; z-index: 4;
  opacity: 1; transition: opacity 0.3s ease;
}
#tutorial-overlay.hidden { opacity: 0; pointer-events: none; visibility: hidden; }

/* ---- Mute / Пауза / Настройки ---- */
#btn-mute, #btn-pause, #btn-settings, #btn-dashboard {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px; z-index: 5;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  /* Было 38px — ниже рекомендуемого тач-таргета 44px; пауза частое действие
     под давлением времени в неудобной зоне (правый верхний угол). */
  min-width: 76px; height: 44px; padding: 0 11px; border-radius: 12px;
  cursor: pointer; pointer-events: auto;
  background: linear-gradient(180deg, rgba(28,8,12,0.84), rgba(8,2,7,0.76));
  border: 1.5px solid rgba(255,41,55,0.54);
  color: #fff; font-size: 1rem; font-weight: 900;
  box-shadow:
    0 0 16px rgba(255,41,55,0.36),
    inset 0 1px 0 rgba(255,255,255,0.10);
  -webkit-backdrop-filter: blur(8px) saturate(1.15);
  backdrop-filter: blur(8px) saturate(1.15);
}
#btn-mute::after,
#btn-pause::after,
#btn-settings::after,
#btn-dashboard::after {
  font-size: .62rem; font-weight: 900; letter-spacing: .03em;
  color: rgba(255,255,255,0.76); transform: translateY(1px);
}
#btn-mute::after { content: 'ЗВУК'; }
#btn-pause::after { content: 'ПАУЗА'; }
#btn-settings::after { content: 'НАСТР'; }
#btn-pause { right: 96px; }
#btn-pause.hidden { display: none; }
#btn-settings { right: 96px; }
#btn-settings.hidden { display: none; }
#btn-dashboard { right: 180px; }
#btn-dashboard::after { content: 'ДОСКА'; }
#btn-dashboard.hidden { display: none; }

/* ---- Дашборд / доска результатов ---- */
#dashboard-screen { align-items: flex-start; }
.dashboard-panel { max-width: 440px; }
.dashboard-subtitle { margin: -4px 0 14px; color: var(--muted); font-size: .84rem; font-weight: 600; line-height: 1.35; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; text-align: left; }
.metric-card { min-width: 0; padding: 11px 12px; border-radius: 12px; background: rgba(22,224,255,.07); border: 1px solid rgba(22,224,255,.20); }
.metric-card b { display: block; overflow: hidden; text-overflow: ellipsis; color: #fff; font-size: 1.25rem; line-height: 1.1; white-space: nowrap; }
.metric-card span { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.leaderboard-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px;
  align-items: center; margin-top: 18px; text-align: left;
}
.leaderboard-head .stats-head { min-width: 0; margin: 0; }
.icon-action {
  grid-column: 2; width: 44px; height: 44px; justify-self: end;
  border: 1px solid rgba(22,224,255,.4); border-radius: 11px;
  background: rgba(22,224,255,.08); color: var(--cyan);
  font: inherit; font-size: 1.2rem; font-weight: 900; cursor: pointer;
}
.leaderboard-list { margin: 8px 0 4px; list-style: none; text-align: left; }
.leaderboard-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; min-height: 38px; padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.08); color: var(--muted); font-size: .85rem; font-weight: 700; }
.leaderboard-list li.you { background: rgba(255,47,61,.12); border-radius: 9px; color: #fff; }
.leaderboard-list .leader-place { color: var(--cyan); font-weight: 900; text-align: center; }
.leaderboard-list .leader-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-list .leader-tg { color: var(--cyan); font-size: .72rem; }
/* ✓ «забег подтверждён» — зелёный, чтобы не спорить с циановым ✈ (Telegram)
   и фирменным красным. Значки стоят парой после имени: подтверждён + куда писать. */
.leaderboard-list .leader-verified { color: var(--ok); font-size: .72rem; font-weight: 900; }
.leaderboard-list .leader-dist { color: var(--muted); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.leaderboard-list .leader-score { color: #fff; font-weight: 900; }
.leaderboard-list.compact li { min-height: 32px; padding: 4px 8px; font-size: .8rem; }
.leaderboard-more { width: 100%; min-height: 44px; margin: 8px 0 2px; }

/* ---- Табы периода доски ---- */
.board-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tab-btn { width: 100%; min-width: 0; min-height: 44px; padding: 7px 6px; font-size: .7rem; opacity: .55; }
.tab-btn.active { opacity: 1; border-color: var(--cyan); color: var(--cyan); }

/* ---- Имя игрока на доске ---- */
.name-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.name-input {
  flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid rgba(22,224,255,.35);
  border-radius: 10px; background: rgba(22,224,255,.06); color: #fff;
  font: inherit; font-size: .88rem; font-weight: 700; outline: none;
}
.name-input:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(22,224,255,.25); }
.name-input::placeholder { color: var(--muted); font-weight: 600; }
.name-status { flex-shrink: 0; min-width: 0; color: var(--cyan); font-size: .7rem; font-weight: 700; }

/* ---- Промокод на game over ---- */
.promo-block { margin-top: 10px; text-align: center; }
.promo-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.promo-code {
  padding: 9px 18px; border: 1px dashed var(--cyan); border-radius: 10px;
  background: rgba(22,224,255,.08); color: var(--cyan); cursor: pointer;
  font: inherit; font-size: 1rem; font-weight: 900; letter-spacing: .12em;
}
.promo-code:active { transform: scale(.97); }

/* ---- Привязка Telegram (дашборд) ---- */
.tg-link { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(22,224,255,.2); border-radius: 12px; text-align: left; }
.tg-link-status { margin: 0 0 4px; color: var(--muted); font-size: .74rem; font-weight: 600; line-height: 1.35; }
.tg-link-status.online { color: var(--cyan); }
.tg-link .btn.ghost { margin-top: 6px; }
.tg-link-code-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.tg-link-code-row .btn.ghost { margin-top: 0; text-decoration: none; display: inline-block; }

/* ---- Серверный результат на game over ---- */
.over-board {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding: 11px 12px; border: 1px solid rgba(255,90,100,.38);
  border-radius: 13px; background: rgba(255,41,55,.09); text-align: left;
}
.over-board-summary { min-width: 0; }
.over-board .stats-head { margin: 0; font-size: .72rem; letter-spacing: .04em; }
.over-board-place { margin: 3px 0 0; color: #fff; font-size: .84rem; font-weight: 900; }
.btn.ghost { min-height: 44px; margin-top: 10px; padding: 9px 14px; font-size: .74rem; background: transparent; border-color: rgba(22,224,255,.4); color: var(--cyan); }
.over-board .btn { width: auto; flex-shrink: 0; margin: 0; border-color: rgba(255,90,100,.55); color: #fff; }
.run-details-toggle { margin-top: 8px !important; }
.run-details {
  margin-top: 9px; padding: 12px; border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px; background: rgba(0,0,0,.24);
}
.run-details .rank-line { margin: 0 0 10px !important; text-align: left; }
.run-details #stats, .run-details #missions-block { margin: 10px 0 0; }
.dashboard-status { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: .74rem; font-weight: 600; line-height: 1.35; }
.dashboard-status.online { color: var(--cyan); }

/* ---- Подсказка лёгкого режима (game over) ---- */
.lite-hint {
  margin: 0 0 14px; padding: 12px 14px;
  border: 1px solid rgba(22,224,255,0.38); border-radius: 14px;
  background: linear-gradient(180deg, rgba(22,224,255,0.10), rgba(22,224,255,0.03));
  text-align: left;
}
.lite-hint.hidden { display: none; }
.lite-hint-text { margin: 0 0 10px; font-size: .84rem; font-weight: 600; line-height: 1.35; color: var(--muted); }
.lite-hint-actions { display: flex; gap: 8px; }
.lite-hint-actions .btn { margin-top: 0; flex: 1 1 auto; min-height: 44px; padding: 9px 12px; font-size: .78rem; }

/* ---- Экран настроек ---- */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; text-align: left;
}
.setting-label { font-size: .88rem; font-weight: 700; color: var(--muted); }
.btn.toggle {
  width: auto; min-height: 44px; margin-top: 0; padding: 9px 16px; font-size: .82rem;
  white-space: nowrap; flex-shrink: 0;
}

#pause-screen { z-index: 8; background: rgba(2,0,6,0.6); backdrop-filter: blur(3px); }
.countdown {
  font-size: 4rem; font-weight: 900; color: var(--cyan); margin: 16px 0;
  text-shadow: 0 0 28px rgba(22,224,255,0.8);
}
.countdown.hidden { display: none; }

.glitch { animation: glitch 3.2s infinite; }
@keyframes glitch {
  0%,92%,100% { text-shadow: 0 0 22px rgba(255,41,55,0.55); transform: none; }
  93% { text-shadow: -2px 0 var(--red), 2px 0 #fff; transform: translateX(1px); }
  96% { text-shadow: 2px 0 var(--red), -2px 0 #fff; transform: translateX(-1px); }
}

/* Уважаем системную настройку «уменьшить движение»: глушим декоративные
   CSS-анимации (canvas-эффекты гасятся отдельно через Settings.fx() в JS). */
@media (prefers-reduced-motion: reduce) {
  .screen, .screen::before, .screen::after, .logo-mark, .btn.primary::after, .btn.cta,
  .badge, #combo-display.bump, .glitch, #mult-display, .rank-line.rank-up,
  #score-display.tick, #lives-display.bump {
    animation: none !important;
  }
  .start-bg-video {
    display: none;
  }
}

@media (max-width: 360px), (max-height: 620px) {
  #start-screen { padding-top: calc(env(safe-area-inset-top) + 16px); }
  #start-screen .panel { padding: 16px 14px; }
  #start-screen .logo { margin-bottom: 8px; }
  #start-screen h1 { font-size: 1.8rem; margin-bottom: 8px; }
  #start-screen .tagline { margin-bottom: 12px; font-size: .91rem; }
  #start-screen .mission-preview { margin-bottom: 8px; }
  #start-screen .privacy-note { font-size: .6rem; }
  #start-screen .rank-line-start { display: none; }
  #game-over-screen { padding: calc(env(safe-area-inset-top) + 50px) 10px calc(env(safe-area-inset-bottom) + 12px); }
  #game-over-screen .panel { padding: 16px 14px; }
  #game-over-screen h1 { font-size: 1.55rem; }
  #game-over-screen .final b { font-size: 1.35rem; }
  .card-preview { width: min(150px, 58%); }
  #stats, #missions-block { margin-top: 12px; }
}

@media (max-aspect-ratio: 3/4) {
  #start-screen {
    padding-top: calc(env(safe-area-inset-top) + clamp(62px, 10vh, 104px));
    background-image:
      linear-gradient(180deg, rgba(5,1,10,0.22) 0%, rgba(5,1,10,0.08) 44%, rgba(5,1,10,0.58) 100%),
      radial-gradient(circle at 50% 20%, rgba(255,255,255,0.10), transparent 34%),
      image-set(
        url('../assets/start/start-bg-portrait.webp') type('image/webp')
      ),
      linear-gradient(180deg, #16072d 0%, #05010a 100%);
    background-position: center center;
  }
  #start-screen .panel {
    padding: 24px 20px;
  }
  #btn-mute, #btn-pause, #btn-settings, #btn-dashboard {
    min-width: 44px; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  }
  #btn-mute::after,
  #btn-pause::after,
  #btn-settings::after,
  #btn-dashboard::after {
    display: none;
  }
  #btn-pause { right: 62px; }
  #btn-settings { right: 62px; }
  #btn-dashboard { right: 112px; }
}

@media (min-aspect-ratio: 16/9) {
  #start-screen {
    background-position: center 48%;
  }
}
