/* Numeris 2 — a star atlas of mathematics.
   Layout concept: an observatory. The sky is the hub; each problem sits on a
   lit instrument bench. Night sky in dark mode, a printed day chart in light. */

:root {
  --sky: #EEF2FB; --sky-2: #E1E8F7;
  --panel: #FFFFFF; --panel-2: #F4F6FC; --bench: #FFFFFF; --bench-grid: rgba(21, 26, 58, 0.06);
  --ink: #151A3A; --ink-2: #3D4470; --ink-3: #5D648F; --line: rgba(21, 26, 58, 0.13);
  --gold: #E09A00; --gold-soft: rgba(224, 154, 0, 0.16); --go: #FFC857; --go-ink: #151A3A;
  /* gold that reads on light panels: marks and large numbers (3.8:1), small text (5:1) */
  --gold-mark: #B07800; --gold-ink: #9A6500;
  --cyan: #00838F; --good: #12865A; --good-ink: #0A6343; --good-bg: #DDF4E9; --try: #6B44D8; --try-bg: #ECE6FD; --bad: #C93A2E;
  --focus: #6B44D8;
  --shadow: 0 1px 0 rgba(21, 26, 58, 0.08), 0 12px 28px rgba(21, 26, 58, 0.10);
  --shadow-lift: 0 2px 0 rgba(21, 26, 58, 0.1), 0 18px 40px rgba(21, 26, 58, 0.16);
  --r: 22px; --r-sm: 14px;
  --f-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --f-ui: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --f-math: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky: #070B1E; --sky-2: #0E1533; --panel: #111938; --panel-2: #17214A; --bench: #0D1532; --bench-grid: rgba(200, 210, 255, 0.07);
    --ink: #EEF1FF; --ink-2: #B9C0E8; --ink-3: #8C95C4; --line: rgba(200, 210, 255, 0.15);
    --gold: #FFC857; --gold-soft: rgba(255, 200, 87, 0.16); --gold-mark: #FFC857; --gold-ink: #FFC857; --cyan: #5CE1E6; --good: #5BE3A1; --good-ink: #5BE3A1; --good-bg: rgba(91, 227, 161, 0.14);
    --try: #B79CFF; --try-bg: rgba(183, 156, 255, 0.14); --bad: #FF7A6B; --focus: #FFC857;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 14px 30px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 2px 0 rgba(0, 0, 0, 0.45), 0 20px 44px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sky: #070B1E; --sky-2: #0E1533; --panel: #111938; --panel-2: #17214A; --bench: #0D1532; --bench-grid: rgba(200, 210, 255, 0.07);
  --ink: #EEF1FF; --ink-2: #B9C0E8; --ink-3: #8C95C4; --line: rgba(200, 210, 255, 0.15);
  --gold: #FFC857; --gold-soft: rgba(255, 200, 87, 0.16); --gold-mark: #FFC857; --gold-ink: #FFC857; --cyan: #5CE1E6; --good: #5BE3A1; --good-ink: #5BE3A1; --good-bg: rgba(91, 227, 161, 0.14);
  --try: #B79CFF; --try-bg: rgba(183, 156, 255, 0.14); --bad: #FF7A6B; --focus: #FFC857;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 14px 30px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 2px 0 rgba(0, 0, 0, 0.45), 0 20px 44px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--sky); color: var(--ink); font-family: var(--f-ui); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { max-width: 100%; }
[hidden] { display: none !important; }
.rw-sr-only, .sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -0.015em; text-wrap: balance; margin: 0; line-height: 1.02; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: 16px; }
/* what a crawler or a visitor without JavaScript sees; the app replaces it */
.play-fallback { padding-block: 48px 64px; }
.play-fallback h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 10px 0 14px; }
.play-fallback p { max-width: 62ch; color: var(--ink-2); }
.play-fallback nav { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 18px; font-weight: 600; }
@media (min-width: 720px) { .wrap { padding-inline: 28px; } }
.screen { display: block; padding-block: 18px 48px; animation: screenIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow svg { width: 14px; height: 14px; color: var(--gold-mark); }
.small { font-size: .9rem; color: var(--ink-2); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.3rem; margin-bottom: 6px; }
.panel p { margin: 0 0 12px; color: var(--ink-2); }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin: 30px 0 14px; }
.section-h h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
.section-h p { margin: 0; color: var(--ink-2); }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 62px;
  padding: 10px max(16px, calc((100vw - 1180px) / 2 + 28px)); background: var(--sky); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #111938; color: #FFC857; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 200, 87, .35); }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--f-display); font-weight: 800; font-size: 1.32rem; line-height: 1; letter-spacing: -.02em; }
