:root {
  --saffron: #F28C28;
  --saffron-soft: #FDE7D0;
  --green: #1E9E5A;
  --green-soft: #D6F2E2;
  --red: #D93F3F;
  --red-soft: #FADBDB;
  --blue: #2F6FD6;
  --blue-soft: #DCE8FB;
  --purple: #8E5CD9;
  --navy: #1F3A5F;
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F1EDE6;
  --text: #1E2430;
  --text-2: #5C6472;
  --border: #E3DED5;
  --water: #D7E9F7;
  --land: #EDE8DF;
  --land-stroke: #FFFFFF;
  --country: #E2E0DA;
  --country-text: #9A968C;
  --lv1: #FBD3A6;
  --lv2: #B7E3C8;
  --lv3: #1E9E5A;
  --locked: #D5CFC4;
  --sea-label: #6C9CC4;
  --route: #1F3A5F;
  --soft-text: #B5600F;
  --pointer: #1F3A5F;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(30, 36, 48, .08);
  color-scheme: light;
}
/* Dark theme: follows the device, or an explicit data-theme on the root */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161D;
    --surface: #1B212B;
    --surface-2: #252C38;
    --text: #EEF1F5;
    --text-2: #A3ACBA;
    --border: #2E3644;
    --water: #0D1622;
    --land: #3D4A5E;
    --land-stroke: #0D1622;
    --country: #1F2733;
    --country-text: #5E6878;
    --saffron-soft: #4A3016;
    --green-soft: #173A28;
    --red-soft: #4A1E1E;
    --blue-soft: #1C2E4A;
    --lv1: #8A5A26;
    --lv2: #2F6B49;
    --locked: #2A313D;
    --sea-label: #3D6487;
    --route: #FFFFFF;
    --soft-text: #F5B370;
    --pointer: #FFFFFF;
    --shadow: 0 2px 10px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161D;
  --surface: #1B212B;
  --surface-2: #252C38;
  --text: #EEF1F5;
  --text-2: #A3ACBA;
  --border: #2E3644;
  --water: #0D1622;
  --land: #3D4A5E;
  --land-stroke: #0D1622;
  --country: #1F2733;
  --country-text: #5E6878;
  --saffron-soft: #4A3016;
  --green-soft: #173A28;
  --red-soft: #4A1E1E;
  --blue-soft: #1C2E4A;
  --lv1: #8A5A26;
  --lv2: #2F6B49;
  --locked: #2A313D;
  --sea-label: #3D6487;
  --route: #FFFFFF;
  --soft-text: #F5B370;
  --pointer: #FFFFFF;
  --shadow: 0 2px 10px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif; background: var(--bg); color: var(--text); overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { margin: 0; font-weight: 700; }
[hidden] { display: none !important; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }
.page { max-width: 640px; margin: 0 auto; width: 100%; padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); gap: 10px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.page-head h1 { font-size: 22px; flex: 1; }
.page-head.center { justify-content: center; text-align: center; margin: 24px 0 8px; }
.count { font-weight: 700; color: var(--text-2); }

