/* ============================================================
   VAULT 813 — БЕСКОНЕЧНЫЙ САПЁР
   style.css — Военно-тактическая тема / CRT-терминал
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

/* ── Переменные ──────────────────────────────────────────── */
:root {
  --bg:           #0d1a0e;
  --bg-deep:      #080f09;
  --cell-closed:  #1a2e1b;
  --cell-open:    #101a11;
  --cell-border:  #2a4a2c;
  --phosphor:     #39ff14;
  --phosphor-dim: #1a7a08;
  --phosphor-mid: #25c40a;
  --amber:        #ffb300;
  --danger:       #ff2200;
  --danger-dim:   #7a1000;
  --success:      #00ff88;
  --metal:        #1c2e1c;
  --metal-light:  #2a402a;
  --text-main:    #39ff14;
  --text-dim:     #1f6610;
  --text-bright:  #7aff50;
  --font-mono:    'Share Tech Mono', 'Courier New', monospace;
  --font-vt:      'VT323', monospace;
  --hud-h:        56px;
  --fab-size:     52px;
  --radius:       3px;
  --cell-px:      48px;
  --transition:   0.15s ease;
}

/* ── Сброс и база ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-mono);
  user-select: none;
  -webkit-user-select: none;
}

/* ── Фоновая текстура ───────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(57,255,20,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,255,20,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ── HUD (верхняя панель) ───────────────────────────────── */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--hud-h);
  z-index: 100;
  display: flex; align-items: center; gap: 0;
  background: linear-gradient(180deg, #0a1a0b 0%, #0d1a0e 100%);
  border-bottom: 1px solid var(--cell-border);
  box-shadow: 0 2px 20px rgba(0,0,0,0.6), 0 0 40px rgba(57,255,20,0.04);
  padding: 0 12px;
}

#hud-logo {
  font-family: var(--font-vt);
  font-size: 22px;
  color: var(--phosphor);
  letter-spacing: 0.1em;
  margin-right: auto;
  text-shadow: 0 0 8px rgba(57,255,20,0.6);
  white-space: nowrap;
}
#hud-logo span { color: var(--phosphor-dim); font-size: 14px; }

.hud-stat {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-left: 1px solid var(--cell-border);
  font-size: 13px;
  color: var(--phosphor-mid);
  white-space: nowrap;
}
.hud-stat .icon { font-size: 15px; opacity: 0.8; }
.hud-stat .val  { font-family: var(--font-vt); font-size: 20px; color: var(--phosphor); letter-spacing: 0.05em; min-width: 36px; }
.hud-stat .lbl  { font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.15em; display: block; line-height: 1; margin-top: 1px; }

#hud-sector {
  padding: 6px 12px;
  border-left: 1px solid var(--cell-border);
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--phosphor-dim);
  text-align: center;
}
#hud-sector strong { display: block; font-size: 15px; color: var(--amber); font-family: var(--font-vt); }

#btn-mute, #btn-help, #btn-restart-hud {
  background: none; border: 1px solid var(--cell-border);
  color: var(--phosphor-dim); cursor: pointer;
  font-size: 16px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  margin-left: 6px;
  transition: var(--transition);
}
#btn-mute:hover, #btn-help:hover, #btn-restart-hud:hover {
  border-color: var(--phosphor-mid);
  color: var(--phosphor);
  background: rgba(57,255,20,0.05);
}

/* ── Canvas-обёртка ─────────────────────────────────────── */
#game-wrap {
  position: fixed;
  top: var(--hud-h); left: 0; right: 0; bottom: 0;
  z-index: 1;
  cursor: crosshair;
  overflow: hidden;
}
#game-wrap.flag-mode { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ctext y='20' font-size='18'%3E🚩%3C/text%3E%3C/svg%3E") 4 20, pointer; }
#game-wrap.dragging  { cursor: grabbing !important; }

#game-canvas {
  position: absolute; top: 0; left: 0;
  touch-action: none;
  image-rendering: pixelated;
}

