/* ==========================================================================
   Mahabharat360 · Mystery Rooms — shared design system
   Night-temple palette: lamp gold on indigo-black. Mobile first.
   ========================================================================== */

:root {
  --bg: #0b0912;
  --bg-2: #131020;
  --bg-3: #1b1630;
  --bg-4: #241d3d;
  --line: rgba(243, 233, 214, 0.12);
  --line-2: rgba(243, 233, 214, 0.22);
  --text: #f3e9d6;
  --text-dim: #c3b8a4;
  --text-faint: #91877a;
  --gold: #e3a84a;
  --gold-2: #f6cf83;
  --gold-ink: #1a1206;
  --vermilion: #e5573d;
  --tulsi: #7cc48a;
  --accent: #2bb3a6;      /* overridden per game */
  --accent-2: #3d7be0;
  --accent-ink: #04201d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);
  --font-display: "Eczar", "Georgia", serif;
  --font-body: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--gold-2); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
p { margin: 0 0 0.8em; }
.kicker {
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 6px;
}
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 16px; text-decoration: none; letter-spacing: 0.01em;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); box-shadow: 0 8px 24px -10px rgba(227, 168, 74, 0.7); }
.btn-ghost { background: rgba(243, 233, 214, 0.06); border-color: var(--line-2); color: var(--text); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn-danger { background: var(--vermilion); color: #fff; }
.linkish { background: none; border: 0; padding: 6px 0; color: var(--text-faint); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Access code (shared by every game) ---------- */
.access { text-align: left; }
.access-label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.access-lock { color: var(--gold); display: inline-grid; }
.access-note { color: var(--text-faint); font-size: 14px; margin: 0 0 10px; }
.access-row { display: flex; gap: 8px; }
.access-row .input { flex: 1; min-width: 0; }
.access-row .btn { flex: none; padding: 0 22px; }
.dice-btn { min-height: 52px; padding: 0 16px !important; }
.dice-btn span { display: inline-block; font-size: 20px; }
.dice-btn.roll span { animation: roll 0.5s ease; }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(200deg) scale(1.25); } 100% { transform: rotate(360deg) scale(1); } }
.input.flash { animation: flash 0.6s ease; }
@keyframes flash { 0% { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(227, 168, 74, 0.35); } 100% { box-shadow: 0 0 0 0 rgba(227, 168, 74, 0); } }
.access-input { text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; }
.access-input::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; }
.access .feedback { text-align: left; margin-top: 8px; }
.cover-actions .access { padding: 14px; border-radius: 16px; background: rgba(11, 9, 18, 0.72); border: 1px solid var(--line-2); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14.5px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px;
  background: transparent; border: 1px solid var(--line); color: var(--text);
}
.icon-btn svg { width: 22px; height: 22px; }

/* ==========================================================================
   HOME / LOBBY
   ========================================================================== */
.home { position: relative; isolation: isolate; }
.home::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(227, 168, 74, 0.14), transparent 60%),
    radial-gradient(50rem 40rem at -20% 30%, rgba(61, 123, 224, 0.10), transparent 60%),
    var(--bg);
}
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.site-head { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + var(--safe-t)) 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 38px; height: 38px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: 0.02em; line-height: 1; }
.brand-name b { color: var(--gold); font-weight: 700; }
.brand-sub { display: block; font-family: var(--font-body); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-faint); margin-top: 4px; font-weight: 700; }

