:root {
  --ink: #172921;
  --green: #174b3c;
  --lime: #d8f256;
  --paper: #f1ece3;
  --orange: #e8663b;
  --cardboard: #c58a52;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }

body {
  font-family: "Manrope", sans-serif;
  background-image: radial-gradient(rgba(23, 41, 33, .075) .7px, transparent .7px);
  background-size: 5px 5px;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1600px, 100%); margin: 0 auto; min-height: 100vh; padding: 0 34px; }

.topbar {
  height: 76px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(23,41,33,.25); font-family: "DM Mono", monospace;
  font-size: 11px; letter-spacing: .12em;
}

.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; }
.brand-logo { display: block; width: 148px; height: auto; }
.event-label { padding: 9px 14px; border: 1px solid rgba(23,41,33,.28); border-radius: 50px; }
.sound-toggle { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: "DM Mono"; font-size: 10px; letter-spacing: .08em; }
.sound-bars { display: flex; align-items: center; gap: 2px; height: 14px; }
.sound-bars i { display: block; width: 2px; background: var(--green); height: 7px; }
.sound-bars i:nth-child(2) { height: 14px; }
.sound-bars i:nth-child(3) { height: 10px; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; padding: 27px 0 24px; }
.eyebrow, .panel-kicker { margin: 0 0 8px; font: 500 10px/1 "DM Mono"; letter-spacing: .19em; }
h1 { font-size: clamp(34px, 4.2vw, 68px); letter-spacing: -.055em; line-height: .87; margin: 0; font-weight: 800; }
h1 em { font-style: normal; color: var(--green); }
.daily-best { min-width: 145px; text-align: right; border-left: 1px solid rgba(23,41,33,.25); padding-left: 22px; }
.daily-best span, .daily-best small { display: block; font: 500 9px/1.4 "DM Mono"; letter-spacing: .14em; }
.daily-best strong { display: block; font-size: 46px; line-height: 1; letter-spacing: -.07em; }
.daily-best small { color: var(--green); margin-top: 5px; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 246px; gap: 14px; }
.stage-wrap { position: relative; overflow: hidden; aspect-ratio: 16/8.7; min-height: 510px; background: #bdc4ad; border-radius: 3px; border: 1px solid var(--ink); }
#gameCanvas { display: block; width: 100%; height: 100%; }
#camera, #visionCanvas, #poseCanvas { position: fixed; width: 2px; height: 2px; opacity: .001; pointer-events: none; }

.camera-card { position: absolute; left: 16px; top: 16px; width: 190px; padding: 7px; background: rgba(241,236,227,.92); border: 1px solid rgba(23,41,33,.65); z-index: 3; box-shadow: 4px 4px 0 rgba(23,41,33,.12); }
.camera-frame { aspect-ratio: 1.5; overflow: hidden; background: var(--ink); }
#cameraPreview { width: 100%; height: 100%; display: block; object-fit: cover; }
.tracking-row { display: flex; align-items: center; gap: 6px; padding: 6px 2px 0; font: 500 8px/1 "DM Mono"; letter-spacing: .06em; }
.tracking-row b { margin-left: auto; font-weight: 500; }
.tracking-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px rgba(232,102,59,.15); }
.tracking-dot.live { background: #33b35e; box-shadow: 0 0 0 3px rgba(51,179,94,.17); }

.score-card { position: absolute; right: 16px; top: 16px; min-width: 132px; text-align: right; color: var(--paper); background: var(--green); padding: 12px 15px 10px; z-index: 3; }
.score-card span { display: block; font: 500 8px/1 "DM Mono"; letter-spacing: .13em; }
.score-card strong { display: block; font-size: 43px; line-height: 1; letter-spacing: -.06em; }
.status-pill { position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); background: var(--lime); color: var(--ink); padding: 9px 17px; border-radius: 100px; z-index: 3; font: 500 9px/1 "DM Mono"; letter-spacing: .13em; white-space: nowrap; border: 1px solid rgba(23,41,33,.4); }