/* ── FAB (мобильные кнопки) ─────────────────────────────── */
#fab-wrap {
  position: fixed;
  right: 16px; bottom: 24px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
}

.fab-btn {
  width: var(--fab-size); height: var(--fab-size);
  border-radius: 4px;
  border: 1px solid var(--cell-border);
  background: #0d1a0e;
  color: var(--phosphor-mid);
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 8px rgba(57,255,20,0.06);
  transition: var(--transition);
  position: relative;
}
.fab-btn:hover, .fab-btn:active {
  border-color: var(--phosphor-mid);
  background: #111f12;
  color: var(--phosphor);
  box-shadow: 0 0 16px rgba(57,255,20,0.15);
}
.fab-btn.active {
  border-color: var(--amber);
  background: #1a1800;
  color: var(--amber);
  box-shadow: 0 0 16px rgba(255,179,0,0.2);
}
.fab-btn .fab-lbl {
  position: absolute;
  bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 8px; color: var(--text-dim); white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* ── Модальный оверлей ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.visible {
  opacity: 1; pointer-events: all;
}

/* ── Судоку-терминал ─────────────────────────────────────── */
#sudoku-modal .terminal-frame {
  width: min(480px, 98vw);
  background: #08100a;
  border: 3px solid #2a4a2c;
  border-radius: 2px;
  box-shadow:
    0 0 0 6px #0d1a0e,
    0 0 0 8px #1a2e1b,
    0 0 60px rgba(57,255,20,0.12),
    0 0 120px rgba(0,0,0,0.8);
  position: relative;
  overflow: hidden;
  animation: terminal-boot 0.55s ease-out;
}

/* Металлические заклёпки */
.terminal-frame::before,
.terminal-frame::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4a6a4a, #1a2e1a);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
}
.terminal-frame::before { top: 10px; left: 10px; box-shadow: 10px 0 0 #1a2e1a, inset 0 1px 2px rgba(0,0,0,0.6); }
.terminal-frame::after  { bottom: 10px; right: 10px; box-shadow: -10px 0 0 #1a2e1a, inset 0 1px 2px rgba(0,0,0,0.6); }

/* CRT scanlines */
.terminal-screen {
  position: relative;
  padding: 20px;
}
.terminal-screen::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
}
/* CRT flickering */
.terminal-screen { animation: crt-flicker 7s infinite; }

/* Строка статуса терминала */
.term-statusbar {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--phosphor-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cell-border);
  margin-bottom: 14px;
}
.term-statusbar .blink { animation: blink 1s step-end infinite; }

/* Заголовок тревоги */
.term-alert-header {
  text-align: center;
  margin-bottom: 16px;
}
.term-alert-header .warn-icon { font-size: 28px; display: block; margin-bottom: 4px; animation: pulse-warn 1.5s ease-in-out infinite; }
.term-alert-header h2 {
  font-family: var(--font-vt);
  font-size: 26px;
  color: var(--danger);
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(255,34,0,0.5);
  animation: blink 1.2s step-end infinite;
}
.term-alert-header p {
  font-size: 10px; color: var(--phosphor-dim);
  letter-spacing: 0.2em; text-transform: uppercase;
  margin-top: 4px;
}

/* Судоку-сетка 9×9 */
#sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
  margin: 0 auto 10px;
  max-width: 330px;
  background: #0a180b;
  border: 2px solid var(--cell-border);
  padding: 3px;
  position: relative; z-index: 1;
}

/* Утолщенные линии 3×3 блоков */
.s-cell.border-r-thick { border-right: 2px solid var(--phosphor-mid) !important; }
.s-cell.border-b-thick { border-bottom: 2px solid var(--phosphor-mid) !important; }

