/* ============================================================
   🚂 TRAIN ADVENTURE — style.css
   Pixel-art theme with Press Start 2P font
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  --green:  #00ff00;
  --cyan:   #00ffff;
  --yellow: #ffff00;
  --pink:   #ff00ff;
  --orange: #ff8800;
  --red:    #ff2222;
  --gold:   #ffd700;
  --blue:   #4488ff;
  --bg:     #0a0e27;
  --panel:  rgba(0,0,0,0.88);
  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --shadow-green: 0 0 18px rgba(0,255,0,0.5);
  --shadow-cyan:  0 0 18px rgba(0,255,255,0.5);
  --shadow-gold:  0 0 24px rgba(255,215,0,0.7);
}

body {
  font-family: var(--pixel);
  background: var(--bg);
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
  image-rendering: pixelated;
}

/* ── Stars background ──────────────────────────────────────── */
.stars {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.stars::before {
  content: '';
  position: absolute; width: 3px; height: 3px;
  background: transparent;
  box-shadow:
    42px 85px #fff,  183px 62px #fff,  305px 147px #fff, 468px 30px #fff,
    590px 200px #fff,730px 88px #fff,  860px 160px #fff, 990px 40px #fff,
    110px 320px #0ff,240px 400px #0ff, 380px 280px #0ff, 520px 350px #0ff,
    650px 130px #0ff,800px 250px #0ff, 940px 310px #0ff,1080px 190px #0ff,
    60px 500px #f0f, 190px 570px #f0f, 330px 460px #f0f, 470px 540px #f0f,
    155px 680px #ff8,295px 720px #ff8, 435px 660px #ff8, 575px 700px #ff8,
    700px 640px #ff8,840px 710px #ff8, 980px 680px #ff8,1120px 630px #ff8;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%,100%{opacity:.25} 50%{opacity:1} }

/* CRT scanlines */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(
    to bottom, transparent 0px, transparent 3px,
    rgba(0,0,0,0.15) 3px, rgba(0,0,0,0.15) 4px
  );
}

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%; max-width: 1400px;
  padding: 16px 20px 60px;
  position: relative; z-index: 3;
}

