/* «Последняя платформа» — стили */
/* Переопределение токенов theme.css под аркадный стиль */
:root {
  --brand: #d4863a;
  --brand-2: #b86f2a;
  --accent: #e74c3c;
  --bg: #1a1410;
  --surface: #2b2318;
  --surface-2: #3d3328;
  --text: #f4ece4;
  --muted: #a89885;
  --border: rgba(212, 134, 58, 0.2);
  --grad: linear-gradient(135deg, #d4863a 0%, #e74c3c 100%);
  --shadow-arcade: 0 8px 24px rgba(0,0,0,0.6), 0 2px 8px rgba(231,76,60,0.3);
  --glow-accent: 0 0 16px rgba(231,76,60,0.5);
  --transition: 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Сканлайны (декор) */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.12) 2px, rgba(0,0,0,0.12) 4px);
  pointer-events: none;
  z-index: 9999;
  opacity: 0.25;
}

/* Шапка */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: rgba(26, 20, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: var(--step-1);
  transition: var(--transition);
}
.brand:hover { color: var(--brand); transform: translateY(-1px); }
.brand-mark { display: flex; flex-shrink: 0; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.2; }
.brand-text em { font-style: normal; font-weight: 400; font-size: 0.7em; color: var(--muted); }

.topnav {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.link-btn {
  background: none;
  border: none;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-2);
  transition: var(--transition);
  text-decoration: none;
}
.link-btn:hover { color: var(--text); background: var(--surface); }
.snd-toggle { font-size: 0.9em; }

/* Главная сцена */
.stage-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}
@media (min-width: 1024px) {
  .stage-wrap {
    grid-template-columns: minmax(420px, 540px) 1fr;
    align-items: start;
  }
}

/* Игровая сцена */
.scene {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-3);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-arcade);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  max-width: 540px;
  margin: 0 auto;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

/* HUD */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: var(--space-3);
  background: linear-gradient(to bottom, rgba(26,20,16,0.85) 0%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}
.hud-cell { display: flex; flex-direction: column; pointer-events: auto; }
.hud-center { align-items: center; }
.hud-right { align-items: flex-end; }
.hud-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.hud-val { font-size: 1.3rem; font-weight: 700; color: var(--brand); margin-top: 2px; }
.hud-val.big { font-size: 1.8rem; color: var(--text); }

.pause-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  padding: var(--space-2);
  cursor: pointer;
  color: var(--text);
  transition: var(--transition);
  display: flex;
}
.pause-btn:hover { background: var(--brand); border-color: var(--brand); }

/* Комбо-вспышка */
.combo-flash {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(231,76,60,0.8);
  pointer-events: none;
  opacity: 0;
  z-index: 20;
  animation: comboFlash 0.6s ease-out;
}
@keyframes comboFlash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-30px); }
}

/* Оверлеи (экраны) */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,20,16,0.96);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: panelSlide 0.4s var(--ease-out);
}
@keyframes panelSlide {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--brand);
}
.eyebrow.danger { color: var(--accent); }

.game-title {
  margin: 0 0 var(--space-3);
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 900;
  line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.game-sub {
  margin: 0 0 var(--space-5);
  color: var(--muted);
  font-size: 1rem;
}

.panel-h {
  margin: 0 0 var(--space-4);
  font-size: 1.8rem;
  font-weight: 700;
}

/* Поле ввода имени */
.name-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  text-align: left;
}
.name-field span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.name-field input {
  padding: var(--space-3);
  border: 2px solid var(--border);
  border-radius: var(--radius-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}
.name-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(212,134,58,0.2);
}

/* Кнопки */
.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-2);
  background: var(--grad);
  color: #fff;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-arcade);
  transition: var(--transition);
  margin-bottom: var(--space-3);
}
.btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.7), 0 4px 12px rgba(231,76,60,0.5);
}
.btn-play:active {
  transform: translateY(0);
}

.btn-ghost-arc {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-ghost-arc:hover {
  background: var(--surface-2);
  border-color: var(--brand);
}

.center-btn {
  display: block;
  margin: var(--space-5) auto 0;
}

/* Легенда управления */
.mini-legend {
  margin-top: var(--space-4);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.mini-legend b { color: var(--text); }

/* Результаты */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.result-cell {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
}
.result-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.result-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--brand);
}

.rank-note {
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  background: rgba(212,134,58,0.15);
  border: 1px solid var(--brand);
  border-radius: var(--radius-2);
  color: var(--text);
  font-weight: 600;
}