.s-cell {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-vt);
  font-size: 20px;
  background: #071007;
  border: 1px solid #1a3a1c;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  position: relative;
  line-height: 1;
}
.s-cell.given {
  color: var(--phosphor-dim);
  cursor: default;
}
.s-cell.player {
  color: var(--phosphor);
  text-shadow: 0 0 8px rgba(57,255,20,0.5);
}
.s-cell.selected {
  background: #0f2a10;
  border-color: var(--phosphor);
  box-shadow: 0 0 12px rgba(57,255,20,0.25), inset 0 0 6px rgba(57,255,20,0.1);
}
.s-cell.wrong {
  color: var(--danger) !important;
  border-color: var(--danger) !important;
  animation: shake-cell 0.3s ease;
  text-shadow: 0 0 8px rgba(255,34,0,0.6) !important;
}
.s-cell.correct-flash {
  background: #0a2a10 !important;
  border-color: var(--success) !important;
}
.s-cell:not(.given):not(.player)::after {
  content: '';
  display: block;
  width: 60%; height: 2px;
  background: var(--phosphor-dim);
  animation: blink 1s step-end infinite;
  position: absolute; bottom: 4px;
  opacity: 0;
}
.s-cell.selected:not(.given):not(.player)::after { opacity: 1; }

/* Цифровая клавиатура */
#sudoku-keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
.key-btn {
  height: 42px;
  background: #0d1a0e;
  border: 1px solid var(--cell-border);
  color: var(--phosphor-mid);
  font-family: var(--font-vt);
  font-size: 22px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.key-btn:hover, .key-btn:active {
  background: #111f12;
  border-color: var(--phosphor-mid);
  color: var(--phosphor);
  box-shadow: 0 0 10px rgba(57,255,20,0.15);
}
.key-btn.key-clear { font-size: 16px; color: var(--phosphor-dim); }

/* Таймер обезвреживания */
#sudoku-timer-wrap {
  text-align: center;
  font-family: var(--font-vt);
  font-size: 14px;
  color: var(--phosphor-dim);
  letter-spacing: 0.2em;
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
#sudoku-timer {
  font-size: 28px;
  color: var(--phosphor);
  text-shadow: 0 0 10px rgba(57,255,20,0.4);
  display: block;
}
#sudoku-timer.urgent { color: var(--danger); text-shadow: 0 0 10px rgba(255,34,0,0.5); animation: blink 0.5s step-end infinite; }

/* Попытки */
#sudoku-attempts {
  text-align: center;
  font-size: 10px; color: var(--phosphor-dim);
  letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 12px;
  position: relative; z-index: 1;
}
#sudoku-attempts .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 3px; background: var(--phosphor-dim); }
#sudoku-attempts .dot.used { background: var(--danger); box-shadow: 0 0 6px rgba(255,34,0,0.4); }

/* Кнопки действий */
.term-actions {
  display: flex; gap: 8px;
  position: relative; z-index: 1;
}
.btn-verify, .btn-surrender {
  flex: 1; padding: 12px 8px;
  font-family: var(--font-vt); font-size: clamp(15px, 4.5vw, 22px);
  letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
  border: 1px solid;
  white-space: nowrap;
}
.btn-verify {
  background: #091a0c; border-color: var(--phosphor-mid);
  color: var(--phosphor);
}
.btn-verify:hover {
  background: #0f2a10;
  box-shadow: 0 0 16px rgba(57,255,20,0.2);
}
.btn-surrender {
  background: #1a0808; border-color: var(--danger-dim);
  color: #e05050;
}
.btn-surrender:hover {
  background: #240d0d;
  border-color: var(--danger);
  box-shadow: 0 0 16px rgba(255,34,0,0.2);
}

/* Сообщение об ошибке/успехе внутри Судоку */
#sudoku-message {
  text-align: center;
  font-family: var(--font-vt); font-size: 18px;
  letter-spacing: 0.1em; height: 24px; line-height: 24px;
  margin-bottom: 8px; position: relative; z-index: 1;
}
#sudoku-message.err  { color: var(--danger); animation: blink 0.6s step-end 3; }
#sudoku-message.ok   { color: var(--success); }

