:root {
  color-scheme: light;
  --ink: #10243a; --ink-2: #3b5068; --paper: #fbf6ee; --card: #ffffff; --line: #e8dfd2;
  --sea: #1667a8; --sea-2: #0c3f6b; --sun: #ff7a3d; --sun-2: #ffb347; --mint: #2bb3a3; --bad: #d64545;
  --r: 18px; --shadow: 0 1px 2px rgba(16,36,58,.06), 0 8px 24px rgba(16,36,58,.08);
  --font-head: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); color: var(--ink); background: var(--paper); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--sea); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 7vw, 46px); }
h2 { font-size: clamp(21px, 4.6vw, 28px); }
h3 { font-size: 18px; }
p { margin: 0 0 .8em; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(251,246,238,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 600; font-size: 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 65% 35%, #ffd76a 0 26%, transparent 27%), linear-gradient(180deg, #7fd0ff 0 55%, #1d84c9 55% 75%, #f2d38f 75%); box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--line); }
.brand small { display: block; font-family: var(--font-body); font-weight: 700; font-size: 11px; color: var(--sun); letter-spacing: .08em; text-transform: uppercase; }
.navlink { font-weight: 700; font-size: 14px; text-decoration: none; color: var(--ink-2); padding: 8px 12px; border-radius: 999px; }
.navlink:hover { background: #f1e8da; }

.demo-bar { background: #fff3c4; color: #6b5200; font-size: 13px; font-weight: 700; text-align: center; padding: 7px 12px; border-bottom: 1px solid #f0dd8a; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(180deg, #3aa6e8 0%, #7cc8f2 46%, #ffb37a 82%, #ff8a55 100%); }
.hero .wrap { position: relative; z-index: 2; padding-block: 38px 120px; }
.hero h1 { text-shadow: 0 2px 0 rgba(10,40,70,.18); max-width: 14ch; }
.hero p.lead { font-size: 18px; font-weight: 700; max-width: 42ch; color: #f5fbff; }
.hero-mountain { position: absolute; left: 0; right: 0; bottom: 0; height: 130px; z-index: 1; }
.weather-chip { display: inline-flex; align-items: center; gap: 10px; background: rgba(8,38,66,.35); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 8px 14px 8px 10px; font-weight: 700; font-size: 14px; margin-bottom: 16px; max-width: 100%; }
.weather-chip .dot { width: 22px; height: 22px; border-radius: 50%; background: #ffd76a; box-shadow: 0 0 0 4px rgba(255,215,106,.3); flex: none; }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 0; cursor: pointer; font: 700 16px/1 var(--font-body); padding: 14px 20px; border-radius: 999px; background: var(--sun); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 3px 0 rgba(0,0,0,.12); transition: transform .08s, filter .15s; min-height: 48px; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.sea { background: var(--sea); }
.btn.small { padding: 9px 14px; font-size: 14px; min-height: 38px; }
.btn.danger { background: var(--bad); }
.btn.wa { background: #25d366; color: #06301b; }
.share { margin: 8px 0 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

/* ---------- game cards (postcards) ---------- */
.section { padding: 36px 0; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: -88px; position: relative; z-index: 3; }
.gcard { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; border: 1px solid var(--line); transition: transform .15s, box-shadow .15s; }
.gcard:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(16,36,58,.14); }
.gcard .art { height: 128px; position: relative; display: flex; align-items: center; justify-content: center; }
.gcard .art svg { width: 100%; height: 100%; }
.gcard .pick { position: absolute; top: 10px; left: 10px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; }
.gcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gcard h3 { margin: 0; font-size: 21px; }
.gcard .tag { font-size: 14px; color: var(--ink-2); margin: 0; }
.gcard .prize { font-size: 13px; font-weight: 700; background: #fff4ea; color: #8a3b10; border-radius: 10px; padding: 8px 10px; }
.gcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 6px; }
.sponsor-mini { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.sponsor-mini img { height: 26px; width: auto; max-width: 80px; object-fit: contain; }
.sponsor-mini span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.age { font-size: 11px; font-weight: 800; background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 6px; }

/* ---------- panels ---------- */
.panel { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 20px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--sun); color: #fff; font: 600 16px/30px var(--font-head); text-align: center; }
.two { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 800px) { .two { grid-template-columns: 1.2fr 1fr; } }
.prize-card { border: 2px dashed var(--sun); background: #fffaf3; border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.prize-card .code { font: 600 22px/1.2 var(--font-head); letter-spacing: .05em; color: var(--sea-2); }

/* ---------- play page ---------- */
.play-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; flex-wrap: wrap; }
.play-head h1 { font-size: clamp(24px, 6vw, 34px); margin: 0; }
.sponsor-strip { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 8px 0 14px; }
.sponsor-strip img { height: 38px; width: auto; max-width: 120px; object-fit: contain; }
.sponsor-strip .who { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.sponsor-strip .name { font-weight: 800; }
.stage-wrap { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .stage-wrap { grid-template-columns: minmax(0, 420px) 1fr; } }
.stage { position: relative; width: min(100%, 420px, calc((100svh - 24px) * 0.6)); max-width: 420px; aspect-ratio: 360 / 600; margin: 0 auto; border-radius: 20px; overflow: hidden; background: #0c3f6b; box-shadow: 0 10px 30px rgba(12,63,107,.25); }
.stage canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(8,28,48,.55); backdrop-filter: blur(2px); z-index: 5; }
.overlay .box { background: #fff; color: var(--ink); border-radius: 18px; padding: 20px; width: 100%; max-width: 340px; max-height: 100%; overflow: auto; text-align: left; }
.overlay h2 { font-size: 24px; }
.big-score { font: 600 52px/1 var(--font-head); color: var(--sun); margin: 2px 0 6px; }
.prize-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.prize-list li { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; }
.medal { flex: none; width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 600 13px/26px var(--font-head); text-align: center; }
.m1 { background: #e7a619; } .m2 { background: #9aa6b2; } .m3 { background: #b9733f; }
.board { list-style: none; padding: 0; margin: 0; }
.board li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-weight: 700; }
.board li .r { width: 28px; color: var(--ink-2); }
.board li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li.me { background: #fff4ea; border-radius: 8px; }
.board li { align-items: center; }
.board li .n small { display: block; font-weight: 600; font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.flag { flex: none; width: 24px; height: 18px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); object-fit: cover; }
.seg { display: flex; gap: 4px; padding: 4px; margin: 8px 0; background: #f1ece3; border-radius: 999px; }
.seg button { flex: 1; appearance: none; border: 0; background: transparent; padding: 9px 8px; border-radius: 999px; font: inherit; font-weight: 800; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink, #12263a); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
/* however long the instructions are, Play stays on screen */
.stick { position: sticky; bottom: -20px; margin: 0 -20px -20px; padding: 10px 20px 20px; background: linear-gradient(rgba(255,255,255,0), #fff 28%); }
.leaders { margin: 6px 0 10px; }
.leaders ol { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 5px; }
.leaders li { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.leaders .medal { width: 22px; height: 22px; font-size: 12px; line-height: 22px; }
.ad { display: block; margin-top: 14px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); }
.ad img { width: 100%; }
.ad .t { padding: 10px 14px; font-weight: 700; font-size: 14px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=url], input[type=date], select, textarea {
  width: 100%; font: 16px var(--font-body); padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(255,122,61,.25); border-color: var(--sun); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 13px; margin: 10px 0; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--sun); }
.err { color: var(--bad); font-weight: 700; font-size: 14px; margin: 8px 0 0; }

/* ---------- footer, modal, toast ---------- */
footer { padding: 30px 0 50px; color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--line); margin-top: 30px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 24px; justify-content: space-between; }
dialog { border: 0; border-radius: 18px; padding: 0; max-width: min(560px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(8,28,48,.5); }
dialog .in { padding: 22px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 99; box-shadow: var(--shadow); max-width: 90vw; }

body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--paper); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
[hidden] { display: none !important; }