.hero { padding: 36px 0 30px; display: grid; gap: 28px; align-items: center; }
.hero-mark { width: 132px; height: 132px; filter: drop-shadow(0 0 40px rgba(227, 168, 74, 0.35)); animation: spin 120s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero h1 { font-size: clamp(34px, 9vw, 60px); font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero-lede { font-size: 18px; color: var(--text-dim); max-width: 34em; margin-top: 14px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
@media (min-width: 820px) {
  .hero { grid-template-columns: 1fr auto; padding: 64px 0 48px; }
  .hero-mark { width: 220px; height: 220px; order: 2; }
}

.steps { display: grid; gap: 12px; margin: 8px 0 44px; padding: 0; list-style: none; counter-reset: s; }
.steps li {
  counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start;
  padding: 14px 16px; background: rgba(243, 233, 214, 0.035); border: 1px solid var(--line); border-radius: var(--radius);
}
.steps li::before {
  content: counter(s); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--gold); color: var(--gold); font-family: var(--font-display); font-weight: 700;
}
.steps b { display: block; font-size: 16.5px; }
.steps span { color: var(--text-dim); font-size: 15px; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .steps { grid-template-columns: repeat(4, 1fr); } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 26px; }

.games { display: grid; gap: 16px; margin-bottom: 56px; }
@media (min-width: 720px) { .games { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .games { grid-template-columns: repeat(3, 1fr); } }

.game-card {
  --c: var(--gold);
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px; border: 1px solid var(--line); background: var(--bg-2);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
a.game-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.game-art { position: relative; aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; }
.game-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 9, 18, 0) 30%, rgba(19, 16, 32, 1) 100%); }
.game-art .game-logo { position: absolute; left: 16px; bottom: -26px; width: 72px; height: 72px; z-index: 2; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)); }
.game-art .badge { position: absolute; top: 12px; right: 12px; z-index: 2; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(11, 9, 18, 0.72); border: 1px solid var(--line-2); color: var(--text-dim); backdrop-filter: blur(6px);
}
.badge.live { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.game-body { padding: 34px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.game-body .kicker { color: var(--c); }
.game-body h3 { font-size: 24px; }
.game-body p { color: var(--text-dim); font-size: 15.5px; margin: 4px 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-faint); font-size: 13.5px; font-weight: 500; margin-top: auto; padding-top: 8px; }
.meta span::before { content: "◆"; color: var(--c); font-size: 8px; margin-right: 6px; vertical-align: 2px; }
.game-card .btn { margin-top: 14px; }
.game-card.soon { opacity: 0.86; }
.game-card.soon .game-art { filter: saturate(0.75) brightness(0.85); }
.game-card.emblem .game-art .game-logo { left: 50%; top: 50%; bottom: auto; width: 112px; height: 112px; transform: translate(-50%, -50%); }
.game-card.emblem .game-art::after { background: linear-gradient(180deg, rgba(11, 9, 18, 0) 55%, rgba(19, 16, 32, 0.9) 100%); }
.game-card.emblem .game-body { padding-top: 18px; }
.lock-note { display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: 13px; font-weight: 500; margin-top: 10px; }

.occasions { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 18px 0 0; }
.occasions li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(243, 233, 214, 0.04); font-size: 14px; color: var(--text-dim); font-weight: 500; }
.section-title { flex-wrap: wrap; }
.section-title .faint { white-space: nowrap; }
.access .feedback:empty, .checkpoint .feedback:empty { min-height: 0; margin: 0; }
.section-lede { color: var(--text-dim); font-size: 15.5px; margin: -6px 0 16px; max-width: 46em; }
.badge.hosted { color: #fff; background: color-mix(in srgb, var(--c) 70%, #000); border-color: var(--c); }

.site-foot { border-top: 1px solid var(--line); padding: 24px 0 calc(28px + var(--safe-b)); color: var(--text-faint); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

/* ==========================================================================
   GAME SHELL
   ========================================================================== */
.game { min-height: 100vh; min-height: 100dvh; position: relative; isolation: isolate; }
.game::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(48rem 30rem at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    var(--bg);
}

/* ---------- Cover ---------- */
.cover { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.cover-bg { position: absolute; inset: 0; background: center / cover no-repeat; transform: scale(1.08); filter: blur(2px) brightness(0.5) saturate(1.1); z-index: -1; animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift { to { transform: scale(1.16) translate(-2%, 1%); } }
.cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(11, 9, 18, 0.35), rgba(11, 9, 18, 0.55) 40%, var(--bg) 92%); }
.cover-top { display: flex; justify-content: space-between; align-items: center; padding: calc(12px + var(--safe-t)) 16px 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); text-decoration: none; font-size: 14.5px; font-weight: 500; min-height: 44px; }
.cover-inner { margin-top: auto; padding: 24px 16px calc(28px + var(--safe-b)); width: 100%; max-width: 560px; align-self: center; text-align: center; }
.cover-logo { width: 124px; height: 124px; margin: 0 auto 16px; filter: drop-shadow(0 0 36px color-mix(in srgb, var(--accent) 50%, transparent)); }
.cover-title { font-size: clamp(38px, 11vw, 58px); font-weight: 700; }
.cover-tag { color: var(--text-dim); font-size: 17.5px; margin: 12px auto 18px; max-width: 28em; }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 0 0 24px; }
.chips li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(11, 9, 18, 0.5); font-size: 13.5px; color: var(--text-dim); font-weight: 500; }
.cover-actions { display: grid; gap: 10px; }
.resume-note { font-size: 13.5px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Brief ---------- */
.brief { max-width: 620px; margin: 0 auto; padding: calc(20px + var(--safe-t)) 16px calc(32px + var(--safe-b)); }
.brief h1 { font-size: clamp(30px, 8vw, 42px); margin-bottom: 14px; }
.brief .story p { font-size: 17.5px; color: var(--text-dim); }
.brief .story p:first-child::first-letter { font-family: var(--font-display); font-size: 3.1em; float: left; line-height: 0.9; margin: 6px 8px 0 0; color: var(--gold); }
.role { margin: 18px 0; padding: 14px 16px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 0 12px 12px 0; }
.rules { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 10px; }
.rules li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; font-size: 15.5px; color: var(--text-dim); }
.rules li b { color: var(--text); }
.rules .ri { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-3); color: var(--gold); font-size: 15px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 14.5px; }
.input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font-size: 17px; outline: none;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 168, 74, 0.2); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 18px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; background: var(--bg-4); border: 1px solid var(--line-2); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text-dim); transition: transform 0.2s, background 0.2s; }
.switch[aria-checked="true"] { background: color-mix(in srgb, var(--gold) 35%, var(--bg-4)); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--gold-2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  background: rgba(11, 9, 18, 0.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .mini-logo { width: 34px; height: 34px; }
.where { min-width: 0; }
.where-label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.beads { display: flex; gap: 4px; margin-top: 4px; }
.bead { width: 100%; max-width: 22px; height: 5px; border-radius: 3px; background: var(--bg-4); }
.bead.done { background: var(--gold); }
.bead.now { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.bead.skip { background: var(--text-faint); }
.timer {
  font-family: var(--font-display); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums;
  padding: 6px 12px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line-2); min-width: 78px; text-align: center;
}
.timer.low { color: var(--gold-2); border-color: rgba(227, 168, 74, 0.5); }
.timer.over { color: #fff; background: var(--vermilion); border-color: var(--vermilion); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(229, 87, 61, 0.18); } }
/* "2 min used" under the clock. Hints are revealed inside the hint sheet (.overlay, z 80), so the pop
   sits above it (below toasts) on its own pill, readable over the dimmed page. */
.penalty-pop { position: fixed; top: calc(60px + var(--safe-t)); right: 16px; z-index: 88; padding: 4px 12px; border-radius: 999px; background: var(--bg-4); border: 1px solid color-mix(in srgb, var(--vermilion) 45%, transparent); font-weight: 700; color: var(--vermilion); animation: rise 1.6s ease forwards; pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-18px); } }

/* ---------- Room layout ---------- */
.room { max-width: 1180px; margin: 0 auto; padding: 14px 16px calc(40px + var(--safe-b)); display: grid; gap: 18px; }
@media (min-width: 960px) {
  .room { grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); align-items: start; gap: 26px; padding-top: 22px; }
  .room .col-lock { position: sticky; top: 84px; }
}
.col-scene, .col-lock { display: grid; gap: 14px; min-width: 0; }