.brand-name small { display: block; font-family: var(--f-ui); font-weight: 600; font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.tb-space { flex: 1; }
/* the way to the grown-ups screen, and from there to the rest of the site: quiet, beside the
   star count (the site's own pages count visits, so they stay one deliberate step away) */
.tb-site { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--ink-2); font: inherit; font-weight: 600; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tb-btn { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; font-size: .92rem; }
.tb-btn svg { width: 20px; height: 20px; flex: none; }
.tb-btn:hover { border-color: var(--ink-3); }
.tb-btn.icon-only { width: 44px; padding: 0; justify-content: center; }
.stars-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink); font-size: 1rem; padding: 0 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.stars-chip svg { width: 18px; height: 18px; color: var(--gold-mark); display: block; }
@media (max-width: 560px) { .hide-sm { display: none; } .brand-name small { display: none; } }
.stars-chip:hover { border-color: var(--ink-3); }
.brand { min-width: 0; }
@media (max-width: 380px) { .topbar { gap: 8px; } .topbar .tb-btn ~ .brand .brand-mark { display: none; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 14px; border: 0;
  background: var(--go); color: var(--go-ink); font-weight: 700; font-size: 1.04rem; text-decoration: none;
  box-shadow: 0 3px 0 #C98F12, 0 10px 22px rgba(224, 154, 0, .22); transition: transform .12s ease, box-shadow .12s ease, filter .2s; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #C98F12; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--panel-2); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); cursor: not-allowed; filter: none; transform: none; }
.btn-quiet { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.btn-quiet:hover { box-shadow: inset 0 0 0 1px var(--ink-3), var(--shadow); }
.btn-hint { background: var(--try-bg); color: var(--try); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--try) 45%, transparent); }
.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--bad) 70%, #000); }
.btn-sm { min-height: 42px; padding: 0 14px; font-size: .92rem; border-radius: 11px; }
.link-btn { background: none; border: 0; padding: 6px 2px; min-height: 44px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--topic, var(--gold)) 60%, var(--line)); background: color-mix(in srgb, var(--topic, var(--gold)) 12%, var(--panel)); color: var(--ink); font-weight: 700; }
.chip:hover { background: color-mix(in srgb, var(--topic, var(--gold)) 22%, var(--panel)); }
.chip-quiet { border-color: var(--line); background: transparent; }

.foot { border-top: 1px solid var(--line); padding-block: 22px 32px; color: var(--ink-2); font-size: .9rem; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; align-items: center; }
.foot a { color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; }
.foot .link-btn { min-height: 44px; }

/* ---------- sky (home) ---------- */
.sky-screen { padding-top: 0; }
.sky-hero { padding-top: 18px; }
.sky-title { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px; margin-bottom: 14px; }
.sky-title h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); font-weight: 800; }
.sky-title p { margin: 8px 0 0; color: var(--ink-2); font-size: 1.08rem; max-width: 46ch; }
.sky-count { display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
.sky-count b { font-family: var(--f-display); font-size: 1.5rem; color: var(--gold-mark); font-variant-numeric: tabular-nums; }
/* The stage is a field of constellations above a strip of ground: the hill with the
   Observatory, Tessel and his speech bubble. js/sky.js lays out the zones in the field. */
.sky-stage { --field: clamp(390px, 42vw, 500px); --ground: 124px; position: relative; width: 100%; height: calc(var(--field) + var(--ground)); border-radius: 28px; overflow: hidden; background: #070B1E; box-shadow: var(--shadow-lift); isolation: isolate; }
.sky-canvas { position: absolute; inset: 0; z-index: -1; display: block; }
.sky-stage { --sky-label: #EEF1FF; --sky-label-2: #B9C0E8; --sky-halo: rgba(7, 11, 30, .95); }
.const { position: absolute; z-index: 1; }
.const-go { position: absolute; inset: 0; padding: calc(var(--box, 100px) + 2px) 2px 2px; border: 0; border-radius: 16px; background: transparent; color: inherit;
  display: flex; flex-direction: column; justify-content: flex-start; align-items: center; text-align: center; transition: background .2s; }
.const-go:hover { background: color-mix(in srgb, var(--topic) 12%, transparent); }
.const-go:focus-visible { outline-offset: -2px; }
.const-name { font-family: var(--f-display); font-weight: 700; font-size: .92rem; line-height: 1.1; color: var(--sky-label, var(--ink)); text-shadow: 0 1px 6px var(--sky-halo, transparent); }
.const-topic { font-size: .72rem; font-weight: 600; color: var(--sky-label-2, var(--ink-2)); line-height: 1.2; }
.ct-name::after { content: ' · '; }
.sky-stage.is-phone .const-name { font-size: .78rem; }
.sky-stage.is-phone .const-topic { font-size: .68rem; }
.sky-stage.is-phone .ct-name, .sky-stage.is-compact .ct-name { display: none; }
/* the constellation's topic, for screen readers when the label is too small to show it */
.ct-sr { display: none; }
.sky-stage.is-phone .ct-sr, .sky-stage.is-compact .ct-sr { display: inline; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sky-stage.is-compact .const-name { font-size: .84rem; }
.sky-stage.is-compact .const-topic { font-size: .7rem; }
@media (max-width: 640px) {
  .sky-stage { --field: max(296px, calc(100vw - 24px)); --ground: calc(var(--say-h, 124px) + 86px); border-radius: 22px; margin-inline: -4px; width: calc(100% + 8px); }
}
@media (max-width: 360px) { .sky-stage { --say-h: 146px; } }
@media (min-width: 641px) and (max-width: 899px) { .sky-stage { --ground: 224px; } }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 26px; margin-top: 26px; align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
.home-side { display: grid; gap: 18px; }
.next-card { position: relative; overflow: hidden; padding: 24px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.next-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--topic); }
.next-card h2 { font-size: clamp(1.45rem, 3vw, 2rem); margin: 6px 0 6px; }
.next-card p { margin: 0 0 16px; color: var(--ink-2); }
.next-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.topic-card { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); transition: transform .2s var(--spring), border-color .2s; }
.topic-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--topic) 60%, var(--line)); }
.tc-glyph { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: #0E1533; }
.tc-glyph svg line, .gu-glyph svg line, .tc-glyph svg circle, .gu-glyph svg circle { stroke: var(--topic); }
.tc-glyph svg line, .gu-glyph svg line { stroke-width: 1.4; opacity: .75; }
.tc-glyph svg circle, .gu-glyph svg circle { fill: #fff; stroke-width: 1.2; }
.tc-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.tc-body b { font-family: var(--f-display); font-size: 1.08rem; }
.tc-body small { color: var(--ink-2); font-size: .84rem; }
.tc-bar { display: block; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.tc-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--topic), var(--gold)); border-radius: 3px; }
.spark { background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 14%, var(--panel)), var(--panel) 60%); }
.spark h2 { margin-top: 4px; }