/* ── Состояние Успеха (SUCCESS) ─────────────────────────── */
#sudoku-success-screen {
  display: none;
  padding: 24px 20px;
  text-align: center;
}
#sudoku-success-screen .success-icon { font-size: 48px; display: block; margin-bottom: 12px; animation: bounce-in 0.4s ease; }
#sudoku-success-screen h2 {
  font-family: var(--font-vt); font-size: 28px;
  color: var(--success); letter-spacing: 0.08em;
  text-shadow: 0 0 16px rgba(0,255,136,0.5);
  margin-bottom: 6px;
}
#sudoku-success-screen p { font-size: 10px; color: var(--phosphor-dim); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 20px; }
.btn-continue {
  width: 100%; padding: 14px;
  font-family: var(--font-vt); font-size: clamp(18px, 5vw, 24px);
  background: #061a0c; border: 1px solid var(--success);
  color: var(--success); cursor: pointer; border-radius: var(--radius);
  letter-spacing: 0.08em; transition: var(--transition);
  white-space: nowrap;
}
.btn-continue:hover { background: #0a2a14; box-shadow: 0 0 20px rgba(0,255,136,0.25); }

/* ── Состояние Провала (FAIL) внутри судоку ─────────────── */
.terminal-frame.fail-mode { border-color: var(--danger) !important; box-shadow: 0 0 60px rgba(255,34,0,0.2), 0 0 0 6px #1a0808, 0 0 0 8px #2a0a0a !important; animation: terminal-boot 0.3s ease-out !important; }
.terminal-frame.fail-mode .terminal-screen { background: #100505 !important; }
.terminal-frame.fail-mode .term-statusbar { color: #7a1000 !important; border-color: #3a1010 !important; }

/* ── Game Over ───────────────────────────────────────────── */
#gameover-modal .go-box {
  width: min(400px, 94vw);
  background: #080f08;
  border: 2px solid var(--cell-border);
  padding: 32px 28px;
  text-align: center;
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 40px rgba(57,255,20,0.06);
  animation: scale-in 0.3s ease-out;
}
#gameover-modal h2 {
  font-family: var(--font-vt);
  font-size: clamp(20px, 6vw, 38px);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  text-shadow: 0 0 16px currentColor;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}
#gameover-modal h2.lost  { color: var(--danger); }
#gameover-modal h2.won   { color: var(--success); }
#gameover-modal .go-sub  { font-size: 10px; color: var(--text-dim); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 24px; word-break: break-word; }

.go-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px; margin-bottom: 24px;
}
.go-stat {
  background: #0d1a0e; border: 1px solid var(--cell-border);
  padding: 12px 8px; text-align: center;
}
.go-stat .gs-val { font-family: var(--font-vt); font-size: 32px; color: var(--phosphor); display: block; }
.go-stat .gs-lbl { font-size: 8px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.15em; }

.btn-restart {
  width: 100%; padding: 14px;
  font-family: var(--font-vt); font-size: clamp(18px, 5vw, 24px);
  background: #0d1a0e; border: 1px solid var(--phosphor-mid);
  color: var(--phosphor); cursor: pointer; border-radius: var(--radius);
  letter-spacing: 0.08em; transition: var(--transition);
  margin-top: 4px;
  white-space: nowrap;
}
.btn-restart:hover { background: #111f12; box-shadow: 0 0 16px rgba(57,255,20,0.15); }

/* ── How To Play ─────────────────────────────────────────── */
#help-modal .help-box {
  width: min(420px, 96vw);
  background: #080f08;
  border: 2px solid var(--cell-border);
  padding: 28px 24px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  animation: scale-in 0.25s ease-out;
}
#help-modal h2 {
  font-family: var(--font-vt); font-size: 26px; color: var(--phosphor);
  letter-spacing: 0.1em; margin-bottom: 16px; text-align: center;
}
.help-section { margin-bottom: 18px; }
.help-section h3 { font-size: 10px; color: var(--phosphor-dim); letter-spacing: 0.2em; text-transform: uppercase; border-bottom: 1px solid var(--cell-border); padding-bottom: 4px; margin-bottom: 10px; }
.help-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; font-size: 12px; color: var(--phosphor-mid); line-height: 1.5; }
.help-row .hi { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; margin-top: -1px; }
.btn-help-close {
  width: 100%; padding: 12px;
  font-family: var(--font-vt); font-size: 22px;
  background: #0d1a0e; border: 1px solid var(--cell-border);
  color: var(--phosphor-dim); cursor: pointer; border-radius: var(--radius);
  letter-spacing: 0.08em; transition: var(--transition); margin-top: 4px;
}
.btn-help-close:hover { border-color: var(--phosphor-mid); color: var(--phosphor); }