.scene { position: relative; margin: 0; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); box-shadow: var(--shadow); }
.scene-stage { position: relative; }
/* portrait posters: centred, height-capped, over a soft blurred copy of themselves */
.scene.portrait { isolation: isolate; }
.scene.portrait .scene-stage { margin: 0 auto; z-index: 1; }
.scene-backdrop { position: absolute; inset: 0; background: center / cover no-repeat; filter: blur(26px) brightness(0.45) saturate(1.1); transform: scale(1.15); z-index: 0; }
.scene-stage img { width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.scene-caption {
  padding: 10px 14px 12px; margin: 0; background: #07060c; border-top: 1px solid var(--line);
  font-family: var(--font-display); font-size: clamp(14px, 3.8vw, 18px); line-height: 1.4; text-align: center; color: #f7eedd;
}
.placeholder-tag { position: absolute; top: 8px; left: 8px; z-index: 3; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); color: var(--text-faint); }

.hotspot {
  position: absolute; z-index: 2; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center;
}
.hotspot::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, var(--gold-2) 40%, rgba(246, 207, 131, 0) 72%);
  box-shadow: 0 0 14px 4px rgba(246, 207, 131, 0.55);
  animation: glint 2.4s ease-in-out infinite;
}
.hotspot::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px solid rgba(246, 207, 131, 0.65); animation: ring 2.4s ease-out infinite; }
.hotspot.found::before { animation: none; width: 18px; height: 18px; background: rgba(11, 9, 18, 0.75); box-shadow: 0 0 0 1.5px var(--tulsi); }
.hotspot.found::after { content: "✓"; inset: auto; border: 0; color: var(--tulsi); font-size: 12px; font-weight: 700; animation: none; }
@keyframes glint { 0%, 100% { transform: scale(0.8); opacity: 0.75; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes ring { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(1.4); opacity: 0; } }
/* The suggested next spark: the same spark, about a quarter bigger, with a faster pulse that draws the eye.
   (The big spotlight appears only when the player asks the guide "Show me where to tap".) */
.hotspot.next { z-index: 3; }
.hotspot.next::before { width: 17px; height: 17px; animation-duration: 1.5s; }
.hotspot.next::after { border-color: rgba(246, 207, 131, 0.85); animation: ring-next 1.5s ease-out infinite; }
.hs-wave { display: none; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px solid rgba(246, 207, 131, 0.7); pointer-events: none; }
.hotspot.next .hs-wave { display: block; animation: ring-next 1.5s ease-out 0.75s infinite; }
.hotspot.next .hs-wave + .hs-wave { display: none; }
@keyframes ring-next { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(1.75); opacity: 0; } }

.scene-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.scene-tools .btn { flex: 1; min-width: 140px; }
.count-pill { font-variant-numeric: tabular-nums; color: var(--gold-2); }

.story-card h1 { font-size: clamp(28px, 7.4vw, 40px); }
.story-card .sanskrit { font-family: var(--font-display); color: var(--accent); font-size: 17px; margin: 4px 0 10px; }
.story-card .intro { color: var(--text-dim); font-size: 17px; }
.story-card .intro p:last-child { margin: 0; }

.lock-card {
  position: relative; border-radius: 20px; padding: 18px 16px 16px; background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.lock-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.8; }
.lock-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lock-head .lk { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(227, 168, 74, 0.12); color: var(--gold); flex: none; }
.lock-head h2 { font-size: 21px; }
.lock-prompt { color: var(--text-dim); font-size: 16px; margin-bottom: 14px; }
.lock-prompt b { color: var(--text); }
.feedback { min-height: 24px; margin-top: 12px; font-weight: 500; font-size: 15.5px; text-align: center; }
.feedback.bad { color: #ff8a73; }
.feedback.near { color: var(--gold-2); }
.feedback.good { color: var(--tulsi); }
.shake { animation: shake 0.45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-7px); } }
.alarm-flash { position: fixed; inset: 0; z-index: 85; pointer-events: none; background: radial-gradient(circle, transparent 40%, rgba(229, 87, 61, 0.45)); animation: flash 0.6s ease forwards; }
.alarm-flash.lightning { background: rgba(220, 230, 255, 0.55); animation: flash 0.5s steps(3) forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.hint-row { display: flex; gap: 8px; }
.hint-row .btn { flex: 1; }

/* ---------- Puzzle widgets ---------- */
.pz-actions { display: flex; gap: 8px; margin-top: 14px; }
.pz-actions .btn { flex: 1; padding: 0 14px; }
.pz-actions .btn-primary { flex: 2; }
.pz-text { display: grid; gap: 10px; }
.pz-text .input { text-align: center; font-family: var(--font-display); font-size: 21px; letter-spacing: 0.06em; }

/* dials */
.dials { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 8px; }
.dial { display: grid; gap: 6px; justify-items: center; text-align: center; }
.dial-label { font-family: var(--font-display); font-weight: 700; color: var(--gold); font-size: 18px; }
.dial-face {
  width: 100%; aspect-ratio: 1; max-width: 92px; border-radius: 50%;
  border: 2px solid var(--line-2); background: radial-gradient(circle at 35% 30%, var(--bg-4), var(--bg)); display: grid; place-items: center;
  font-size: 32px; box-shadow: inset 0 -6px 14px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.4); transition: transform 0.25s ease, border-color 0.2s;
}
.dial-face.set { border-color: var(--gold); }
.dial-face .q { font-family: var(--font-display); color: var(--text-faint); font-size: 30px; }
.dial-name { font-size: 13px; color: var(--text-dim); min-height: 1.4em; font-weight: 500; }

