/* Savannah Maze Run — Lion Family Day 2026 kiosk (1080 x 1920 design canvas)
   Palette sampled from the Lion Family Day "Savannah" artwork: sunset red/orange, earth brown,
   sand cream and sun gold. Backgrounds are the supplied artwork (assets/bg-*.jpg). */

@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo2-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-display: block;
}

:root {
  --sun: #d8320a;           /* sunset red-orange */
  --sun-dark: #a81d05;
  --sun-deep: #6e1003;
  --orange: #fd6a02;        /* sky orange */
  --earth: #5a2a0c;         /* savannah earth brown */
  --earth-dark: #2e1305;
  --ink: #2e1305;
  --muted: #8a6447;
  --line: #e8cfa0;
  --paper: #fff6e4;         /* sand cream */
  --paper-2: #fbe9c6;
  --gold: #fdb913;
  --gold-dark: #c07a06;
}

[hidden] { display: none !important; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Baloo 2', 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  /* Windows touch: no pinch-zoom, no pan, no edge-swipe back navigation */
  touch-action: none;
  overscroll-behavior: none;
  -ms-touch-action: none;
}

body.hide-cursor, body.hide-cursor * { cursor: none !important; }

img { pointer-events: none; }
button { font-family: inherit; cursor: pointer; border: 0; outline: none; touch-action: none; }

/* ---------- Stage: fixed design canvas, scaled + letterboxed by JS ---------- */
.stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1080px;
  height: 1920px;
  transform-origin: 0 0;
  background: var(--paper);
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility 0s linear .3s;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s ease, visibility 0s;
}

/* ---------- Shared ---------- */
.page-logo {
  position: absolute;
  top: 70px;
  left: 360px;
  width: 360px;
  filter: drop-shadow(0 6px 8px rgba(46, 19, 5, .55));
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(46, 19, 5, .55);
  color: var(--gold);
  border: 4px solid var(--gold);
}
.icon-btn svg { width: 56px; height: 56px; }
.icon-btn:active { transform: scale(.92); }

.kiosk-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  border-radius: 80px;
  background: linear-gradient(180deg, #ff9a1f 0%, var(--orange) 40%, var(--sun) 100%);
  color: #fff;
  border: 6px solid var(--gold);
  font-size: 72px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1;
  padding-top: 10px;           /* Baloo sits high; optically centre caps */
  text-shadow: 0 4px 0 var(--sun-deep);
  box-shadow: 0 12px 0 var(--sun-deep), 0 18px 30px rgba(46, 19, 5, .45);
  transition: transform .08s ease, box-shadow .08s ease;
}
.kiosk-btn:active {
  transform: translateY(10px);
  box-shadow: 0 2px 0 var(--sun-deep), 0 6px 12px rgba(46, 19, 5, .4);
}

.coin-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe07a 0 22%, var(--gold) 23% 62%, var(--gold-dark) 63%);
  box-shadow: inset 0 0 0 .08em var(--gold-dark);
  flex: none;
}

.star-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  background: var(--sun);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  flex: none;
}

/* ================= PAGE 1: HOME ================= */
.screen-home { background: #3a1204 url('../assets/bg-home.jpg') 0 0 / 1080px 1920px no-repeat; }

.home-logo {
  position: absolute;
  top: 70px;
  left: 340px;
  width: 400px;
  filter: drop-shadow(0 6px 8px rgba(46, 19, 5, .55));
}

.home-familyday {
  position: absolute;
  top: 236px;
  left: 230px;
  width: 620px;
  filter: drop-shadow(0 4px 6px rgba(46, 19, 5, .6));
}

.sound-btn {
  position: absolute;
  top: 60px;
  right: 60px;
}

.home-badge {
  position: absolute;
  top: 318px;
  left: 70px;
  width: 940px;
  filter: drop-shadow(0 14px 18px rgba(46, 19, 5, .5));
}

.home-title {
  position: absolute;
  top: 728px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 150px;
  font-weight: 800;
  letter-spacing: 6px;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 14px var(--earth-dark);
  paint-order: stroke fill;
  text-shadow: 0 10px 0 var(--earth-dark), 0 18px 26px rgba(46, 19, 5, .55);
}

.home-mascot {
  position: absolute;
  top: 892px;
  left: 404px;              /* 272 wide at 508 tall -> centred */
  height: 508px;
  filter: drop-shadow(0 18px 18px rgba(46, 19, 5, .45));
  animation: mascot-bob 2.2s ease-in-out infinite alternate;
}

@keyframes mascot-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-22px); }
}

