:root {
  --bg: #120a2a;
  --bg-2: #1c1240;
  --card: #241a52;
  --card-2: #2e2264;
  --line: rgba(255, 220, 160, 0.14);
  --text: #f8eedb;
  --muted: #c4b7e0;
  --gold: #ffc94d;
  --saffron: #ff8a1f;
  --clay: #b8642e;
  --decoy: #f2d16b;
  --channel: #41347a;
  --water: #173a6e;
  --bad: #ff7b7b;
  --good: #8fe3a8;
  --radius: 16px;
  --page-glow: #2a1a5e;
  --tile-1: #30245a;
  --tile-2: #1c1439;
  --groove: #120a26;
  --oil: #43367a;
  --groove-lit: #3a2208;
  --board-bg: rgba(10, 5, 24, .4);
  --city: #0a0518;
  --land: #221846;
  --sea-1: #10285a;
  --sea-2: #0a1530;
  --scrim: rgba(6, 3, 16, .72);
  --display: 'Yatra One', 'Mukta', serif;
  --body: 'Mukta', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 70% at 50% 0%, var(--page-glow) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.15; }
p { margin: 0; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); opacity: .9; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  transition: transform .08s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, #ffb347, var(--saffron));
  color: #2a1300;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255, 138, 31, .35);
}
.btn.ghost { background: transparent; }
.btn.big { padding: 16px 28px; font-size: 18px; width: 100%; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: 40px; height: 40px; font-size: 24px; line-height: 1; }

/* ---------- home ---------- */
.home { display: flex; flex-direction: column; gap: 20px; }
.brand { text-align: center; padding-top: 8px; }
.brand h1 { font-size: 44px; color: var(--gold); text-shadow: 0 0 24px rgba(255, 190, 80, .35); }
.tagline { color: var(--muted); font-style: italic; }
.tagline span { display: block; font-style: normal; font-size: 13px; opacity: .8; }