/* ── Screens ───────────────────────────────────────────────── */
.screen { display: none; }
.screen.active {
  display: block;
  animation: screenIn .35s ease-out both;
}
@keyframes screenIn {
  from { opacity:0; transform:translateY(20px) scale(.98); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

/* ============================================================
   MAIN MENU
   ============================================================ */
#mainMenu { text-align: center; }

.title-container { margin-bottom: 32px; }

.title-glow h1 {
  font-size: clamp(1.4em,4vw,2.4em);
  color: var(--yellow);
  text-shadow:
    0 0 8px var(--yellow), 0 0 20px var(--yellow),
    0 0 40px var(--orange), 4px 4px 0 #443300;
  animation: titleGlow 2s ease-in-out infinite;
  letter-spacing: 2px; margin-bottom: 20px;
}
@keyframes titleGlow {
  0%,100%{ text-shadow:0 0 8px var(--yellow),0 0 20px var(--yellow),4px 4px 0 #443300; }
  50%    { text-shadow:0 0 16px var(--yellow),0 0 36px var(--orange),4px 4px 0 #443300; }
}

.subtitle-box {
  background: rgba(255,200,0,0.08);
  border: 3px solid var(--yellow);
  padding: 18px 28px; display: inline-block;
  box-shadow: 0 0 16px rgba(255,200,0,0.3), 4px 4px 0 #443300;
}
.subtitle      { font-size: clamp(.7em,2vw,1em); color: var(--yellow); margin-bottom:10px; letter-spacing:3px; }
.subtitle-desc { font-size: clamp(.36em,1vw,.5em); color: var(--cyan); line-height:1.9; }

/* Station map */
.map-preview {
  background: rgba(0,20,50,.7);
  border: 4px solid var(--cyan);
  padding: 28px 20px; margin: 28px 0 32px;
  box-shadow: var(--shadow-cyan), 4px 4px 0 #003333;
}
.map-title {
  font-size: clamp(.5em,1.4vw,.8em);
  color: var(--cyan); margin-bottom: 24px;
  letter-spacing: 2px; text-shadow: 0 0 10px var(--cyan);
}
.station-map {
  display: flex; justify-content: center;
  align-items: center; flex-wrap: wrap; gap: 4px;
}
.station-node {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 10px 14px; min-width: 80px;
  background: rgba(0,40,80,.5);
  border: 2px solid #334466;
  transition: all .25s; cursor: default;
}
.station-node.done  { border-color:var(--green); background:rgba(0,80,0,.35); }
.station-node.done .node-icon { filter:drop-shadow(0 0 8px rgba(0,255,0,.7)); }
.node-icon  { font-size: clamp(1.2em,3vw,2em); }
.node-label { font-size: clamp(.3em,.7vw,.42em); color:var(--cyan); text-align:center; }
.track-line {
  width: 36px; height: 6px;
  background: linear-gradient(90deg,var(--yellow),var(--orange),var(--yellow));
  background-size: 200% 100%;
  animation: trackFlow 1s linear infinite;
  flex-shrink: 0;
}
@keyframes trackFlow { 0%{background-position:0 50%} 100%{background-position:200% 50%} }

/* Buttons */
.menu-buttons { display:flex; justify-content:center; gap:20px; flex-wrap:wrap; }

.pixel-btn {
  font-family: var(--pixel);
  font-size: clamp(.4em,1.1vw,.68em);
  padding: 16px 24px; border: 3px solid;
  background: var(--panel); color: #fff;
  cursor: pointer; position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  text-transform: uppercase; letter-spacing: 1px;
  box-shadow: 5px 5px 0 rgba(0,0,0,.7);
  transition: transform .1s, box-shadow .1s;
  clip-path: polygon(6px 0%,calc(100% - 6px) 0%,100% 6px,100% calc(100% - 6px),calc(100% - 6px) 100%,6px 100%,0% calc(100% - 6px),0% 6px);
}
.pixel-btn:hover  { transform:translate(-3px,-3px); box-shadow:8px 8px 0 rgba(0,0,0,.7); }
.pixel-btn:active { transform:translate(2px,2px);   box-shadow:2px 2px 0 rgba(0,0,0,.7); }

.btn-primary {
  border-color: var(--yellow);
  background: linear-gradient(135deg,rgba(255,200,0,.12),rgba(200,120,0,.2));
}
.btn-primary:hover {
  background: linear-gradient(135deg,rgba(255,200,0,.22),rgba(200,120,0,.3));
  box-shadow: 0 0 16px rgba(255,200,0,.4),8px 8px 0 rgba(0,0,0,.7);
}
.btn-secondary {
  border-color: var(--cyan);
  background: linear-gradient(135deg,rgba(0,255,255,.07),rgba(0,120,200,.15));
}
.btn-secondary:hover {
  background: linear-gradient(135deg,rgba(0,255,255,.17),rgba(0,120,200,.25));
  box-shadow: 0 0 16px rgba(0,255,255,.35),8px 8px 0 rgba(0,0,0,.7);
}
.btn-icon  { font-size:1.4em; }
.large-btn { font-size:clamp(.5em,1.3vw,.88em); padding:20px 34px; }

/* ── ปุ่มเริ่มเกมเต็มจอ (ใหญ่พิเศษ กดง่ายบนมือถือ) ── */
.start-fs-btn {
  font-size: clamp(.6em, 1.8vw, 1em) !important;
  padding: 24px 44px !important;
  border-width: 4px !important;
  animation: startPulse 1.6s ease-in-out infinite;
}
@keyframes startPulse {
  0%,100% { box-shadow: 0 0 14px rgba(255,200,0,.45), 5px 5px 0 rgba(0,0,0,.7); }
  50%     { box-shadow: 0 0 32px rgba(255,200,0,.85), 5px 5px 0 rgba(0,0,0,.7); }
}
.start-hint {
  margin-top: 14px;
  font-size: clamp(.32em, 1vw, .45em);
  color: var(--cyan);
  line-height: 1.9;
  opacity: .85;
}

/* ============================================================
   GAME SCREEN
   ============================================================ */
#gameScreen { min-height: 90vh; }

.game-hud {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 12px; margin-bottom: 10px; align-items: center;
  background: rgba(0,0,0,.85);
  border: 3px solid var(--yellow);
  padding: 10px 16px;
  box-shadow: 0 0 14px rgba(255,200,0,.25);
}
.hud-left, .hud-right {
  display: flex; gap: 20px; align-items: center;
}
.hud-right { justify-content: flex-end; }
.hud-stat  { display:flex; flex-direction:column; gap:3px; }
.hud-label { font-size:.38em; color:var(--cyan); letter-spacing:1px; }
.hud-value { font-size:.62em; color:var(--yellow); }
.hud-center { text-align:center; }
.hud-station-name {
  display: block; font-size:.55em; color:var(--yellow);
  text-shadow: 0 0 10px var(--yellow);
}
.hud-state-label {
  display: block; font-size:.38em; color:var(--cyan); margin-top:4px;
  animation: blinkFade 1.2s ease-in-out infinite;
}
@keyframes blinkFade { 0%,100%{opacity:1} 50%{opacity:.3} }

.snd-toggle {
  font-size: 1.1em; background: none; border: 2px solid var(--yellow);
  color: var(--yellow); cursor: pointer; padding: 6px 10px;
  transition: opacity .2s;
}
.snd-toggle:hover { opacity: .7; }

/* Canvas */
.canvas-wrapper {
  background: #060b1a;
  border: 4px solid var(--yellow);
  box-shadow: 0 0 20px rgba(255,200,0,.3), 6px 6px 0 #332200;
  position: relative; overflow: hidden;
}
.canvas-wrapper::before {
  content:''; position:absolute; inset:0; pointer-events:none; z-index:1;
  background: radial-gradient(ellipse at center,transparent 60%,rgba(0,0,0,.5) 100%);
}
#gameCanvas {
  display:block; width:100%; height:auto;
  image-rendering: pixelated; image-rendering: crisp-edges;
  touch-action: none;          /* กัน scroll/zoom ขณะแตะเล่นเกม */
  -webkit-user-select: none;
  user-select: none;
}

/* Minigame overlay */
.mini-ui {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding-bottom: 12px; pointer-events: none;
}
.mini-ui.hidden { display: none; }
.mini-ui > * { pointer-events: all; }

/* Action bar */
.action-bar {
  background: rgba(0,0,0,.8);
  border: 3px solid var(--cyan);
  min-height: 50px;
  box-shadow: 0 0 12px rgba(0,255,255,.2);
}

/* ============================================================
   INFO SCREEN
   ============================================================ */
.info-panel {
  background: rgba(0,0,0,.92);
  border: 4px solid var(--cyan);
  padding: 36px 40px; max-width: 960px; margin: 0 auto;
  box-shadow: var(--shadow-cyan), 6px 6px 0 #003333;
}
.panel-title {
  text-align:center; font-size:clamp(1em,2.5vw,1.6em);
  color:var(--cyan); margin-bottom:28px;
  text-shadow:0 0 12px var(--cyan); letter-spacing:2px;
}
.info-content { font-size:.5em; line-height:2; color:#fff; }
.info-section {
  margin-bottom:24px; padding:16px 20px;
  background:rgba(0,60,80,.12);
  border-left:4px solid var(--cyan);
}
.info-section h3 { color:var(--yellow); margin-bottom:10px; font-size:1.1em; }

.mini-list  { display:grid; gap:10px; margin-top:12px; }
.mini-item  {
  display:grid; grid-template-columns:36px 1fr; gap:12px;
  align-items:center; padding:12px;
  background:rgba(0,0,0,.35); border:2px solid var(--green);
}
.mini-num {
  width:34px; height:34px; background:var(--green); color:#000;
  display:flex; align-items:center; justify-content:center; font-weight:bold;
  clip-path:polygon(25% 0%,75% 0%,100% 25%,100% 75%,75% 100%,25% 100%,0% 75%,0% 25%);
}
.mini-item strong { color:var(--cyan); display:block; margin-bottom:4px; }

.tips-list   { list-style:none; margin-top:10px; }
.tips-list li {
  padding:9px 13px; margin-bottom:7px;
  background:rgba(0,255,200,.06); border-left:4px solid var(--cyan);
}

/* ============================================================
   COMPLETION / GAMEOVER / FINAL
   ============================================================ */
.completion-panel {
  background: rgba(0,0,0,.96);
  border: 4px solid var(--green);
  padding: 36px; max-width: 720px; margin: 0 auto;
  box-shadow: 0 0 40px rgba(0,255,0,.6), 6px 6px 0 #003300;
  text-align: center;
}
.completion-header   { margin-bottom:28px; }
.completion-title    { font-size:clamp(1em,2.8vw,1.6em); color:var(--green); margin-bottom:14px; }
.station-icon-big    { font-size: 3.5em; display:block; margin:10px 0; }
.station-name-big    { font-size:.65em; color:var(--yellow); }

.stats-grid {
  display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:28px;
}
.stat-card {
  background:rgba(0,60,0,.25); border:3px solid var(--green);
  padding:16px; text-align:center; box-shadow:3px 3px 0 #003300;
  transition: transform .2s;
}
.stat-card:hover     { transform:translateY(-4px); }
.stat-card-icon      { font-size:2em; margin-bottom:6px; }
.stat-card-value     { font-size:1.6em; color:var(--yellow); margin-bottom:6px; }
.stat-card-label     { font-size:.42em; color:var(--cyan); }

.completion-footer {
  display:flex; justify-content:center; gap:16px; flex-wrap:wrap;
}

/* gameover */
.gameover-panel  { border-color:var(--red); box-shadow:0 0 40px rgba(255,0,0,.6),6px 6px 0 #330000; }
.gameover-title  { font-size:clamp(1.6em,4vw,2.4em); color:var(--red); text-shadow:0 0 18px var(--red); margin-bottom:16px; }
.gameover-icon   { font-size:5em; display:block; margin:16px 0; animation:deathShake .4s ease-in-out 3; }
@keyframes deathShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
.gameover-text   { font-size:.5em; color:#ffaaaa; margin-bottom:28px; }

/* final */
.final-panel {
  background:rgba(0,0,0,.97); border:5px solid var(--gold);
  padding:46px; max-width:860px; margin:0 auto;
  box-shadow:var(--shadow-gold),6px 6px 0 #443300; text-align:center;
}
.final-trophy   { font-size:6em; animation:trophyBounce .9s ease-in-out infinite; display:block; margin-bottom:16px; }
@keyframes trophyBounce { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-16px) scale(1.08)} }
.final-title    { font-size:clamp(1em,3vw,1.9em); color:var(--gold); margin-bottom:10px; text-shadow:0 0 24px var(--gold); }
.final-subtitle { font-size:clamp(.6em,1.8vw,1em); color:var(--green); margin-bottom:32px; }
.final-score-box {
  display:inline-flex; flex-direction:column; gap:8px;
  background:rgba(255,200,0,.1); border:3px solid var(--gold);
  padding:20px 40px; box-shadow:0 0 16px rgba(255,200,0,.3);
}
.final-score-label { font-size:.5em; color:var(--cyan); }
.final-score-value { font-size:2em; color:var(--gold); text-shadow:0 0 12px var(--gold); }

/* ============================================================
   MINIGAME IN-CANVAS UI (overlays)
   ============================================================ */
/* memory card game */
.memory-grid {
  display:grid; gap:8px;
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
}
.mem-card {
  width:80px; height:80px;
  background:rgba(0,40,80,.9); border:3px solid var(--cyan);
  font-size:2em; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:transform .15s;
  box-shadow: 3px 3px 0 #003333;
  user-select:none;
}
.mem-card:hover { transform:scale(1.06); }
.mem-card.flipped { background:rgba(0,80,40,.9); border-color:var(--green); }
.mem-card.matched { background:rgba(0,60,0,.6); border-color:var(--green); opacity:.7; pointer-events:none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:900px) {
  .game-hud { grid-template-columns:1fr 1fr; }
  .hud-center { grid-column:1/-1; order:-1; }
  .stats-grid { grid-template-columns:1fr 1fr; }
}
@media (max-width:600px) {
  .game-hud { grid-template-columns:1fr; }
  .pixel-btn { font-size:.4em; padding:13px 16px; }
  .large-btn { font-size:.52em; padding:16px 22px; }
  .info-panel,.completion-panel,.final-panel { padding:18px; }
  .station-map { gap:2px; }
  .track-line  { width:18px; }
}

/* ============================================================
   ROTATE OVERLAY — แสดงเฉพาะ portrait บน mobile
   ============================================================ */
.rotate-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: #060b1a;
  align-items: center; justify-content: center;
  flex-direction: column;
}
.rotate-inner {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  text-align: center; padding: 32px;
}
.rotate-icon  { font-size: 5em; animation: rotatePhone 1.8s ease-in-out infinite; }
.rotate-arrow {
  font-size: 3em; color: var(--yellow);
  text-shadow: 0 0 18px var(--yellow);
  animation: rotateSpin 1.8s ease-in-out infinite;
}
@keyframes rotatePhone {
  0%,100% { transform: rotate(0deg); }
  40%,60% { transform: rotate(90deg); }
}
@keyframes rotateSpin {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.3); }
}
.rotate-title {
  font-family: var(--pixel);
  font-size: clamp(0.9em, 4vw, 1.3em);
  color: var(--yellow);
  text-shadow: 0 0 12px var(--yellow);
}
.rotate-sub {
  font-family: var(--pixel);
  font-size: clamp(0.45em, 2vw, 0.65em);
  color: var(--cyan);
  line-height: 1.8;
}

/* แสดง overlay เมื่อเป็น portrait บน mobile (max-width ขนาดมือถือ) */
@media screen and (max-width: 900px) and (orientation: portrait) {
  .rotate-overlay { display: flex; }
  /* ซ่อน content หลัก */
  .container { visibility: hidden; }
}

/* ============================================================
   MOBILE LANDSCAPE — FULL VIEWPORT GAME
   ============================================================ */
@media screen and (max-width: 900px) and (orientation: landscape) {

  /* reset body ให้ไม่ scroll */
  html, body {
    overflow: hidden;
    height: 100%;
    width: 100%;
  }

  body {
    align-items: stretch;
    padding: 0;
  }

  /* container เต็มจอ ไม่มี padding ใหญ่ — ใช้ dvh รองรับแถบ URL มือถือ */
  .container {
    padding: 0;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  /* ── Main Menu ── */
  #mainMenu {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }
  .title-container  { margin-bottom: 6px; }
  .title-glow h1    { font-size: clamp(1em, 3.5vw, 1.6em); margin-bottom: 8px; }
  .subtitle-box     { padding: 8px 14px; }
  .subtitle         { font-size: clamp(0.5em, 1.8vw, 0.7em); margin-bottom: 4px; }
  .subtitle-desc    { font-size: clamp(0.28em, 1vw, 0.38em); }
  .map-preview      { padding: 10px 8px; margin: 6px 0 10px; }
  .map-title        { font-size: clamp(0.38em, 1.2vw, 0.55em); margin-bottom: 10px; }
  .station-node     { padding: 5px 6px; min-width: 52px; }
  .node-icon        { font-size: clamp(1em, 3vw, 1.5em); }
  .node-label       { font-size: clamp(0.22em, 0.7vw, 0.34em); }
  .track-line       { width: 18px; height: 5px; }

  /* ── Menu buttons — ใหญ่ขึ้น แตะง่าย ── */
  .menu-buttons     { gap: 12px; }
  .pixel-btn        { font-size: clamp(0.42em, 1.4vw, 0.62em); padding: 14px 20px; }
  .large-btn        { font-size: clamp(0.52em, 1.8vw, 0.76em); padding: 16px 28px; }
  .btn-icon         { font-size: 1.6em; }
  .start-fs-btn     { font-size: clamp(0.6em, 2.4vw, 0.95em) !important; padding: 18px 34px !important; }
  .start-hint       { font-size: clamp(0.26em, 0.9vw, 0.36em); margin-top: 8px; }

  /* ── Game Screen — เต็มจอ ── */
  #gameScreen {
    height: 100vh;
    height: 100dvh;
    min-height: unset;
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  /* HUD บาง ── */
  .game-hud {
    padding: 4px 10px;
    margin-bottom: 0;
    border-width: 0 0 2px 0;   /* แค่ขอบล่าง */
    box-shadow: none;
    grid-template-columns: 1fr auto 1fr;
    flex-shrink: 0;
  }
  .hud-label  { font-size: 0.28em; }
  .hud-value  { font-size: 0.46em; }
  .hud-station-name { font-size: 0.38em; }
  .hud-state-label  { font-size: 0.28em; margin-top: 1px; }
  .snd-toggle { font-size: 0.85em; padding: 3px 7px; }

  /* Canvas wrapper — flex-grow เต็มที่เหลือ */
  .canvas-wrapper {
    flex: 1 1 auto;
    border-width: 0;
    box-shadow: none;
    display: flex;
    align-items: stretch;
  }
  #gameCanvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
  }

  /* Action bar — สูงขึ้น ปุ่มใหญ่ */
  .action-bar {
    flex-shrink: 0;
    min-height: 56px;
    border-width: 2px 0 0 0;
    padding: 2px 0;
  }
  /* ปุ่มใน action bar */
  .action-bar button,
  .action-bar .pixel-btn {
    font-size: clamp(0.5em, 1.8vw, 0.7em) !important;
    padding: 10px 20px !important;
    min-height: 44px;
  }
  /* ข้อความใน action bar */
  .action-bar div {
    font-size: clamp(0.38em, 1.3vw, 0.55em) !important;
    gap: 10px !important;
  }

  /* ── How To Play ── */
  #howToPlay {
    height: 100vh; height: 100dvh; overflow-y: auto; padding: 8px;
  }
  .info-panel {
    padding: 14px 16px; max-width: 100%;
  }
  .panel-title  { font-size: clamp(0.6em, 2vw, 0.9em); margin-bottom: 14px; }
  .info-content { font-size: 0.38em; }
  .mini-list    { gap: 6px; }
  .mini-item    { padding: 8px; }

  /* ── Station Complete / Game Over / Final ── */
  #stationComplete, #gameOver, #finalComplete {
    height: 100vh; height: 100dvh; overflow-y: auto; padding: 8px;
  }
  .completion-panel, .final-panel {
    padding: 16px 20px; max-width: 100%;
  }
  .completion-title  { font-size: clamp(0.7em, 2.2vw, 1em); }
  .station-icon-big  { font-size: 2.4em; }
  .stats-grid        { grid-template-columns: repeat(3,1fr); gap: 8px; }
  .stat-card         { padding: 10px 6px; }
  .stat-card-icon    { font-size: 1.4em; }
  .stat-card-value   { font-size: 1.1em; }
  .stat-card-label   { font-size: 0.34em; }
  .completion-footer { gap: 10px; }
  .final-trophy      { font-size: 3.5em; }
  .final-title       { font-size: clamp(0.7em, 2.2vw, 1.1em); }
  .final-subtitle    { font-size: clamp(0.45em, 1.4vw, 0.7em); }
  .gameover-title    { font-size: clamp(1.1em, 3.5vw, 1.6em); }
  .gameover-icon     { font-size: 3.2em; }
}

/* ============================================================
   SAFE AREA (notch / home bar)
   ============================================================ */
@supports (padding: env(safe-area-inset-left)) {
  @media screen and (max-width: 900px) and (orientation: landscape) {
    .container {
      padding-left:  env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
    .action-bar {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* Scrollbar */
::-webkit-scrollbar { width:8px; }
::-webkit-scrollbar-track { background:#0a0e27; }
::-webkit-scrollbar-thumb { background:var(--yellow); border:1px solid #332200; }