/* tiles (sequence) */
.tiles { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
.tile {
  position: relative; min-height: 76px; padding: 10px 6px; border-radius: 14px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--bg-4), var(--bg-3)); display: grid; place-items: center; gap: 4px; text-align: center;
  transition: transform 0.12s ease, border-color 0.2s, background 0.2s;
}
.tile:active { transform: scale(0.96); }
.tile .glyph { font-size: 26px; line-height: 1; }
.tile .glyph svg { width: 40px; height: 40px; }
.tile .tl { font-size: 13px; font-weight: 700; line-height: 1.2; }
.tile .ts { font-size: 11.5px; color: var(--text-faint); line-height: 1.2; }
.tile.picked { border-color: var(--gold); background: linear-gradient(180deg, rgba(227, 168, 74, 0.22), rgba(227, 168, 74, 0.06)); }
.tile .order { position: absolute; top: 5px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
/* pick (choose N tiles): a tick instead of an order number; "stones" show one big word each */
.pick-tiles .tile .order { font-size: 13px; }
.pick-tiles.stones .tile { min-height: 64px; border-radius: 22px 18px 24px 16px; background: linear-gradient(170deg, #4a4339, #2c2722); border-color: rgba(243, 233, 214, 0.18); }
.pick-tiles.stones .tile .tl { font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: 0.02em; color: #f1e4c8; }
.pick-tiles.stones .tile.picked { background: linear-gradient(170deg, #6b5a35, #3b3122); border-color: var(--gold); }
.pick-tiles.cards .tile { min-height: 64px; padding: 10px; }
.pick-tiles.cards .tile .tl { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.seq-track { display: flex; justify-content: center; gap: 6px; margin: 2px 0 12px; }
.seq-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-4); border: 1px solid var(--line-2); }
.seq-dot.on { background: var(--gold); border-color: var(--gold); }

/* stars */
.starfield { border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: radial-gradient(ellipse at 50% 120%, #1a2350, #070814 70%); touch-action: manipulation; }
.starfield svg { width: 100%; height: auto; }
.star-hit { cursor: pointer; fill: transparent; }
.star-core { transition: r 0.15s ease; pointer-events: none; }
.star-ring { fill: none; stroke: var(--gold-2); stroke-width: 1.6; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.star.on .star-ring { opacity: 1; }
.pick-count { text-align: center; color: var(--text-dim); font-size: 14.5px; margin-top: 10px; font-variant-numeric: tabular-nums; }

/* path grid */
.corridor { border-radius: 14px; border: 1px solid var(--line-2); overflow: hidden; background: linear-gradient(180deg, #0d0b18, #17122a); }
.corridor-end { text-align: center; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); padding: 8px; font-weight: 700; }
.lane-row { display: grid; grid-template-columns: 34px repeat(var(--lanes, 5), minmax(0, 1fr)); gap: 6px; padding: 4px 8px; align-items: center; }
.lane-row .step-no { font-size: 11.5px; color: var(--text-faint); text-align: center; font-weight: 700; line-height: 1.1; }
.lane-tile {
  min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: rgba(243, 233, 214, 0.04);
  font-family: var(--font-display); font-size: 16px; font-weight: 600; position: relative; transition: background 0.2s, border-color 0.2s;
}
.lane-tile.has-glyph { display: grid; place-items: center; align-content: center; gap: 1px; padding: 4px 2px; }
.lane-tile .lg { font-size: 17px; line-height: 1; }
.lane-tile .ll { font-size: 14.5px; line-height: 1.1; letter-spacing: 0.04em; }
.corridor.alarm { animation: alarm 0.9s ease-out; }
@keyframes alarm { 0%, 40% { box-shadow: 0 0 0 2px var(--vermilion), 0 0 30px rgba(229, 87, 61, 0.6); background-color: rgba(229, 87, 61, 0.18); } 100% { box-shadow: none; } }
.lane-tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 28%, transparent); }
.lane-tile.on::after {
  content: ""; position: absolute; top: -13px; right: -9px; width: 30px; height: 30px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg fill='%23ffd36b' stroke='%233a2400' stroke-width='.9'%3E%3Cellipse cx='10' cy='21' rx='4.6' ry='7.2' transform='rotate(-12 10 21)'/%3E%3Ccircle cx='5.8' cy='11.6' r='1.5'/%3E%3Ccircle cx='8.2' cy='10.2' r='1.8'/%3E%3Ccircle cx='11.1' cy='10' r='1.6'/%3E%3Ccircle cx='13.6' cy='11' r='1.3'/%3E%3Cellipse cx='22' cy='14' rx='4.6' ry='7.2' transform='rotate(12 22 14)'/%3E%3Ccircle cx='18.4' cy='4.4' r='1.3'/%3E%3Ccircle cx='20.9' cy='3.2' r='1.6'/%3E%3Ccircle cx='23.8' cy='3.2' r='1.8'/%3E%3Ccircle cx='26.3' cy='4.6' r='1.5'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(255, 211, 107, 0.85)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9));
  animation: step-in 0.25s ease-out;
}
@keyframes step-in { from { transform: scale(0.4); opacity: 0; } }
.lane-wall { display: grid; grid-template-columns: 34px 1fr; padding: 0 8px; font-size: 11px; color: var(--text-faint); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }

/* bins */
.tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 14px; border: 1px dashed var(--line-2); min-height: 62px; align-items: center; justify-content: center; margin-bottom: 12px; }
.tray-empty { color: var(--text-faint); font-size: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px 6px 10px; border-radius: 999px;
  background: var(--bg-4); border: 1px solid var(--line-2); font-weight: 600; font-size: 15px; line-height: 1.2; text-align: left;
}
.chip .cg { font-size: 20px; }
.chip.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 168, 74, 0.25); background: rgba(227, 168, 74, 0.16); }
.bins { display: grid; gap: 10px; }
.bins.two { grid-template-columns: 1fr 1fr; }
.bin { border-radius: 14px; border: 1px solid var(--line-2); background: rgba(243, 233, 214, 0.03); padding: 10px; display: grid; gap: 8px; align-content: start; text-align: left; transition: border-color 0.2s, background 0.2s; }
.bin.target { border-color: var(--gold); background: rgba(227, 168, 74, 0.07); }
.bin-head { display: flex; gap: 10px; align-items: flex-start; }
.bin-head .bg { font-size: 24px; line-height: 1; }
.bin-title { font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.bin-sub { font-size: 13.5px; color: var(--text-dim); line-height: 1.35; }
.bin-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-empty { min-height: 44px; flex: 1; border-radius: 999px; border: 1px dashed var(--line-2); color: var(--text-faint); font-size: 13px; display: grid; place-items: center; padding: 0 10px; background: transparent; }

/* shards */
.shards { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 8px; }
.shard {
  min-height: 64px; padding: 10px 12px; border: 1px solid rgba(190, 210, 255, 0.35); color: #eaf0ff;
  background: linear-gradient(135deg, rgba(200, 220, 255, 0.22), rgba(120, 140, 200, 0.08) 45%, rgba(220, 230, 255, 0.18));
  font-family: var(--font-display); font-size: 16.5px; line-height: 1.2; text-align: center;
  clip-path: polygon(0 8%, 92% 0, 100% 78%, 86% 100%, 4% 94%);
  transition: transform 0.25s ease, background 0.2s;
}
.shard:nth-child(2n) { clip-path: polygon(6% 0, 100% 10%, 96% 100%, 0 88%); }
.shard:nth-child(3n) { clip-path: polygon(0 0, 100% 4%, 94% 92%, 10% 100%); }
.shard .sx { display: inline-block; transition: transform 0.3s ease; }
.shard.mir .sx { transform: scaleX(-1); }
.shard.sel { background: linear-gradient(135deg, rgba(246, 207, 131, 0.45), rgba(246, 207, 131, 0.12)); border-color: var(--gold); }
.shard-no { display: block; font-family: var(--font-body); font-size: 10.5px; color: rgba(234, 240, 255, 0.55); letter-spacing: 0.1em; margin-bottom: 2px; }

/* keypad */
.code-slots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.code-slot { width: 42px; height: 54px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); display: grid; place-items: center; font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--gold-2); }
.code-slot.cur { border-color: var(--gold); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; margin: 0 auto; }
.key { min-height: 56px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg-4); font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.key:active { background: var(--bg-3); transform: scale(0.97); }
.key.go { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-size: 17px; font-family: var(--font-body); font-weight: 700; }

/* numbers ledger */
.ledger { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ledger-item { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.ledger-num { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--gold-2); text-align: center; line-height: 1; }
.ledger-num small { display: block; font-size: 12px; color: var(--text-faint); font-weight: 600; margin-top: 2px; }
.ledger-t { font-size: 13.5px; line-height: 1.25; color: var(--text-dim); }
.ledger-item.missing { opacity: 0.45; }

/* riddle */
.riddle { font-family: var(--font-display); font-size: 17.5px; line-height: 1.5; color: var(--text); padding: 14px 16px; border-radius: 14px; background: rgba(243, 233, 214, 0.04); border: 1px solid var(--line); margin-bottom: 14px; white-space: pre-line; }

/* ---------- Sheet / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; background: rgba(5, 4, 10, 0.66); backdrop-filter: blur(3px); animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 620px; max-height: 88vh; max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + var(--safe-b)); box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6); animation: up 0.28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 720px) { .overlay { align-items: center; } .sheet { border-radius: 22px; border-bottom: 1px solid var(--line-2); } }
.sheet-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sheet-head h2 { font-size: 23px; }
.sheet-body { color: var(--text-dim); font-size: 16.5px; }
.sheet-body p { white-space: pre-line; }
.sheet-body h3 { color: var(--text); font-size: 17px; margin: 16px 0 6px; }
.sheet .btn { margin-top: 8px; }
.clue-seal { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; background: rgba(227, 168, 74, 0.12); border: 1px solid rgba(227, 168, 74, 0.3); margin-bottom: 10px; }
.quote { font-family: var(--font-display); font-size: 18px; color: var(--text); border-left: 3px solid var(--gold); padding: 4px 0 4px 14px; margin: 8px 0 14px; white-space: pre-line; }
.journal-room { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.journal-clue { padding: 10px 12px; border-radius: 12px; background: var(--bg-3); margin: 8px 0; }
.journal-clue b { color: var(--text); display: block; font-size: 15px; }
.journal-clue span { font-size: 14.5px; white-space: pre-line; }
.menu-list { display: grid; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); text-align: left; width: 100%; font-size: 16px; font-weight: 600; text-decoration: none; color: var(--text); }
.menu-item .mi { width: 26px; text-align: center; font-size: 18px; }
.menu-item .mv { margin-left: auto; color: var(--text-faint); font-weight: 500; font-size: 14px; }
.hint-box { padding: 12px 14px; border-radius: 12px; background: rgba(227, 168, 74, 0.08); border: 1px solid rgba(227, 168, 74, 0.25); color: var(--text); margin: 8px 0; }
.hint-box b { color: var(--gold-2); display: block; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2px; }

/* success modal */
.modal { width: calc(100% - 32px); max-width: 460px; margin: auto; text-align: center; padding: 26px 22px 22px; border-radius: 24px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 22%, var(--bg-2)), var(--bg-2) 70%); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: pop 0.4s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }
.overlay.center { align-items: center; }
.big-num { font-family: var(--font-display); font-weight: 700; font-size: 84px; line-height: 1; color: var(--gold-2); text-shadow: 0 0 40px rgba(246, 207, 131, 0.55); margin: 6px 0 2px; }
.big-num small { font-size: 26px; color: var(--text-dim); margin-left: 10px; vertical-align: 14px; }
.modal h2 { font-size: 26px; margin: 8px 0 10px; }
.modal p { color: var(--text-dim); }
.num-meaning { font-size: 14.5px; color: var(--gold-2); margin-bottom: 18px; }

