/* Muthu's Maze Run — Singer Finance kiosk (1080 x 1920 design canvas)
   Palette: Singer red from the logo, navy from Muthu's shorts, white. Gold only for coins. */

@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/baloo2-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-display: block;
}

:root {
  --red: #e81c24;          /* logo red */
  --red-dark: #b3121a;
  --red-deep: #8c0d13;
  --navy: #1a407c;         /* Muthu's shorts */
  --navy-dark: #102a55;
  --ink: #1b2230;
  --muted: #6b7384;
  --line: #e3e6ec;
  --paper: #ffffff;
  --paper-2: #f4f5f8;
  --gold: #f5b400;
  --gold-dark: #b77a00;
}

[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: 350px;
  width: 380px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--navy);
  border: 4px solid var(--line);
}
.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: var(--red);
  color: #fff;
  font-size: 72px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1;
  padding-top: 10px;           /* Baloo sits high; optically centre caps */
  box-shadow: 0 12px 0 var(--red-deep);
  transition: transform .08s ease, box-shadow .08s ease;
}
.kiosk-btn:active {
  transform: translateY(10px);
  box-shadow: 0 2px 0 var(--red-deep);
}

.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(--red);
  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 ================= */
.home-logo {
  position: absolute;
  top: 110px;
  left: 300px;
  width: 480px;
}

.sound-btn {
  position: absolute;
  top: 60px;
  right: 60px;
}

.home-title {
  position: absolute;
  top: 330px;
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--navy);
  font-weight: 800;
  line-height: .86;
}
.home-title span { display: block; }
.home-title span:first-child { font-size: 118px; letter-spacing: 6px; }
.home-title span:last-child { font-size: 172px; color: var(--red); letter-spacing: 2px; }

.home-red-field {
  position: absolute;
  left: -270px;
  top: 1380px;
  width: 1620px;
  height: 1000px;
  border-radius: 50%;
  background: var(--red);
}

.home-mascot {
  position: absolute;
  top: 670px;
  left: 347px;              /* 386 wide at 752 tall → centred */
  height: 752px;
  filter: drop-shadow(0 18px 18px rgba(16, 42, 85, .28));
  animation: mascot-bob 2.2s ease-in-out infinite alternate;
}

@keyframes mascot-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-22px); }
}

.kiosk-btn-white {
  background: var(--paper);
  color: var(--red);
  box-shadow: 0 12px 0 var(--red-deep);
}

.home-start {
  top: 1600px;
  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: var(--paper-2); }

.field {
  position: absolute;
  left: 80px;
  width: 920px;
}
.field-name { top: 290px; }
.field-mobile { top: 560px; }

.field-label {
  font-size: 56px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 16px;
  text-align: center;
}

.field-box {
  height: 140px;
  border-radius: 28px;
  background: var(--paper);
  border: 5px solid var(--line);
  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(--navy); }
.field-error .field-box { border-color: var(--red); }

.field-placeholder { color: #b7bcc7; font-weight: 600; }

.caret {
  display: inline-block;
  width: 6px;
  height: 72px;
  margin-left: 6px;
  margin-top: -10px;
  background: var(--red);
  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: 600;
  line-height: 1;
  color: var(--red);
}

.register-start {
  top: 850px;
  left: 80px;
  width: 920px;
}

/* On-screen keyboards */
.osk {
  position: absolute;
  left: 40px;
  top: 1100px;
  width: 1000px;
}

.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(--navy-dark);
  font-size: 58px;
  font-weight: 700;
  line-height: 1;
  padding-top: 8px;
  box-shadow: 0 6px 0 #c9ced8;
  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 #c9ced8;
  background: #e6e9f0;
}

.osk-wide { width: 190px; font-size: 38px; }
.osk-space { width: 364px; font-size: 38px; }
.osk-action { color: var(--red); }
.osk-next { background: var(--navy); color: #fff; box-shadow: 0 6px 0 var(--navy-dark); }
.osk-next.is-down, .osk-next:active { background: var(--navy-dark); box-shadow: 0 1px 0 var(--navy-dark); }

.osk-numpad {
  left: 90px;
  width: 900px;
  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(--paper); }

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 200px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 40px;
  background: var(--paper);
  border-bottom: 6px solid var(--red);
}

.hud-logo { width: 270px; 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: var(--navy);
  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(--red); animation: time-flash .5s ease-in-out infinite alternate; }
@keyframes time-flash { to { transform: scale(1.06); } }

.hud-score { background: var(--paper); color: var(--navy-dark); border: 5px solid var(--navy); }

.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: var(--navy);
  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: var(--red);
  color: #fff;
  box-shadow: 0 8px 0 var(--red-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(--red-deep);
  background: var(--red-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: var(--paper); }

.finish-title {
  position: absolute;
  top: 250px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 104px;
  font-weight: 800;
  line-height: 1;
  color: var(--red);
}

.finish-name {
  position: absolute;
  top: 380px;
  left: 60px;
  width: 960px;
  text-align: center;
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finish-mascot {
  position: absolute;
  top: 480px;
  left: 396px;              /* 288 wide at 560 tall → centred */
  height: 560px;
  filter: drop-shadow(0 14px 14px rgba(16, 42, 85, .25));
  animation: mascot-bob .7s ease-in-out infinite alternate;
}

.score-card {
  position: absolute;
  top: 1080px;
  left: 110px;
  width: 860px;
  border-radius: 40px;
  background: var(--paper-2);
  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: var(--red);
  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; }

.finish-again {
  top: 1640px;
  left: 190px;
  width: 700px;
}

.redirect-bar {
  position: absolute;
  top: 1850px;
  left: 290px;
  width: 500px;
  height: 14px;
  border-radius: 7px;
  background: var(--line);
  overflow: hidden;
}
.redirect-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 7px;
}