/* ── Тост-уведомления ────────────────────────────────────── */
#toast {
  position: fixed; top: calc(var(--hud-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 600;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--phosphor); background: #0a1a0b;
  border: 1px solid var(--phosphor-mid);
  padding: 8px 18px; letter-spacing: 0.1em;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  text-transform: uppercase;
}
#toast.show { opacity: 1; }

/* ── Экран первого запуска ───────────────────────────────── */
#splash {
  position: fixed; inset: 0; z-index: 800;
  background: #080f09;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease;
}
#splash.hidden { opacity: 0; pointer-events: none; }
#splash h1 {
  font-family: var(--font-vt);
  font-size: clamp(28px, 8vw, 56px);
  color: var(--phosphor);
  letter-spacing: 0.12em;
  text-shadow: 0 0 30px rgba(57,255,20,0.4);
  text-align: center;
}
#splash .vault-num {
  font-size: clamp(14px, 4vw, 22px); color: var(--amber);
  letter-spacing: 0.25em; font-family: var(--font-mono);
}
#splash .splash-hint {
  font-size: 11px; color: var(--text-dim); letter-spacing: 0.2em;
  text-transform: uppercase; animation: blink 1.2s step-end infinite;
}
.btn-start {
  padding: 14px 48px;
  font-family: var(--font-vt); font-size: 28px;
  background: #0a1a0b; border: 1px solid var(--phosphor-mid);
  color: var(--phosphor); cursor: pointer; border-radius: var(--radius);
  letter-spacing: 0.12em; transition: var(--transition);
  text-transform: uppercase;
}
.btn-start:hover { background: #111f12; box-shadow: 0 0 30px rgba(57,255,20,0.2); }

/* ── Анимации ────────────────────────────────────────────── */
@keyframes crt-flicker {
  0%, 92%, 100% { opacity: 1; }
  93%            { opacity: 0.96; }
  94%            { opacity: 1; }
  95%            { opacity: 0.93; }
  96%            { opacity: 1; }
}

@keyframes terminal-boot {
  0%   { clip-path: inset(50% 0 50% 0); opacity: 0; }
  35%  { clip-path: inset(10% 0 10% 0); opacity: 0.7; }
  100% { clip-path: inset(0% 0 0% 0);   opacity: 1;   }
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes pulse-warn {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.1); opacity: 0.8; }
}