/* ---------- constellation (topic) ---------- */
.topic-head { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: center; margin-bottom: 26px; }
@media (max-width: 720px) { .topic-head { grid-template-columns: 1fr; gap: 10px; } .topic-fig { max-width: 200px; } }
.topic-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 4px 0 8px; }
.topic-head p { margin: 0; color: var(--ink-2); max-width: 62ch; }
.topic-fig { aspect-ratio: 1; border-radius: 26px; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--topic) 30%, #111938), #070B1E 72%); padding: 6px; box-shadow: var(--shadow-lift); }
.topic-fig svg { width: 100%; height: 100%; display: block; }
:is(.topic-fig, .cel-fig) line { stroke: rgba(200, 210, 255, .25); stroke-width: 1.6; stroke-dasharray: 3 5; }
:is(.topic-fig, .cel-fig) line.on { stroke: #FFC857; stroke-dasharray: none; stroke-width: 2.4; filter: drop-shadow(0 0 4px rgba(255, 200, 87, .7)); }
:is(.topic-fig, .cel-fig) .fs circle { fill: rgba(200, 210, 255, .35); }
:is(.topic-fig, .cel-fig) .fs.s1 circle { fill: #FFE3A3; } :is(.topic-fig, .cel-fig) .fs.s2 circle { fill: #FFD27A; } :is(.topic-fig, .cel-fig) .fs.s3 circle { fill: #FFC857; filter: drop-shadow(0 0 6px rgba(255, 200, 87, .9)); }
:is(.topic-fig, .cel-fig) .fs.trial circle { stroke: rgba(255, 200, 87, .6); stroke-width: 2; }
:is(.topic-fig, .cel-fig) .fs text { fill: rgba(230, 236, 255, .8); font: 700 11px var(--f-ui); text-anchor: middle; }
:is(.topic-fig, .cel-fig) .fs .fs-ring { fill: none; stroke: #FFC857; stroke-width: 2; filter: none; transform-box: fill-box; transform-origin: center; animation: ringOut 1.8s ease-out infinite; }
@keyframes ringOut { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.topic-sum { margin-top: 14px; display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
.topic-sum b { color: var(--gold-mark); font-family: var(--f-display); font-size: 1.2rem; }
.lvl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lvl { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: 'n body meta' 'n acts acts'; gap: 6px 16px; align-items: center; padding: 16px 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
@media (min-width: 980px) { .lvl { grid-template-columns: 48px minmax(0, 1fr) auto auto; grid-template-areas: 'n body meta acts'; } }
.lvl.is-full { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 9%, var(--panel)), var(--panel) 50%); }
.lvl-n { grid-area: n; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--topic) 18%, var(--panel)); border: 1.5px solid color-mix(in srgb, var(--topic) 60%, transparent); font-family: var(--f-display); font-weight: 800; font-size: 1.2rem; }
.lvl-body { grid-area: body; min-width: 0; }
.lvl-body h2 { font-size: 1.12rem; line-height: 1.2; }
.lvl-body p { margin: 2px 0 0; color: var(--ink-2); font-size: .94rem; }
.lvl-std { display: inline-block; margin-top: 4px; font-size: .74rem; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.lvl-meta { grid-area: meta; display: grid; justify-items: end; gap: 6px; }
.lvl-stars { display: flex; gap: 2px; }
.lvl-stars i { width: 20px; height: 20px; color: color-mix(in srgb, var(--ink-3) 40%, transparent); }
.lvl-stars i.on { color: var(--gold-mark); }
.lvl-stars svg { width: 100%; height: 100%; display: block; }
.lvl-actions { grid-area: acts; display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--topic) 65%, var(--line)); background: var(--panel); color: var(--ink); font-weight: 700; font-size: .94rem; }
.pill:hover { background: color-mix(in srgb, var(--topic) 14%, var(--panel)); }
.pill svg { width: 16px; height: 16px; }
.pill.done { background: color-mix(in srgb, var(--good) 14%, var(--panel)); border-color: color-mix(in srgb, var(--good) 60%, transparent); }
.pill.done svg { color: var(--good); }
.pill-soft { border-style: dashed; color: var(--ink-2); }
.pill small { font-weight: 600; color: var(--ink-3); }
/* on a lit pill's green tint the counter needs the stronger ink to keep 4.5:1 */
.pill.done small { color: var(--ink-2); }
.mdots { display: inline-flex; gap: 4px; }
.mdots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--ink-3) 70%, transparent); }
.mdots i.u { background: var(--good); border-color: var(--good); }
.mdots i.h { background: linear-gradient(90deg, var(--good) 50%, transparent 50%); border-color: var(--good); }
.mdots i.x { border-style: dashed; }
.mdots i.g { background: radial-gradient(circle, var(--good) 0 38%, transparent 42%); border-color: var(--good); }
.mdots.inline { vertical-align: -1px; }
.trial-card { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px; border-radius: var(--r); color: #EEF1FF;
  background: radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--topic) 45%, transparent), transparent 55%), #0E1533; box-shadow: var(--shadow-lift); }