.start-overlay, .game-over-overlay { position: absolute; inset: 0; background: rgba(23,41,33,.56); backdrop-filter: blur(4px); z-index: 5; display: grid; place-items: center; padding: 20px; }
.start-panel, .game-over-panel { width: min(515px, 92%); background: var(--paper); padding: 35px 42px 32px; border-top: 7px solid var(--lime); box-shadow: 10px 10px 0 rgba(23,41,33,.35); text-align: center; }
.start-panel h2, .game-over-panel h2 { font-size: 37px; letter-spacing: -.05em; margin: 0 0 10px; }
.start-panel > p { font-size: 13px; line-height: 1.55; max-width: 410px; margin: 0 auto; }
.gesture-guide { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin: 23px 0; }
.gesture-guide div { border: 1px solid rgba(23,41,33,.25); padding: 11px 5px; }
.gesture-icon { display: block; width: 28px; height: 28px; margin: 0 auto 7px; border-radius: 50%; background: var(--lime); line-height: 27px; font-weight: 800; }
.gesture-guide b, .gesture-guide small { display: block; }
.gesture-guide b { font: 500 9px/1.2 "DM Mono"; letter-spacing: .1em; }
.gesture-guide small { font-size: 9px; margin-top: 4px; opacity: .65; }
.primary-button { width: 100%; border: 0; padding: 15px 17px; background: var(--green); color: white; font: 600 10px/1 "DM Mono"; letter-spacing: .12em; display: flex; justify-content: space-between; align-items: center; }
.primary-button:hover { background: #0b372c; }
.primary-button:disabled { cursor: wait; opacity: .7; }
.primary-button span { font-size: 17px; }
.text-button { border: 0; border-bottom: 1px solid rgba(23,41,33,.4); padding: 1px; background: transparent; margin-top: 14px; color: var(--ink); font-size: 10px; }

.game-over-overlay[hidden] { display: none; }
.game-over-overlay { display: none !important; backdrop-filter: none; background: transparent; }
.game-over-panel { width: min(420px, 92%); border-top-color: var(--orange); }
.final-score { margin: 22px auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.final-score span, .final-score small, .game-over-panel label { font: 500 9px/1.2 "DM Mono"; letter-spacing: .12em; }
.final-score span { text-align: right; padding-bottom: 9px; }
.final-score small { text-align: left; padding-bottom: 9px; }
.final-score strong { font-size: 66px; line-height: .75; letter-spacing: -.07em; color: var(--green); }
.game-over-panel label { display: block; text-align: left; margin-bottom: 7px; }
.game-over-panel input { width: 100%; border: 1px solid var(--ink); background: transparent; padding: 12px; text-transform: uppercase; font-family: "DM Mono"; margin-bottom: 9px; outline: none; }
.game-over-panel input:focus { box-shadow: inset 0 -3px var(--lime); }
.restart-gesture { margin-top: 24px; padding: 18px; border: 1px solid rgba(23,41,33,.3); background: var(--lime); }
.restart-gesture span { display: block; width: 38px; height: 38px; margin: 0 auto 9px; border-radius: 50%; background: var(--green); color: white; font-size: 24px; line-height: 38px; }
.restart-gesture b, .restart-gesture small { display: block; }
.restart-gesture b { font: 600 11px/1.2 "DM Mono"; letter-spacing: .13em; }
.restart-gesture small { margin-top: 5px; font-size: 10px; }

.side-panel { display: grid; grid-template-rows: repeat(3, auto) 1fr; gap: 8px; }
.shift-card { background: rgba(255,255,255,.36); border: 1px solid rgba(23,41,33,.25); padding: 17px 15px; display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: start; }
.card-number { color: var(--orange); font: 500 10px/1 "DM Mono"; border-top: 2px solid var(--orange); padding-top: 6px; }
.shift-card p { font-size: 11px; line-height: 1.4; margin: 0; }
.impact-card { background: var(--lime); padding: 18px; align-content: end; display: grid; }
.impact-card > span { font: 500 9px/1 "DM Mono"; letter-spacing: .16em; }
.impact-card p { font-size: 13px; line-height: 1.4; margin: 10px 0 22px; font-weight: 600; }
.loop-line { display: flex; align-items: center; justify-content: space-between; }
.loop-line i { width: 11px; height: 11px; border-radius: 50%; background: var(--green); position: relative; }
.loop-line i:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 5px; width: 45px; border-top: 1px solid var(--green); }

footer { display: flex; justify-content: space-between; padding: 16px 1px 24px; font: 500 9px/1 "DM Mono"; letter-spacing: .13em; }

@media (max-width: 900px) {
  .app-shell { padding: 0 14px; }
  .event-label { display: none; }
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: repeat(3, 1fr); grid-template-rows: auto; }
  .impact-card { grid-column: 1 / -1; }
  .stage-wrap { min-height: 470px; }
}

@media (max-width: 600px) {
  .topbar { height: 60px; }
  .hero { padding: 20px 0; }
  .daily-best { min-width: 105px; }
  .daily-best strong { font-size: 34px; }
  .stage-wrap { min-height: 550px; aspect-ratio: auto; }
  .camera-card { width: 135px; }
  .start-panel { padding: 27px 19px 24px; }
  .start-panel h2 { font-size: 30px; }
  .side-panel { grid-template-columns: 1fr; }
  .impact-card { grid-column: auto; }
  .shift-card { display: none; }
  footer span:last-child { display: none; }
}

/* Full-screen kiosk: the game is the entire interface. */
html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}
.stage-wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.daily-best {
  position: absolute;
  right: 16px;
  top: 103px;
  z-index: 3;
  min-width: 132px;
  padding: 11px 15px;
  border: 1px solid rgba(23,41,33,.5);
  background: rgba(241,236,227,.92);
  text-align: right;
}
.daily-best strong { font-size: 34px; }