@keyframes shake-cell {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-4px); }
  40%  { transform: translateX(4px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

@keyframes scale-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes bounce-in {
  0%   { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1)   rotate(0deg); opacity: 1; }
}

@keyframes defuse-wave {
  0%   { opacity: 0.8; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(2.5); }
}

/* ── Адаптив ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --hud-h: 48px; --fab-size: 48px; }

  #hud-logo span { display: none; }
  .hud-stat .lbl { display: none; }
  .hud-stat { padding: 4px 8px; }
  .hud-stat .val { font-size: 18px; }

  #sudoku-modal .terminal-frame { width: 100vw; border-left: none; border-right: none; border-radius: 0; }
  #sudoku-modal .modal-overlay { align-items: flex-end; }
  #sudoku-modal .terminal-screen { padding: 16px 14px; }
  #sudoku-grid { max-width: 320px; gap: 1px; }
  .s-cell { font-size: 16px; }
  .s-cell:not(.given):not(.player)::after { bottom: 2px; }
  .key-btn { font-size: 20px; }

  .go-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .hud-stat { padding: 4px 6px; gap: 4px; }
  .hud-stat .val { min-width: 28px; }
  #btn-help { display: none; }
}

/* ── Скроллбар (для help box) ────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0a1a0b; }
::-webkit-scrollbar-thumb { background: var(--cell-border); border-radius: 2px; }

/* ── Стили для SVG иконок ────────────────────────────────── */
.svg-icon {
  width: 1.2em;
  height: 1.2em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  display: inline-block;
}

.hud-stat .svg-icon {
  width: 20px;
  height: 20px;
  stroke: var(--phosphor-mid);
}

.fab-btn .svg-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

#btn-mute .svg-icon, 
#btn-help .svg-icon, 
#btn-restart-hud .svg-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Переключатель звука */
#btn-mute.muted .sound-on { display: none; }
#btn-mute:not(.muted) .sound-off { display: none; }

/* ── Тема сектора WEST (Янтарный CRT-терминал) ────────────── */
body.sector-west {
  --bg:           #1c1005;
  --bg-deep:      #0e0802;
  --cell-closed:  #2e1b0c;
  --cell-open:    #1a1007;
  --cell-border:  #4a2d14;
  --phosphor:     #ffb300;
  --phosphor-dim: #8a6100;
  --phosphor-mid: #cc8f00;
  --text-main:    #ffb300;
  --text-dim:     #664800;
  --text-bright:  #ffe299;
  --metal:        #2d1c0c;
  --metal-light:  #402a14;
}

body.sector-west::before {
  background-image:
    linear-gradient(rgba(255,179,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,179,0,0.03) 1px, transparent 1px);
}

/* Стилизация кликабельного сектора */
#hud-sector {
  cursor: pointer;
  transition: var(--transition);
}
#hud-sector:hover {
  background: rgba(255,255,255,0.04);
}
#hud-sector:hover strong {
  text-shadow: 0 0 8px currentColor;
}
#hud-logo {
  cursor: pointer;
}
#hud-logo:hover {
  text-shadow: 0 0 12px var(--phosphor);
}

/* ── Медиа-запрос для экранов с малой высотой (ноутбуки/нетбуки) ── */
@media (max-height: 820px) {
  #sudoku-modal .terminal-frame {
    width: min(400px, 98vw);
  }
  .terminal-screen {
    padding: 12px 14px;
  }
  .term-statusbar {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  .term-alert-header {
    margin-bottom: 6px;
  }
  .term-alert-header h2 {
    font-size: 22px;
  }
  .term-alert-header p {
    font-size: 9px;
    letter-spacing: 0.15em;
  }
  .term-alert-header .warn-icon {
    font-size: 20px;
    margin-bottom: 2px;
  }
  #sudoku-grid {
    max-width: 270px;
    gap: 1px;
    margin-bottom: 8px;
    padding: 2px;
  }
  .s-cell {
    font-size: 16px;
  }
  .s-cell:not(.given):not(.player)::after {
    bottom: 2px;
  }
  #sudoku-timer-wrap {
    margin-bottom: 4px;
  }
  #sudoku-timer {
    font-size: 20px;
  }
  #sudoku-attempts {
    margin-bottom: 6px;
    font-size: 9px;
  }
  #sudoku-attempts .dot {
    width: 6px;
    height: 6px;
    margin: 0 2px;
  }
  #sudoku-keypad {
    gap: 4px;
    margin-bottom: 8px;
  }
  .key-btn {
    height: 32px;
    font-size: 16px;
  }
  .term-actions {
    gap: 6px;
  }
  .btn-verify, .btn-surrender {
    padding: 8px 4px;
    font-size: clamp(14px, 4.2vw, 18px);
  }
}