/* explore */
.explore { position: fixed; inset: 0; z-index: 75; background: #000; display: grid; grid-template-rows: auto 1fr auto; }
.explore-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(0, 0, 0, 0.7); }
.explore-bar .t { font-weight: 700; font-size: 15px; }
.explore-scroll { overflow: auto; overscroll-behavior: contain; display: flex; align-items: center; -webkit-overflow-scrolling: touch; }
.explore-scroll .scene-stage { height: calc(var(--z, 1) * 100%); flex: none; margin: auto; }
.explore-scroll .scene-stage img { height: 100%; width: auto; max-width: none; }
.explore-foot { padding: 8px 12px calc(10px + var(--safe-b)); text-align: center; font-size: 13.5px; color: var(--text-faint); background: rgba(0, 0, 0, 0.7); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); z-index: 90; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--bg-4); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600; font-size: 15px; animation: up 0.25s ease; }

/* ---------- Ending ---------- */
.ending { max-width: 720px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 16px calc(40px + var(--safe-b)); text-align: center; }
.ending-lotus { width: min(330px, 86vw); margin: 0 auto 8px; }
.ending-lotus .petal { transition: fill 0.6s ease, opacity 0.6s; }
.ending-art { display: block; width: 100%; height: auto; margin: 0 auto 10px; border-radius: 18px; border: 1px solid rgba(227, 168, 74, 0.35); box-shadow: var(--shadow); }
.ending h1 { font-size: clamp(32px, 9vw, 50px); margin: 8px 0 14px; }
.scroll-msg { font-family: var(--font-display); font-size: 20px; line-height: 1.5; color: var(--gold-2); margin: 10px auto 22px; max-width: 30em; }
.cert { text-align: left; margin: 20px 0; padding: 18px; border-radius: 20px; border: 1px solid rgba(227, 168, 74, 0.4); background: linear-gradient(160deg, rgba(227, 168, 74, 0.12), rgba(19, 16, 32, 0.9) 60%); }
.cert-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cert-head img { width: 54px; height: 54px; }
.cert-team { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.1; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 10px; border-radius: 12px; background: rgba(11, 9, 18, 0.55); text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: 24px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.meanings { text-align: left; display: grid; gap: 6px; margin: 18px 0; }
.meaning { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 15px; color: var(--text-dim); }
.meaning b { font-family: var(--font-display); font-size: 22px; color: var(--gold-2); text-align: center; }
.end-actions { display: grid; gap: 10px; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   HOSTED GAME PAGE (live games run by a Game Master)
   ========================================================================== */
.hosted-wrap { max-width: 1100px; margin: 0 auto; padding: calc(4px + var(--safe-t)) 16px calc(40px + var(--safe-b)); }
.hosted-top { display: flex; justify-content: space-between; align-items: center; }
.hosted-hero { text-align: center; padding: 8px 0 22px; max-width: 640px; margin: 0 auto; }
.hosted-hero h1 { font-size: clamp(32px, 9vw, 52px); font-weight: 700; }
.hosted-hero .kicker { color: var(--accent); }
.hosted-hero .cover-logo { width: 112px; height: 112px; }
.hosted-hero .chips { margin-bottom: 0; }
.hosted-grid { display: grid; gap: 16px; }
.hosted-main { display: grid; gap: 16px; align-content: start; }
@media (min-width: 900px) {
  .hosted-grid { grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); align-items: start; gap: 24px; }
  .hosted-side { order: 2; position: sticky; top: 20px; }
}
.hosted-card { border-radius: 20px; padding: 18px; background: var(--bg-2); border: 1px solid var(--line); }
.hosted-story p { color: var(--text-dim); font-size: 17px; }
.hosted-story p:first-child { color: var(--text); font-size: 18px; }
.hosted-punch { font-family: var(--font-display); font-size: 20px; color: var(--gold-2); margin: 4px 0 0; }
.hosted-card .rules { margin: 8px 0 0; }
.hosted-card.book { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 16%, var(--bg-2)), var(--bg-2) 70%); }
.hosted-card.book h2 { font-size: 22px; margin-bottom: 6px; }
.hosted-card.book p { color: var(--text-dim); }
.checkpoint .field { margin-bottom: 0; }
.envelope { margin-top: 14px; padding: 16px; border-radius: 16px; text-align: center; border: 1px dashed rgba(227, 168, 74, 0.6); background: rgba(227, 168, 74, 0.08); animation: up 0.3s ease; }
.envelope p { margin: 0 0 4px; color: var(--text-dim); }
.envelope-yay { font-weight: 700; color: var(--tulsi) !important; font-size: 16.5px; }
.envelope-code { font-family: var(--font-display); font-size: clamp(28px, 8vw, 36px); font-weight: 700; letter-spacing: 0.06em; color: var(--gold-2); margin-top: 4px; }
.unlocked-list { margin-top: 14px; }
.unlocked-list:empty { display: none; }
.chips.left { justify-content: flex-start; margin-bottom: 4px; }
.chips.left li { color: var(--tulsi); border-color: rgba(124, 196, 138, 0.35); }