.sky-card { background: linear-gradient(180deg, #0d0722, var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 12px; overflow: hidden; }
.skyline { width: 100%; display: block; }
.skyline .city { fill: var(--city); stroke: rgba(255, 200, 120, .18); stroke-width: 1; vector-effect: non-scaling-stroke; }
.skyline .ghat { fill: #2a1d3f; }
.skyline .ghat-steps { stroke: rgba(255, 220, 160, .12); stroke-width: 1; }
.sky-diya.lit .flame { animation: flicker 1.6s ease-in-out infinite; transform-origin: 50px 45px; }
.sky-stats { text-align: center; color: var(--muted); font-size: 15px; margin-top: 4px; }
.sky-stats b { color: var(--gold); }

.cta { display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; }
.cta-sub { color: var(--muted); font-size: 14px; }
.locked-cta { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; }
.countdown { font-size: 20px; margin-top: 4px; }
.countdown b { color: var(--gold); font-variant-numeric: tabular-nums; }
.done-note { font-family: var(--display); font-size: 22px; color: var(--gold); }

.chapters h2 { font-size: 22px; margin-bottom: 10px; }
.chapters ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.chapters li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.chapters li.is-locked { opacity: .55; }
.ch-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-weight: 700; font-size: 14px; flex: none; }
.is-done .ch-num { background: var(--gold); color: #2a1300; }
.ch-name { flex: 1; font-weight: 600; }
.ch-name small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.status { font-size: 13px; white-space: nowrap; }
.status.done { color: var(--good); }
.status.open { color: var(--gold); }
.status.locked { color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 12px; opacity: .7; padding-bottom: 8px; }

/* ---------- play ---------- */
.play { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; height: calc(100dvh - 32px - env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h2 { font-size: clamp(17px, 5vw, 22px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ghee { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 6px; }
.ghee-ico { width: 26px; height: 26px; display: block; }
.ghee-ico svg { width: 100%; height: 100%; }
.ghee b { color: var(--gold); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: rgba(255, 201, 77, .12); border: 1px solid rgba(255, 201, 77, .35); color: var(--gold); border-radius: 999px; padding: 3px 12px; font-size: 13px; }

.story-strip {
  position: relative; min-height: 4.6em; font-size: 15px; line-height: 1.4; font-weight: 600;
  color: #3b2410; padding: 10px 16px 10px 32px; border-radius: 16px;
  background:
    repeating-linear-gradient(180deg, transparent 0 21px, rgba(120, 80, 30, .12) 21px 22px),
    linear-gradient(180deg, #efdcae, #d8bd84);
  box-shadow: inset 0 0 0 1px rgba(110, 70, 20, .35), inset 0 0 18px rgba(120, 70, 20, .25), 0 6px 18px rgba(0, 0, 0, .35);
}
.story-strip::before {
  content: ''; position: absolute; left: 12px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: #5a3a18; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6);
}
.story-strip .line { animation: fadeIn .6s ease both; }

.board-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
.board {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--tile));
  grid-auto-rows: var(--tile);
  gap: 2px;
  padding: 5px;
  background: var(--board-bg);
  backdrop-filter: blur(2px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  touch-action: manipulation;
}
.tile {
  position: relative;
  border: 0;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--tile-1), var(--tile-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 -3px 0 rgba(0, 0, 0, .35);
  overflow: hidden;
}
.tile .pipes { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform .24s cubic-bezier(.34, 1.56, .64, 1); }
.tile .groove { stroke: var(--groove); fill: var(--groove); stroke-width: 24; stroke-linecap: round; }
.tile .oil { stroke: var(--oil); fill: var(--oil); stroke-width: 9; stroke-linecap: round; transition: stroke .1s, fill .1s; }
.tile.lit .oil {
  stroke: var(--gold); fill: var(--gold); stroke-width: 11;
  filter: drop-shadow(0 0 5px rgba(255, 190, 70, .95));
  transition: stroke .25s var(--delay, 0ms), fill .25s var(--delay, 0ms), stroke-width .25s var(--delay, 0ms);
}
.tile.lit .groove { stroke: var(--groove-lit); fill: var(--groove-lit); transition: stroke .25s var(--delay, 0ms), fill .25s var(--delay, 0ms); }
.tile .lamp { position: absolute; inset: 8%; display: grid; place-items: center; pointer-events: none; }
.tile .lamp svg { width: 100%; height: 100%; }
.tile.diya .lamp, .tile.decoy .lamp { inset: 2% 4% 6%; z-index: 2; }
.tile.diya::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255, 196, 80, .55), transparent 62%);
  transition: opacity .1s;
}
.tile.diya.lit::after { opacity: 1; transition: opacity .35s var(--delay, 0ms); }
.tile.diya.ignite::before {
  content: ''; position: absolute; left: 50%; top: 36%; width: 5px; height: 5px; margin: -2.5px;
  border-radius: 50%; z-index: 3; pointer-events: none;
  animation: sparks .75s ease-out var(--delay, 0ms) both;
}
.tile.source { background: radial-gradient(circle, rgba(255, 140, 30, .45), var(--bg-2) 72%); }
.tile .flame { animation: flicker 1.4s ease-in-out infinite; transform-origin: 50px 45px; }
.flame.off { opacity: 0; transition: opacity .3s; }
.tile.lit .flame.off { opacity: 1; transition-delay: var(--delay, 0ms); }
.tile.decoy { box-shadow: inset 0 0 0 2px rgba(242, 209, 107, .5); }
.tile.decoy .lamp { animation: mirage 2.6s ease-in-out infinite; }
.tile.decoy.trap { background: radial-gradient(circle, rgba(255, 90, 90, .45), var(--bg-2) 70%); box-shadow: inset 0 0 0 2px var(--bad); }
.seal-wrap { position: absolute; top: 3px; right: 3px; width: 32%; height: 32%; z-index: 2; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); }
.seal-wrap svg { width: 100%; height: 100%; display: block; }
.tile.locked { background: linear-gradient(150deg, #3a2a40, #241830); }
.tile.water {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 6px, transparent 6px 14px),
    linear-gradient(180deg, #1e4a85, var(--water));
  background-size: 28px 28px, 100% 100%;
  animation: waves 3.5s linear infinite;
  cursor: default;
}
.tile.crossing { background: linear-gradient(180deg, #1e4a85, var(--water)); }
.tile.crossing::before {
  position: absolute; bottom: 2px; left: 0; right: 0; text-align: center;
  font-size: calc(var(--tile) * .2); line-height: 1; z-index: 1; color: #fff; opacity: .9;
}
.tile.skin-ganga::before { content: '⛵'; }
.tile.skin-ocean::before { content: 'leap'; font-weight: 700; color: var(--gold); }
.tile.skin-setu::before { content: 'राम'; font-weight: 700; color: var(--gold); }
.tile.skin-pampa::before { content: '• • •'; }
.tile.skin-sarayu::before { content: 'ghat'; font-weight: 700; color: var(--gold); }
.tile.hinted { box-shadow: 0 0 0 3px var(--gold); }
/* Gentle hint: a pulsing ring says "this one is wrong" without turning it. */
.tile.pointed { box-shadow: 0 0 0 3px var(--gold); animation: pointPulse 1.1s ease-in-out infinite; z-index: 1; }
@keyframes pointPulse { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(255, 201, 77, .9); } }
/* Smriti keepsake: a faint glint until the flame reaches it. */
.tile.relic .lamp { inset: 18%; z-index: 2; color: var(--gold); opacity: .28; animation: glint 2.8s ease-in-out infinite; }
.tile.relic.lit .lamp { opacity: 1; animation: none; filter: drop-shadow(0 0 6px rgba(255, 201, 77, .9)); transition: opacity .3s var(--delay, 0ms); }
.tile.relic.found .lamp { animation: pop .5s ease; }
.relic-svg { width: 100%; height: 100%; display: block; }
@keyframes glint { 0%, 70%, 100% { opacity: .22; } 82% { opacity: .55; } }
.relic-chip::first-letter { color: var(--gold); }
.relic-chip.found { background: rgba(255, 201, 77, .28); }
.tile.nudge { animation: nudge .3s; }
.board.solved { box-shadow: 0 0 40px rgba(255, 190, 70, .45); border-color: rgba(255, 201, 77, .6); transition: box-shadow .6s; }

.meta-line { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.meta-line b { color: var(--text); font-weight: 600; }
.dawn { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.dawn-bar { flex: 1; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #ffb26b, #ffe08a); opacity: .9; overflow: hidden; }
.dawn-bar div { height: 100%; background: #1a1140; margin-left: auto; transition: width .2s; float: right; }
.play-actions { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; }
.play-actions .btn { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.play-actions .btn:disabled { opacity: .4; cursor: default; }

/* ---------- overlay & sheets ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 20;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  display: grid; align-items: end; justify-items: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
#overlay[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 520px;
  max-height: calc(100dvh - 32px); overflow: auto;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
  animation: rise .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet h2 { font-size: 26px; color: var(--gold); }
.sheet.center { align-self: center; text-align: center; }
.actions { display: flex; justify-content: center; gap: 10px; margin-top: 6px; }
.actions.stack { flex-direction: column; }
.fact { background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 10px 12px; font-size: 15px; color: var(--muted); }
.fact b { color: var(--gold); }
.reward { color: var(--good); font-size: 14px; }
.card-diya { width: 72px; height: 72px; margin: 0 auto; }
.card-diya svg { width: 100%; height: 100%; }
.big-count { font-size: 56px; font-family: var(--display); color: var(--gold); }

/* ---------- scenes ---------- */
.scene { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.scene-intro { color: var(--muted); }
.scene-stage { display: flex; flex-direction: column; gap: 16px; align-items: stretch; padding: 8px 0; }
.scene-stage.won { pointer-events: none; }
.scene-status { min-height: 1.5em; font-weight: 600; }
.scene-status[data-tone="bad"] { color: var(--bad); }
.scene-status[data-tone="good"] { color: var(--good); }
.scene-actions { display: flex; justify-content: center; gap: 10px; }
.pips { display: flex; gap: 8px; justify-content: center; }
.pips span { width: 14px; height: 14px; border-radius: 50%; background: var(--channel); }
.pips span.on { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.meter { position: relative; height: 26px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.meter .zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(255,201,77,.4), rgba(255,201,77,.8), rgba(255,201,77,.4)); }
.meter .marker { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #fff; border-radius: 3px; box-shadow: 0 0 10px #fff; }

.power-track { position: relative; height: 34px; border-radius: 99px; background: var(--water); border: 1px solid var(--line); }
.power-target { position: absolute; top: 0; bottom: 0; background: rgba(143, 227, 168, .35); border-left: 2px solid var(--good); border-right: 2px solid var(--good); }
.power-target span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--good); white-space: nowrap; padding-bottom: 2px; }
.power-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(255,138,31,.2), rgba(255,201,77,.6)); border-radius: 99px; }
.power-dot { position: absolute; top: 50%; left: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px var(--gold); }

.tap-head { display: flex; align-items: center; gap: 12px; }
.tap-score { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.timer { flex: 1; height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.timer div { height: 100%; width: 100%; background: var(--gold); }
.tap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 320px; margin: 0 auto; width: 100%; }
.tap-cell { aspect-ratio: 1; border-radius: 16px; border: 1px solid var(--line); background: var(--bg-2); display: grid; place-items: center; touch-action: manipulation; }
.tap-cell.pop { animation: pop .2s; }
.tap-cell.shake { animation: nudge .3s; }
.berry { width: 46%; aspect-ratio: 1; border-radius: 50%; animation: rise .2s; }
.berry.ripe { background: radial-gradient(circle at 35% 30%, #c9a3ff, #5b2a91 60%, #36145e); box-shadow: 0 0 12px rgba(160, 100, 255, .5); }
.berry.unripe { background: radial-gradient(circle at 35% 30%, #d6f5a6, #6f9e3a 60%, #3f6420); }
.stone { width: 70%; aspect-ratio: 1.3; border-radius: 40% 46% 42% 48%; background: linear-gradient(160deg, #8a8496, #4d475a); display: grid; place-items: center; font-weight: 700; font-size: 20px; color: transparent; animation: rise .2s; }
.stone.marked { color: var(--gold); text-shadow: 0 0 8px rgba(255, 201, 77, .8); }

.jewels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.jewel { aspect-ratio: .8; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.jewel span { font-size: 26px; color: var(--c); }
.jewel small { font-size: 10px; color: var(--muted); }
.jewel.flash { background: var(--c); box-shadow: 0 0 18px var(--c); }
.jewel.flash span, .jewel.flash small { color: #1a0f00; }

.finale-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.finale-diya { min-width: 0; aspect-ratio: 1; border: 0; background: var(--bg-2); border-radius: 12px; padding: 4px; }
.finale-diya svg { width: 100%; height: 100%; }
.finale-diya.lit { background: radial-gradient(circle, rgba(255, 190, 70, .45), var(--bg-2) 70%); }
.finale-diya .flame { animation: flicker 1.4s ease-in-out infinite; transform-origin: 50px 45px; }
.celebrate .finale-grid { animation: glow 1.2s ease-in-out infinite alternate; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #0b0619; border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30;
  max-width: calc(100vw - 32px); text-align: center; animation: rise .2s;
}
.debug { position: fixed; left: 8px; top: 8px; z-index: 15; max-width: 260px; background: rgba(0,0,0,.85); border: 1px solid #555; border-radius: 10px; padding: 6px; font: 11px/1.3 ui-monospace, monospace; color: #cfc; }
.debug:not(.open) > :not(.debug-toggle) { display: none; }
.debug-toggle { background: none; border: 0; color: #cfc; font-size: 11px; padding: 0 4px; }
.debug-btns { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.debug-btns button { background: #333; border: 1px solid #666; border-radius: 6px; padding: 3px 6px; font-size: 11px; }
.debug-log { margin: 0; padding-left: 16px; max-height: 140px; overflow: auto; word-break: break-all; }

@keyframes flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.94, 1.06); } 60% { transform: scale(1.04, .96); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes pop { 50% { transform: scale(1.12); } }
@keyframes glow { from { filter: drop-shadow(0 0 0 transparent); } to { filter: drop-shadow(0 0 14px rgba(255, 190, 70, .8)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- v2: shaped boards, coach, sound, share ---------- */
.tile.void { background: transparent; pointer-events: none; }
.board.shaped { background: rgba(10, 5, 24, .35); }
.board.shaped.solved .tile:not(.void):not(.water) { box-shadow: 0 0 14px rgba(255, 190, 70, .35); }
.tile.marked::before {
  content: 'राम'; position: absolute; top: 3px; left: 0; right: 0; text-align: center; z-index: 1;
  font-weight: 700; font-size: calc(var(--tile) * .2); color: var(--gold); opacity: .85; line-height: 1;
}
.tile.marked { background: linear-gradient(180deg, #3a3550, #23203a); }
.shape-reveal { font-family: var(--display); color: var(--gold); font-size: 18px; }

.brand { position: relative; }
.brand .sound-btn { position: absolute; right: 0; top: 0; font-size: 18px; }
.topbar .sound-btn { font-size: 16px; flex: none; }

.board-wrap { position: relative; }
.coach { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 5; transition: left .3s ease, top .3s ease; }
.coach-ring {
  position: absolute; width: var(--size, 56px); height: var(--size, 56px);
  left: calc(var(--size, 56px) / -2); top: calc(var(--size, 56px) / -2);
  border-radius: 12px; box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(255, 201, 77, .8);
  animation: coachGlow 2s ease-in-out infinite;
}
.coach-hand { position: absolute; left: 0; top: 4px; font-size: 34px; transform: translate(-30%, 0); animation: coachTap 2s ease-in-out infinite; text-shadow: 0 4px 6px rgba(0, 0, 0, .5); will-change: transform; }
.coach-bubble {
  position: absolute; left: 0; right: 0; top: 4px; margin: 0 auto;
  width: fit-content; max-width: 92%; text-align: center; font-size: 14px; font-weight: 600;
  background: var(--gold); color: #2a1300; padding: 8px 14px; border-radius: 14px; z-index: 5;
  animation: rise .3s ease both;
}
/* Calm guidance: the ring glows softly; the hand rests, then taps once every 2s. */
@keyframes coachGlow { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 34px rgba(255, 201, 77, 1); } }
@keyframes coachTap { 0%, 60%, 100% { transform: translate(-30%, 0); } 72% { transform: translate(-30%, 5px) scale(.94); } 84% { transform: translate(-30%, 0); } }

.share-layer {
  position: fixed; inset: 0; z-index: 25; background: rgba(6, 3, 16, .8); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; animation: fadeIn .2s ease;
}
.share-sheet { align-self: center; }
.share-preview { border-radius: 14px; overflow: hidden; background: #0b0619; aspect-ratio: 1080 / 1350; max-height: 52dvh; margin: 0 auto; display: grid; place-items: center; }
.share-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.share-loading { color: var(--muted); }

/* ---------- v3: backdrops, progress row, motion ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; animation: fadeIn .6s ease both; }
.backdrop svg { width: 100%; height: 100%; display: block; }
.backdrop .bd-shape { opacity: .9; }
.bd-bal, .bd-ayodhya { color: #0c0620; background: linear-gradient(180deg, transparent 45%, rgba(255, 140, 40, .10)); }
.bd-diwali { color: #0c0620; background: linear-gradient(180deg, transparent 35%, rgba(255, 150, 50, .22)); }
.bd-aranya { color: #0a1a18; background: linear-gradient(180deg, transparent 40%, rgba(60, 140, 90, .14)); }
.bd-kishkindha { color: #160f26; background: linear-gradient(180deg, transparent 40%, rgba(150, 100, 60, .14)); }
.bd-sundara { color: #0a1c3c; background: linear-gradient(180deg, transparent 40%, rgba(40, 110, 200, .18)); }
.bd-yuddha { color: #0b1630; background: linear-gradient(180deg, transparent 35%, rgba(200, 80, 50, .16)); }

.progress-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.diya-row { display: flex; flex-wrap: wrap; gap: 1px; }
.diya-row .mini { width: 20px; height: 20px; opacity: .45; transition: opacity .3s, filter .3s; }
.diya-row:has(.mini:nth-child(13)) .mini { width: 15px; height: 15px; }
.diya-row .mini svg { width: 100%; height: 100%; display: block; }
.diya-row .mini.lit { opacity: 1; filter: drop-shadow(0 0 4px rgba(255, 190, 70, .85)); }
.diya-row .mini.lit .flame.off { opacity: 1; }

.home, .play { animation: screenIn .35s ease both; }
@keyframes screenIn { from { opacity: 0; transform: scale(.985); } }
@keyframes waves { to { background-position: 28px 0, 0 0; } }
@keyframes mirage { 50% { filter: brightness(1.35) saturate(1.3); transform: translateY(-2px); } }
@keyframes sparks {
  0% { opacity: 1; box-shadow: 0 0 #ffd257, 0 0 #ffb347, 0 0 #fff2b0, 0 0 #ffd257, 0 0 #fff2b0, 0 0 #ffb347; }
  100% { opacity: 0; box-shadow: -16px -18px 0 -1px #ffd257, 14px -20px 0 -1px #ffb347, -20px -2px 0 -2px #fff2b0,
    18px -4px 0 -2px #ffd257, 0 -26px 0 -1px #fff2b0, -8px -28px 0 -2px #ffb347; }
}

/* ---------- v4: home hero, journey map, title cards, story card ---------- */
#app.in-play { padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); }
#app.in-play .play { height: calc(100dvh - 20px - env(safe-area-inset-bottom)); }

.brand.compact { display: flex; align-items: center; justify-content: center; min-height: 40px; padding-top: 0; }
.brand.compact h1 { font-size: 30px; }
.brand .sound-btn { position: absolute; right: 0; top: 0; }

.hero { margin: 0 -16px; position: relative; }
.hero .skyline { width: 100%; display: block; }
.hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 30px; height: 40%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(255, 150, 50, .06)); }
.hero .sky-stats { margin-top: 2px; }

.locked-cta { text-align: center; }
.teaser { font-family: var(--display); font-size: 21px; color: var(--text); margin: 6px 0 2px; line-height: 1.25; }

.journey h2 { font-size: 22px; margin-bottom: 6px; }
.india-map {
  position: relative; margin: 0 -8px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(120% 90% at 70% 60%, var(--sea-1), var(--sea-2) 70%);
  box-shadow: inset 0 0 0 1px var(--line);
}
.india-map > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.india-map .land { fill: var(--land); stroke: rgba(255, 201, 77, .35); stroke-width: .7; stroke-linejoin: round; }
.india-map .river { fill: none; stroke: #3d74c2; stroke-width: 1.1; opacity: .6; stroke-linecap: round; }
.india-map .river-label { fill: #6f9be0; font: italic 6.5px var(--body); opacity: .8; }
.india-map .sea-label { fill: rgba(150, 180, 230, .45); font: italic 8px var(--body); letter-spacing: .08em; }
.india-map .minor { fill: var(--muted); opacity: .8; }
.india-map .minor-label { fill: var(--muted); font: 6.5px var(--body); opacity: .85; }
.india-map .setu-shoals { stroke: #c9b07a; stroke-width: 1.6; stroke-dasharray: 1 1.6; opacity: .8; }
.route .seg { fill: none; stroke: rgba(196, 183, 224, .4); stroke-width: 1.4; stroke-dasharray: 1.5 3; stroke-linecap: round; }
.route .seg.lit { stroke: var(--gold); stroke-width: 2.2; stroke-dasharray: none; filter: drop-shadow(0 0 2px rgba(255, 190, 70, .9)); }
.route .seg.flight.lit { stroke-dasharray: 5 3; }
.map-note { color: var(--muted); font-size: 11px; opacity: .7; text-align: center; margin-top: 6px; }

.stop {
  position: absolute; width: 38px; height: 38px; transform: translate(-50%, -50%);
  background: none; border: 0; padding: 0; z-index: 2;
}
.stop-diya {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, var(--card-2) 55%, var(--bg-2)); border: 2px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
}
.stop-diya svg { width: 72%; height: 72%; }
.stop.done .stop-diya { border-color: var(--gold); background: radial-gradient(circle, rgba(255, 190, 70, .4), #2e2264 70%); }
.stop.current .stop-diya { border-color: var(--gold); animation: stopPulse 1.8s ease-in-out infinite; }
.stop.locked .stop-diya { filter: grayscale(.8); opacity: .7; }
.stop-label {
  position: absolute; top: 50%; transform: translateY(-50%); width: max-content; max-width: 132px;
  display: flex; flex-direction: column; gap: 1px; text-align: left; line-height: 1.15;
  background: rgba(12, 7, 30, .72); border: 1px solid rgba(255, 220, 160, .12); border-radius: 10px; padding: 4px 8px;
}
.label-right .stop-label { left: calc(100% + 6px); }
.label-left .stop-label { right: calc(100% + 6px); text-align: right; align-items: flex-end; }
/* Hangs down-right from the marker (used where a neighbour sits to the left). */
.label-rightdown .stop-label { left: calc(100% + 5px); top: -2px; transform: none; max-width: 104px; }
@media (max-width: 400px) { .stop { width: 34px; height: 34px; } }
.stop-label small { color: var(--gold); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; }
.stop-row { display: flex; flex-direction: column; }
.label-left .stop-row { align-items: flex-end; }
.stop-row b { font-weight: 700; font-size: 13px; }
.stop.locked .stop-label { opacity: .65; }
.stop-status { color: var(--muted); font-size: 11px; display: flex; gap: 5px; align-items: center; }
.stop-row.done .stop-status { color: var(--good); }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 6px; height: 6px; border-radius: 50%; background: var(--channel); }
.pip.on { background: var(--gold); box-shadow: 0 0 5px var(--gold); }
@keyframes stopPulse { 50% { box-shadow: 0 0 0 8px rgba(255, 201, 77, .15), 0 0 24px rgba(255, 190, 70, .6); } }

.title-card {
  position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; text-align: center;
  background: radial-gradient(120% 80% at 50% 10%, #2a1a5e, #0b0619 70%); cursor: pointer;
  animation: fadeIn .45s ease both;
}
.title-card.out { animation: fadeOut .4s ease both; }
.title-bg { position: absolute; inset: 0; }
.title-bg svg { width: 100%; height: 100%; display: block; }
.title-inner { position: relative; padding: 24px; max-width: 420px; display: flex; flex-direction: column; gap: 10px; animation: rise .7s .15s ease both; }
.title-card h1 { font-size: clamp(40px, 12vw, 58px); color: var(--gold); text-shadow: 0 0 30px rgba(255, 190, 80, .45); }
.title-sub { font-family: var(--display); font-size: 22px; color: var(--text); }
.title-intro { color: var(--muted); font-size: 17px; margin-top: 6px; }
.title-hint { font-size: 13px; color: var(--muted); opacity: .7; margin-top: 18px; animation: fadeIn 1s 1.2s both; }
@keyframes fadeOut { to { opacity: 0; } }

.story-card { padding: 10px; }
.card-frame {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; border-radius: 16px;
  border: 1px solid rgba(255, 201, 77, .45);
  box-shadow: inset 0 0 0 4px rgba(36, 26, 82, 1), inset 0 0 0 5px rgba(255, 201, 77, .25);
  background:
    radial-gradient(circle at 0 0, rgba(255, 201, 77, .22) 0 14px, transparent 15px),
    radial-gradient(circle at 100% 0, rgba(255, 201, 77, .22) 0 14px, transparent 15px),
    radial-gradient(circle at 0 100%, rgba(255, 201, 77, .22) 0 14px, transparent 15px),
    radial-gradient(circle at 100% 100%, rgba(255, 201, 77, .22) 0 14px, transparent 15px);
}
.card-sky { margin: -8px -8px 0; border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, #0d0722, #1c1240); }
.card-sky.pulse { animation: skyPulse .9s ease; }
.card-text { font-size: 15px; color: var(--text); opacity: .92; }
.medallion { display: flex; gap: 12px; align-items: flex-start; background: rgba(0, 0, 0, .22); border-radius: 14px; padding: 10px 12px; }
.medal-ico {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #c98a1e); color: #3a2208; font-size: 16px;
  box-shadow: 0 0 0 2px rgba(255, 201, 77, .35);
}
.medallion p { font-size: 14px; color: var(--muted); }
.medallion b { color: var(--gold); }
.fly-flame {
  position: fixed; z-index: 30; width: 34px; height: 34px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff7d1 0 20%, #ffd257 40%, rgba(255, 140, 30, .6) 60%, transparent 72%);
  box-shadow: 0 0 24px 8px rgba(255, 190, 70, .55);
}
@keyframes skyPulse { 40% { filter: brightness(1.5) drop-shadow(0 0 12px rgba(255, 190, 70, .8)); } }

/* Short phones: reclaim vertical space so tiles stay ≥ 44px. */
@media (max-height: 780px) {
  .play { gap: 7px; }
  .story-strip { min-height: 3.1em; font-size: 14px; padding: 7px 14px 7px 28px; }
  .topbar-title h2 { -webkit-line-clamp: 1; }
  .play-actions .btn { padding: 10px 18px; }
  .meta-line { font-size: 13px; }
}

/* ================= Themes (art directions, #20) ================= */
:root[data-theme="madhubani"] {
  --bg: #f3e4c4; --bg-2: #ead6ae; --card: #fff4dc; --card-2: #fbe9c6;
  --line: rgba(42, 22, 8, .35); --text: #2a1608; --muted: #6b4a2a;
  --gold: #d9480f; --saffron: #e67700; --clay: #a0441c; --channel: #cdb88f; --water: #4f8fb0;
  --good: #2b8a3e; --bad: #c92a2a;
  --page-glow: #fbecd0; --tile-1: #fff6e2; --tile-2: #f1dfb8; --groove: #2a1608; --oil: #e6d3a8;
  --groove-lit: #2a1608; --board-bg: rgba(255, 244, 220, .7); --city: #2a1608;
  --land: #f6e6c4; --sea-1: #a9cddb; --sea-2: #86b6ca; --scrim: rgba(42, 22, 8, .45);
}
[data-theme="madhubani"] .tile { box-shadow: inset 0 0 0 1.5px #2a1608; }
[data-theme="madhubani"] .board,
[data-theme="madhubani"] .sheet,
[data-theme="madhubani"] .india-map { border: 3px double #2a1608; }
[data-theme="madhubani"] .tile.lit .oil { filter: none; }
[data-theme="madhubani"] .brand h1, [data-theme="madhubani"] .sheet h2 { text-shadow: none; }
[data-theme="madhubani"] .india-map .land { stroke: #2a1608; stroke-width: 1; }
[data-theme="madhubani"] .india-map .sea-label, [data-theme="madhubani"] .india-map .minor-label { fill: #2a1608; }
[data-theme="madhubani"] .stop-label { background: rgba(255, 244, 220, .92); border-color: #2a1608; }
[data-theme="madhubani"] .route .seg { stroke: rgba(42, 22, 8, .45); }
[data-theme="madhubani"] .route .seg.lit { stroke: #d9480f; filter: none; }
[data-theme="madhubani"] .hero, [data-theme="madhubani"] .card-sky { filter: sepia(.15); }

:root[data-theme="glow"] {
  --bg: #07070d; --bg-2: #10101c; --card: #151526; --card-2: #1c1c33;
  --line: rgba(255, 255, 255, .1); --text: #f2f2f7; --muted: #a3a3bd;
  --gold: #ffb86b; --saffron: #ff7a45; --channel: #26264a;
  --page-glow: #1a1030; --tile-1: #17172d; --tile-2: #0e0e1c; --groove: #05050b; --oil: #262646;
  --groove-lit: #2b1606; --board-bg: rgba(255, 255, 255, .03); --city: #05050b;
  --land: #141428; --sea-1: #0b1a33; --sea-2: #070f1f; --radius: 20px;
  --display: 'Mukta', system-ui, sans-serif;
}
[data-theme="glow"] h1, [data-theme="glow"] h2 { font-weight: 700; letter-spacing: -.01em; }
[data-theme="glow"] .tile { border-radius: 14px; box-shadow: none; }
[data-theme="glow"] .story-strip { background: rgba(255, 255, 255, .06); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); font-weight: 400; }
[data-theme="glow"] .story-strip::before { display: none; }
[data-theme="glow"] .story-strip { padding-left: 16px; }
[data-theme="glow"] .card-frame { border-color: rgba(255, 255, 255, .12); box-shadow: none; background: none; }

/* ================= Accessibility (#18) ================= */
[data-large] .story-strip { font-size: 18px; }
[data-large] .card-text, [data-large] .sheet p { font-size: 18px; }
[data-large] .medallion p { font-size: 16px; }
[data-large] .cta-sub, [data-large] .meta-line, [data-large] .sky-stats { font-size: 16px; }
[data-large] .stop-row b { font-size: 15px; }
[data-large] .stop-status, [data-large] .stop-label small { font-size: 13px; }
[data-large] .eyebrow { font-size: 13px; }
[data-large] .chip { font-size: 15px; }
[data-large] .btn { font-size: 18px; }

/* High contrast: lit vs unlit differ by shape and brightness, not just hue. */
[data-contrast] { --muted: #e4dcf5; --line: rgba(255, 255, 255, .35); }
[data-contrast][data-theme="madhubani"] { --muted: #3d2410; --line: rgba(42, 22, 8, .7); }
[data-contrast] .tile .oil { stroke-dasharray: 4 6; stroke-width: 7; }
[data-contrast] .tile.lit .oil { stroke-dasharray: none; stroke-width: 14; stroke: #fff2b3; filter: drop-shadow(0 0 4px #ffb000); }
[data-contrast] .tile.decoy.trap::after {
  content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; z-index: 4;
  color: #fff; font-weight: 700; font-size: calc(var(--tile) * .45); text-shadow: 0 0 6px #000;
}
.tile:focus-visible, .stop:focus-visible, .btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Settings sheet */
.settings h2 { margin-bottom: 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-of-type { border-bottom: 0; }
.setting-row span small { display: block; color: var(--muted); font-size: 13px; }
.switch { width: 52px; height: 30px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg-2); position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch[aria-checked="true"] { background: var(--saffron); }
.switch[aria-checked="true"]::after { transform: translateX(22px); background: #fff; }
.theme-options { display: grid; gap: 8px; }
.theme-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); }
.theme-opt[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.theme-opt small { display: block; color: var(--muted); font-size: 12px; }
.swatch { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.swatch-pahari { background: linear-gradient(135deg, #1c1240 50%, #ffc94d 50%); }
.swatch-madhubani { background: linear-gradient(135deg, #f3e4c4 50%, #d9480f 50%); box-shadow: inset 0 0 0 2px #2a1608; }
.swatch-glow { background: linear-gradient(135deg, #07070d 50%, #ffb86b 50%); }

[data-theme="madhubani"] .backdrop { opacity: .28; }
[data-theme="madhubani"] .title-card { background: radial-gradient(120% 80% at 50% 10%, #fbecd0, #ead6ae 70%); }
[data-theme="madhubani"] .title-card .title-intro, [data-theme="madhubani"] .title-card .title-hint { color: #4a2c12; }
[data-theme="madhubani"] .title-bg { opacity: .35; }
[data-theme="glow"] .backdrop { display: none; }
[data-theme="glow"] .board { background: none; border: 0; backdrop-filter: none; gap: 6px; }
[data-theme="glow"] .tile { background: linear-gradient(160deg, #1a1a33, #0d0d1a); }
[data-theme="glow"] .tile.lit { box-shadow: 0 0 18px rgba(255, 184, 107, .18); }
[data-theme="glow"] .tile.lit .oil { filter: drop-shadow(0 0 7px rgba(255, 160, 80, 1)); }
[data-theme="glow"] .story-strip { border-radius: 20px; }

/* ================= Scene visuals (#11) ================= */
.bow-svg { width: min(100%, 300px); margin: 0 auto; display: block; overflow: visible; }
.bow-half path { fill: none; stroke: #c98a3a; stroke-width: 7; stroke-linecap: round; transition: d .25s ease; }
.bow-half { transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .6s; transform-origin: 100px 14px; }
.bow-string { fill: none; stroke: #f3e6c4; stroke-width: 1.6; transition: d .25s ease, opacity .3s; }
.bow-grip { fill: #7a3f16; }
.bow-svg.snapped .left { transform: translate(-14px, 10px) rotate(-28deg); }
.bow-svg.snapped .right { transform: translate(14px, 10px) rotate(28deg); }
.bow-svg.snapped .bow-string { opacity: 0; }
.bow-svg.snapped { filter: drop-shadow(0 0 12px rgba(255, 200, 90, .7)); }

.crossing { position: relative; height: 110px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.crossing.river { background: repeating-linear-gradient(170deg, rgba(255,255,255,.07) 0 3px, transparent 3px 16px), linear-gradient(180deg, #2a5f9e, #173a6e); background-size: 40px 40px, 100% 100%; animation: waves 4s linear infinite; }
.crossing.sea { background: linear-gradient(180deg, #0d1736 0 45%, transparent 45%), repeating-linear-gradient(175deg, rgba(255,255,255,.06) 0 3px, transparent 3px 14px), linear-gradient(180deg, #1d4f8f, #0c2550); background-size: 100% 100%, 40px 40px, 100% 100%; animation: waves 5s linear infinite; }
.bank.near { position: absolute; left: 0; top: 0; bottom: 0; width: 6%; background: linear-gradient(90deg, #4a3220, #6b4a2a); }
.far-zone { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(180deg, rgba(232, 213, 168, .55) 0 6px, rgba(180, 150, 100, .55) 6px 12px); border-left: 2px solid var(--good); }
.crossing.sea .far-zone { background: linear-gradient(180deg, transparent 45%, rgba(110, 160, 90, .55) 45%); }
.far-zone span { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.traveller { position: absolute; bottom: 22px; left: 4%; width: 54px; transform: translate(-50%, 0); }
.traveller svg { width: 100%; display: block; filter: drop-shadow(0 3px 2px rgba(0,0,0,.4)); }
.traveller .orb { display: block; width: 24px; height: 24px; margin: 0 auto; border-radius: 50%; background: radial-gradient(circle, #fff7d1 0 25%, #ffd257 45%, rgba(255,140,30,.5) 65%, transparent 72%); box-shadow: 0 0 22px 6px rgba(255, 180, 60, .6); }
.traveller.landed { animation: pop .4s; }

.tap-grid.skin-berries .tap-cell { background: radial-gradient(circle at 50% 60%, #2f6b3c, #183b22 70%); border-color: rgba(120, 200, 120, .25); }
.tap-grid.skin-stones .tap-cell { background: repeating-radial-gradient(circle at 50% 55%, rgba(255,255,255,.08) 0 2px, transparent 2px 10px), linear-gradient(180deg, #24558f, #123566); border-color: rgba(120, 170, 230, .3); }
.tap-grid.skin-stones .stone.marked { animation: rise .2s, bob 1.2s ease-in-out infinite; }
.tap-cell.sink .stone, .tap-cell.sink { animation: sinkStone .4s ease-in both; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes sinkStone { to { transform: translateY(10px) scale(.9); opacity: .4; } }

.jewels.trail { padding: 10px 8px; border-radius: 14px; background: linear-gradient(180deg, #3b2a1a, #2a1d12); box-shadow: inset 0 2px 8px rgba(0,0,0,.5); }
.jewel.fall span { animation: jewelFall .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes jewelFall { from { transform: translateY(-38px) rotate(-20deg); opacity: 0; } }

/* Map polish (#29) */
.india-map .region-label { fill: rgba(140, 200, 140, .5); font: italic 7px var(--body); letter-spacing: .12em; text-transform: uppercase; }
[data-theme="madhubani"] .india-map .region-label { fill: #2b6a3a; }
.stop.partial .stop-diya { border-color: transparent; background:
  radial-gradient(circle, var(--card-2) 58%, transparent 60%),
  conic-gradient(var(--gold) 0 50%, var(--line) 50% 100%); }

/* Chapter vignettes (#10) */
.title-art { width: min(58vw, 230px); margin: 0 auto 4px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .5)); }
.title-art svg, .complete-art svg { width: 100%; display: block; }
.title-card .title-inner { gap: 6px; }
.complete-art { width: 120px; margin: 0 auto -6px; }
@media (max-height: 700px) { .title-art { width: 150px; } }

/* Language toggle (Hindi) */
.seg-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg-toggle button { background: none; border: 0; padding: 6px 14px; font-weight: 600; }
.seg-toggle button[aria-checked="true"] { background: var(--saffron); color: #2a1300; }
:root[lang="hi"] .story-strip { line-height: 1.55; }
:root[lang="hi"] .eyebrow { letter-spacing: .02em; }
:root[lang="hi"] .stop-label small { letter-spacing: 0; text-transform: none; }

/* ================= Comic pages ================= */
.comic {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px;
  background: #1a0f08; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.panel { position: relative; margin: 0; overflow: hidden; border: 2.5px solid #1a0f08; border-radius: 4px; background: #000; }
.panel svg, .panel img { display: block; width: 100%; height: 100%; object-fit: cover; }
.panel-1 { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.panel-2, .panel-3 { aspect-ratio: 1 / 1; }
.cap {
  position: absolute; left: 4px; top: 4px; max-width: calc(100% - 8px);
  background: #fff4c7; color: #1a0f08; border: 1.5px solid #1a0f08; border-radius: 3px;
  padding: 3px 6px; font-size: 12px; line-height: 1.25; font-weight: 600;
  box-shadow: 2px 2px 0 #1a0f08;
}
.panel-3 .cap { top: auto; bottom: 4px; }
.cap em { display: block; font-style: italic; font-weight: 400; font-size: 10px; opacity: .75; }
:root[lang="hi"] .cap { font-size: 12.5px; line-height: 1.4; }
[data-large] .cap { font-size: 14.5px; }
.card-more summary { cursor: pointer; color: var(--gold); font-weight: 600; font-size: 14px; }
.card-more p { margin-top: 6px; }

.story-book { max-height: calc(100dvh - 32px); }
.book { display: flex; flex-direction: column; gap: 18px; }
.book-kand h3 { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--text); margin: 2px 0 8px; }
.book-page { margin-bottom: 12px; }
.book-page h4 { margin: 0 0 6px; font-size: 15px; color: var(--gold); }

/* ================= Story text v2 ================= */
.story-strip { display: flex; align-items: center; gap: 10px; }
.strip-line { flex: 1; margin: 0; }
.strip-line.in { animation: lineIn .45s ease both; }
.strip-pips { display: flex; flex-direction: column; gap: 4px; flex: none; }
.strip-pips i { width: 6px; height: 6px; border-radius: 50%; background: rgba(90, 58, 24, .3); }
.strip-pips i.on { background: #8a4a12; }
[data-theme="glow"] .strip-pips i { background: rgba(255,255,255,.15); }
[data-theme="glow"] .strip-pips i.on { background: var(--gold); }
@keyframes lineIn { from { opacity: 0; transform: translateY(4px); } }
.who { all: unset; cursor: pointer; border-bottom: 1.5px dotted currentColor; font-weight: 700; }
.who:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.who-tip {
  position: fixed; z-index: 40; background: #0b0619; color: var(--text); border: 1px solid var(--gold);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.4; box-shadow: 0 10px 24px rgba(0,0,0,.5);
  animation: rise .2s ease;
}
.who-tip b { color: var(--gold); margin-right: 4px; }
.meaning {
  margin: 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--gold);
  font-family: var(--display); font-size: 19px; line-height: 1.35; color: var(--text);
}
.medallion .source { display: block; margin-top: 4px; font-size: 12px; opacity: .75; font-style: italic; }
.tradition-note { font-size: 13px; color: var(--muted); font-style: italic; }
.card-more .card-text { margin-top: 6px; }

/* ================= Account, contest, feedback ================= */
.brand .acct-btn { position: absolute; left: 0; top: 0; width: auto; min-width: 40px; padding: 0 10px; font-size: 13px; font-weight: 700; }
.acct-label { white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--saffron); color: #2a1300; font-weight: 700; font-size: 14px; }
.brand.compact .acct-btn, .brand.compact .sound-btn { top: 0; }
.auth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #dadce0; }
.auth-btn[data-p="facebook"] { background: #1877f2; color: #fff; border-color: #1877f2; }
.auth-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-family: Arial, sans-serif; }
.auth-btn[data-p="google"] .auth-ico { color: #4285f4; }
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.email-form, .name-form { display: flex; flex-direction: column; gap: 10px; }
.email-form input, .name-form input, .sheet textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.sheet textarea { resize: vertical; min-height: 96px; }
.status-line { min-height: 1.2em; font-size: 14px; color: var(--gold); }
.fine-print { font-size: 12px; color: var(--muted); }
.fine-print a, .consent a { color: var(--gold); }
.muted-line { color: var(--muted); font-size: 14px; }
.contest-card { background: linear-gradient(135deg, rgba(255, 138, 31, .16), rgba(255, 201, 77, .08)); border: 1px solid rgba(255, 201, 77, .45); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.contest-card.entered { border-color: var(--good); background: linear-gradient(135deg, rgba(143, 227, 168, .16), rgba(143, 227, 168, .05)); }
.consent { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 14px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--saffron); flex: none; }
.rating { display: flex; justify-content: center; gap: 6px; }
.rating button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); padding: 4px; }
.rating button.lit { background: radial-gradient(circle, rgba(255, 190, 70, .4), var(--bg-2) 70%); border-color: var(--gold); }
.rating svg { width: 100%; height: 100%; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 14px; align-self: center; }

/* ================= Onboarding ================= */
.onboard {
  position: fixed; inset: 0; z-index: 36; display: grid; place-items: center; overflow-y: auto;
  background: radial-gradient(120% 80% at 50% 0%, var(--page-glow), var(--bg) 70%);
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); animation: fadeIn .3s ease both;
}
.onboard.out { animation: fadeOut .3s ease both; }
.onb-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; text-align: center; animation: rise .45s ease both; }
.onb-diya { width: 84px; height: 84px; margin: 0 auto; filter: drop-shadow(0 0 18px rgba(255, 190, 70, .6)); }
.onb-diya svg, .onb-sky svg { width: 100%; display: block; }
.onboard h1 { font-size: clamp(28px, 8vw, 36px); color: var(--gold); }
.onb-bilingual span { display: block; font-size: .8em; color: var(--text); margin-top: 4px; }
.lang-cards { display: grid; gap: 12px; }
.lang-card {
  display: flex; flex-direction: column; gap: 2px; align-items: center; padding: 18px 16px;
  border-radius: 18px; border: 2px solid var(--line); background: var(--card); color: var(--text);
}
.lang-card b { font-size: 26px; font-family: var(--display); font-weight: 400; }
.lang-card small { color: var(--muted); font-size: 14px; }
.lang-card[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 201, 77, .25), 0 8px 24px rgba(255, 150, 50, .25); }
.onb-sky { margin: 0 -16px; }
.onb-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.onb-points li { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px; }
.onb-points span { font-size: 22px; flex: none; }

/* ---------- Smriti, Daily Diya, family challenge ---------- */
.home-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.relic-line { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 15px; }
.relic-line .relic-ico { width: 34px; height: 34px; flex: none; }
.relic-line.missed { color: var(--muted); font-size: 14px; }
.smriti { display: grid; gap: 10px; }
.relic-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: rgba(0, 0, 0, .22); border: 1px dashed var(--line); border-radius: 14px; padding: 12px;
}
button.relic-card:hover { border-color: rgba(255, 201, 77, .5); }
.relic-card.found { border-style: solid; border-color: rgba(255, 201, 77, .4); }
.relic-card h4 { margin: 0 0 2px; font-size: 16px; color: var(--text); }
.relic-card.found h4 { color: var(--gold); }
.relic-card p { font-size: 14px; color: var(--muted); }
.relic-card .source { display: block; margin-top: 4px; font-size: 12px; opacity: .75; font-style: italic; color: var(--muted); }
.relic-card .relic-ico { width: 44px; height: 44px; flex: none; color: var(--gold); display: grid; place-items: center; }
.relic-ico.unknown { border-radius: 50%; background: rgba(255, 255, 255, .05); color: var(--muted); font-family: var(--display); font-size: 22px; }

.daily-home {
  background: linear-gradient(135deg, rgba(255, 201, 77, .12), rgba(255, 138, 31, .06));
  border: 1px solid rgba(255, 201, 77, .35); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.daily-home.done { border-color: var(--line); background: var(--card); }
.daily-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.streak-pill { font-size: 13px; font-weight: 700; color: #2a1300; background: var(--gold); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.daily-pitch, .daily-next { font-size: 14px; color: var(--muted); }
.daily-next b { color: var(--gold); font-variant-numeric: tabular-nums; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 0; opacity: .55; }
.wk svg { width: 30px; height: 30px; }
.wk small { font-size: 11px; color: var(--muted); }
.wk.on { opacity: 1; }
.wk.today small { color: var(--gold); font-weight: 700; }
.daily-card .week-strip { margin: 2px 0; }
.streak-line { color: var(--muted); font-size: 14px; }
.streak-line b { color: var(--gold); }
.shloka {
  margin: 4px 0 0; padding: 12px 14px; border-left: 3px solid var(--gold); background: rgba(0, 0, 0, .22);
  border-radius: 0 12px 12px 0; font-size: 18px; line-height: 1.6; color: var(--text);
}
.shloka-meaning { font-size: 15px; }
.daily-card .source { font-size: 12px; color: var(--muted); font-style: italic; }
.taps-line { font-size: 14px; color: var(--muted); }
.shloka-strip .strip-line { font-size: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 14px; color: var(--muted); }
.field input {
  font: inherit; font-size: 16px; color: var(--text); background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.field input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.vs { display: flex; flex-direction: column; gap: 8px; }
.vs-row { display: grid; grid-template-columns: minmax(0, 6em) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.vs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.vs-row.me .vs-name { color: var(--text); font-weight: 700; }
.vs-bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.vs-bar i { display: block; height: 100%; border-radius: 99px; background: var(--muted); }
.vs-row.me .vs-bar i { background: var(--gold); box-shadow: 0 0 10px rgba(255, 201, 77, .6); }
.challenge-card.won h2 { color: var(--gold); }
@media (prefers-reduced-motion: reduce) {
  .tile.pointed, .tile.relic .lamp { animation: none; }
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
a.link-btn { align-self: center; }
.tradition-note a { color: var(--gold); white-space: nowrap; }

/* ================= Chugli Games: Biji and the studio credit ================= */
/* Biji's bubble: cream on the night sky, like the chat bubbles on chugligames.com. */
.biji { display: flex; align-items: flex-end; gap: 8px; text-align: left; }
.biji-face {
  width: 44px; height: 44px; border-radius: 50%; flex: none; background: #e9dccb;
  box-shadow: 0 0 0 2px var(--gold), 0 4px 10px rgba(0, 0, 0, .35);
}
.biji-line {
  background: #fff7ec; color: #3a1016; font-size: 15px; line-height: 1.4;
  padding: 8px 12px 9px; border-radius: 16px 16px 16px 4px; box-shadow: 0 6px 16px rgba(6, 3, 16, .35);
}
.biji-line b { display: block; font-size: 12px; color: #7a1f2b; letter-spacing: .02em; }
.biji.compact .biji-face { width: 32px; height: 32px; }
.biji.compact .biji-line { font-size: 13.5px; padding: 6px 10px 7px; }
.biji.in-card { margin-top: 12px; }
.home-say { margin-top: -6px; }
.biji-toast {
  position: fixed; left: 12px; right: 12px; margin: 0 auto; max-width: 520px; z-index: 30; pointer-events: none;
  bottom: calc(20px + env(safe-area-inset-bottom)); animation: rise .25s ease both;
}
.biji-toast.out { animation: fadeOut .35s ease both; }
.coach-bubble { background: none; color: inherit; padding: 0; font-weight: 400; text-align: left; border-radius: 0; }

/* "a Chugli Games game" under the title, and the studio's wordmark at the foot of home. */
.brand-title { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.by-chugli { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-decoration: none; letter-spacing: .02em; }
.by-chugli img { width: 16px; height: 16px; border-radius: 4px; }
.made-by { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-size: 12px; padding-bottom: 12px; opacity: .85; }
.made-by img { width: 132px; height: auto; }

/* Chugli Games presents: the mark gives its side-eye while the gossip pops in. */
.onboard.splash { cursor: pointer; }
.splash-inner { align-items: center; gap: 8px; }
.splash-stage { position: relative; width: min(260px, 64vw); margin: 44px auto 22px; }
.splash-stage .chugli-mark { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .45)); animation: chugliBob 4s ease-in-out infinite; }
.chugli-mark .pupils { animation: sideEye 5s ease-in-out infinite; }
.chugli-mark .brows { transform-origin: 256px 180px; animation: browsUp 5s ease-in-out infinite; }
.splash-stage .bubble {
  position: absolute; z-index: 1; margin: 0; max-width: 220px; padding: 8px 13px 7px; border-radius: 16px; text-align: left;
  font-weight: 600; font-size: 14px; line-height: 1.3; color: #3a1016; background: #fff7ec; box-shadow: 0 8px 18px rgba(6, 3, 16, .45);
  opacity: 0; animation: bubbleIn .45s cubic-bezier(.2, .8, .2, 1) forwards;
}
.splash-stage .b1 { top: -30px; left: -18%; border-bottom-left-radius: 4px; animation-delay: .5s; }
.splash-stage .b2 { top: 50%; right: -22%; border-bottom-right-radius: 4px; animation-delay: 1.5s; }
.splash-stage .b3 { bottom: -22px; left: -14%; border-top-left-radius: 4px; animation-delay: 2.5s; }
.splash-word { width: 200px; height: auto; margin: 0 auto; }
.splash-presents { color: var(--muted); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.splash-title { font-family: var(--display); font-size: 46px; line-height: 1.1; color: var(--gold); text-shadow: 0 0 24px rgba(255, 190, 80, .4); opacity: 0; animation: rise .6s ease 3.1s forwards; }
.splash-hint { color: var(--muted); font-size: 13px; opacity: 0; animation: fadeIn .4s ease 3.8s forwards; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes sideEye { 0%, 30% { transform: translateX(0); } 38%, 70% { transform: translateX(-20px); } 78%, 100% { transform: translateX(0); } }
@keyframes browsUp { 0%, 30%, 78%, 100% { transform: translateY(0); } 38%, 70% { transform: translateY(-8px); } }
@keyframes chugliBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) {
  .splash-stage .chugli-mark, .chugli-mark .pupils, .chugli-mark .brows { animation: none; }
  .splash-stage .bubble, .splash-title, .splash-hint { animation: none; opacity: 1; }
  .biji-toast { animation: none; }
}
