/* ============================================================
   Brass Lion — Spirit of the City · shared styles
   Brand: cream paper, label navy, burnt orange, brass gold,
   bottle green. Stencil digits + heavy grotesque headers.
   ============================================================ */

:root {
  --cream: #f2ecdc;
  --cream-deep: #e9e1cc;
  --paper-line: #d9c9a3;
  --ink: #16212e;          /* label navy */
  --ink-soft: #33404f;
  --orange: #c8511b;       /* burnt orange base strip */
  --orange-bright: #d95f22;
  --gold: #c9a24b;
  --gold-soft: #d9bc7a;
  --green: #1d4432;        /* bottle green panel */
  --green-deep: #143526;
  --chalk: #191919;        /* chalkboard strip */
  --white: #f8f4e9;
  --danger: #a83224;
  --font-display: 'Archivo Black', 'Archivo', sans-serif;
  --font-stencil: 'Stardos Stencil', cursive;
  --font-body: 'Archivo', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* subtle paper grain */
  background-image:
    radial-gradient(rgba(120, 96, 55, 0.055) 1px, transparent 1.4px),
    radial-gradient(rgba(120, 96, 55, 0.045) 1px, transparent 1.6px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 4px 6px;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- screens ---------- */
.screen { display: none; flex-direction: column; flex: 1; }
.screen.active { display: flex; }

.screen-pad { padding: 24px 22px 40px; }

/* ---------- brand bits ---------- */
.wordmark {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.wordmark small { display: block; font-size: 10px; letter-spacing: 0.34em; font-family: var(--font-body); font-weight: 600; color: var(--orange); margin-top: 6px; }

.brand-logo { height: 108px; margin: 0 auto; display: block; }

.stencil { font-family: var(--font-stencil); font-weight: 700; }

.hero-title {
  font-family: var(--font-stencil);
  font-weight: 700;
  font-size: clamp(40px, 11vw, 56px);
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 2px 2px 0 rgba(201, 162, 75, 0.35);
}
.hero-sub {
  font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--orange); font-weight: 700; margin-top: 10px;
}
.rule-orn { display: flex; align-items: center; gap: 10px; color: var(--gold); margin: 14px 0; }
.rule-orn::before, .rule-orn::after { content: ''; flex: 1; border-top: 1.5px solid var(--gold); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em;
  border: none; cursor: pointer; text-decoration: none; text-align: center;
  border-radius: 6px; transition: transform 0.06s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--orange); color: var(--white);
  font-size: 19px; padding: 16px 26px; width: 100%;
  box-shadow: 0 3px 0 #93370f, 0 8px 18px rgba(200, 81, 27, 0.3);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
  background: transparent; color: var(--ink);
  border: 2px solid var(--ink); font-size: 14px; padding: 12px 18px; width: 100%;
}
.btn-ghost {
  background: transparent; color: var(--ink-soft); font-family: var(--font-body);
  font-weight: 700; font-size: 13px; padding: 10px; text-transform: none; letter-spacing: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-green {
  background: var(--green); color: var(--white);
  font-size: 16px; padding: 14px 22px; width: 100%;
  box-shadow: 0 3px 0 var(--green-deep);
}

/* ---------- panels ---------- */
.panel-green {
  background: var(--green);
  border: 2px solid var(--gold);
  outline: 1px solid var(--gold);
  outline-offset: -7px;
  border-radius: 10px;
  color: var(--white);
  padding: 22px 20px;
}
.panel-chalk {
  background: var(--chalk);
  border: 2px solid var(--orange);
  border-radius: 10px;
  color: var(--white);
  padding: 22px 20px;
}
.panel-line {
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 252, 243, 0.55);
}

/* ---------- landing ---------- */
#screen-landing { justify-content: flex-start; }
.landing-head { text-align: center; padding-top: 30px; }
.landing-bottle { height: 190px; margin: 18px auto 6px; display: block; filter: drop-shadow(0 12px 14px rgba(22, 33, 46, 0.25)); }
.landing-offer {
  text-align: center; margin: 18px 0 6px;
}
.landing-offer .n { font-family: var(--font-stencil); font-size: 44px; color: var(--gold-soft); line-height: 1; }
.landing-offer .t { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; }
.how-list { list-style: none; margin: 10px 0 0; font-size: 14px; line-height: 1.55; }
.how-list li { display: flex; gap: 10px; margin-bottom: 8px; align-items: baseline; }
.how-list .num { font-family: var(--font-stencil); color: var(--orange); font-size: 18px; min-width: 18px; }

.age-row { display: flex; gap: 10px; align-items: flex-start; margin: 18px 2px 14px; font-size: 13px; color: var(--ink-soft); }
.age-row input { width: 20px; height: 20px; accent-color: var(--orange); flex-shrink: 0; margin-top: 1px; }

.landing-links { display: flex; gap: 10px; margin-top: 12px; }
.landing-links .btn { flex: 1; }

.preselected-bar {
  background: var(--green); color: var(--white); border-radius: 6px;
  font-size: 13px; padding: 10px 14px; margin-top: 14px; text-align: center;
}
.preselected-bar b { color: var(--gold-soft); }

/* ---------- game ---------- */
#screen-game { height: 100dvh; overflow: hidden; }
.game-hud {
  display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center;
  padding: 12px 18px 8px;
}
.hud-brand { font-family: var(--font-display); font-size: 15px; line-height: 1; text-transform: uppercase; }
.hud-cell { text-align: right; }
.hud-label { font-size: 10px; letter-spacing: 0.3em; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; }
.hud-value { font-family: var(--font-stencil); font-size: 27px; line-height: 1; color: var(--orange); }
.hud-value.bump-good { animation: bump-good 0.35s ease-out; }
.hud-value.bump-bad { animation: bump-bad 0.55s ease-out; }
@keyframes bump-good {
  35% { transform: scale(1.35); color: var(--green); }
  100% { transform: scale(1); }
}
@keyframes bump-bad {
  20% { transform: scale(1.5) rotate(-4deg); color: var(--danger); }
  45% { transform: scale(1.3) rotate(3deg); color: var(--danger); }
  70% { transform: scale(1.15) rotate(-2deg); color: var(--danger); }
  100% { transform: scale(1); }
}
#game-canvas-wrap { flex: 1; position: relative; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

.game-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: rgba(242, 236, 220, 0.82); z-index: 5; padding: 30px;
}
.game-overlay.hidden { display: none; }
.countdown-num { font-family: var(--font-stencil); font-size: 110px; color: var(--orange); line-height: 1; }