/* ---------- Revisiting opened chambers ---------- */
button.where { background: none; border: 0; padding: 4px 6px; margin: -4px -6px; border-radius: 10px; text-align: left; color: inherit; font: inherit; cursor: pointer; min-width: 0; }
button.where:hover .where-label, button.where:focus-visible .where-label { color: var(--text); }
.where-caret { opacity: 0.6; }
.bead.view { box-shadow: 0 0 0 2px var(--gold-2); }
.menu-item.locked { opacity: 0.45; cursor: default; }
.review-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); border: 1px solid var(--line-2); }
.review-bar p { margin: 0; flex: 1; min-width: 0; font-size: 14.5px; color: var(--text-dim); }
.review-bar p b { color: var(--text); }
.review-bar .btn-sm { flex: none; min-width: 40px; }
@media (max-width: 560px) { .review-bar p { flex-basis: calc(100% - 100px); order: -1; } .review-bar .btn-primary { flex: 1; } }
.review-card { text-align: center; }
.review-card .lock-head { justify-content: center; }
.review-card h3 { font-size: 20px; margin: 4px 0 8px; }
.review-text p { color: var(--text-dim); font-size: 15.5px; }

/* ==========================================================================
   CHALLENGE-CHAIN GAMES (m360-challenge.js), e.g. Surprise Birthday Party Challenge
   ========================================================================== */
.cg-i { display: inline-grid; place-items: center; line-height: 0; }
.bd-ic { display: block; flex: none; }
.cg-sound { gap: 6px; }
.cover.cg-cover .cover-bg { filter: brightness(0.62) saturate(1.1); transform: scale(1.04); }
.cover.cg-cover::after { background: linear-gradient(180deg, rgba(11, 9, 18, 0.15), rgba(11, 9, 18, 0.45) 38%, var(--bg) 90%); }
.cg-credit { font-size: 13.5px; color: var(--text-faint); margin: 14px 0 0; }
.cg-credit a { color: var(--text-dim); }