/* Тач-подсказки */
.touch-hint {
  position: absolute;
  bottom: var(--space-4);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-4);
  font-size: 0.9rem;
  color: rgba(244,236,228,0.5);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  animation: hintFadeIn 1s 0.5s forwards;
}
@keyframes hintFadeIn {
  to { opacity: 1; }
}
.th-left, .th-right { text-shadow: 0 1px 4px rgba(0,0,0,0.8); }

@media (min-width: 768px) {
  .touch-hint { display: none; }
}

/* Боковая колонка */
.side {
  display: none;
}
@media (min-width: 1024px) {
  .side {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
  }
}

.side-card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-2);
}
.side-card h3 {
  margin: 0 0 var(--space-3);
  font-size: 1.2rem;
  font-weight: 700;
}
.side-big {
  font-size: 2.5rem;
  font-weight: 900;
  margin: var(--space-2) 0;
  color: var(--brand);
}
.accent-card {
  background: linear-gradient(135deg, rgba(212,134,58,0.15), rgba(231,76,60,0.1));
  border-color: var(--brand);
}
.muted-arc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.bonus-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bonus-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.95rem;
}
.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.chip-spring { background: #3498db; color: #fff; }
.chip-shield { background: #9b59b6; color: #fff; }
.chip-slow { background: #f39c12; color: #fff; }
.chip-double { background: #2ecc71; color: #fff; }

/* Контентные секции */
.content-section {
  padding: var(--space-8) var(--space-4);
  background: var(--bg);
}
.content-section.alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.section-h {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
}
.lead-sub {
  max-width: 60ch;
  margin: 0 0 var(--space-6);
  font-size: 1.1rem;
  color: var(--muted);
}

/* Правила */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-7);
}
.rule-card {
  padding: var(--space-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-1);
  transition: var(--transition);
}
.rule-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-3);
  border-color: var(--brand);
}
.rule-num {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-2);
  background: var(--grad);
  color: #fff;
  font-weight: 900;
  font-size: 0.9rem;
  margin-bottom: var(--space-3);
}
.rule-card h3 {
  margin: 0 0 var(--space-2);
  font-size: 1.3rem;
  font-weight: 700;
}
.rule-card p {
  margin: 0;
  color: var(--muted);
}

.controls-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-5);
}
.ctrl-card {
  padding: var(--space-5);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-3);
}
.ctrl-card h4 {
  margin: 0 0 var(--space-3);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand);
}
.ctrl-card p {
  margin: 0;
}
.keys {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}
kbd {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius-1);
  border: 2px solid var(--border);
  background: var(--surface);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 3px 0 var(--border);
}
.or {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Таблица рекордов */
.leader-box {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-3);
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.leader-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
.leader-table thead {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
.leader-table th {
  padding: var(--space-3);
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}
.leader-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.leader-table tbody tr:hover {
  background: rgba(212,134,58,0.08);
}
.leader-table tbody tr:last-child {
  border-bottom: none;
}
.leader-table td {
  padding: var(--space-3);
}
.c-rank { width: 50px; text-align: center; font-weight: 900; color: var(--brand); }
.c-name { font-weight: 600; }
.c-h, .c-s { text-align: right; font-variant-numeric: tabular-nums; }
.c-s { color: var(--brand); font-weight: 700; }

.loading {
  text-align: center !important;
  color: var(--muted);
  padding: var(--space-5) !important;
}

/* Футер */
.site-footer {
  padding: var(--space-7) var(--space-4) var(--space-5);
  background: var(--surface);
  border-top: 2px solid var(--border);
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto var(--space-5);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}
.footer-brand .brand-text {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.footer-links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.copy {
  text-align: center;
  margin: 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

/* --- Недостающие дизайн-токены (значения из theme.css платформы) --- */
:root{
  --font-sans: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --step-0: clamp(1rem, .96rem + .2vw, 1.125rem);
  --space-3: 12px;
  --space-4: 16px;
  --space-2: 8px;
  --step-1: clamp(1.2rem, 1.1rem + .5vw, 1.45rem);
  --radius-2: 16px;
  --space-6: 32px;
  --radius-3: 22px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --space-5: 24px;
  --space-1: 4px;
  --shadow-2: 0 1px 2px rgba(20, 20, 40, .06), 0 10px 24px rgba(20, 20, 40, .08);
  --radius-pill: 999px;
  --space-8: 64px;
  --space-7: 48px;
  --shadow-1: 0 1px 2px rgba(20, 20, 40, .06);
  --shadow-3: 0 2px 4px rgba(20, 20, 40, .06), 0 24px 60px rgba(20, 20, 40, .14);
  --radius-1: 10px;
}
