/* Journey of the Union (/55). Arabic first: every rule uses logical properties so the
   same sheet serves RTL and LTR. */
:root {
  --night: #170a2e;
  --night-2: #24104a;
  --plum: #3a1c6e;
  --violet: #a855f7;      /* edcare purple, used sparingly */
  --gold: #f5c451;
  --gold-deep: #c8922a;
  --cream: #fff4dc;
  --lav: #cbbbe9;         /* quiet text on night */
  --red: #e5383f;
  --green: #14a35f;
  --ink: #15101d;
  --sand: #6f685f;        /* locked emirates */
  --sand-edge: #91887b;
  --bar-h: 56px;
  --display: 'Lalezar', 'Baloo Bhaijaan 2', system-ui, sans-serif;
  --body: 'Baloo Bhaijaan 2', system-ui, 'Segoe UI', Tahoma, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night);
  color: var(--cream);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.app {
  position: fixed; inset: 0; overflow: hidden;
  background:
    radial-gradient(120% 70% at 78% -10%, #4a2590 0%, transparent 60%),
    radial-gradient(90% 60% at 0% 100%, #2c1160 0%, transparent 65%),
    var(--night);
}
/* A scatter of stars, drawn once and never animated. */
.app::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 24%, var(--gold) 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 81% 28%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 92% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 47%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 62%, var(--gold) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 18% 78%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 88%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 71% 71%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 93%, #fff 50%, transparent 51%);
}

/* ---------- Stage and map ---------- */
.stage { position: absolute; inset: 0; z-index: 0; isolation: isolate; }
.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.map path { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
/* The symbolic map: an empty tile is a dashed outline, a reached tile is filled with its own colour. */
.em-halo { fill: none; stroke: rgba(168, 85, 247, .22); stroke-width: 20; }
.em-base { fill: rgba(203, 187, 233, .1); stroke: rgba(255, 244, 220, .5); stroke-width: 1.6; stroke-dasharray: 5 6; }
.em-lit { stroke: var(--night); stroke-width: 5; }
.em-hit { fill: transparent; stroke: none; cursor: pointer; }
.route-base { fill: none; stroke: rgba(255, 244, 220, .35); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
.route-done { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }

.markers { position: absolute; inset: 0; pointer-events: none; }
.mk {
  position: absolute; inset-block-start: 0; left: 0; width: 0; height: 0; pointer-events: auto;
}
.mk__dot {
  position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold); border: 2.5px solid var(--ink);
}
.mk::after { content: ''; position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; }
.mk--locked .mk__dot { background: transparent; border-color: rgba(255, 244, 220, .55); left: -5px; top: -5px; width: 10px; height: 10px; border-width: 2px; }
.mk--done .mk__dot { left: -14px; top: -14px; width: 28px; height: 28px; display: grid; place-items: center; background: #fff; border: 3px solid var(--ink); color: #0a6a3c; box-shadow: 0 3px 0 rgba(21, 16, 29, .5); animation: none; }
.mk--done .mk__dot .glyph { width: 17px; height: 17px; }
.mk--current .mk__dot { box-shadow: 0 0 0 0 rgba(245, 196, 81, .7); animation: pulse 1.8s ease-out infinite; }
.mk__pin {
  position: absolute; left: -27px; top: -68px; width: 54px; height: 54px; border-radius: 50%;
  display: none; place-items: center; color: var(--ink);
  background: var(--gold); border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--cream);
}
.mk__pin::after {
  content: ''; position: absolute; left: 50%; bottom: -12px; width: 14px; height: 14px; margin-left: -7px;
  background: var(--gold); border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg); border-radius: 0 0 3px 0;
}
.mk__pin .glyph { width: 28px; height: 28px; position: relative; z-index: 1; }
.mk.is-selected { z-index: 3; }
.mk.is-selected .mk__pin { display: grid; animation: pop .35s cubic-bezier(.2, 1.6, .4, 1) both; }
.mk--locked.is-selected .mk__pin { background: #8d84a3; }
.mk--locked.is-selected .mk__pin::after { background: #8d84a3; }
@keyframes pulse { to { box-shadow: 0 0 0 16px rgba(245, 196, 81, 0); } }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }

.falcon { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .3s; z-index: 4; }
.falcon.is-flying { opacity: 1; }
.falcon svg { position: absolute; left: -26px; top: -30px; width: 52px; fill: var(--gold); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; filter: drop-shadow(0 6px 0 rgba(21, 16, 29, .35)); animation: flap .5s ease-in-out infinite alternate; transform-origin: 50% 40%; }
@keyframes flap { to { transform: scaleY(.55); } }

.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* ---------- Top bar ---------- */
.bar {
  position: absolute; inset-block-start: 0; inset-inline: 0; height: var(--bar-h); z-index: 20;
  display: flex; align-items: center; gap: 8px; padding-inline: 14px;
}
.bar__gap { flex: 1; }
.lockup { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--cream); font-family: var(--display); line-height: 1; }
.lockup__55 { font-size: 30px; color: var(--gold); text-shadow: -1.5px 1.5px 0 var(--green), -3px 3px 0 var(--red), -4.5px 4.5px 0 var(--ink); }
.lockup__name { font-size: 20px; }
.app[data-screen='landing'] .lockup { visibility: hidden; }
.round {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(255, 244, 220, .1); border: 1.5px solid rgba(255, 244, 220, .28); font-weight: 700; font-size: 14px;
}
.round .glyph { width: 20px; height: 20px; }

/* ---------- Layers ---------- */
.layer { position: absolute; inset: 0; display: none; z-index: 10; }
.layer.is-active { display: block; }
.landing, .home { pointer-events: none; }
.landing > *, .home > * { pointer-events: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 8px 26px; border-radius: 999px;
  font-family: var(--display); font-size: 22px; line-height: 1.1; text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.btn--gold { background: linear-gradient(#ffd972, var(--gold)); color: var(--ink); box-shadow: 0 5px 0 var(--gold-deep), 0 10px 24px rgba(0, 0, 0, .35); }
.btn--ghost { background: rgba(255, 244, 220, .1); color: var(--cream); box-shadow: inset 0 0 0 1.5px rgba(255, 244, 220, .4); }
.btn--xl { width: 100%; min-height: 62px; font-size: 28px; }
.btn:active { transform: translateY(3px); }
.btn--gold:active { box-shadow: 0 2px 0 var(--gold-deep), 0 6px 14px rgba(0, 0, 0, .35); }
.btn[disabled] { background: #51446f; color: #a99cc4; box-shadow: none; cursor: default; }
.link { color: var(--lav); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Landing ---------- */
.landing__head { position: absolute; inset-block-start: calc(var(--bar-h) - 14px); inset-inline: 0; padding-inline: 22px; text-align: center; }
.title { font-family: var(--display); font-weight: 400; line-height: .95; display: grid; justify-items: center; }
.title__55 {
  font-size: clamp(76px, 24vw, 128px); color: var(--gold); letter-spacing: .02em;
  text-shadow: -3px 3px 0 var(--cream), -6px 6px 0 var(--green), -9px 9px 0 var(--red), -12px 12px 0 var(--ink);
}
.title__name { font-size: clamp(36px, 11vw, 60px); color: var(--cream); margin-block-start: 6px; }
.lede { margin: 10px auto 0; max-width: 30ch; color: var(--lav); font-size: 17px; line-height: 1.45; }
.landing__foot {
  position: absolute; inset-block-end: 0; inset-inline: 0; margin-inline: auto; max-width: 480px;
  padding: 0 18px calc(14px + var(--safe-b)); display: grid; gap: 10px; text-align: center;
}
.family { color: var(--cream); font-weight: 600; font-size: 15px; }
.teaser { background: rgba(36, 16, 74, .88); border: 1.5px solid rgba(245, 196, 81, .35); border-radius: 20px; padding: 10px 14px; text-align: start; }
.teaser__head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-block-end: 4px; }
.teaser__head .glyph { width: 18px; height: 18px; color: var(--gold); }
.teaser__head small { margin-inline-start: auto; color: var(--lav); font-weight: 500; font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; padding-block: 5px; }
.row + .row { border-block-start: 1px solid rgba(203, 187, 233, .16); }
.row__rank { width: 24px; font-family: var(--display); font-size: 20px; color: var(--gold); text-align: center; flex: none; }
.row__main { flex: 1; min-width: 0; line-height: 1.25; }
.row__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__sub { font-size: 13px; color: var(--lav); }
.row__pts { font-family: var(--display); font-size: 19px; }
.row--me { background: rgba(245, 196, 81, .14); border-radius: 14px; padding-inline: 8px; margin-inline: -8px; border: 0 !important; }
.footlinks { display: flex; justify-content: center; gap: 20px; }

/* ---------- Avatar medallion ---------- */
.medal {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 24px; line-height: 1; background: var(--cream); border: 3px solid var(--gold); box-shadow: 0 0 0 2px var(--ink);
}
.medal--sm { width: 34px; height: 34px; font-size: 18px; border-width: 2px; }
.medal--lg { width: 72px; height: 72px; font-size: 40px; }

/* ---------- Map home ---------- */
.hud { position: absolute; inset-block-start: var(--bar-h); inset-inline: 0; padding-inline: 14px; display: flex; align-items: center; gap: 10px; }
.pill {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 4px 14px 4px 5px; border-radius: 999px;
  background: rgba(36, 16, 74, .9); border: 1.5px solid rgba(245, 196, 81, .35); line-height: 1.15;
}
[dir='rtl'] .pill { padding: 4px 5px 4px 14px; }
.pill b { display: block; font-size: 15px; }
.pill span { font-size: 13px; color: var(--gold); font-weight: 700; }
.pill--board { margin-inline-start: auto; padding-inline: 14px !important; gap: 6px; font-weight: 700; font-size: 15px; }
.pill--board .glyph { width: 20px; height: 20px; color: var(--gold); }

.dock { position: absolute; inset-block-end: 0; inset-inline: 0; margin-inline: auto; max-width: 560px; padding: 0 12px calc(12px + var(--safe-b)); }
.route { position: relative; display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
.route::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-width: 74px; padding: 6px 10px 7px; border-radius: 18px; text-align: center; scroll-snap-align: center;
  background: rgba(36, 16, 74, .9); border: 1.5px solid rgba(203, 187, 233, .25); line-height: 1.2;
}
.chip__name { display: block; font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip__state { display: flex; justify-content: center; align-items: center; height: 16px; margin-block-start: 2px; color: #8d84a3; }
.chip__state .glyph { width: 14px; height: 14px; }
.chip--locked { color: #a99cc4; }
.chip.is-selected { background: var(--cream); color: var(--ink); border-color: var(--gold); box-shadow: 0 3px 0 var(--gold-deep); }
.chip.is-selected .star { fill: #d9cbb0; }
.chip.is-selected .star.is-on { fill: var(--gold-deep); }

.stars { display: inline-flex; gap: 2px; direction: ltr; }
.star { width: 14px; height: 14px; fill: rgba(203, 187, 233, .3); }
.star.is-on { fill: var(--gold); }
.stars--md .star { width: 22px; height: 22px; }

.stopcard {
  background: var(--night-2); border: 2px solid var(--gold); border-radius: 26px; padding: 14px 16px 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
.stopcard__top { display: flex; align-items: flex-start; gap: 12px; }
.stopcard__badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 0 0 0 2px var(--cream); }
.stopcard__badge .glyph { width: 30px; height: 30px; }
.stopcard__badge.is-locked { background: #8d84a3 !important; }
.stopcard__main { flex: 1; min-width: 0; }
.stopcard__n { font-size: 13px; color: var(--lav); font-weight: 600; line-height: 1.2; }
.stopcard__name { font-family: var(--display); font-weight: 400; font-size: 32px; line-height: 1.05; }
.stopcard__chapter { font-size: 15px; line-height: 1.35; color: var(--cream); margin-block-start: 2px; }
.stopcard__chapter span { color: var(--lav); }
.stopcard__note { font-size: 13.5px; color: var(--lav); margin-block-start: 8px; line-height: 1.4; }
.stopcard .btn { width: 100%; margin-block-start: 12px; }

.toast {
  position: absolute; inset-inline: 0; inset-block-end: calc(100% + 6px); margin-inline: auto; width: max-content; max-width: 90%;
  padding: 8px 20px; border-radius: 999px; background: var(--gold); color: var(--ink); font-family: var(--display); font-size: 22px;
  box-shadow: 0 5px 0 var(--gold-deep); opacity: 0; transform: translateY(10px) scale(.9); transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.is-on { opacity: 1; transform: none; }

/* ---------- Sign-up sheet ---------- */
.sheetwrap { background: rgba(23, 10, 46, .72); }
.sheetwrap.is-active { display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  scrollbar-width: none;
  width: 100%; max-width: 520px; max-height: calc(100% - var(--bar-h) - 6px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--night-2); border-radius: 30px 30px 0 0; border-block-start: 3px solid var(--gold);
  padding: 20px 18px calc(18px + var(--safe-b)); display: grid; gap: 16px;
  animation: rise .32s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__title { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.1; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 700; font-size: 16px; }
.field__hint { font-size: 13.5px; color: var(--lav); line-height: 1.4; }
.field__hint.is-error { color: #ffb4a8; font-weight: 600; }
.input {
  width: 100%; min-height: 52px; padding: 8px 18px; border-radius: 999px; font-size: 18px; font-weight: 600;
  background: var(--night); border: 2px solid #5a3f96; color: var(--cream);
}
.input::placeholder { color: #8d7db3; font-weight: 500; }
.input:focus { outline: none; border-color: var(--gold); }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; justify-items: center; }
.avatars button { border-radius: 50%; opacity: .55; transition: opacity .15s, transform .15s; }
.avatars button[aria-checked='true'] { opacity: 1; transform: scale(1.12); }
.avatars button[aria-checked='true'] .medal { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--cream); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  min-height: 42px; padding: 6px 16px; border-radius: 999px; font-weight: 600; font-size: 15.5px;
  background: var(--night); border: 2px solid #5a3f96;
}
.opt[aria-checked='true'] { background: var(--cream); color: var(--ink); border-color: var(--gold); }
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trackcard { text-align: start; padding: 12px 14px; border-radius: 20px; background: var(--night); border: 2px solid #5a3f96; line-height: 1.3; }
.trackcard b { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.1; }
.trackcard span { font-size: 13.5px; color: var(--lav); }
.trackcard[aria-checked='true'] { background: var(--cream); color: var(--ink); border-color: var(--gold); box-shadow: 0 4px 0 var(--gold-deep); }
.trackcard[aria-checked='true'] span { color: #5b4a7d; }
.schools { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet__foot { display: grid; gap: 10px; text-align: center; position: sticky; inset-block-end: calc(-18px - var(--safe-b)); background: linear-gradient(transparent, var(--night-2) 22%); padding-block: 18px calc(18px + var(--safe-b)); margin-block-end: calc(-18px - var(--safe-b)); }

/* ---------- Level: an arcade arena ---------- */
.level { --heat: 0; background: var(--night); overflow: hidden; }
.level.is-active { display: flex; flex-direction: column; }

/* The room itself: slow rays, drifting stars, and a heat that rises as the clock runs down. */
.arena { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: radial-gradient(110% 75% at 50% 30%, #5a2bbb 0%, #2f1469 46%, var(--night) 100%); }
.arena__rays {
  position: absolute; left: 50%; top: 30%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax;
  background: repeating-conic-gradient(rgba(255, 244, 220, .085) 0 10deg, transparent 10deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 3%, transparent 47%); mask-image: radial-gradient(circle, #000 3%, transparent 47%);
  animation: spin 80s linear infinite;
}
.arena__stars { position: absolute; inset: 0; }
.arena__stars::before, .arena__stars::after {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 200%; background-size: 100% 50%;
  background-image:
    radial-gradient(2.5px 2.5px at 8% 12%, #fff 50%, transparent 52%), radial-gradient(2px 2px at 23% 64%, var(--gold) 50%, transparent 52%),
    radial-gradient(3px 3px at 41% 31%, #fff 50%, transparent 52%), radial-gradient(2px 2px at 58% 83%, #fff 50%, transparent 52%),
    radial-gradient(2.5px 2.5px at 74% 47%, var(--gold) 50%, transparent 52%), radial-gradient(2px 2px at 91% 21%, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 66% 6%, #fff 50%, transparent 52%), radial-gradient(3px 3px at 15% 91%, #fff 50%, transparent 52%);
  animation: drift 50s linear infinite;
}
.arena__stars::after { animation-duration: 27s; opacity: .55; transform-origin: center; background-position: 43% 0; background-size: 71% 50%; }
.arena__heat {
  position: absolute; inset: 0; opacity: var(--heat);
  background: radial-gradient(95% 75% at 50% 38%, rgba(255, 150, 60, .12) 0%, rgba(229, 56, 63, .78) 100%);
}
.level.is-danger .arena__heat { animation: throb .5s ease-in-out infinite alternate; }
.level.is-danger .arena__rays { animation-duration: 9s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { to { transform: translateY(-50%); } }
@keyframes throb { from { opacity: .62; } to { opacity: 1; } }

/* Heads-up display */
.ghud { position: relative; z-index: 2; flex: none; display: flex; align-items: center; gap: 10px; height: var(--bar-h); padding: 8px 14px; padding-inline-end: 118px; }
.gscore {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: 8px 16px; border-radius: 999px;
  background: rgba(23, 10, 46, .78); border: 2px solid var(--gold); font-family: var(--display); font-size: 25px; line-height: 1; color: var(--gold);
}
.gscore svg { width: 24px; height: 24px; fill: var(--gold); }
.gscore b { font-weight: 400; padding-block-start: 3px; font-variant-numeric: tabular-nums; }
.gscore.is-bump { animation: bump .28s cubic-bezier(.2, 1.8, .4, 1); }
.streak {
  display: inline-flex; align-items: center; gap: 2px; height: 40px; padding-inline: 8px 12px; border-radius: 999px;
  background: linear-gradient(#ff8a3d, var(--red)); color: #fff; font-family: var(--display); font-size: 22px; line-height: 1;
  box-shadow: 0 4px 0 #8f1d23; animation: bump .35s cubic-bezier(.2, 1.8, .4, 1);
}
.streak .glyph { width: 20px; height: 20px; color: #ffe08a; }
.streak b { font-weight: 400; padding-block-start: 3px; direction: ltr; unicode-bidi: isolate; }
.slots { position: relative; z-index: 2; flex: none; display: flex; justify-content: center; gap: 10px; padding-block: 2px 4px; }
.slot { display: block; width: 30px; height: 30px; }
.slot svg { width: 100%; height: 100%; fill: rgba(255, 244, 220, .12); stroke: rgba(255, 244, 220, .4); stroke-width: 1.4; stroke-linejoin: round; }
.slot.is-now svg { stroke: var(--gold); stroke-width: 2; animation: slotNow 1s ease-in-out infinite alternate; }
.slot.is-right svg { fill: var(--gold); stroke: var(--ink); animation: bump .4s cubic-bezier(.2, 1.8, .4, 1); filter: drop-shadow(0 3px 0 var(--gold-deep)); }
.slot.is-wrong svg { fill: #6d5c8f; stroke: #46366a; }
@keyframes slotNow { from { transform: scale(.9); } to { transform: scale(1.15); } }
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }

.gbody {
  position: relative; z-index: 1; flex: 1; min-height: 0; width: 100%; max-width: 800px; margin-inline: auto;
  display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: none; padding: 0 16px calc(16px + var(--safe-b));
}
.gbody::-webkit-scrollbar { display: none; }

/* Level intro */
.intro { margin-block: auto; display: grid; gap: 10px; text-align: center; justify-items: center; padding-block: 8px; animation: popIn .5s cubic-bezier(.2, 1.3, .4, 1) both; }
.scene { width: min(100%, 320px); height: auto; display: block; }
.intro__name {
  font-family: var(--display); font-weight: 400; font-size: clamp(64px, 20vw, 120px); line-height: 1; color: var(--gold);
  text-shadow: -3px 3px 0 var(--cream), -6px 6px 0 var(--green), -9px 9px 0 var(--red), -12px 12px 0 var(--ink);
  margin-block-end: 10px;
}
.intro__about { font-size: 15px; font-weight: 600; color: var(--lav); margin-block-end: -6px; }
.intro__chapter { font-size: 21px; font-weight: 700; line-height: 1.35; max-width: 24ch; text-wrap: balance; }
.intro__chips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.intro__chips li { padding: 4px 14px; border-radius: 999px; background: rgba(23, 10, 46, .7); border: 1.5px solid rgba(245, 196, 81, .6); font-weight: 700; font-size: 14.5px; color: var(--gold); }
.intro__rule { color: var(--lav); max-width: 32ch; text-wrap: balance; }
.intro .btn { margin-block-start: 6px; max-width: 420px; }
.btn--pulse { animation: cta 1.1s ease-in-out infinite alternate; }
@keyframes cta { from { transform: scale(1); } to { transform: scale(1.045); } }
.btn--dark { background: var(--ink); color: var(--cream); box-shadow: 0 5px 0 #000; }

/* Three, two, one */
.countdown { position: absolute; inset: 0; z-index: 5; display: none; place-items: center; background: rgba(23, 10, 46, .72); }
.countdown.is-on { display: grid; }
.countdown b {
  font-family: var(--display); font-weight: 400; font-size: min(52vw, 300px); line-height: 1; color: var(--gold);
  -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill;
  text-shadow: -5px 5px 0 var(--cream), -10px 10px 0 var(--green), -15px 15px 0 var(--red), -20px 20px 0 var(--ink);
  animation: count .6s cubic-bezier(.2, 1.5, .4, 1) both;
}
.countdown b.is-go { font-size: min(30vw, 190px); color: var(--cream); }
@keyframes count { 0% { transform: scale(2.4) rotate(-8deg); opacity: 0; } 55% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.flash { position: absolute; inset: 0; z-index: 6; background: #fff; opacity: 0; pointer-events: none; }
.flash.is-on { animation: flash .4s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }

/* A question */
.q { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; animation: qIn .34s cubic-bezier(.2, 1.1, .3, 1) both; }
.q.is-out { animation: qOut .19s ease-in both; }
.q.is-shake { animation: shakeX .4s; }
@keyframes qIn { from { transform: translateY(26px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes qOut { to { transform: translateY(-22px) scale(.97); opacity: 0; } }
@keyframes shakeX { 20% { transform: translateX(9px); } 40% { transform: translateX(-8px); } 60% { transform: translateX(6px); } 80% { transform: translateX(-4px); } }

.q__top { flex: none; position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; height: 92px; margin-block-end: -30px; padding-inline: 8px; }
.mascot { justify-self: start; width: 96px; height: 96px; }
.falco { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 0 rgba(21, 16, 29, .45)); animation: bob 2.2s ease-in-out infinite alternate; transform-origin: 50% 100%; transition: transform .25s cubic-bezier(.2, 1.6, .4, 1); }
[data-mood='cheer'] .falco { animation: hop .5s cubic-bezier(.3, 0, .4, 1) infinite alternate; }
[data-mood='oops'] .falco { animation: none; transform: rotate(-10deg) translateY(4px); }
[data-mood='hurry'] .falco { animation: shakeX .3s linear infinite; }
@keyframes bob { to { transform: translateY(-5px); } }
@keyframes hop { to { transform: translateY(-16px); } }
@keyframes flapL { to { transform: rotate(60deg); } }
@keyframes flapR { to { transform: rotate(-60deg); } }

.prize {
  align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 2px 18px 0 12px; border-radius: 999px; margin-block-end: 22px;
  background: linear-gradient(#ffe08a, var(--gold)); color: var(--ink); font-family: var(--display); font-size: 30px; line-height: 1.25;
  border: 2.5px solid var(--ink); box-shadow: 0 5px 0 var(--gold-deep), 0 12px 22px rgba(0, 0, 0, .35);
}
[dir='rtl'] .prize { padding: 2px 12px 0 18px; }
.prize svg { width: 26px; height: 26px; fill: #fff; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; margin-block-end: 3px; }
.prize b { font-weight: 400; font-variant-numeric: tabular-nums; min-width: 2.6ch; text-align: center; }
.level.is-danger .prize { animation: slotNow .25s ease-in-out infinite alternate; }

.clock { justify-self: end; position: relative; width: 82px; height: 82px; border-radius: 50%; display: grid; place-items: center; background: var(--night); border: 3px solid var(--ink); box-shadow: 0 6px 0 #0c0420, 0 14px 22px rgba(0, 0, 0, .35); }
.clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.clock__track { fill: none; stroke: rgba(255, 244, 220, .16); stroke-width: 8; }
.clock__ring { fill: none; stroke: var(--gold); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 100; }
.clock b { position: relative; font-family: var(--display); font-weight: 400; font-size: 38px; line-height: 1; padding-block-start: 5px; color: var(--cream); font-variant-numeric: tabular-nums; }
.level.is-danger .clock { background: #6d0f1a; animation: shakeX .32s linear infinite; }
.level.is-danger .clock__ring { stroke: #ff7a7f; }


.qcard {
  flex: none; position: relative; text-align: center; padding: 38px 20px 22px; border-radius: 30px;
  background: linear-gradient(#4420a0, #2b1263); border: 3px solid var(--gold);
  box-shadow: 0 9px 0 #12072a, 0 26px 40px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .18);
}
.qcard__media { margin: 0 0 8px; }
.qcard__media .scene { width: min(100%, 210px); margin-inline: auto; }
.qcard__media figcaption { font-size: 12px; color: var(--lav); }
.qcard__text { font-size: 24px; font-weight: 800; line-height: 1.4; text-wrap: balance; }
.q--explorer .qcard__text { font-size: 29px; }
.qcard__hint { color: var(--gold); font-weight: 600; font-size: 15px; margin-block-start: 4px; }

/* Answer tiles */
.answers { flex: 1; min-height: 0; display: grid; gap: 14px 12px; grid-auto-rows: minmax(62px, 1fr); max-height: 430px; padding-block-end: 8px; }
.answers.is-settled { flex: none; grid-auto-rows: auto; max-height: none; grid-template-columns: 1fr; }
.tile {
  --c: var(--red); --cd: #a11d25; --ct: #fff;
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 8px 16px; border-radius: 22px; text-align: start; color: var(--ct);
  font-size: 19px; font-weight: 800; line-height: 1.3;
  background: var(--c); border: 2.5px solid var(--ink); box-shadow: 0 7px 0 var(--cd), 0 15px 20px rgba(0, 0, 0, .32);
  animation: tileIn .5s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i, 0) * 80ms + 120ms);
  transition: transform .08s, box-shadow .08s, opacity .25s, filter .25s;
}
.tile--c1 { --c: var(--green); --cd: #0a6a3c; }
.tile--c2 { --c: #8d52f5; --cd: #5a25b6; }
.tile--c3 { --c: #ffb72e; --cd: #b97707; --ct: var(--ink); }
/* A gloss along the top edge and a slow shine: cheap, and it makes a button feel like a button. */
.tile::before { content: ''; position: absolute; inset: 0 0 52% 0; background: linear-gradient(rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)); pointer-events: none; }
.tile::after {
  content: ''; position: absolute; inset-block: -10%; left: 0; width: 34%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: translateX(-140%) skewX(-18deg); animation: sweep 4.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * .45s + 1.4s);
}
.tile:active:not([disabled]) { transform: translateY(5px); box-shadow: 0 2px 0 var(--cd), 0 6px 10px rgba(0, 0, 0, .3); }
.tile[disabled] { cursor: default; }
.tile__key {
  position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(21, 16, 29, .28); border: 2px solid rgba(255, 255, 255, .6); color: #fff; font-family: var(--display); font-size: 23px; line-height: 1;
}
.tile__key .glyph { width: 24px; height: 24px; }
.tile__label { position: relative; flex: 1; min-width: 0; text-shadow: 0 1.5px 0 rgba(21, 16, 29, .28); }
.tile--c3 .tile__label { text-shadow: none; }
.tile__label small { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.1; color: #ffe08a; }
.level.is-danger .tile:not([disabled]) { animation: jitter .22s linear infinite; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes tileIn { from { transform: translateY(40px) scale(.7) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sweep { 0%, 55% { transform: translateX(-140%) skewX(-18deg); } 100% { transform: translateX(460%) skewX(-18deg); } }
@keyframes jitter { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(1.5px, -1px) rotate(.4deg); } 75% { transform: translate(-1.5px, 1px) rotate(-.4deg); } 100% { transform: translate(0, 0) rotate(0); } }

.tile.is-right { --c: #19c471; --cd: #0a6a3c; --ct: #fff; z-index: 1; box-shadow: 0 0 0 3px #fff, 0 0 0 7px var(--gold), 0 12px 0 var(--cd), 0 0 44px rgba(245, 196, 81, .75); animation: win .6s cubic-bezier(.2, 1.7, .4, 1) both; }
.tile.is-right .tile__key { background: #fff; color: #0a6a3c; border-color: var(--ink); }
.tile.is-wrong { --c: #6a5a80; --cd: #3f3355; --ct: #e7dff5; animation: shakeX .4s both; }
.tile.is-wrong .tile__key { background: var(--red); border-color: var(--ink); }
.tile.is-dim { opacity: .38; filter: saturate(.3); animation: none; }
.tile.is-gone { display: none; }
.tile.is-right::after, .tile.is-wrong::after, .tile.is-dim::after { display: none; }
@keyframes win { 0% { transform: scale(1); } 40% { transform: scale(1.07) rotate(-1.2deg); } 70% { transform: scale(.98) rotate(.6deg); } 100% { transform: scale(1); } }

/* Explorer: three picture tiles */
.answers--pics { grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(170px, 1fr); max-height: 300px; gap: 12px; }
.answers--pics.is-settled { flex: none; grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(150px, auto); }
.tile--pic { flex-direction: column; justify-content: center; gap: 8px; padding: 14px 6px 12px; text-align: center; border-radius: 26px; background: var(--cream); color: var(--ink); border: 4px solid var(--c); box-shadow: 0 8px 0 var(--cd), 0 16px 22px rgba(0, 0, 0, .32); font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.2; }
.tile--pic .tile__label { flex: none; text-shadow: none; }
.tile--pic.is-right { background: #d6f8e4; border-color: #19c471; color: var(--ink); }
.tile--pic.is-wrong { background: #e9dccd; border-color: #b88a5c; color: var(--ink); }
.art { width: 92px; height: 92px; display: grid; place-items: center; flex: none; position: relative; }
.art svg { width: 100%; height: 100%; }
.art--number b { font-family: var(--display); font-weight: 400; font-size: 66px; line-height: .9; color: var(--red); }
.art--number .dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 62px; }
.art--number .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--plum); }
.art--text b { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; color: var(--red); }
.art--swatches { grid-template-columns: 1fr 1fr; gap: 5px; padding: 6px; align-content: center; }
.art--swatches i { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink); }

/* Put-in-order tiles */
.answers--order { max-height: 300px; }
.answers--order .tile.is-picked .tile__key { background: var(--gold); color: var(--ink); border-color: var(--ink); }
.answers--order .tile:not(.is-picked) .tile__key { border-style: dashed; }
.q__actions { flex: none; display: grid; grid-template-columns: auto 1fr; gap: 10px; }

/* After the answer */
.reveal {
  flex: none; display: grid; gap: 8px; padding: 16px 18px 18px; border-radius: 28px; background: var(--cream); color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 0 8px 0 rgba(12, 4, 32, .7), 0 22px 34px rgba(0, 0, 0, .4);
  animation: revealIn .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.reveal__banner { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--display); font-size: 36px; line-height: 1.1; }
.reveal__banner svg { width: 30px; height: 30px; fill: var(--gold); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; animation: twirl .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.reveal.is-right .reveal__banner { color: #0a6a3c; }
.reveal.is-wrong .reveal__banner { color: #8a4b12; }
.gains { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.gains li { padding: 2px 12px; border-radius: 999px; background: var(--gold); border: 2px solid var(--ink); font-weight: 800; font-size: 14.5px; }
.gains li.is-hot { background: linear-gradient(#ff8a3d, var(--red)); color: #fff; }
.reveal__fact { font-size: 18px; font-weight: 700; line-height: 1.45; text-align: center; text-wrap: balance; }
.reveal__answer { font-size: 15.5px; font-weight: 800; color: #0a6a3c; text-align: center; }
.reveal .btn { margin-block-start: 4px; }
@keyframes revealIn { from { transform: translateY(40px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes twirl { from { transform: scale(0) rotate(-180deg); } to { transform: none; } }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* Points that fly */
.floaty {
  position: fixed; z-index: 35; pointer-events: none; font-family: var(--display); font-weight: 400; font-size: 54px; line-height: 1; color: var(--gold);
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); white-space: nowrap; direction: ltr;
}
.flystar { position: fixed; left: -17px; top: -17px; width: 34px; height: 34px; z-index: 35; pointer-events: none; }
.flystar svg { width: 100%; height: 100%; fill: var(--gold); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }

/* ---------- Result ---------- */
.result { background: var(--night); overflow: hidden; }
.arena--win { background: radial-gradient(110% 70% at 50% 16%, #6a32d6 0%, #2f1469 50%, var(--night) 100%); }
.arena--win .arena__rays { top: 18%; background: repeating-conic-gradient(rgba(245, 196, 81, .13) 0 10deg, transparent 10deg 20deg); animation-duration: 40s; }
.result__body {
  position: relative; z-index: 1; height: 100%; overflow-y: auto; scrollbar-width: none; max-width: 520px; margin-inline: auto;
  padding: calc(var(--bar-h) + 4px) 20px calc(22px + var(--safe-b)); display: grid; grid-auto-rows: max-content; gap: 12px; text-align: center; justify-items: center; align-content: start;
}
.result__body::-webkit-scrollbar { display: none; }
.win__title {
  font-family: var(--display); font-weight: 400; font-size: clamp(34px, 9.5vw, 52px); line-height: 1.15; color: var(--cream);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); animation: popIn .45s cubic-bezier(.2, 1.5, .4, 1) both;
}
.bigstars { display: flex; gap: 6px; direction: ltr; align-items: flex-end; height: 108px; }
.bigstars svg { width: 78px; height: 78px; fill: rgba(203, 187, 233, .2); stroke: rgba(203, 187, 233, .35); stroke-width: 1; stroke-linejoin: round; }
.bigstars svg:nth-child(2) { width: 104px; height: 104px; }
.bigstars svg.is-on { fill: var(--gold); stroke: var(--ink); stroke-width: 1.2; animation: slam .55s cubic-bezier(.2, 1.6, .4, 1) both; filter: drop-shadow(0 6px 0 var(--gold-deep)) drop-shadow(0 0 18px rgba(245, 196, 81, .7)); }
@keyframes slam { 0% { transform: scale(3.2) rotate(-50deg); opacity: 0; } 55% { transform: scale(.85) rotate(6deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
.win__sub { font-family: var(--display); font-size: 24px; line-height: 1.1; color: var(--gold); }
.tally { width: 100%; border-radius: 26px; padding: 6px 18px 10px; text-align: start; background: rgba(23, 10, 46, .8); border: 2.5px solid var(--gold); box-shadow: 0 8px 0 #12072a; }
.tally__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 7px; border-block-end: 1.5px dashed rgba(203, 187, 233, .28); font-weight: 700; }
.tally__row b { display: inline-flex; align-items: center; gap: 2px; font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1; color: var(--cream); direction: ltr; }
.tally__row .glyph { width: 20px; height: 20px; color: #ff8a3d; }
.tally__total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block-start: 8px; font-weight: 800; font-size: 19px; }
.tally__total b { font-family: var(--display); font-weight: 400; font-size: 52px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; text-shadow: 0 4px 0 var(--ink); }
.result__rank { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px; background: var(--green); border: 2px solid var(--ink); font-weight: 800; font-size: 15px; color: #fff; }
.result__rank .glyph { width: 18px; height: 18px; color: #ffe08a; }
.result__actions { width: 100%; display: grid; gap: 10px; margin-block-start: 4px; }

.sharecard {
  width: 100%; border-radius: 26px; padding: 16px 18px; text-align: start; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #4a2590, #24104a 70%); border: 2px solid var(--gold);
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center;
}
.sharecard::before { content: ''; position: absolute; inset-block: 0; inset-inline-end: 0; width: 10px; background: linear-gradient(var(--green) 0 33.3%, #fff 0 66.6%, var(--ink) 0); }
.sharecard::after { content: ''; position: absolute; inset-block: 0; inset-inline-end: 10px; width: 6px; background: var(--red); }
.sharecard__who { line-height: 1.2; }
.sharecard__who b { display: block; font-size: 20px; }
.sharecard__who span { font-size: 13.5px; color: var(--lav); }
.sharecard__line { grid-column: 1 / -1; font-family: var(--display); font-size: 25px; line-height: 1.25; padding-inline-end: 20px; }
.sharecard__foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-inline-end: 22px; }
.sharecard__url { font-weight: 800; color: var(--gold); direction: ltr; }

/* Short phones: tighten the round */
@media (max-height: 700px) {
  .q__top { height: 78px; margin-block-end: -26px; }
  .mascot { width: 80px; height: 80px; }
  .clock { width: 68px; height: 68px; }
  .clock b { font-size: 30px; }
  .prize { font-size: 25px; margin-block-end: 18px; }
  .qcard { padding: 30px 16px 16px; }
  .qcard__text { font-size: 21px; }
  .q--explorer .qcard__text { font-size: 24px; }
  .qcard__media .scene { width: 150px; }
  .answers { gap: 11px 10px; grid-auto-rows: minmax(52px, 1fr); }
  .tile { font-size: 17px; padding-block: 5px; }
  .tile__key { width: 36px; height: 36px; font-size: 20px; }
  .answers--pics { grid-auto-rows: minmax(140px, 1fr); }
  .art { width: 72px; height: 72px; }
  .slot { width: 24px; height: 24px; }
  .bigstars { height: 84px; } .bigstars svg { width: 60px; height: 60px; } .bigstars svg:nth-child(2) { width: 80px; height: 80px; }
  .tally__total b { font-size: 42px; }
}

/* Tablets and up: two-by-two tiles, bigger type, a bigger falcon */
@media (min-width: 600px) {
  .gbody { padding-inline: 28px; }
  .slot { width: 38px; height: 38px; }
  .slots { gap: 14px; padding-block: 4px 8px; }
  .q { gap: 18px; }
  .q__top { height: 124px; margin-block-end: -40px; padding-inline: 18px; }
  .mascot { width: 132px; height: 132px; }
  .clock { width: 108px; height: 108px; }
  .clock b { font-size: 50px; }
  .prize { font-size: 40px; padding-inline: 18px 26px; margin-block-end: 30px; }
  .prize svg { width: 34px; height: 34px; }
  .qcard { padding: 52px 36px 34px; border-radius: 38px; }
  .qcard__text { font-size: 34px; }
  .q--explorer .qcard__text { font-size: 40px; }
  .qcard__media .scene { width: 280px; }
  .answers--grid { grid-template-columns: 1fr 1fr; gap: 20px 18px; grid-auto-rows: minmax(104px, 1fr); max-height: 360px; }
  .tile { font-size: 24px; padding: 12px 22px; border-radius: 28px; gap: 16px; }
  .tile__key { width: 54px; height: 54px; font-size: 30px; }
  .answers--pics { gap: 20px; grid-auto-rows: minmax(250px, 1fr); max-height: 380px; }
  .tile--pic { font-size: 28px; border-width: 5px; border-radius: 34px; }
  .art { width: 150px; height: 150px; }
  .art--number b { font-size: 104px; } .art--number .dots { max-width: 100px; gap: 5px; } .art--number .dots i { width: 12px; height: 12px; }
  .art--text b { font-size: 72px; }
  .answers--order { grid-auto-rows: minmax(84px, 1fr); max-height: 340px; }
  .reveal { padding: 22px 28px 26px; }
  .reveal__banner { font-size: 48px; } .reveal__banner svg { width: 40px; height: 40px; }
  .reveal__fact { font-size: 23px; }
  .gains li { font-size: 17px; }
  .scene { width: 400px; }
  .intro__chapter { font-size: 28px; }
  .intro__chips li { font-size: 17px; padding: 6px 18px; }
  .intro__rule { font-size: 20px; }
  .result__body { max-width: 600px; gap: 16px; }
  .bigstars { height: 150px; } .bigstars svg { width: 108px; height: 108px; } .bigstars svg:nth-child(2) { width: 146px; height: 146px; }
  .tally__row { font-size: 20px; } .tally__row b { font-size: 30px; }
  .tally__total b { font-size: 68px; }
}
/* Tablets held sideways and desktops: less height, so keep the round compact */
@media (min-width: 600px) and (max-height: 860px) {
  .q { gap: 14px; }
  .q__top { height: 100px; margin-block-end: -34px; }
  .mascot { width: 108px; height: 108px; }
  .clock { width: 88px; height: 88px; } .clock b { font-size: 40px; }
  .prize { font-size: 32px; margin-block-end: 24px; }
  .qcard { padding: 40px 30px 22px; }
  .qcard__text { font-size: 28px; } .q--explorer .qcard__text { font-size: 32px; }
  .qcard__media .scene { width: 170px; }
  .answers--grid { grid-auto-rows: minmax(84px, 1fr); max-height: 250px; gap: 16px; }
  .answers--pics { grid-auto-rows: minmax(190px, 1fr); max-height: 260px; }
  .art { width: 108px; height: 108px; } .art--number b { font-size: 76px; } .art--text b { font-size: 54px; }
  .scene { width: 260px; }
  .intro__name { font-size: 84px; }
  .bigstars { height: 104px; } .bigstars svg { width: 76px; height: 76px; } .bigstars svg:nth-child(2) { width: 100px; height: 100px; }
  .result__body { max-width: 980px; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  .result__body > .win__title, .result__body > .bigstars, .result__body > .win__sub { grid-column: 1 / -1; }
  .result__body > .result__rank { grid-column: 1 / -1; }
}

/* ---------- Modal ---------- */
.modal { position: absolute; inset: 0; z-index: 40; background: rgba(23, 10, 46, .72); display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal__card { width: 100%; max-width: 520px; max-height: 86%; overflow-y: auto; background: var(--night-2); border-radius: 30px 30px 0 0; border-block-start: 3px solid var(--gold); padding: 18px 18px calc(18px + var(--safe-b)); display: grid; gap: 12px; animation: rise .28s cubic-bezier(.2, .9, .3, 1) both; }
.modal__head { display: flex; align-items: center; gap: 10px; }
.modal__head h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.1; flex: 1; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--night); border-radius: 999px; padding: 4px; }
.tabs button { min-height: 42px; border-radius: 999px; font-weight: 700; }
.tabs button[aria-selected='true'] { background: var(--cream); color: var(--ink); }
.note { font-size: 14.5px; color: var(--lav); line-height: 1.5; }
.stack { display: grid; gap: 10px; }

/* ---------- Short phones ---------- */
@media (max-height: 740px) {
  .title__55 { font-size: 64px; text-shadow: -2px 2px 0 var(--cream), -4px 4px 0 var(--green), -6px 6px 0 var(--red), -8px 8px 0 var(--ink); }
  .title__name { font-size: 32px; }
  .lede { font-size: 15.5px; margin-block-start: 6px; }
  .teaser .row:nth-child(n + 3) { display: none; }
  .btn--xl { min-height: 56px; font-size: 25px; }
  .stopcard__name { font-size: 28px; }
  .intro__name { font-size: 56px; }
  .scene { width: min(100%, 220px); }
}

/* ---------- Wide screens: a wider map, the same flow ---------- */
@media (min-width: 900px) {
  .landing__head { inset-inline: 0 auto; inset-block-start: 14%; width: 40%; padding-inline: 40px; }
  .landing__foot { inset-inline: 0 auto; inset-block-end: 8%; width: 40%; max-width: none; margin: 0; padding-inline: 60px; }
  .dock { inset-inline: 24px auto; inset-block-end: 24px; width: 420px; margin: 0; padding: 0; }
  .sheetwrap.is-active, .modal { align-items: center; }
  .sheet, .modal__card { border-radius: 30px; border: 2px solid var(--gold); }
}

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

/* In a level the top bar keeps only the language and sound buttons. */
.app[data-screen='level'] .lockup { display: none; }

[hidden] { display: none !important; }
.row__name, .row__sub { display: block; }
.lockup__name { white-space: nowrap; }
[dir='ltr'] .lockup__name { font-size: 17px; }
[dir='ltr'] .lockup__55, [dir='ltr'] .title__55, [dir='ltr'] .intro__name { direction: ltr; }
/* The bar is a transparent strip: only its own buttons take taps, so controls beneath stay reachable. */
.bar { pointer-events: none; }
.bar > * { pointer-events: auto; }
.bar > .bar__gap { pointer-events: none; }

/* Keep the round centred on tall screens instead of leaving the bottom empty. */
.q { justify-content: safe center; }
@media (min-width: 600px) and (min-height: 1000px) {
  .answers--pics { grid-auto-rows: minmax(300px, 1fr); max-height: 480px; }
  .answers--grid { grid-auto-rows: minmax(130px, 1fr); max-height: 440px; }
  .art { width: 180px; height: 180px; }
}
@media (min-width: 600px) and (max-height: 860px) {
  .result__body > .tally { grid-column: 1 / -1; max-width: 640px; }
}

/* ==========================================================================
   The live game: sign-up fields, live boards, news strip, sharing, finale.
   ========================================================================== */

/* ---------- Landing ---------- */
.kicker {
  display: inline-block; margin-block-end: 6px; padding: 2px 16px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--gold);
  background: rgba(23, 10, 46, .72); border: 1.5px solid rgba(245, 196, 81, .7);
}
.lede { max-width: 34ch; }
.teaser { display: block; width: 100%; text-align: start; cursor: pointer; }
.teaser__body { min-height: 44px; }
.teaser__empty { font-size: 14px; color: var(--lav); padding-block: 8px; }
.teaser__head .livepill { margin-inline-start: auto; }
.link--wa { display: inline-flex; align-items: center; gap: 6px; color: #7ff0a8; font-weight: 700; text-decoration: none; }
.link--wa .glyph { width: 17px; height: 17px; }

/* ---------- Live ---------- */
.livepill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  background: rgba(20, 163, 95, .2); border: 1.5px solid rgba(79, 208, 143, .6); color: #8ff0bd; font-weight: 700; font-size: 12.5px; line-height: 1.5;
}
.livepill__dot { width: 8px; height: 8px; border-radius: 50%; background: #3ee08f; flex: none; animation: livedot 1.4s ease-out infinite; }
@keyframes livedot { from { box-shadow: 0 0 0 0 rgba(62, 224, 143, .7); } to { box-shadow: 0 0 0 9px rgba(62, 224, 143, 0); } }
.pill .livepill { color: #8ff0bd; font-size: 12px; padding: 0 8px; }
.pill i { font-style: normal; color: var(--cream); unicode-bidi: isolate; }
.pill--board .pill__label { color: inherit; font-size: inherit; }

.row { position: relative; border-radius: 12px; transition: background-color .5s; }
.row.is-hot { background-color: rgba(245, 196, 81, .22); }
.row.is-up .row__rank::after { content: '▲'; display: block; font-size: 9px; line-height: 1; color: #3ee08f; font-family: var(--body); }
.row--top .row__rank { color: var(--ink); background: var(--gold); border-radius: 50%; width: 26px; height: 26px; line-height: 28px; font-size: 18px; }
a.row__name { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.medal--xs { width: 26px; height: 26px; font-size: 14px; border-width: 2px; box-shadow: none; }

.ticker {
  position: absolute; z-index: 25; inset-inline-start: 14px; inset-block-start: 10px; max-width: calc(100% - 128px);
  display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 5px; border-radius: 999px; white-space: nowrap; overflow: hidden;
  background: rgba(36, 16, 74, .95); border: 1.5px solid rgba(203, 187, 233, .4); font-weight: 700; font-size: 13.5px; line-height: 1.6;
  opacity: 0; transform: translateY(-12px) scale(.94); transition: opacity .3s, transform .3s cubic-bezier(.2, 1.4, .4, 1); pointer-events: none;
}
[dir='rtl'] .ticker { padding: 4px 5px 4px 14px; }
.ticker.is-on { opacity: 1; transform: none; }
.ticker.is-gold { background: var(--gold); color: var(--ink); border-color: var(--ink); padding-inline: 12px 14px; box-shadow: 0 4px 0 var(--gold-deep); }
.ticker > span:not(.medal):not(.stars) { overflow: hidden; text-overflow: ellipsis; }
.ticker .glyph { width: 18px; height: 18px; flex: none; }
.ticker .stars { flex: none; }
.app[data-screen='map'] .ticker { inset-block-start: calc(var(--bar-h) + 54px); max-width: calc(100% - 28px); }
.app:not([data-screen='map']):not([data-screen='landing']) .ticker { display: none; }

.notice {
  position: absolute; z-index: 50; inset-inline: 0; inset-block-start: 66px; margin-inline: auto; width: max-content; max-width: 88%;
  padding: 10px 20px; border-radius: 18px; background: #ffd0c7; color: var(--ink); font-weight: 800; font-size: 15.5px; text-align: center;
  border: 2.5px solid var(--ink); box-shadow: 0 5px 0 rgba(12, 4, 32, .7);
  opacity: 0; transform: translateY(-14px); transition: opacity .25s, transform .25s; pointer-events: none;
}
.notice.is-on { opacity: 1; transform: none; }

/* ---------- Sign-up ---------- */
.chips--grades { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.chips--grades .opt { padding-inline: 4px; min-width: 0; }
.chips--grades [data-grade^='kg'], .chips--grades .opt--wide { grid-column: span 3; }
.opt--num { font-family: var(--display); font-size: 21px; font-weight: 400; padding-block-start: 9px; }
.opt--dash { border-style: dashed; }
.input:disabled { opacity: .5; }
.field__hint[hidden] { display: none; }
.sheet__foot { padding-block-start: 14px; }

/* ---------- Level ---------- */
.tile.is-wait { animation: waitPulse .45s ease-in-out infinite alternate; outline: 3px solid #fff; outline-offset: 2px; }
@keyframes waitPulse { from { filter: brightness(1); } to { filter: brightness(1.22); } }
.answers--pics, .answers--pics.is-settled { grid-template-columns: repeat(var(--n, 3), 1fr); }
.art--emoji b { font-size: 62px; line-height: 1; font-weight: 400; }
.art--pair b { font-size: 38px; white-space: nowrap; }
.stopcard__best { color: var(--gold); font-weight: 700; margin-block-start: 4px; }
.stopcard .btn + .btn { margin-block-start: 8px; }

/* ---------- Result and sharing ---------- */
.btn--wa { background: linear-gradient(#4be585, #22b85d); color: var(--ink); box-shadow: 0 5px 0 #11793a, 0 10px 24px rgba(0, 0, 0, .35); }
.btn--wa:active { box-shadow: 0 2px 0 #11793a, 0 6px 14px rgba(0, 0, 0, .35); }
.btn--wa .glyph { width: 26px; height: 26px; }
.result__rank.is-first { background: var(--gold); color: var(--ink); }
.result__rank.is-first .glyph { color: var(--ink); }

/* ---------- Boards ---------- */
.tabs--3 { grid-template-columns: repeat(3, 1fr); }
.seg { display: flex; justify-content: center; gap: 8px; }
.seg button { min-height: 36px; padding: 2px 18px; border-radius: 999px; border: 1.5px solid #5a3f96; font-weight: 700; font-size: 14.5px; }
.seg button[aria-selected='true'] { background: var(--gold); color: var(--ink); border-color: var(--ink); }
.board { min-height: 132px; }
.board .row { padding-inline: 6px; }
.board__empty { text-align: center; padding-block: 36px; }
.modal__head h2 { flex: 0 1 auto; }
.modal__head #boardLive { flex: 1; display: flex; }
.modal__head .round { margin-inline-start: auto; }

/* ---------- Finale ---------- */
.finale .result__body { gap: 12px; }
.pole { position: relative; width: 196px; height: 150px; direction: ltr; }
.pole__staff { position: absolute; left: 14px; top: 6px; bottom: 0; width: 8px; border-radius: 4px; background: var(--cream); box-shadow: 0 0 0 2px var(--ink); }
.pole__staff::before { content: ''; position: absolute; left: -4px; top: -10px; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--ink); }
.pole__flag { position: absolute; left: 24px; top: 10px; width: 160px; border: 2px solid var(--ink); border-radius: 3px; overflow: hidden; line-height: 0; box-shadow: 0 0 34px rgba(245, 196, 81, .55); transform-origin: 0 50%; animation: wave 2.2s ease-in-out infinite alternate; }
.pole__flag svg { width: 100%; height: auto; display: block; }
.pole.is-rising .pole__flag { animation: hoist 2.6s cubic-bezier(.3, .7, .3, 1) both, wave 2.2s ease-in-out 2.6s infinite alternate; }
@keyframes hoist { from { top: 96px; opacity: .2; } to { top: 10px; opacity: 1; } }
@keyframes wave { from { transform: skewY(-2.5deg); } to { transform: skewY(2.5deg); } }
.cert {
  position: relative; overflow: hidden; width: 100%; display: grid; gap: 4px; padding: 18px 18px 22px; border-radius: 26px;
  background: linear-gradient(135deg, #4a2590, #24104a 70%); border: 3px solid var(--gold); box-shadow: 0 8px 0 #12072a;
}
.cert::after { content: ''; position: absolute; inset-inline: 0; inset-block-end: 0; height: 8px; background: linear-gradient(90deg, var(--red) 0 25%, var(--green) 0 50%, #fff 0 75%, var(--ink) 0); }
.cert__title { font-family: var(--display); font-size: 27px; line-height: 1.2; color: var(--gold); }
.cert__line { font-size: 14.5px; color: var(--lav); }
.cert__name { font-family: var(--display); font-size: clamp(34px, 10vw, 54px); line-height: 1.2; overflow-wrap: anywhere; }
.cert__body { font-size: 15.5px; font-weight: 600; line-height: 1.45; text-wrap: balance; }
.cert__foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-block-start: 8px; }
.cert__foot span { padding: 2px 14px; border-radius: 999px; background: var(--gold); color: var(--ink); border: 2px solid var(--ink); font-weight: 800; font-size: 14.5px; }

@media (max-height: 740px) {
  .kicker { font-size: 12.5px; margin-block-end: 2px; }
  .pole { height: 118px; transform: scale(.8); transform-origin: 50% 100%; }
}
@media (min-width: 600px) {
  .art--emoji b { font-size: 104px; }
  .art--pair b { font-size: 62px; }
  .cert { padding: 26px 28px 30px; }
  .cert__title { font-size: 36px; } .cert__body { font-size: 19px; } .cert__line { font-size: 17px; }
  .ticker { font-size: 15px; }
}
@media (min-width: 600px) and (max-height: 860px) {
  .art--emoji b { font-size: 74px; }
  .art--pair b { font-size: 46px; }
  .finale .result__body { grid-template-columns: 1fr; max-width: 620px; }
}
@media (min-width: 900px) {
  .ticker, .app[data-screen='map'] .ticker { inset-block-start: 12px; inset-inline-start: auto; inset-inline-end: 124px; max-width: 46%; }
}

/* ---------- Landing as a column ----------
   The words sit at the top and the start button with the live board at the bottom, so neither can
   run into the other on a short phone. On a wide screen the same column moves to the side. */
.landing.is-active { display: flex; flex-direction: column; justify-content: space-between; }
.landing__head, .landing__foot { position: static; width: 100%; }
.landing__head { padding-block-start: calc(var(--bar-h) - 14px); }
.teaser .row__main { min-width: 0; }
.teaser .row__sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teaser__head > span:first-of-type { white-space: nowrap; }
.footlinks { gap: 16px; white-space: nowrap; }
.footlinks .link { font-size: 13.5px; }
[dir='ltr'] .title__name { font-size: clamp(30px, 8.6vw, 46px); }
@media (max-height: 700px) {
  .lede { font-size: 14.5px; line-height: 1.35; }
  .family { font-size: 13.5px; }
  .landing__foot { gap: 7px; }
}
@media (min-width: 900px) {
  .landing.is-active { inset-inline: 0 auto; width: 42%; justify-content: center; gap: 24px; padding-block: 64px 28px; }
  .landing__head, .landing__foot { width: 100%; max-width: 560px; margin-inline: auto; padding-inline: 44px; }
  .landing__head { padding-block-start: 0; }
  .landing__foot { padding-block-end: 0; }
}
.landing__foot { grid-template-columns: minmax(0, 1fr); }
.teaser { min-width: 0; overflow: hidden; }
.footlinks { flex-wrap: wrap; row-gap: 2px; }
.pill { text-align: start; color: inherit; }
.mefoot { justify-content: flex-start; margin-block: 0 6px; }
.modal .btn { width: 100%; }