.trial-card .eyebrow { color: #B9C0E8; }
.trial-card h2 { font-size: 1.5rem; margin: 4px 0; }
.trial-card p { margin: 0; color: #B9C0E8; max-width: 60ch; }
.trial-card .lock svg { width: 34px; height: 34px; color: #8C95C4; }
.trial-card.done { box-shadow: 0 0 0 2px #FFC857, var(--shadow-lift); }

.actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.actions .btn { min-width: 160px; }
@keyframes starIn { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.burst { position: fixed; z-index: 80; width: 14px; height: 14px; pointer-events: none; }
.burst svg { width: 100%; height: 100%; }
/* ---------- modal + settings ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(7, 11, 30, .55); backdrop-filter: blur(4px); animation: fadeIn .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(100%, 520px); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; border-radius: 24px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-lift); border: 1px solid var(--line); }
.modal h2 { font-size: 1.6rem; margin-bottom: 14px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.setting > div:first-child { font-weight: 700; }
.setting small { display: block; font-weight: 500; color: var(--ink-2); font-size: .84rem; }
/* the whole label is the target: at least 44px each way for small fingers */
.switch { display: inline-flex; align-items: center; justify-content: center; min-width: 72px; min-height: 48px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; width: 68px; height: 44px; border-radius: 999px; background: var(--panel-2); border: 1.5px solid var(--ink-3); margin: 0; cursor: pointer; transition: background .2s; }
.switch input::after { content: ''; position: absolute; left: 4px; top: 4px; width: 33px; height: 33px; border-radius: 50%; background: var(--ink-3); transition: transform .2s var(--spring), background .2s; }
.switch input:checked { background: var(--gold); border-color: var(--gold); }
.switch input:checked::after { transform: translateX(24px); background: #fff; }
.celebrate { display: grid; justify-items: center; text-align: center; gap: 8px; }
.celebrate p { margin: 0; color: var(--ink-2); }
.celebrate .actions { flex-direction: column; align-items: stretch; width: 100%; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
.lvl-actions { flex-wrap: nowrap; }
.pill { white-space: nowrap; flex: none; }
@media (min-width: 980px) { .lvl { grid-template-columns: 48px minmax(0, 1fr) auto max-content; } }
@media (max-width: 560px) { .lvl-actions { flex-wrap: wrap; } .lvl { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 14px; } .lvl-n { width: 38px; height: 38px; font-size: 1rem; } }
/* sky decoration */
.twinkles { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.twinkle { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(200, 215, 255, .8); opacity: .15; animation: twinkle 4.2s var(--d) ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .1; transform: scale(.6); } 50% { opacity: .95; transform: scale(1); } }

/* news sits at the foot of the field, where only labels live (friends sit at the top of
   their zones), never takes a tap, and fades after a few seconds */
.sky-toast { position: absolute; left: 50%; top: auto; bottom: calc(var(--ground, 0px) + 6px); transform: translateX(-50%); z-index: 4; pointer-events: none; width: max-content; max-width: calc(100% - 24px); text-align: center; line-height: 1.3; display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: rgba(17, 25, 56, .88); color: #FFE3A3; font-weight: 700; box-shadow: 0 0 0 1px rgba(255, 200, 87, .45), 0 10px 30px rgba(0, 0, 0, .4); animation: toastIn .6s var(--spring) both .3s; }
.sky-toast svg { width: 18px; height: 18px; color: #FFC857; flex: none; }
.sky-toast.out { animation: toastOut .6s ease both; }
@keyframes toastOut { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 480px) { .sieve { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.tessel-role { font-size: .82rem; color: var(--ink-2); }
/* ---------- sky friends (one per constellation; drawn in js/friends.js) ---------- */
.fr .fr-eyes-shut, .fr .fr-zzz { display: none; }
/* asleep is dreaming, not switched off: colors stay, eyes close, z's drift up */
.fr[data-stage="asleep"] .cx-eyes-open, .fr[data-stage="asleep"] .cx-eyes-happy { display: none; }
.fr[data-stage="asleep"] .fr-eyes-shut, .fr[data-stage="asleep"] .fr-zzz { display: inline; }
.fr[data-stage="asleep"] .cx-body { filter: saturate(.82); animation-duration: 5.2s; }
.fr[data-stage="asleep"] .cx-cheek { opacity: .4; }
/* glowing and shining are light: a soft glow in the friend's color, then gold */
.fr { filter: var(--fr-rim,) var(--fr-glow,); }
.fr[data-stage="glowing"] { --fr-glow: drop-shadow(0 0 3px color-mix(in srgb, var(--fr) 70%, #fff)) drop-shadow(0 0 10px color-mix(in srgb, var(--fr) 75%, transparent)); }
.fr[data-stage="shining"] { --fr-glow: drop-shadow(0 0 3px #FFF1C2) drop-shadow(0 0 12px rgba(255, 200, 87, .85)); }
/* on the night tiles a thin moonlit rim keeps the ink outline readable */
:is(.sky-stage, .tc-friend, .log-face, .fc-face, .th-face, .chart-photo, .riddle-face) .fr { --fr-rim: drop-shadow(0 0 1.2px rgba(214, 224, 255, .85)); }
.fr .fr-zzz path { animation: frZ 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.fr .fr-zzz .fr-z2 { animation-delay: 1.1s; }
@keyframes frZ { 0%, 100% { opacity: .25; transform: translateY(2px); } 50% { opacity: 1; transform: translateY(-3px); } }
.fr .fr-rays path { animation: frRay 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.fr .fr-rays path:nth-child(2n) { animation-delay: .8s; }
@keyframes frRay { 0%, 100% { transform: scale(.7); opacity: .6; } 50% { transform: scale(1.1); opacity: 1; } }
.fr.stir .cx-body { animation: cxWobble .5s ease-in-out 1; }
.fr.stir .fr-zzz path { animation-duration: .7s; }
.fr.waking .cx-body { animation: frWake .9s cubic-bezier(.3, 1.4, .5, 1) 1; }
@keyframes frWake { 0% { transform: scale(.94, 1.04); } 35% { transform: translateY(-12px) scale(1.06, .94); } 70% { transform: scale(.98, 1.02); } 100% { transform: none; } }
/* per-friend hinges, so a turning head stays on its neck and wings stay on their shoulders */
.cx.fr-fibby .cx-head { transform-origin: 90px 105px; }
.cx.fr-clawdia .cx-head { transform-origin: 60px 68px; }
.cx.fr-clawdia .cx-arm-l { transform-origin: 36px 80px; }
.cx.fr-clawdia .cx-arm-r { transform-origin: 84px 80px; }
.cx.fr-dash .cx-head { transform-origin: 60px 58px; }
.cx.fr-dash .cx-arm-l, .cx.fr-dash .cx-arm-r { transform-origin: 60px 64px; }
.cx.fr-maybe .cx-head { transform-origin: 60px 78px; }
.cx.fr-demi .cx-head { transform-origin: 70px 62px; }
.cx.fr-demi .cx-arm-l { transform-origin: 68px 62px; }
.cx.fr-dot .cx-arm-l { transform-origin: 42px 82px; }
.cx.fr-dot .cx-arm-r { transform-origin: 78px 82px; }
.cx.fr-clawdia:is([data-mood="happy"], [data-mood="cheer"]) .cx-arm-l { transform: rotate(16deg); }
.cx.fr-clawdia:is([data-mood="happy"], [data-mood="cheer"]) .cx-arm-r { transform: rotate(-16deg); }
.cx.fr-clawdia[data-mood="think"] .cx-arm-r { transform: rotate(-10deg); }
.cx.fr-dash[data-mood="happy"] .cx-arm-l { transform: rotate(14deg); }
.cx.fr-dash[data-mood="happy"] .cx-arm-r { transform: rotate(-14deg); }
.cx.fr-dash[data-mood="cheer"] .cx-arm-l { transform: rotate(24deg); }
.cx.fr-dash[data-mood="cheer"] .cx-arm-r { transform: rotate(-24deg); }
.cx.fr-dash[data-mood="think"] .cx-arm-r { transform: none; }
.cx.fr-dash:not([data-stage="asleep"]) .cx-arm-l, .cx.fr-dash:not([data-stage="asleep"]) .cx-arm-r { animation: dashBuzz 2.6s ease-in-out infinite; }
.cx.fr-dash .cx-arm-r { animation-delay: .08s; }
@keyframes dashBuzz { 0%, 86%, 100% { rotate: 0deg; } 90% { rotate: 6deg; } 94% { rotate: -4deg; } }
.cx.fr-demi:is([data-mood="happy"], [data-mood="cheer"]) .cx-arm-l { transform: rotate(-22deg); }
.cx.fr-demi[data-mood="think"] .cx-arm-r { transform: none; }
.cx.fr-dot[data-mood="cheer"] .cx-arm-l { transform: rotate(48deg); }
.cx.fr-dot[data-mood="cheer"] .cx-arm-r { transform: rotate(-48deg); }
/* Ex changes color now and then, the way a variable changes value */
.cx.fr-ex:not([data-stage="asleep"]) .fr-skin { animation: exSkin 12s ease-in-out infinite; }
@keyframes exSkin { 0%, 40%, 100% { fill: #FFD54F; } 60% { fill: #A8DC6E; } 75% { fill: #8FD6C4; } }
@media (prefers-reduced-motion: reduce) { .fr .fr-zzz path, .fr .fr-rays path, .cx.fr-dash .cx-arm-l, .cx.fr-dash .cx-arm-r, .cx.fr-ex .fr-skin, .fr.waking .cx-body, .fr.stir .cx-body { animation: none !important; } }
:root[data-motion="reduced"] :is(.fr .fr-zzz path, .fr .fr-rays path, .cx.fr-dash .cx-arm-l, .cx.fr-dash .cx-arm-r, .cx.fr-ex .fr-skin, .fr.waking .cx-body, .fr.stir .cx-body) { animation: none !important; }
.fr-tile { background: #0E1533; }

/* ---------- the sky as a place: friends, the Observatory hill, Tessel ---------- */
.sky-stage :focus-visible { outline-color: #FFC857; }
.skip-sky { position: absolute; left: 50%; z-index: 20; transform: translate(-50%, -140%); min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--go); color: var(--go-ink); font-weight: 700; box-shadow: var(--shadow); opacity: 0; pointer-events: none; }
.skip-sky:focus { opacity: 1; pointer-events: auto; transform: translate(-50%, 8px); }
.sky-hero { position: relative; }
/* a friend sits beside its figure, inside its own zone; the button is at least 44px */
.const-friend { position: absolute; z-index: 2; top: 0; left: var(--fx, 0px); width: max(44px, var(--fs, 44px)); height: max(44px, var(--fs, 44px)); padding: 0; border: 0; border-radius: 50%; background: transparent;
  display: flex; align-items: flex-start; justify-content: flex-start; -webkit-tap-highlight-color: transparent; }
.const:not(.fr-left) .const-friend { left: auto; right: 0; justify-content: flex-end; }
.const-friend svg { width: var(--fs, 44px); height: var(--fs, 44px); flex: none; transition: transform .3s var(--spring); }
.const-friend:hover svg { transform: translateY(-3px) scale(1.07); }
.const-friend:focus-visible { outline-offset: 0; }
.sky-say { position: absolute; z-index: 6; margin: 0; max-width: min(300px, calc(100% - 16px)); padding: 8px 12px; border-radius: 14px; background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); font-size: .92rem; line-height: 1.4; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .25s var(--spring); }
.sky-say.show { opacity: 1; transform: none; }
.sky-say::before { content: ''; position: absolute; top: -7px; left: calc(var(--tail, 30px) - 6px); width: 12px; height: 12px; background: var(--panel); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.sky-say.above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.sky-lens { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .45s ease;
  background: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), transparent calc(var(--lr, 80px) - 1px), rgba(3, 6, 18, .7) var(--lr, 80px)); }
.sky-lens::after { content: ''; position: absolute; left: calc(var(--lx, 50%) - var(--lr, 80px)); top: calc(var(--ly, 50%) - var(--lr, 80px)); width: calc(var(--lr, 80px) * 2); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 3px #FFC857, 0 0 0 9px rgba(255, 200, 87, .18), 0 0 30px 6px rgba(255, 200, 87, .45); }
.sky-stage.lensing .sky-lens { opacity: 1; }
.const.in-lens { z-index: 4; }
.sky-ground { position: absolute; left: 0; right: 0; bottom: 0; height: var(--ground, 0px); z-index: 5; pointer-events: none; }
.sky-ground .hill { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 112px; display: block; }
.obs-btn, .tessel-btn, .shoot-btn { position: absolute; padding: 0; border: 0; background: none; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.obs-btn { left: max(10px, 3%); bottom: 0; width: 132px; height: 113px; border-radius: 18px 18px 0 0; }
.obs-btn .obs { width: 100%; height: 100%; display: block; overflow: visible; }
.obs-scope { transform-box: view-box; transform-origin: 70px 50px; transform: rotate(var(--aim, 0deg)); transition: transform .6s var(--spring); }
.obs-glow { filter: drop-shadow(0 0 5px rgba(255, 200, 87, .95)) drop-shadow(0 0 12px rgba(255, 200, 87, .55)); animation: lantern 3.4s ease-in-out infinite; }
@keyframes lantern { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 60% { opacity: .95; } }
.tessel-btn { left: calc(max(10px, 3%) + 126px); bottom: 2px; width: 96px; height: 96px; border-radius: 50%; }
.tessel-btn .cx { width: 100%; height: 100%; }
.tessel-btn:hover .cx { filter: drop-shadow(0 0 10px rgba(255, 224, 138, .5)); }
.shoot-btn { right: 18px; bottom: 30px; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #FFC857; background: radial-gradient(circle, rgba(255, 200, 87, .38), rgba(255, 200, 87, 0) 70%); opacity: 0; transition: opacity .4s; }
.shoot-btn svg { width: 30px; height: 30px; filter: drop-shadow(0 0 8px rgba(255, 220, 140, .95)); transform: scale(.3); transition: transform .5s var(--spring); }
.shoot-btn.landed { opacity: 1; }
.shoot-btn.landed svg { transform: none; }
.shoot-btn.landed svg { animation: shootBob 2.6s ease-in-out infinite .5s; }
@keyframes shootBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
.shoot-streak { position: absolute; left: 0; top: 0; z-index: 3; width: 130px; height: 3px; margin: -1.5px 0 0 -130px; border-radius: 2px; transform-origin: 100% 50%; pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 243, 196, 0), #FFF3C4 75%, #fff); box-shadow: 0 0 12px 2px rgba(255, 220, 140, .7); }
/* Tessel's speech bubble, on the hill beside him (wide skies) or above him (narrow skies) */
.tessel-bubble { position: absolute; z-index: 1; left: calc(max(10px, 3%) + 232px); right: 84px; bottom: 16px; margin: 0; padding: 10px 14px; border-radius: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35); line-height: 1.45; pointer-events: auto; }
.tessel-bubble::before { content: ''; position: absolute; left: -7px; bottom: 26px; width: 13px; height: 13px; background: var(--panel); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.tessel-bubble.pop { animation: bubblePop .4s var(--spring) both; }
@keyframes bubblePop { 0% { transform: scale(.97); } 100% { transform: none; } }
@media (max-width: 899px) {
  .tessel-bubble { left: 10px; right: 10px; bottom: 120px; font-size: .96rem; }
  .tessel-bubble::before { left: 168px; bottom: -7px; transform: rotate(-45deg); }
}
@media (max-width: 640px) {
  .sky-toast { font-size: .86rem; padding: 7px 12px; border-radius: 14px; bottom: calc(var(--ground, 0px) + 4px); white-space: nowrap; }
  .sky-ground .hill { height: 92px; }
  .obs-btn { width: 96px; height: 82px; left: 8px; }
  .tessel-btn { left: 100px; width: 74px; height: 74px; }
  .shoot-btn { right: 6%; bottom: 20px; }
  .tessel-bubble { left: 8px; right: 8px; bottom: 82px; padding: 9px 12px; font-size: .93rem; line-height: 1.4; }
  .tessel-bubble::before { left: 130px; }
}
@media (max-width: 360px) { .tessel-bubble { font-size: .9rem; } }

/* settings: a segmented control */
.seg { display: inline-flex; flex-wrap: wrap; border-radius: 12px; background: var(--panel-2); padding: 4px; gap: 4px; border: 1px solid var(--line); }
.seg button { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; font-weight: 700; font-size: .95rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sky); }
.riddle-face svg { width: 100%; height: 100%; display: block; }

/* while a screen is still loading: the bench, empty, with a quiet note */
.shell { padding-top: 26px; }
.shell-bench { display: grid; place-items: center; min-height: min(56vh, 460px); margin-top: 12px; border-radius: 26px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lift); position: relative; }
.shell-bench::before { content: ''; position: absolute; left: 24px; right: 24px; top: -1px; height: 4px; border-radius: 0 0 4px 4px; background: var(--topic); }
.shell-note { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-weight: 700; color: var(--ink-2); }
.shell-star { display: block; width: 26px; height: 26px; color: var(--gold-mark); animation: shellSpin 1.6s ease-in-out infinite; }
.shell-star svg { width: 100%; height: 100%; display: block; }
@keyframes shellSpin { 0%, 100% { transform: scale(.85) rotate(0); opacity: .7; } 50% { transform: scale(1.1) rotate(72deg); opacity: 1; } }

/* topic cards and the star log */
.tc-friend { background: #0E1533; }
/* the small portraits in cards and the log hold still; the sky is where friends move */
:is(.tc-friend, .log-face) .fr .cx-body, :is(.tc-friend, .log-face) .fr .fr-zzz path, :is(.tc-friend, .log-face) .fr .fr-skin, :is(.tc-friend, .log-face) .fr .cx-arm-l, :is(.tc-friend, .log-face) .fr .cx-arm-r { animation: none !important; }
.tc-friend svg { width: 58px; height: 58px; display: block; }
.log-panel h2 { margin-top: 4px; }
.log-list { list-style: none; margin: 6px 0 16px; padding: 0; display: grid; gap: 10px; }
.log-list li { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: center; font-size: .94rem; color: var(--ink-2); line-height: 1.4; }
.log-face, .log-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #0E1533; }
.log-face svg { width: 34px; height: 34px; }
.log-ico svg { width: 18px; height: 18px; color: #FFC857; }
.log-date { font-weight: 700; color: var(--ink); margin-right: 2px; }

/* the constellation page's host */
.topic-host { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.th-face { flex: none; width: 80px; height: 80px; padding: 4px; border: 0; border-radius: 20px; background: #0E1533; box-shadow: var(--shadow); }
.th-face svg { width: 100%; height: 100%; display: block; }
.topic-host p { position: relative; margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: 56ch; }
.topic-host p::before { content: ''; position: absolute; left: -8px; top: 22px; width: 13px; height: 13px; background: var(--panel); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }

.riddle { display: grid; justify-items: center; text-align: center; gap: 8px; }
.riddle h2 { margin-bottom: 0; }
.riddle p { margin: 0; color: var(--ink-2); }
.riddle-face { width: 112px; height: 112px; padding: 6px; border-radius: 28px; background: #0E1533; box-shadow: var(--shadow); }
.riddle .riddle-q { font-size: 1.22rem; font-weight: 700; color: var(--ink); max-width: 34ch; margin: 4px 0; }
.riddle-a { width: 100%; }
.riddle .actions { width: 100%; }
/* answering the riddle */
.riddle-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; width: 100%; margin: 4px 0; }
.riddle-choice { min-height: 52px; padding: 10px 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); font-family: var(--f-math); font-size: 1.02rem; font-weight: 600; box-shadow: 0 2px 0 var(--line); transition: transform .15s var(--spring), border-color .15s, background .15s; }
.riddle-choice:hover:not([disabled]) { border-color: var(--ink-3); transform: translateY(-2px); }
.riddle-choice.is-right { border-color: var(--good); background: var(--good-bg); color: var(--ink); opacity: 1; }
.riddle-choice.is-picked.out { text-decoration: line-through; opacity: .55; }
.riddle-choice[disabled] { cursor: default; }
.riddle-choice[disabled]:not(.is-right):not(.is-picked) { opacity: .55; }
.riddle .riddle-peek { min-height: 44px; }
.riddle .riddle-peek[hidden] { display: none; }
.riddle-a:empty { display: none; }
.riddle-a p { margin: 4px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); color: var(--ink); text-align: left; }

/* ---------- a browser that can't keep progress ---------- */
.store-note { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); color: var(--ink); font-size: .92rem; line-height: 1.45; }
.store-ico svg { width: 18px; height: 18px; display: block; margin-top: 2px; color: var(--gold-ink); }

/* ---------- the first thing to do, in the first view ---------- */
/* the daily spark's own panel sits below the constellations on narrow screens, so the first
   view carries a way into it there; wide screens show the panel beside the sky */
.hero-spark { display: none; min-height: 44px; }
.hero-spark svg { width: 18px; height: 18px; color: var(--gold); }
@media (max-width: 900px) { .hero-spark { display: inline-flex; } }
.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hero-go { min-height: 62px; padding: 8px 20px 8px 22px; border-radius: 16px; text-align: left; gap: 14px; }
.hero-go-txt { display: grid; gap: 2px; line-height: 1.2; }
.hero-go-txt small { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .78; }
@media (max-width: 640px) {
  .sky-title { gap: 12px; }
  .hero-side { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .hero-go { flex: 1 1 100%; min-width: 0; }
  .sky-count { flex: none; padding: 6px 12px; font-size: .86rem; }
  .sky-count b { font-size: 1.2rem; }
}

/* the mastery moment fits a short laptop screen, buttons and all */
@media (max-height: 760px) {
  .celebrate { gap: 6px; }
  .celebrate .cel-scene { width: 196px; height: 132px; }
  .celebrate .cel-fig { width: 128px; height: 128px; }
  .celebrate .cel-friend { width: 82px; height: 82px; }
  .celebrate h2 { font-size: 1.45rem; margin-bottom: 0; }
  .celebrate .actions { margin-top: 10px; gap: 8px; }
  .celebrate .actions .btn { min-height: 46px; }
  .modal { padding: 18px 22px; }
}

/* focus scrolled into view clears the sticky top bar (and, on phones, the buttons along the bottom) */
html { scroll-padding-top: calc(76px + env(safe-area-inset-top, 0px)); }
@media (max-width: 899px) { html { scroll-padding-bottom: 96px; } }

/* a screen that failed to draw: try again, or start fresh */
.load-fail { padding-top: 32px; padding-bottom: 32px; }
.load-fail .actions { justify-content: flex-start; }
.load-fail .trouble { margin-top: 28px; max-width: 60ch; color: var(--ink-2); }
.load-fail .trouble summary { cursor: pointer; font-weight: 700; color: var(--ink); min-height: 44px; display: flex; align-items: center; }

/* each star's grade band, beside its name */
.lvl-band { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; font: 700 .74rem var(--f-ui); letter-spacing: .02em; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); vertical-align: 2px; white-space: nowrap; }

/* first visit: which grade? (only picks the first star) */
.grade-pick { display: grid; gap: 8px; margin: 0 0 12px; }
.gp-h { font-weight: 700; }
.gp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.grade-pick .chip[aria-pressed="true"] { background: var(--ink); color: var(--sky); border-color: var(--ink); }
.next-card .gp-note { margin: 0 0 16px; }
.gp-note .link-btn { font-weight: 700; }
.next-card h2 .lvl-band { font-size: .78rem; vertical-align: 4px; }
.hero-grade { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; color: var(--ink); }
.hg-lab { font-weight: 700; margin-right: 4px; }
.hg-chip { min-width: 44px; justify-content: center; padding: 0 10px; font-weight: 700; }
.hero-grade .chip[aria-pressed="true"] { background: var(--ink); color: var(--sky); border-color: var(--ink); }
.chip.chip-preview:not([aria-pressed="true"]) { border-style: dashed; }
.chip-preview small { font-weight: 600; opacity: .8; }
.hg-note { flex-basis: 100%; text-align: right; font-size: .85rem; color: var(--ink-2); }
.grade-card { margin: 18px 0 6px; padding: 16px 18px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.grade-card .grade-pick { margin: 0 0 4px; }
.grade-card .gp-note { margin: 4px 0 0; }
@media (max-width: 719px) { .hero-side { flex-wrap: wrap; } .hero-grade { flex-basis: 100%; justify-content: flex-start; } .hg-lab { flex-basis: 100%; } .hg-note { text-align: left; } }