/* brief + warm-up */
.cg-rules .ri { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-3)); }
.cg-start { margin-top: 18px; }
.cg-warmup { margin-top: 18px; }
.cg-qa { margin: 0 0 6px; color: var(--text-dim); }
.cg-qa b { color: var(--gold-2); font-family: var(--font-display); }
.cg-warmup .lock-prompt { margin-top: 10px; }
.cg-warmup .lock-prompt code { font-family: var(--font-display); font-weight: 700; color: var(--text); background: var(--bg-4); padding: 1px 8px; border-radius: 6px; letter-spacing: 0.04em; }

/* a challenge */
.cg-kicker { display: flex; align-items: center; gap: 7px; color: var(--accent); }
.cg-figure { margin: 0; border-radius: var(--radius); overflow: hidden; background: #120a1f; border: 1px solid var(--line); box-shadow: var(--shadow); }
.cg-art svg { width: 100%; height: auto; }
.cg-extra { display: grid; gap: 8px; }
.cg-cta { gap: 10px; }
.cg-note { font-size: 14px; color: var(--text-faint); margin: 0; text-align: center; }
.cg-tools .btn { gap: 8px; }

/* answer slots */
.cg-slots { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 12px; margin: 4px 0 14px; cursor: text; }
.cg-grp { display: inline-flex; gap: 4px; }
.cg-prefix { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--text-dim); margin-right: -4px; }
.cg-slot {
  width: 30px; height: 40px; display: grid; place-items: center; border-radius: 8px;
  background: rgba(11, 9, 18, 0.55); border: 1px solid var(--line-2); border-bottom: 3px solid var(--line-2);
  font-family: var(--font-display); font-weight: 700; font-size: 21px; text-transform: uppercase; color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.cg-slots.some { gap: 6px 8px; }
.cg-slots.some .cg-slot { width: 23px; height: 34px; font-size: 18px; border-radius: 7px; }
.cg-slots.many { gap: 6px 8px; }
.cg-slots.many .cg-slot { width: 20px; height: 31px; font-size: 16px; border-radius: 6px; }
.cg-grp { gap: 3px; }
.cg-slot.ghost { color: var(--text-faint); }
.cg-slot.on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); border-bottom-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)); animation: slot-in 0.18s ease; }
.cg-slots.focus .cg-slot.cur { border-bottom-color: var(--gold-2); box-shadow: 0 6px 14px -8px var(--gold); }
.cg-slots.over .cg-slot.on { border-bottom-color: var(--vermilion); }
@keyframes slot-in { from { transform: translateY(-3px); } }

/* success modal + passwords */
.cg-badge { width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 24px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(145deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 30px -12px var(--accent); animation: badge 0.6s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes badge { from { transform: scale(0.4) rotate(-20deg); opacity: 0; } }
.cg-pwline { color: var(--text-dim); margin: 0 0 12px; }
.cg-pw { display: inline-block; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.04em; color: var(--text); background: var(--bg-4); border: 1px solid var(--line-2); padding: 1px 10px; border-radius: 8px; word-break: break-all; }

/* party plan */
.cg-plan { display: grid; gap: 6px; }
.cg-plan-item { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 12px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); text-align: left; width: 100%; color: var(--text); }
.cg-plan-item .mv { margin-left: auto; color: var(--text-faint); font-size: 14px; }
.cg-plan-item .cg-pw { margin-left: auto; font-size: 14.5px; }
.cg-plan-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--bg-4); color: var(--text-faint); }
.cg-plan-item.done .cg-plan-ic { background: color-mix(in srgb, var(--accent) 22%, var(--bg-3)); color: var(--accent); }
.cg-plan-item.now { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.cg-plan-item.now .cg-plan-ic { background: var(--accent); color: var(--accent-ink); }
.cg-plan-item.todo { opacity: 0.6; }
.cg-plan-t { display: grid; line-height: 1.2; min-width: 0; }
.cg-plan-t b { font-size: 15.5px; }
.cg-plan-t small { font-size: 12.5px; color: var(--text-faint); }
button.cg-plan-item:active { transform: scale(0.99); }

/* hints with pictures */
.cg-hint-t { display: block; white-space: pre-line; }
.cg-hint-art { margin-top: 10px; border-radius: 10px; overflow: hidden; }
.cg-hint-art svg { width: 100%; height: auto; }

/* full-screen views: zoom, scribble pad, book */
.cg-full-tools { display: flex; gap: 6px; align-items: center; }
.cg-zoom { display: block; }
.cg-zoom-art { width: calc(var(--z, 1) * 100%); max-width: none; margin: 0 auto; }
.cg-zoom-art svg { width: 100%; height: auto; max-width: none; }
@media (min-width: 720px) { .cg-zoom-art { width: calc(var(--z, 1) * min(100%, 900px)); } }
.cg-pad { position: relative; overflow: hidden; display: grid; place-items: center; background: #0d0a16; touch-action: none; }
.cg-pad-stage { position: relative; }
.cg-pad-stage.blank { background: #fbf7ee; border-radius: 10px; }
.cg-pad-art { position: absolute; inset: 0; opacity: 0.85; }
.cg-pad-art svg { width: 100%; height: 100%; }
.cg-pad-canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.cg-pad-foot { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.cg-inks { display: flex; gap: 6px; }
.cg-ink { width: 27px; height: 27px; border-radius: 50%; background: var(--ink); border: 3px solid transparent; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.cg-ink.on { border-color: #0d0a16; box-shadow: 0 0 0 2px var(--ink); }
/* the PDF book */
.cg-pdf { position: relative; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 10px; background: radial-gradient(circle at 50% 30%, #2a1d3d, #0b0812); }
.cg-pdf-sheet { width: max-content; margin: 0 auto; }
.cg-pdf-page { display: block; max-width: none; background: #fff; border-radius: 4px; box-shadow: 0 20px 50px -18px #000; }
.cg-pdf-msg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; color: var(--text-dim); font-weight: 600; }
.cg-pdf-msg p { max-width: 26em; margin: 0; }
.cg-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cg-book-foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.cg-book-foot .icon-btn[disabled] { opacity: 0.3; }
.cg-pdf-jump { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; color: var(--text-dim); }
.cg-pdf-num { width: 74px; min-height: 42px; padding: 6px 8px; text-align: center; font-weight: 700; font-size: 17px; }

/* the song player */
.cg-audio { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--bg-3)), var(--bg-2)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.cg-play { width: 56px; height: 56px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(145deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 24px -10px var(--accent); }
.cg-play .bd-ic { margin-left: 2px; }
.cg-audio.on .cg-play { animation: pulse-acc 1.6s ease-in-out infinite; }
.cg-audio.on .cg-play .bd-ic { margin-left: 0; }
@keyframes pulse-acc { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent); } }
.cg-audio-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
.cg-audio-t { grid-column: 1 / -1; display: grid; line-height: 1.25; min-width: 0; }
.cg-audio-t b { color: var(--text); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-audio-t span { color: var(--text-faint); font-size: 13px; }
.cg-time { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cg-seek { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; }
.cg-seek::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--bg-4) var(--p, 0%)); }
.cg-seek::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--bg-4) var(--p, 0%)); }
.cg-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.cg-seek::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }

/* a song played from its owner's YouTube video. min-height: YouTube asks for a player of at least 200px.
   Through the 16:9 ratio that height would demand a 356px width, so the column is capped (minmax) and
   the frame letterboxes instead of pushing past the card on narrow phones. */
.cg-video { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--bg-3)), var(--bg-2)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.cg-video-t { display: grid; line-height: 1.25; padding: 0 2px; }
.cg-video-t b { color: var(--text); font-size: 16px; }
.cg-video-t span { color: var(--text-faint); font-size: 13px; }
.cg-video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; border-radius: 12px; overflow: hidden; background: #000; }
.cg-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cg-credit { margin: 0; padding: 0 2px; color: var(--text-faint); font-size: 12.5px; line-height: 1.45; }
.cg-credit a { color: var(--accent); font-weight: 700; }

