/* BitMento Arcade — shared styles
   Light theme, dark code panels, mobile-first. CSS/SVG animation only. */

:root {
  /* Palette lifted from bitmento.com: near-black navy bg, blue->violet gradient
     as the primary brand mark, emerald/amber/rose as secondary accents. */
  --bg: #080d18;
  --panel: #1a2335;
  --panel-2: #111827;
  --panel-dark: #0d1117;
  --panel-dark-2: #161b28;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f0f6ff;
  --text-dim: #8899b4;
  --text-on-dark: #f0f6ff;
  --accent: #3b82f6;
  --accent-2: #8b5cf6;
  --accent-dark: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.15);
  --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --good: #10b981;
  --good-light: rgba(16, 185, 129, 0.15);
  --bad: #ef4444;
  --bad-light: rgba(239, 68, 68, 0.15);
  --warn: #f59e0b;
  --warn-light: rgba(245, 158, 11, 0.14);
  --rose: #f43f5e;
  --rose-light: rgba(244, 63, 94, 0.15);
  --radius: 16px;
  --radius-sm: 8px;
  --font-ui: "Cabinet Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Urbanist", "Cabinet Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0 0 0.4em;
  line-height: 1.2;
  font-family: var(--font-heading);
  font-weight: 700;
}

p {
  margin: 0 0 0.8em;
  line-height: 1.5;
}

button {
  font-family: var(--font-ui);
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
}

/* ---------- layout shell ---------- */

.app-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 18px;
}

.topbar img.logo {
  height: 34px;
  width: auto;
}

.topbar .brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.topbar .brand span {
  color: var(--accent);
}

/* ---------- screens ---------- */

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.center-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 70vh;
  gap: 16px;
}

/* ---------- form controls ---------- */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 14px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-ui);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder {
  color: #4b5878;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
  min-height: 50px;
}

.btn:active {
  transform: scale(0.97);
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: none;
}

.error-msg {
  color: var(--bad);
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 8px;
  min-height: 1.2em;
}

/* ---------- warning banner ---------- */

.warning-box {
  background: var(--warn-light);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.warning-box .icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.warning-box strong {
  display: block;
  margin-bottom: 4px;
  color: #fbbf24;
}

.warning-box p {
  margin: 0;
  color: #fde4b0;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ---------- hub ---------- */

.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0 28px;
}

.game-card {
  position: relative;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  width: 100%;
}

.game-card:active {
  transform: scale(0.98);
}

.game-card .icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-light);
}

.game-card .icon svg {
  width: 26px;
  height: 26px;
}

.game-card .body {
  flex: 1;
  min-width: 0;
}

.game-card .title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
}

.game-card .desc {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.game-card .status {
  flex-shrink: 0;
  text-align: right;
}

.game-card .status .badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--good-light);
  color: var(--good);
  margin-bottom: 3px;
}

.game-card .status .badge.badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.game-card .status .score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.game-card.locked {
  opacity: 0.55;
}

/* ---------- leaderboard ---------- */

.lb-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.lb-tabs::-webkit-scrollbar {
  display: none;
}

.lb-tab {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.82rem;
}

.lb-tab.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

.lb-panel {
  display: none;
}

.lb-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.lb-row:last-child {
  border-bottom: none;
}

.lb-row .rank {
  width: 26px;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--text-dim);
  text-align: center;
  flex-shrink: 0;
}

.lb-row.rank-1 .rank { color: #fbbf24; }
.lb-row.rank-2 .rank { color: #cbd5e1; }
.lb-row.rank-3 .rank { color: #f59e0b; }

.lb-row.rank-1 {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), var(--panel) 65%);
}

.lb-row .name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-row .meta-tag {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.lb-row .score {
  font-family: var(--font-mono);
  font-weight: 700;
  flex-shrink: 0;
}

.lb-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- game chrome (shared by all games) ---------- */

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.game-header .back-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 0;
}

.game-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.timer-wrap {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}

.timer-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 1s linear, background 0.3s ease;
}

.timer-bar.low {
  background: var(--bad);
}

.stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-pill {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
}

.stat-pill .label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 700;
}

.stat-pill .value {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
}

/* code editor panel */