.mute-btn {
  position: absolute; right: 12px; bottom: 12px; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ink);
  background: rgba(242, 236, 220, 0.9); font-size: 17px; cursor: pointer;
}

/* ---------- result ---------- */
.result-score-panel { text-align: center; margin-top: 10px; }
.result-label { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; font-weight: 700; color: var(--gold-soft); }
.result-score { font-family: var(--font-stencil); font-size: 84px; line-height: 1; color: var(--white); }
.result-best { font-size: 13px; color: var(--gold-soft); margin-top: 8px; }
.result-msg { font-size: 15px; line-height: 1.5; text-align: center; margin: 18px 4px; }
.result-msg b { color: var(--orange); }
.stack { display: flex; flex-direction: column; gap: 10px; }

.badge-qualified {
  display: inline-block; background: var(--orange); color: var(--white);
  font-family: var(--font-display); text-transform: uppercase; font-size: 13px;
  padding: 7px 14px; border-radius: 4px; letter-spacing: 0.08em;
  transform: rotate(-2deg); margin-bottom: 12px;
}

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; color: var(--ink-soft); }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field select, .field input[type="number"], .field input[type="date"], .field input[type="url"], .field input[type="password"] {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: var(--font-body);
  border: 1.5px solid var(--ink); border-radius: 6px; background: var(--white); color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2.5px solid var(--gold); outline-offset: 1px; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: 12px 0; }
.checkbox-row input { width: 19px; height: 19px; accent-color: var(--green); flex-shrink: 0; margin-top: 1px; }
.pdpa-note { font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); background: var(--cream-deep); border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 0 6px 6px 0; margin: 12px 0; }
.form-error { color: var(--danger); font-size: 13.5px; font-weight: 700; margin: 10px 0; min-height: 18px; }

/* ---------- redeem: bar picker ---------- */
.bar-search { position: sticky; top: 0; background: var(--cream); padding: 8px 0 10px; z-index: 2; }
.bar-list { list-style: none; }
.bar-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 14px; border: 1.5px solid var(--paper-line); border-radius: 8px;
  margin-bottom: 8px; background: rgba(255, 252, 243, 0.6); cursor: pointer;
}
.bar-item:hover { border-color: var(--gold); }
.bar-item.selected { border-color: var(--orange); outline: 1.5px solid var(--orange); background: #fdf6e7; }
.bar-item .b-name { font-weight: 700; font-size: 15px; }
.bar-item .b-area { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; text-transform: uppercase; }
.bar-group-head { font-family: var(--font-display); font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--orange); margin: 18px 0 8px; }
.bar-region-head {
  font-family: var(--font-stencil); font-size: 20px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink); margin: 26px 0 2px; padding-bottom: 4px; border-bottom: 2px solid var(--gold);
}
.bar-region-head:first-child { margin-top: 4px; }
.bar-item.soldout { opacity: 0.6; cursor: default; }
.bar-item.soldout:hover { border-color: var(--paper-line); }
.soldout-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--danger); border: 1px solid var(--danger); border-radius: 99px;
  padding: 3px 8px; white-space: nowrap; flex-shrink: 0;
}