/* the celebration */
.cg-ending h1 { font-size: clamp(40px, 12vw, 64px); background: linear-gradient(90deg, var(--gold-2), #ff9cc9, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cg-cake { width: min(360px, 86vw); margin: 0 auto 6px; }
.cg-cake svg { width: 100%; height: auto; }
.bd-cake .ck-flame { transform-box: fill-box; transform-origin: 50% 90%; animation: flicker 1.4s ease-in-out infinite alternate; transition: opacity 0.5s ease; }
.bd-cake .ck-candle:nth-child(2n) .ck-flame { animation-duration: 1.1s; }
.bd-cake .ck-smoke { opacity: 0; }
.cg-cake.blown .ck-flame { opacity: 0; animation: none; }
.cg-cake.blown .ck-smoke { animation: smoke 2.4s ease-out forwards; }
@keyframes flicker { from { transform: scale(1, 1); } to { transform: scale(0.94, 1.06) translateY(-1px); } }
@keyframes smoke { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-26px); } }
.cg-blow { max-width: 420px; margin: 4px auto 20px; gap: 10px; }
.cg-blow[disabled] { opacity: 1; background: color-mix(in srgb, var(--accent) 30%, var(--bg-3)); color: var(--text); }
.cg-end-h { font-size: 24px; margin: 26px 0 10px; }
.cg-ending .cg-plan { text-align: left; }
.cg-ending .cg-plan-item.todo { opacity: 1; }
.cg-book-card { margin-top: 22px; text-align: left; }
.cg-book-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cg-confetti { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
.cg-menu .menu-item .mi { display: grid; place-items: center; color: var(--accent); }
/* ---------- Timer alerts: every 10 minutes (every 5 in the last quarter-hour) the clock glows, the screen edge flashes and a badge says what is left ---------- */
.timer[data-alert] { animation: timer-ping 1.1s ease-in-out 3; }
.timer[data-alert="urgent"] { animation-name: timer-ping-urgent; }
@keyframes timer-ping { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(246, 207, 131, 0); } 45% { transform: scale(1.14); color: var(--gold-2); border-color: var(--gold-2); box-shadow: 0 0 0 5px rgba(246, 207, 131, 0.25), 0 0 26px 6px rgba(246, 207, 131, 0.45); } }
@keyframes timer-ping-urgent { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 87, 61, 0); } 45% { transform: scale(1.16); color: #fff; background: var(--vermilion); border-color: var(--vermilion); box-shadow: 0 0 0 5px rgba(229, 87, 61, 0.3), 0 0 28px 8px rgba(229, 87, 61, 0.5); } }
.time-flash { position: fixed; inset: 0; z-index: 95; pointer-events: none; animation: time-flash 1.6s ease-out forwards; }
.time-flash.urgent { animation-name: time-flash-urgent; }
@keyframes time-flash { 0% { box-shadow: inset 0 0 0 0 rgba(246, 207, 131, 0); } 22% { box-shadow: inset 0 0 80px 16px rgba(246, 207, 131, 0.5); } 100% { box-shadow: inset 0 0 0 0 rgba(246, 207, 131, 0); } }
@keyframes time-flash-urgent { 0% { box-shadow: inset 0 0 0 0 rgba(229, 87, 61, 0); } 22% { box-shadow: inset 0 0 90px 20px rgba(229, 87, 61, 0.55); } 100% { box-shadow: inset 0 0 0 0 rgba(229, 87, 61, 0); } }
.time-badge { position: fixed; left: 50%; top: calc(66px + var(--safe-t)); z-index: 96; transform: translateX(-50%); padding: 8px 18px; border-radius: 999px; background: rgba(19, 16, 32, 0.95); border: 1px solid var(--gold-2); color: var(--gold-2); font: 700 15px/1.2 var(--font-body); letter-spacing: 0.03em; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); animation: time-badge 3.7s ease forwards; }
.time-badge.urgent { border-color: var(--vermilion); color: #ffc2b4; }
@keyframes time-badge { 0% { opacity: 0; transform: translate(-50%, -10px) scale(0.9); } 10%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -6px); } }
@media (prefers-reduced-motion: reduce) { .timer[data-alert] { animation: none; outline: 2px solid var(--gold-2); outline-offset: 2px; } .time-flash { display: none; } .time-badge { animation: none; } }