.code-panel {
  background: var(--panel-dark);
  border-radius: var(--radius);
  padding: 16px 16px;
  margin-bottom: 16px;
  overflow-x: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.code-panel::before {
  content: "";
  display: block;
  position: absolute;
  top: 12px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 16px 0 0 #f59e0b, 32px 0 0 #22c55e;
}

.code-panel pre {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre;
}

.code-panel .token-fn { color: #93c5fd; }
.code-panel .token-str { color: #86efac; }
.code-panel .token-num { color: #fca5a5; }

.question-text {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 0.98rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  min-height: 50px;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-btn.correct {
  border-color: var(--good);
  background: var(--good-light);
  color: #6ee7b7;
}

.option-btn.wrong {
  border-color: var(--bad);
  background: var(--bad-light);
  color: #fca5a5;
}

.option-btn:disabled {
  cursor: default;
}

.feedback-flash {
  text-align: center;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.feedback-flash.good {
  background: var(--good-light);
  color: var(--good);
}

.feedback-flash.bad {
  background: var(--bad-light);
  color: var(--bad);
}

/* end-of-game summary */

.summary-hero {
  text-align: center;
  padding: 28px 16px;
}

.summary-hero .big-score {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
  margin: 6px 0;
}

.summary-hero .sub {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.already-played-box {
  text-align: center;
  padding: 32px 20px;
}

.already-played-box .big-score {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 2.4rem;
  color: var(--accent);
}

/* ============================================================
   CODE BOARD RUSH
   ============================================================ */

.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.lang-btn {
  padding: 22px 10px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--panel);
  font-weight: 800;
  font-size: 1rem;
  box-shadow: var(--shadow);
}

.lang-btn:active {
  transform: scale(0.97);
}

.board-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  position: relative;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  position: relative;
}

.board-sq {
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 700;
  position: relative;
}

.board-sq.filled {
  background: var(--accent-light);
  border-color: rgba(59, 130, 246, 0.5);
}

.board-sq.finish {
  background: var(--good-light);
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--good);
}

.board-token {
  position: static;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #fff;
  transition: left 0.6s cubic-bezier(.34,1.56,.64,1), top 0.6s cubic-bezier(.34,1.56,.64,1);
  z-index: 3;
  pointer-events: none;
}

.board-token.hop {
  animation: tokenHop 0.6s ease;
}

@keyframes tokenHop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-16px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

.board-token.slide-back {
  animation: tokenShake 0.5s ease;
}

@keyframes tokenShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ============================================================
   STORY MODE
   ============================================================ */

.story-scene {
  height: 180px;
  border-radius: var(--radius);
  background: var(--panel-dark);
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

/* reusable CSS-only walk-cycle character */
.walker {
  position: absolute;
  width: 24px;
  height: 50px;
  z-index: 2;
}

.walker .w-head,
.walker .w-body,
.walker .w-arm,
.walker .w-leg {
  position: absolute;
  background: var(--walker-color, #f0f6ff);
  border-radius: 3px;
}

.walker .w-head {
  top: 0;
  left: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.walker .w-body {
  top: 12px;
  left: 7px;
  width: 10px;
  height: 20px;
  border-radius: 4px;
}

.walker .w-leg {
  top: 30px;
  width: 4px;
  height: 18px;
  transform-origin: top center;
  animation: walkLeg 0.5s ease-in-out infinite;
}

.walker .w-leg-l { left: 8px; animation-delay: 0s; }
.walker .w-leg-r { left: 14px; animation-delay: 0.25s; }

.walker .w-arm {
  top: 14px;
  width: 3px;
  height: 14px;
  transform-origin: top center;
  animation: walkArm 0.5s ease-in-out infinite;
}

.walker .w-arm-l { left: 4px; animation-delay: 0.25s; }
.walker .w-arm-r { left: 18px; animation-delay: 0s; }

.walker.idle .w-leg,
.walker.idle .w-arm {
  animation-duration: 0.9s;
}

@keyframes walkLeg {
  0%, 100% { transform: rotate(24deg); }
  50% { transform: rotate(-24deg); }
}

@keyframes walkArm {
  0%, 100% { transform: rotate(-18deg); }
  50% { transform: rotate(18deg); }
}

.rule-hook {
  font-size: 0.98rem;
  line-height: 1.55;
  text-align: center;
  margin-bottom: 4px;
}

.rule-hook strong {
  color: var(--accent);
}

.rule-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  text-align: left;
}

.rule-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 9px;
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.rule-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 800;
}

.elapsed-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 5px 11px;
  margin-bottom: 14px;
}

.hint-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.hint-btn {
  background: var(--warn-light);
  color: var(--warn);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.76rem;
  font-weight: 700;
}

.hint-btn:disabled {
  opacity: 0.45;
}

.story-intro-scene {
  height: 190px;
  border-radius: var(--radius);
  background: #04060b;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.intro-title {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--text);
  opacity: 0;
  animation: introTitleIn 1s ease 0.2s forwards;
  z-index: 3;
}

@keyframes introTitleIn {
  to { opacity: 0.9; }
}

.intro-door {
  position: absolute;
  right: 6%;
  top: 12%;
  width: 15%;
  height: 74%;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.4), rgba(139, 92, 246, 0.3));
  border-radius: 6px 6px 0 0;
  box-shadow: 0 0 44px rgba(59, 130, 246, 0.45);
}

.walker.walking-across {
  bottom: 14px;
  left: -10%;
  animation: walkAcross 2.6s ease-in-out forwards;
}

@keyframes walkAcross {
  0% { left: -10%; opacity: 1; }
  78% { left: 76%; opacity: 1; }
  100% { left: 90%; opacity: 0; }
}

.intro-skip {
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

.walker.door-idle {
  right: 8%;
  bottom: 8px;
  left: auto;
}

.voice-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-dim);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  flex-shrink: 0;
}

.voice-toggle.on {
  color: var(--accent);
  background: var(--accent-light);
}

.story-chip {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #93c5fd;
  z-index: 5;
}

.story-narrative {
  font-size: 0.92rem;
  color: var(--text-dim);
  margin-bottom: 14px;
  line-height: 1.55;
}

/* radar scene */
.scene-radar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-ring {
  position: absolute;
  border: 1px solid rgba(147, 197, 253, 0.25);
  border-radius: 50%;
}

.radar-sweep {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(from 0deg, rgba(59,130,246,0.55), transparent 55deg);
  animation: spin 2.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.radar-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: blip 1.8s ease-in-out infinite;
}

@keyframes blip {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* breach meter scene */
.scene-breach {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.breach-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #fca5a5;
  letter-spacing: 0.05em;
}

.breach-meter {
  width: 78%;
  height: 16px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  overflow: hidden;
}

.breach-fill {
  height: 100%;
  width: 12%;
  background: linear-gradient(90deg, #ef4444, #f59e0b);
  border-radius: 999px;
  animation: breachGrow 15s linear forwards, breachFlicker 0.4s steps(2) infinite;
}

@keyframes breachGrow {
  to { width: 92%; }
}

@keyframes breachFlicker {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

/* vault dial scene */
.scene-vault {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vault-dial {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid #334155;
  position: relative;
  background: radial-gradient(circle at 50% 50%, #1e293b, #0f172a);
  animation: dialSpin 6s linear infinite;
}

@keyframes dialSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.vault-dial::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 14px;
  background: #fbbf24;
  transform: translateX(-50%);
  border-radius: 2px;
}

.vault-notch {
  position: absolute;
  width: 3px;
  height: 8px;
  background: #475569;
  left: 50%;
  top: 4px;
  transform-origin: 1.5px 56px;
}

/* glitch scene */
.scene-glitch {
  display: flex;
  align-items: center;
  justify-content: center;
}

.glitch-text {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: #f87171;
  position: relative;
}

.glitch-text::before,
.glitch-text::after {
  content: "SENTINEL";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.glitch-text::before {
  color: #60a5fa;
  animation: glitchShift 2.4s infinite linear;
  clip-path: inset(0 0 55% 0);
}

.glitch-text::after {
  color: #4ade80;
  animation: glitchShift 2.4s infinite linear reverse;
  clip-path: inset(55% 0 0 0);
}

@keyframes glitchShift {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 1px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, 2px); }
  80% { transform: translate(2px, -2px); }
}

/* door scene */
.scene-door {
  display: flex;
  align-items: center;
  justify-content: center;
}

.door-frame {
  width: 90px;
  height: 130px;
  border: 4px solid #475569;
  border-radius: 6px;
  position: relative;
  animation: doorShake 0.35s ease-in-out infinite;
  background: repeating-linear-gradient(135deg, #1e293b, #1e293b 8px, #172033 8px, #172033 16px);
}

@keyframes doorShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-2px) rotate(-0.6deg); }
  75% { transform: translateX(2px) rotate(0.6deg); }
}

.door-alarm {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: alarmPulse 0.6s ease-in-out infinite;
}

@keyframes alarmPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* reorder puzzle */
.reorder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.reorder-item {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--panel-dark);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.reorder-item .num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #334155;
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reorder-item.picked {
  opacity: 0.4;
}

.reorder-item.disabled {
  pointer-events: none;
}

.reorder-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.reorder-slot {
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.reorder-slot.filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text);
}

/* ending screen */

.ending-hero {
  text-align: center;
  padding: 28px 18px;
  border-radius: var(--radius);
  color: #fff;
  margin-bottom: 16px;
}

.ending-hero.ending-ghost { background: linear-gradient(145deg, #0f172a, #1e3a8a); }
.ending-hero.ending-smooth { background: linear-gradient(145deg, #0f172a, #14532d); }
.ending-hero.ending-sloppy { background: linear-gradient(145deg, #0f172a, #92400e); }
.ending-hero.ending-caught { background: linear-gradient(145deg, #0f172a, #7f1d1d); }

.ending-hero .ending-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.ending-hero .ending-text {
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.5;
}

/* ============================================================
   ROBOT MAZE
   ============================================================ */

.maze-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.maze-grid {
  display: grid;
  gap: 3px;
  margin: 0 auto;
  max-width: 320px;
  position: relative;
}

.maze-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  position: relative;
}

.maze-cell.wall {
  background: #04060b;
  border-color: rgba(255, 255, 255, 0.03);
}

.maze-cell.reachable {
  background: var(--accent-light);
  cursor: pointer;
}

.maze-cell.reachable:active {
  transform: scale(0.94);
}

.maze-cell.start {
  background: var(--accent-light);
}

.maze-cell.exit {
  background: var(--good-light);
}

.maze-cell.exit::after {
  content: "EXIT";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--good);
  letter-spacing: 0.03em;
}

.robot-icon {
  position: absolute;
  transition: left 0.28s cubic-bezier(.34,1.56,.64,1), top 0.28s cubic-bezier(.34,1.56,.64,1);
  z-index: 4;
  pointer-events: none;
}

.robot-icon.blocked {
  animation: tokenShake 0.3s ease;
}

.robot-icon svg {
  width: 100%;
  height: 100%;
  animation: robotBob 1s ease-in-out infinite;
}

@keyframes robotBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
  justify-content: center;
  margin: 16px auto 4px;
}

.dpad button {
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--panel);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  box-shadow: var(--shadow);
}

.dpad button:active {
  transform: scale(0.92);
  background: var(--accent-light);
}

.dpad .up { grid-column: 2; grid-row: 1; }
.dpad .left { grid-column: 1; grid-row: 2; }
.dpad .right { grid-column: 3; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 3; }

.lane-quiz {
  background: var(--panel);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 0 0 4px var(--accent-light);
  animation: fadeIn 0.2s ease;
}

.lane-quiz-chip {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  text-align: center;
}

.lane-quiz-prompt {
  font-weight: 700;
  text-align: center;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.lane-quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
}

.lane-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--panel-2);
  min-height: 64px;
}

.lane-opt:active {
  transform: scale(0.95);
}

.lane-opt .lane-arrow {
  font-size: 1.3rem;
  color: var(--accent);
  line-height: 1;
}

.lane-opt .lane-num {
  font-weight: 800;
  font-size: 1.05rem;
}

.lane-opt.wrong {
  border-color: var(--bad);
  background: var(--bad-light);
  animation: tokenShake 0.4s ease;
}

.lane-opt.correct {
  border-color: var(--good);
  background: var(--good-light);
}

.lane-quiz-penalty {
  text-align: center;
  color: var(--bad);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 10px;
  min-height: 1.1em;
}

/* ============================================================
   ACCESS CODE SCREEN
   ============================================================ */

.access-hero {
  text-align: center;
  margin-bottom: 8px;
}

.access-hero .logo-big {
  height: 56px;
  margin-bottom: 14px;
}

.access-hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
}

.access-hero p {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.access-code-input {
  text-align: center;
  letter-spacing: 0.15em;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
  text-transform: uppercase;
}

/* ============================================================
   TV LEADERBOARD PAGE (leaderboard.html)
   ============================================================ */

body.tv {
  background: var(--bg);
  color: var(--text);
}

.tv-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 28px;
  min-height: 100vh;
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.tv-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
}

.tv-header img.logo {
  height: 42px;
}

.tv-header .live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #4ade80;
}

.tv-header .live-dot .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: alarmPulse 1.2s ease-in-out infinite;
}

.tv-panel {
  display: none;
}

.tv-panel.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.tv-game-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.tv-game-sub {
  color: #94a3b8;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.tv-lb-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.tv-lb-row.rank-1 {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), var(--panel) 70%);
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.tv-lb-row .rank {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  width: 40px;
  color: #94a3b8;
}

.tv-lb-row.rank-1 .rank { color: #fbbf24; }
.tv-lb-row.rank-2 .rank { color: #cbd5e1; }
.tv-lb-row.rank-3 .rank { color: #d97706; }

.tv-lb-row .name {
  flex: 1;
  font-size: 1.15rem;
  font-weight: 700;
}

.tv-lb-row .meta-tag {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 9px;
  border-radius: 999px;
}

.tv-lb-row .score {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}

.tv-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 28px;
}

.tv-dots .tv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #334155;
  transition: background 0.3s ease;
}

.tv-dots .tv-dot.active {
  background: var(--accent);
}

.tv-empty {
  padding: 40px;
  text-align: center;
  color: #64748b;
}

@media (min-width: 640px) {
  .lang-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