.home-start {
  top: 1440px;
  left: 190px;
  width: 700px;
  height: 180px;
  font-size: 92px;
  letter-spacing: 8px;
  animation: btn-pulse 1.6s ease-in-out infinite;
}
.home-start:active { animation: none; }

@keyframes btn-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ================= PAGE 2: REGISTER ================= */
.screen-register { background: linear-gradient(180deg, rgba(46,19,5,.2), rgba(46,19,5,.7)), #3a1204 url('../assets/bg-sky.jpg') 0 0 / 1080px 1920px no-repeat; background-blend-mode: normal; }

.field {
  position: absolute;
  left: 80px;
  width: 920px;
}
.field-name { top: 290px; }
.field-mobile { top: 560px; }

.field-label {
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 0 var(--earth-dark), 0 6px 14px rgba(46, 19, 5, .6);
  line-height: 1;
  margin-bottom: 16px;
  text-align: center;
}

.field-box {
  height: 140px;
  border-radius: 28px;
  background: var(--paper);
  border: 6px solid var(--gold);
  box-shadow: 0 10px 24px rgba(46, 19, 5, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 40px 0;
  font-size: 70px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  transition: border-color .15s ease;
}

.field-active .field-box { border-color: var(--orange); box-shadow: 0 0 0 8px rgba(253, 106, 2, .35), 0 10px 24px rgba(46, 19, 5, .4); }
.field-error .field-box { border-color: var(--sun); }

.field-placeholder { color: #c9a77c; font-weight: 600; }

.caret {
  display: inline-block;
  width: 6px;
  height: 72px;
  margin-left: 6px;
  margin-top: -10px;
  background: var(--sun);
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.field-error-msg {
  height: 48px;
  padding: 8px 8px 0;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: #ffe07a;
  text-shadow: 0 2px 6px rgba(46, 19, 5, .9);
}

.register-start {
  top: 850px;
  left: 80px;
  width: 920px;
}

/* On-screen keyboards */
.osk {
  position: absolute;
  left: 40px;
  top: 1100px;
  width: 1000px;
}
.osk-qwerty, .osk-numpad {
  padding: 26px 0 10px;
  border-radius: 36px;
  background: rgba(46, 19, 5, .62);
  border: 4px solid rgba(253, 185, 19, .55);
}
.osk-numpad { padding: 26px 26px 30px; }

.osk-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.osk-key {
  flex: none;
  width: 88px;
  height: 160px;
  border-radius: 20px;
  background: var(--paper);
  color: var(--earth-dark);
  font-size: 58px;
  font-weight: 700;
  line-height: 1;
  padding-top: 8px;
  box-shadow: 0 6px 0 #b07a3c;
  display: flex;
  align-items: center;
  justify-content: center;
}
.osk-key svg { width: 64px; height: 64px; margin-top: -8px; }
.osk-key.is-down,
.osk-key:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #b07a3c;
  background: #f3d9a6;
}

.osk-wide { width: 190px; font-size: 38px; }
.osk-space { width: 364px; font-size: 38px; }
.osk-action { color: var(--sun); }
.osk-next { background: var(--orange); color: #fff; box-shadow: 0 6px 0 var(--sun-deep); }
.osk-next.is-down, .osk-next:active { background: var(--sun); box-shadow: 0 1px 0 var(--sun-deep); }

.osk-numpad {
  left: 90px;
  width: 900px;
  top: 1080px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.osk-numpad .osk-key { width: auto; height: 160px; font-size: 76px; }
.osk-numpad .osk-action { font-size: 40px; }

/* ================= PAGE 3: GAME ================= */
.screen-game { background: var(--earth-dark); }

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 200px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 40px;
  background: linear-gradient(180deg, #6e2a0a, var(--earth-dark));
  border-bottom: 8px solid var(--gold);
}

.hud-logo { width: 250px; margin-right: auto; }

.hud-pill {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 116px;
  min-width: 230px;
  padding: 10px 34px 0;
  border-radius: 58px;
  background: linear-gradient(180deg, var(--orange), var(--sun));
  border: 5px solid var(--gold);
  color: #fff;
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
}
.hud-pill svg { width: 58px; height: 58px; margin-top: -10px; flex: none; }
.hud-pill .coin-icon { font-size: 56px; margin-top: -10px; }
.hud-pill span:last-child { flex: 1; text-align: center; }

.hud-time-low { background: var(--sun-dark); animation: time-flash .5s ease-in-out infinite alternate; }
@keyframes time-flash { to { transform: scale(1.06); } }

.hud-score { background: var(--paper); color: var(--earth-dark); border: 5px solid var(--gold); }

.hud-sound { width: 100px; height: 100px; flex: none; }

.maze-wrap {
  position: absolute;
  top: 200px;
  left: 0;
  width: 1080px;
  height: 1440px;
  touch-action: none;
}

#mazeCanvas {
  display: block;
  width: 1080px;
  height: 1440px;
  touch-action: none;
}

.game-controls {
  position: absolute;
  top: 1640px;
  left: 0;
  width: 1080px;
  height: 280px;
  background: linear-gradient(180deg, var(--earth-dark), #6e2a0a);
  border-top: 8px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dpad {
  display: grid;
  grid-template-columns: 250px 110px 250px;
  grid-template-rows: 124px 124px;
  grid-template-areas:
    ".    up    ."
    "left down right";
  gap: 0 14px;
  align-items: stretch;
}

/* Left / right are tall paddles; up / down are stacked in the middle */
.dpad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: linear-gradient(180deg, #ff9a1f, var(--orange) 45%, var(--sun));
  border: 5px solid var(--gold);
  color: #fff;
  box-shadow: 0 8px 0 var(--sun-deep);
  transition: transform .06s ease, box-shadow .06s ease;
}
.dpad-btn svg { width: 72px; height: 72px; }
.dpad-btn.is-down {
  transform: translateY(7px);
  box-shadow: 0 1px 0 var(--sun-deep);
  background: var(--sun-dark);
}

.dpad-up    { grid-area: up; margin-bottom: 8px; }
.dpad-down  { grid-area: down; margin-top: 8px; }
.dpad-left  { grid-area: 1 / 1 / 3 / 2; margin: 8px 0; }
.dpad-right { grid-area: 1 / 3 / 3 / 4; margin: 8px 0; }
.dpad-hub { display: none; }

/* ================= PAGE 4: RESULT ================= */
.screen-finish { background: linear-gradient(180deg, rgba(46,19,5,.1), rgba(46,19,5,.55)), #3a1204 url('../assets/bg-sky.jpg') 0 0 / 1080px 1920px no-repeat; }

.finish-title {
  position: absolute;
  top: 250px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 110px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 12px var(--earth-dark);
  paint-order: stroke fill;
  text-shadow: 0 8px 0 var(--earth-dark);
}

.finish-name {
  position: absolute;
  top: 380px;
  left: 60px;
  width: 960px;
  text-align: center;
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  color: #ffe07a;
  text-shadow: 0 4px 0 var(--earth-dark), 0 6px 14px rgba(46, 19, 5, .7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finish-mascot {
  position: absolute;
  top: 470px;
  left: 411px;              /* 257 wide at 480 tall -> centred */
  height: 480px;
  filter: drop-shadow(0 14px 14px rgba(46, 19, 5, .45));
  animation: mascot-bob .7s ease-in-out infinite alternate;
}

.score-card {
  position: absolute;
  top: 975px;
  left: 110px;
  width: 860px;
  border-radius: 40px;
  background: var(--paper);
  border: 6px solid var(--gold);
  box-shadow: 0 16px 30px rgba(46, 19, 5, .45);
  padding: 20px 50px 0;
  overflow: hidden;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100px;
  font-size: 50px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 3px solid var(--line);
  padding-top: 8px;
}
.score-label { display: flex; align-items: center; gap: 22px; color: var(--muted); }
.score-label .coin-icon, .score-label .star-icon { font-size: 46px; margin-top: -8px; }
.score-value { font-weight: 800; }

.score-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px -50px 0;
  height: 160px;
  padding: 12px 50px 0;
  background: linear-gradient(180deg, var(--orange), var(--sun));
  color: #fff;
  font-weight: 800;
  line-height: 1;
}
.score-total span:first-child { font-size: 56px; letter-spacing: 4px; }
.score-total span:last-child { font-size: 110px; }

/* New high score: gold score bar */
.score-card-record .score-total {
  background: linear-gradient(100deg, var(--gold-dark), var(--gold) 45%, #ffd54a 55%, var(--gold-dark));
  color: var(--earth-dark);
}

/* Highest score banner (target to beat / new record) */
.high-score {
  position: absolute;
  top: 1500px;
  left: 110px;
  width: 860px;
  height: 120px;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 44px 0 36px;
  border: 5px solid var(--gold);
  border-radius: 60px;
  background: var(--paper);
  color: var(--earth);
  box-shadow: 0 10px 24px rgba(46, 19, 5, .4);
  line-height: 1;
  overflow: hidden;
}
.high-score .trophy { flex: none; width: 70px; height: 70px; color: var(--gold); }
.high-score-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.high-score-label { font-size: 38px; font-weight: 800; letter-spacing: 3px; }
.high-score-name {
  font-size: 32px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.high-score-value { flex: none; font-size: 76px; font-weight: 800; padding-top: 10px; }

.high-score-new {
  border-color: var(--gold-dark);
  background: linear-gradient(100deg, var(--gold-dark), var(--gold) 40%, #ffd54a 60%, var(--gold-dark));
  color: var(--earth-dark);
  box-shadow: 0 0 0 8px rgba(253, 185, 19, .25);
  animation: record-pop .6s cubic-bezier(.2, 1.6, .4, 1) both, record-glow 1.2s ease-in-out .6s infinite alternate;
}
.high-score-new .trophy { color: #fff; animation: trophy-wiggle 1.2s ease-in-out infinite; }
.high-score-new .high-score-name { color: var(--earth-dark); opacity: .75; }
.high-score-new::after {        /* light sweep across the banner */
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 30%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  animation: record-shine 2.4s ease-in-out infinite;
}

@keyframes record-pop {
  from { transform: scale(.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes record-glow { to { box-shadow: 0 0 0 16px rgba(253, 185, 19, .12); } }
@keyframes record-shine {
  0% { left: -40%; }
  60%, 100% { left: 120%; }
}
@keyframes trophy-wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg) scale(1.1); }
  75% { transform: rotate(12deg) scale(1.1); }
}

/* Confetti for a new high score (positions/timing set per piece in app.js) */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -40px;
  width: 20px;
  height: 34px;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(46, 19, 5, .1);
  animation: confetti-fall 3s linear 2 both;
}
.confetti i:nth-child(3n) { width: 26px; height: 26px; border-radius: 50%; }
.confetti i:nth-child(3n+1) { width: 14px; height: 40px; }
@keyframes confetti-fall {
  from { transform: translate3d(0, 0, 0) rotate(0); }
  to { transform: translate3d(80px, 2000px, 0) rotate(720deg); }
}
.confetti i:nth-child(even) { animation-name: confetti-fall-left; }
@keyframes confetti-fall-left {
  from { transform: translate3d(0, 0, 0) rotate(0); }
  to { transform: translate3d(-80px, 2000px, 0) rotate(-600deg); }
}

.finish-again {
  top: 1650px;
  left: 190px;
  width: 700px;
}

.redirect-bar {
  position: absolute;
  top: 1850px;
  left: 290px;
  width: 500px;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 246, 228, .35);
  overflow: hidden;
}
.redirect-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 7px;
}