/* ---------- staff PIN pad ---------- */
.staff-hand-note {
  text-align: center; background: var(--chalk); color: var(--white); border-radius: 10px;
  padding: 18px 16px; margin-bottom: 18px; border: 2px solid var(--orange);
}
.staff-hand-note .big { font-family: var(--font-display); font-size: 19px; text-transform: uppercase; }
.pin-identity { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 0 0 4px; }
.pin-identity .edit-link { background: none; border: none; color: var(--orange); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: 13px; padding: 2px 4px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dot.filled { background: var(--ink); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pin-key {
  font-family: var(--font-stencil); font-size: 26px; padding: 14px 0; border-radius: 8px;
  border: 1.5px solid var(--ink); background: var(--white); cursor: pointer; color: var(--ink);
}
.pin-key:active { background: var(--cream-deep); }
.pin-key.aux { font-family: var(--font-body); font-size: 14px; font-weight: 700; }

/* ---------- success ---------- */
.success-wrap { text-align: center; padding-top: 30px; }
.success-check {
  width: 92px; height: 92px; border-radius: 50%; background: var(--green);
  color: var(--white); font-size: 48px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; border: 3px solid var(--gold);
  animation: pop-in 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop-in { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.success-title { font-family: var(--font-stencil); font-size: 40px; text-transform: uppercase; color: var(--green); }
.success-detail { font-size: 15px; margin-top: 10px; line-height: 1.6; }
.success-meta { font-family: var(--font-stencil); font-size: 20px; color: var(--orange); margin-top: 12px; }
.serve-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 20px; }
.success-lb-note { font-size: 13.5px; font-weight: 700; color: var(--green); margin-top: 14px; }

/* ---------- leaderboard ---------- */
.lb-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.lb-table td { padding: 11px 8px; border-bottom: 1px dashed rgba(217, 188, 122, 0.5); font-size: 15px; }
.lb-rank { font-family: var(--font-stencil); color: var(--gold-soft); width: 40px; font-size: 18px; }
.lb-name { letter-spacing: 0.08em; font-weight: 700; }
.lb-score { text-align: right; font-family: var(--font-stencil); font-size: 19px; }
.lb-table tr.you td { color: var(--gold-soft); }
.lb-prize { font-size: 13px; text-align: center; margin-top: 14px; line-height: 1.55; color: var(--gold-soft); }

/* prominent leaderboard prize banner */
.prize-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-deep) 100%);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(29, 68, 50, 0.35);
}
.prize-banner::after {
  content: ''; position: absolute; top: -50%; left: -60%; width: 60%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(217, 188, 122, 0.28), transparent);
  transform: rotate(18deg);
  animation: prize-shine 3.6s ease-in-out infinite;
}
@keyframes prize-shine { 0%, 62% { left: -60%; } 100% { left: 130%; } }
.prize-banner-icon { font-size: 44px; line-height: 1; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.prize-banner-body { position: relative; z-index: 1; }
.prize-banner-label { font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; font-weight: 700; color: var(--gold-soft); }
.prize-banner-title { font-family: var(--font-stencil); font-size: 22px; line-height: 1.05; color: var(--white); margin-top: 3px; }
.prize-banner-worth { font-family: var(--font-stencil); font-size: 18px; color: var(--gold-soft); margin-top: 2px; }
.prize-banner-terms { font-size: 11.5px; color: rgba(248, 244, 233, 0.8); margin-top: 6px; }

/* ---------- header nav (sub-pages) ---------- */
.subpage-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.back-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink); padding: 6px 10px 6px 0; }
.subpage-title { font-family: var(--font-display); text-transform: uppercase; font-size: 19px; }

/* ---------- footer ---------- */
.site-foot { text-align: center; font-size: 11px; color: var(--ink-soft); padding: 26px 20px 30px; line-height: 1.7; }
.site-foot a { color: var(--ink-soft); }

/* ---------- modal ---------- */
.modal-veil { position: fixed; inset: 0; background: rgba(22, 33, 46, 0.55); display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-veil.open { display: flex; }
.modal-card { background: var(--cream); border-radius: 14px 14px 0 0; max-width: 520px; width: 100%; max-height: 82dvh; overflow-y: auto; padding: 24px 22px 34px; }
.modal-card h3 { font-family: var(--font-display); text-transform: uppercase; font-size: 17px; margin-bottom: 12px; }
.modal-card p { font-size: 13.5px; line-height: 1.65; margin-bottom: 10px; color: var(--ink-soft); }

/* centered variant — used by the how-to-play popup over the game screen */
.modal-veil.center-modal { align-items: center; padding: 20px; }
.modal-veil.center-modal .modal-card { border-radius: 16px; max-height: 88dvh; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--white); padding: 12px 20px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 60;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.demo-banner {
  background: repeating-linear-gradient(45deg, #b98c2e, #b98c2e 12px, #a67c24 12px, #a67c24 24px);
  color: #fff; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  padding: 7px 10px; text-transform: uppercase;
}

.hidden { display: none !important; }

/* bar-picker "Next" stays reachable without scrolling past the whole list */
.bar-list-scroll-pad { padding-bottom: 90px; }
.sticky-cta {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--cream) 55%, rgba(242, 236, 220, 0));
  z-index: 20;
}

/* small screens */
@media (max-height: 620px) {
  .landing-bottle { height: 130px; }
  .brand-logo { height: 76px; }
  .hero-title { font-size: 36px; }
}