/* ---------- Generic controls ---------- */
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; font-size: 18px; flex: none; padding: 0; }
.icon-btn.sm { width: 38px; height: 38px; }
.icon-btn:active, .btn:active, .mode:active, .deck-tile:active, .game-tile:active, .coll:active { transform: scale(.97); }
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; min-height: 50px; padding: 10px 14px; font-weight: 600; font-size: 15px; }
.btn.primary { background: var(--saffron); border-color: var(--saffron); color: #fff; }
.btn.good { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.btn.bad { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; }
.bad-text { color: var(--red); }
.input { width: 100%; min-height: 50px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 10px 14px; font: inherit; font-size: 17px; }
.input:focus { outline: 2px solid var(--saffron); border-color: transparent; }
.error { color: var(--red); font-size: 13px; min-height: 18px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-2); margin-top: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.pad { padding: 0 12px 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; min-height: 40px; white-space: nowrap; }
.chip small { color: var(--text-2); }
.chip[aria-checked="true"] { background: var(--saffron-soft); border-color: var(--saffron); font-weight: 700; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subtle { font-size: 12px; color: var(--text-2); text-align: center; }
.subtle.left { text-align: left; }
.bar { display: block; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--green); border-radius: 4px; transition: width .4s; }
.mini-bar { display: block; height: 5px; width: 100%; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--green); }
.speak { border: 0; background: var(--blue-soft); color: var(--blue); border-radius: 999px; width: 30px; height: 30px; font-size: 14px; padding: 0; vertical-align: middle; flex: none; }
.hi-name { font-size: 15px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Mascot ---------- */
.mascot-row { display: flex; align-items: flex-end; gap: 8px; }
.mascot { flex: none; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.bubble { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 14px; box-shadow: var(--shadow); flex: 1; }

/* ---------- Profiles ---------- */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.profile-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow); }
.profile-tile small { color: var(--text-2); }
.profile-tile.add { border-style: dashed; box-shadow: none; }
.p-av { font-size: 48px; line-height: 1.1; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.av { font-size: 30px; aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); padding: 0; }
.av.on { border-color: var(--saffron); background: var(--saffron-soft); }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.level { border: 2px solid var(--border); background: var(--surface); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.level span { font-size: 26px; }
.level small { color: var(--text-2); font-size: 12px; }
.level.on { border-color: var(--saffron); background: var(--saffron-soft); }

/* ---------- Home ---------- */
.home-head { display: flex; align-items: center; gap: 10px; }
.avatar-btn { font-size: 30px; width: 50px; height: 50px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); padding: 0; }
.hh-text { flex: 1; display: flex; flex-direction: column; }
.hh-text b { font-size: 20px; }
.hh-text small { color: var(--text-2); font-size: 13px; }
.streak-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; gap: 8px; }
.freeze { margin-left: 6px; color: var(--blue); }
.spin-btn { border: 0; background: var(--purple); color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; }
.spin-btn.done { background: var(--surface-2); color: var(--text-2); }
.event { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px dashed var(--saffron); background: var(--saffron-soft); border-radius: var(--radius); padding: 10px 14px; }
.event .ev-emoji { font-size: 30px; }
.event b { display: block; }
.event small { color: var(--text-2); font-size: 13px; }
.event .ev-go { margin-left: auto; font-weight: 700; color: var(--saffron); white-space: nowrap; }
.yatra-card { display: flex; align-items: center; gap: 14px; text-align: left; background: linear-gradient(135deg, #F28C28, #E94B8A); color: #fff; border: 0; border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.yatra-card .yc-icon { font-size: 40px; }
.yatra-card .yc-main { flex: 1; display: flex; flex-direction: column; }
.yatra-card b { font-size: 19px; }
.yatra-card small { opacity: .9; font-size: 13px; }
.yatra-card .bar { background: rgba(255, 255, 255, .3); }
.yatra-card .bar-fill { background: #fff; }
.yc-pass { font-size: 26px; background: rgba(255, 255, 255, .22); border-radius: 14px; width: 50px; height: 50px; display: grid; place-items: center; }
.sec { font-size: 17px; margin: 10px 0 0; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.deck-tile { display: flex; flex-direction: column; align-items: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); min-height: 118px; }
.dt-icon { font-size: 28px; }
.dt-icon.big { font-size: 42px; }
.deck-tile b { font-size: 15px; line-height: 1.2; margin-top: 2px; }
.dt-hi { font-size: 12px; color: var(--text-2); }
.deck-tile small { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.game-tile { display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 0; border-radius: var(--radius); padding: 12px; min-height: 100px; color: #fff; box-shadow: var(--shadow); }
.game-tile span { font-size: 28px; }
.game-tile small { opacity: .9; font-size: 12px; }
.game-tile:nth-child(1) { background: #1E9E5A; } .game-tile:nth-child(2) { background: #E94B8A; } .game-tile:nth-child(3) { background: #8E5CD9; }
.game-tile:nth-child(4) { background: #2F6FD6; } .game-tile:nth-child(5) { background: #D9862A; }
.coll-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.coll { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 4px; }
.coll span { font-size: 26px; }
.credit { margin-top: 16px; font-size: 12px; color: var(--text-2); text-align: center; }
.credit a { color: inherit; }

/* ---------- Sheets / overlays ---------- */
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet-card { position: relative; background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 16px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; animation: up .25s ease-out; }
.sheet-card.center { text-align: center; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: 22px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-x { position: absolute; right: 12px; top: 12px; }
.sheet-head { display: flex; gap: 12px; align-items: center; padding-right: 50px; }
.sheet-head h2 { font-size: 21px; }
.modes { display: grid; gap: 8px; }
@media (min-width: 480px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 64px; }
.mode-ic { font-size: 26px; width: 36px; text-align: center; }
.mode b { display: block; }
.mode small { color: var(--text-2); font-size: 13px; }
.toggle { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--green); }
#toasts { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); font-size: 14px; animation: drop .3s ease-out; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* ---------- Game layout ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; }
.tb-center { flex: 1; text-align: center; display: flex; flex-direction: column; min-width: 0; }
.tb-center b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-center small { font-size: 13px; color: var(--text-2); font-weight: 600; }
.tb-right { min-width: 42px; text-align: right; font-size: 14px; font-weight: 700; white-space: nowrap; }
.timer-bar { height: 6px; background: var(--surface-2); margin: 0 12px 6px; border-radius: 3px; overflow: hidden; }
#timer-fill { height: 100%; width: 100%; background: var(--saffron); }
.game-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.map-wrap { position: relative; flex: 1 1 52%; min-height: 230px; margin: 0 12px; background: var(--water); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.map { width: 100%; height: 100%; display: block; position: absolute; inset: 0; user-select: none; -webkit-user-select: none; }
.map-ctrls { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.map-ctrls .icon-btn { opacity: .92; }
.locked .map-ctrls { display: none; }
.map-toast { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.panel { flex: 0 0 auto; padding: 12px 12px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 820px), (orientation: landscape) and (min-width: 600px) {
  .game-body { flex-direction: row; padding-bottom: 12px; }
  .map-wrap { flex: 1 1 auto; margin-right: 0; }
  .panel { width: min(420px, 44vw); padding-top: 0; justify-content: center; overflow-y: auto; }
}

/* ---------- Map ---------- */
.sea { fill: var(--water); }
.country { fill: var(--country); stroke: var(--land-stroke); stroke-width: .8; vector-effect: non-scaling-stroke; }
.clabel { fill: var(--country-text); font-weight: 600; pointer-events: none; letter-spacing: .02em; }
.sea-label { fill: var(--sea-label); font-style: italic; }
.region { fill: var(--land); stroke: var(--land-stroke); stroke-width: 1.1; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill .2s; }
.region.target { fill: var(--saffron); }
.region.selected { fill: var(--blue); }
.region.correct { fill: var(--green); }
.region.wrong { fill: var(--red); }
.region.missed { fill: var(--saffron-soft); stroke: var(--saffron); stroke-width: 3; }
.region.hinted { fill: var(--saffron-soft); }
.region.start { fill: var(--blue); }
.region.visited { fill: #7FC8A0; }
.region.faded { opacity: .45; }
.region.lv1 { fill: var(--lv1); } .region.lv2 { fill: var(--lv2); } .region.lv3 { fill: var(--lv3); }
.region.stamp { fill: var(--green); }
.region.open { fill: var(--saffron-soft); stroke: var(--saffron); stroke-width: 2; animation: glow 1.8s ease-in-out infinite; }
.region.locked { fill: var(--locked); }
@keyframes glow { 50% { fill: #FBC58D; } }
.interactive .region, .interactive .hit { cursor: pointer; }
@media (hover: hover) { .interactive .region:hover:not(.selected):not(.correct):not(.wrong):not(.stamp) { fill: #F9D2A8; } }
.hit { fill: transparent; stroke: transparent; }
.ring { fill: none; stroke: var(--saffron); stroke-width: 2.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.ring.pulse { animation: pulse 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.ring.correct { stroke: var(--green); } .ring.wrong { stroke: var(--red); } .ring.selected { stroke: var(--blue); }
@keyframes pulse { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.pin { pointer-events: none; }
.pin .pin-body { fill: var(--saffron); stroke: #fff; stroke-width: 2; }
.pin .pin-dot { fill: #fff; }
.pin.correct .pin-body { fill: var(--green); }
.pin.selected .pin-body { fill: var(--blue); }
.pin.target .pin-body { fill: #E94B8A; }
.pin-label { font-size: 13px; font-weight: 700; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.dist-line { stroke: var(--text); stroke-width: 2; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.route { fill: none; stroke: var(--route); stroke-width: 4; stroke-dasharray: 2 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rlabel { font-weight: 700; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; }
.rlabel.stamp-mark { fill: #fff; stroke: none; }
.piece { fill: var(--saffron); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); touch-action: none; }
.piece.lifted { cursor: grabbing; fill: #F5A04D; }
.region.slot { fill: var(--surface); stroke: var(--text-2); stroke-dasharray: 4 3; stroke-width: 1.2; }
.region.slot.hinted { fill: var(--saffron-soft); stroke: var(--saffron); stroke-width: 3; }
.region.placed.pz-c0 { fill: #C9C2B6; } .region.placed.pz-c1 { fill: #F28C28; } .region.placed.pz-c2 { fill: #1E9E5A; } .region.placed.pz-c3 { fill: #2F6FD6; }
.region.placed.pz-c4 { fill: #E94B8A; } .region.placed.pz-c5 { fill: #8E5CD9; } .region.placed.pz-c6 { fill: #D9A400; }

/* ---------- Panels: prompts, cards, options ---------- */
.q-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text-2); text-align: center; }
.q-emoji { font-size: 22px; }
.prompt { font-size: 19px; font-weight: 700; text-align: center; }
.prompt small { display: block; font-size: 13px; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.card-stage { perspective: 1000px; }
.card { position: relative; min-height: 190px; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3, .7, .3, 1); touch-action: pan-y; user-select: none; }
.card.flipped { transform: rotateY(180deg); }
.card.dragging { transition: none; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 14px 16px; gap: 4px; overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.face .big { font-size: 24px; font-weight: 800; line-height: 1.15; }
.face .q { font-size: 21px; font-weight: 700; }
.face .sub { font-size: 14px; color: var(--text-2); }
.face .tag { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--saffron-soft); }
.face .hint-tap { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.facts { font-size: 13px; color: var(--text-2); display: grid; gap: 2px; margin-top: 4px; }
.dyk-inline { margin-top: 4px; color: var(--text); }
.swipe-tag { position: absolute; top: 12px; font-weight: 800; font-size: 14px; padding: 4px 10px; border-radius: 8px; border: 2px solid; opacity: 0; z-index: 2; pointer-events: none; }
.swipe-tag.yes { right: 12px; color: var(--green); }
.swipe-tag.no { left: 12px; color: var(--red); }
.options { display: grid; gap: 8px; }
@media (min-width: 400px) and (max-width: 819px) { .options { grid-template-columns: 1fr 1fr; } }
.options.many { grid-template-columns: 1fr 1fr; }
.opt { text-align: left; display: flex; align-items: center; gap: 8px; min-height: 48px; }
.opt .kbd { font-size: 11px; opacity: .45; }
.o-emoji { font-size: 20px; }
.opt.correct { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.opt.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.opt.gone { opacity: .25; }
.feedback { min-height: 20px; text-align: center; font-size: 15px; font-weight: 700; }
.feedback:empty { display: none; }
.feedback.ok { color: var(--green); } .feedback.no { color: var(--red); } .feedback.soft { color: var(--soft-text); }
.dyk { margin-top: 8px; font-size: 13.5px; font-weight: 500; color: var(--text); background: var(--blue-soft); border-radius: 12px; padding: 8px 12px; text-align: left; }
.hint-line { font-size: 13.5px; color: var(--text-2); text-align: center; }
.hint-line:empty { display: none; }
.clues { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 15px; }
.clues li:last-child { font-weight: 700; }
.route-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; font-size: 12.5px; }
.chip-s { background: var(--surface-2); border-radius: 999px; padding: 3px 9px; }
.arrow { color: var(--text-2); }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.pick-ic { font-size: 26px; }
.pick small { color: var(--text-2); font-size: 12px; }
.pass-overlay { position: fixed; inset: 0; background: rgba(31, 58, 95, .92); display: grid; place-items: center; z-index: 60; }
.pass-card { background: var(--bg); border-radius: 22px; padding: 24px; width: min(88vw, 360px); text-align: center; display: grid; gap: 8px; }
.pass-emoji { font-size: 54px; }
.pass-name { font-size: 28px; font-weight: 800; color: var(--saffron); margin-bottom: 8px; }

/* ---------- Results ---------- */
.results { width: 100%; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.res-emoji { font-size: 60px; }
.results h1 { font-size: 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 520px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 6px; }
.stat-v { font-size: 24px; font-weight: 800; }
.stat-l { font-size: 12px; color: var(--text-2); }
.note { background: var(--green-soft); color: var(--green); border-radius: 12px; padding: 10px; font-weight: 600; font-size: 14px; }
.missed { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.missed li { background: var(--red-soft); color: var(--red); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.res-actions { display: grid; gap: 10px; }
.results .mascot-row { text-align: left; }

/* ---------- Collections ---------- */
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.sticker { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border-radius: 16px; padding: 12px 6px; background: var(--surface-2); border: 2px dashed var(--border); font-size: 12px; color: var(--text-2); min-height: 104px; }
.sticker .s-emoji { font-size: 36px; }
.sticker.got { background: var(--surface); border: 2px solid var(--saffron); color: var(--text); box-shadow: var(--shadow); transform: rotate(-1.5deg); }
.sticker.got:nth-child(even) { transform: rotate(1.5deg); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: var(--surface-2); border-radius: 16px; padding: 14px 8px; opacity: .65; }
.badge.got { background: var(--surface); border: 2px solid #F5C518; opacity: 1; box-shadow: var(--shadow); }
.b-ic { font-size: 36px; }
.badge small { font-size: 12px; color: var(--text-2); }
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.stamp-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; font-size: 12px; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); color: var(--text-2); }
.stamp-tile small { font-size: 11px; }
.stamp-ring { width: 58px; height: 58px; border-radius: 50%; border: 3px dashed var(--border); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.stamp-tile.got { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.stamp-tile.got .stamp-ring { border: 4px double var(--green); color: var(--green); transform: rotate(-12deg); }
.legend { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lg.lv0 { background: var(--land); border: 1px solid var(--border); } .lg.lv1 { background: var(--lv1); } .lg.lv2 { background: var(--lv2); } .lg.lv3 { background: var(--lv3); }
.lg.stamp { background: var(--green); } .lg.open { background: var(--saffron-soft); border: 1px solid var(--saffron); } .lg.locked { background: var(--locked); border: 1px solid var(--border); }
.info { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; min-height: 64px; max-height: 34dvh; overflow-y: auto; }
.pm-items { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.pm-items li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); padding: 4px 0; }
.lvl { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.lvl.l0 { background: var(--surface-2); } .lvl.l1 { background: var(--lv1); } .lvl.l2 { background: var(--lv2); } .lvl.l3 { background: var(--green); color: #fff; }
.y-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; gap: 6px; }
.y-card b { font-size: 17px; }

/* ---------- Parent view ---------- */
.pv-head { display: flex; gap: 12px; align-items: center; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 12px; }
.wk-bar { height: 80px; background: var(--surface-2); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.wk-bar span { display: block; width: 100%; background: var(--saffron); border-radius: 8px 8px 0 0; }
.wk small { color: var(--text-2); display: block; }
.pv-decks { display: grid; gap: 8px; }
.pv-deck { display: grid; grid-template-columns: 1fr; font-size: 14px; }
.pv-deck small { color: var(--text-2); font-size: 12px; }
.pv-badges { font-size: 26px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Spin wheel ---------- */
.wheel-wrap { position: relative; width: min(78vw, 300px); margin: 0 auto; }
.wheel { width: 100%; display: block; }
.wheel-pointer { position: absolute; left: 50%; top: -10px; transform: translateX(-50%); font-size: 28px; color: var(--pointer); z-index: 2; }

/* ---------- Certificate ---------- */
.cert-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; overflow-y: auto; }
.certificate { background: #FFFBF2; color: #1E2430; width: min(94vw, 760px); aspect-ratio: 1.414; padding: 14px; border-radius: 6px; }
.cert-inner { height: 100%; border: 6px double #C9962B; outline: 2px solid #F28C28; outline-offset: -14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px; gap: 4px; }
.cert-inner h1 { font-family: Georgia, serif; font-size: clamp(24px, 6vw, 46px); color: #1F3A5F; }
.cert-small { font-size: clamp(11px, 2vw, 14px); letter-spacing: .12em; text-transform: uppercase; color: #8A6A1F; }
.cert-name { font-family: Georgia, serif; font-size: clamp(22px, 6vw, 42px); font-weight: 700; color: #F28C28; border-bottom: 2px solid #C9962B; padding: 0 20px; }
.cert-inner p { font-size: clamp(11px, 2.2vw, 16px); max-width: 80%; margin: 6px 0; }
.cert-date { font-size: clamp(11px, 2vw, 14px); color: #5C6472; }
.cert-seal { font-size: clamp(24px, 5vw, 40px); }
.cert-actions { width: min(94vw, 400px); }
@media print {
  body * { visibility: hidden; }
  .certificate, .certificate * { visibility: visible; }
  .certificate { position: fixed; left: 0; top: 0; width: 100%; }
  .cert-overlay { background: none; }
}

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shake .25s 2; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.row.single { grid-template-columns: 1fr; }

/* In-page dialog and image viewer */
.dialog { max-width: 420px; }
.dialog p { margin: 0; color: var(--text-2); }
#dialog { z-index: 85; }
.share-img { max-width: min(90vw, 420px); max-height: 70dvh; border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.overlay-tip { color: #fff; font-size: 14px; text-align: center; margin: 0; }

/* Add to Home Screen guide */
#install { z-index: 75; }
.install-cta { display: flex; align-items: center; gap: 12px; text-align: left; font-size: 26px; border: 1px solid var(--blue); background: var(--blue-soft); color: var(--text); border-radius: var(--radius); padding: 10px 14px; }
.install-cta b { display: block; font-size: 15px; }
.install-cta small { display: block; font-size: 13px; color: var(--text-2); }
.inst-tabs { justify-content: center; }
.inst-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.inst-for { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.inst-steps { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 10px; font-size: 15px; line-height: 1.5; }
.inst-steps li::marker { font-weight: 800; color: var(--saffron); }
.inst-note { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.inst-warn { background: var(--saffron-soft); border: 1px solid var(--saffron); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ic { width: 22px; height: 22px; vertical-align: -5px; color: var(--blue); }
.ic-key { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-weight: 800; vertical-align: -3px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--blue); font-size: 13px; font-weight: 600; cursor: pointer; }
.link-btn.center { align-self: center; }
.sheet-card h2 { padding-right: 48px; }
