/* ============================================================================
   B1 ACADEMY — "Studio Starry" theme layer (loaded after app.css)
   A light gallery wall: pale lavender paper, ink-black type set very large,
   and live paintings (index.html art engine) as the only loud thing on a page.
   Palette taken from Van Gogh's tubes:
     cobalt  #2346ff  actions, links, progress, the brush ribbon
     chrome  #f4bd1a  stars, highlights, today
     viridian #0f8a5f correct      vermilion #d6361f mistakes
     prussian #1f6fb8 information  ochre #b86e00 warnings
   Articles: der cobalt · die vermilion · das ochre.
   Type (offline, built into Windows): Bahnschrift for headlines and numbers,
   Segoe UI Variable Text for reading, Georgia for German texts and quotes.
   ============================================================================ */
:root {
  --paper: #eceef7;
  --paper-2: #f5f6fb;
  --night: #0c0d18;
  --night-2: #171a2e;
  --ink: var(--paper);            /* app.css paints the page with --ink */
  --ink-2: var(--paper-2);
  --forest: #e2e5f1;
  --emerald: #d9dcec;
  --emerald-2: #c4c9e0;
  --line: rgba(12, 13, 24, 0.09);
  --line-2: rgba(12, 13, 24, 0.16);
  --glass: #ffffff;
  --glass-2: #ffffff;
  --card: #ffffff;
  --surface: #ffffff;
  --text: #23253a;
  --text-dim: #545872;
  --text-faint: #6d7293;
  --heading: #0c0d18;
  --signal: #2346ff;
  --signal-2: #1530d8;
  --signal-soft: rgba(35, 70, 255, 0.08);
  --signal-glow: rgba(35, 70, 255, 0.32);
  --chrome: #f4bd1a;
  --cyan: #1f6fb8;
  --sky: #1f6fb8;
  --pink: #c2307a;
  --ok: #0f8a5f;
  --ok-soft: rgba(15, 138, 95, 0.1);
  --coral: #d6361f;
  --coral-soft: rgba(214, 54, 31, 0.09);
  --amber: #b86e00;
  --amber-soft: rgba(244, 189, 26, 0.2);
  --aurora: linear-gradient(110deg, #1530d8, #2346ff 60%, #4f7bff);
  --van: linear-gradient(110deg, #2346ff 0%, #1f6fb8 55%, #f4bd1a 100%);
  --r-s: 12px; --r-m: 18px; --r-l: 26px;
  --display: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Display", system-ui, sans-serif;
  --numfont: "Bahnschrift", "Segoe UI Variable Display", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", -apple-system, system-ui, sans-serif;
  --serif: Georgia, "Cambria", "Times New Roman", serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur: 420ms;
  --lift: 0 1px 0 rgba(12, 13, 24, .03), 0 24px 48px -36px rgba(12, 13, 24, .35);
}

/* ---------- page ---------- */
body { background: var(--paper); color: var(--text); font-size: 15.5px; }
body::before { display: none; }
::selection { background: var(--signal); color: #fff; }
a { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
html { scrollbar-color: var(--emerald-2) var(--paper); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(12, 13, 24, .16); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--signal); background-clip: padding-box; }
kbd { background: var(--surface); color: var(--text-dim); }

/* ---------- type ---------- */
h1, h2, h3, h4, .brand-name { font-family: var(--display); color: var(--heading); }
.stat .v, .score-banner .big, .timer, .num, .gauge text { font-family: var(--numfont); }
h1 { font-size: clamp(2.6rem, 5.4vw, 4.6rem); font-weight: 400; letter-spacing: -0.035em; line-height: .98; text-transform: none; }
.view h1 { animation: headline 1000ms var(--ease) both; }
h2 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); font-weight: 400; letter-spacing: -0.025em; line-height: 1.08; text-transform: none; }
h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-weight: 600; }
.page-head { margin-bottom: 34px; align-items: flex-end; }
.page-head h1 { padding: 0; }
.page-head p { font-size: 1.04rem; color: var(--text-dim); margin-top: 14px; }
.crumb { font-size: .8rem; color: var(--text-faint); }
.grad-text { background: var(--van); -webkit-background-clip: text; background-clip: text; color: transparent; }
.de { color: var(--heading); }

/* ---------- sidebar: quiet, same paper as the page ---------- */
.sidebar { background: var(--paper); border-right: 1px solid var(--line); padding-top: 22px; }
.brand-name { font-size: 1.1rem; font-weight: 600; letter-spacing: .08em; }
.brand-sub { color: var(--text-faint); }
.brand .brand-mark { transition: transform 700ms var(--spring); }
.brand:hover .brand-mark { transform: rotate(-10deg) scale(1.08); }
.nav-group { font-size: .74rem; font-weight: 600; color: var(--text-faint); padding-top: 18px; }
.nav a { border-radius: 999px; padding: 8px 14px; font-weight: 500; color: var(--text-dim); transition: background 260ms var(--ease), color 260ms var(--ease); }
.nav a svg { opacity: .75; transition: transform 420ms var(--spring); }
.nav a:hover { background: var(--surface); color: var(--heading); text-decoration: none; }
.nav a:hover svg { transform: rotate(-8deg) scale(1.1); }
.nav a.active { background: var(--night); color: #fff; box-shadow: 0 10px 24px -14px rgba(12, 13, 24, .6); }
.nav a.active svg { color: var(--chrome); opacity: 1; }
.nav a.active::before { display: none; }
.nav a.new::after { content: "new"; margin-left: auto; font-size: .64rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--chrome); color: var(--night); }
.nav .badge { background: var(--coral); color: #fff; font-weight: 700; }
.side-foot { border-top: 1px solid var(--line); }
.side-foot .streak svg { color: var(--chrome); }
.side-foot a { color: var(--text-dim); text-decoration: underline; text-decoration-color: var(--line-2); }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; margin: -30px calc(-1 * clamp(18px, 4vw, 52px)) 30px; padding: 14px clamp(18px, 4vw, 52px);
  background: rgba(236, 238, 247, .78); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }
.topbar .search input { border-radius: 999px; background: var(--surface); border-color: transparent; box-shadow: var(--lift); }
.topbar .search input:focus { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.cmdk-btn { padding: 8px 10px 8px 16px; gap: 6px; font-weight: 500; color: var(--text-dim); background: var(--surface); border-color: transparent; box-shadow: var(--lift); }
.cmdk-btn span { margin-right: 6px; }
.cmdk-btn kbd, .cmdk kbd { background: var(--paper); border-color: var(--line); color: var(--text-dim); font-size: 11px; }
.lookup-hint { color: var(--text-faint); }
.exam-bar { top: 64px; border-radius: 0; background: rgba(245, 246, 251, .92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.split .sticky { top: 130px; max-height: calc(100vh - 150px); }
.toc { top: 86px; }
#routebar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; pointer-events: none; background: var(--signal); transform-origin: left; transform: scaleX(0); opacity: 0; }
#routebar.run { opacity: 1; animation: routeRun 900ms var(--ease) forwards; }
#routebar.done { opacity: 0; transform: scaleX(1); transition: opacity 400ms 120ms; }
@keyframes routeRun { from { transform: scaleX(0); } to { transform: scaleX(.85); } }

/* ---------- surfaces ---------- */
.panel, .tile, .q, .day-card { --mx: 50%; --my: -40%; }
.panel { position: relative; background: var(--surface); border: 1px solid transparent; border-radius: var(--r-l); box-shadow: var(--lift); backdrop-filter: none; -webkit-backdrop-filter: none; }
.panel::before, .tile::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 450ms;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(35, 70, 255, .06), transparent 50%); }
.panel:hover::before, .tile:hover::before { opacity: 1; }
.panel > *, .tile > * { position: relative; }
.panel.flat { background: var(--paper-2); box-shadow: none; border-color: var(--line); }
.tile { position: relative; overflow: visible; background: var(--surface); border: 1px solid transparent; border-radius: var(--r-l); padding: 22px; box-shadow: var(--lift);
  transform-style: preserve-3d; will-change: transform; transition: transform 500ms var(--ease), box-shadow 500ms var(--ease); }
.tile:hover { border-color: transparent; background: var(--surface); box-shadow: 0 30px 60px -34px rgba(12, 13, 24, .45); text-decoration: none; }
.tile h4 { font-family: var(--display); font-weight: 500; font-size: 1.2rem; line-height: 1.2; margin: 12px 0 6px; }
.tile .progress-line { height: 4px; background: var(--paper); }
.tile .progress-line i { background: var(--signal); }
.ring-border { position: relative; }

/* ---------- buttons: pills, Lusion-style dot on secondary ones ---------- */
button, .btn { position: relative; overflow: hidden; border-radius: 999px; padding: 10px 20px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--heading);
  transition: background 250ms var(--ease), transform 350ms var(--spring), box-shadow 300ms var(--ease), color 250ms, border-color 250ms; }
button:hover, .btn:hover { background: var(--surface); border-color: var(--heading); text-decoration: none; }
button:active, .btn:active { transform: scale(.95); }
.btn-primary { background: var(--signal); color: #fff; border-color: transparent; font-weight: 600; box-shadow: 0 12px 28px -14px rgba(35, 70, 255, .9); }
.btn-primary:hover { background: var(--night); color: #fff; border-color: transparent; transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(12, 13, 24, .7); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, .7); border-color: transparent; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.pill { display: inline-flex; align-items: center; gap: 12px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; transition: transform 400ms var(--spring); }
.pill:hover::before { transform: scale(1.6); }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); background: rgba(35, 70, 255, .2); animation: ripple 650ms var(--ease) forwards; }
.btn-primary .ripple { background: rgba(255, 255, 255, .35); }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=email], select, textarea { border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); color: var(--heading); }
input:focus, select:focus, textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--signal); }
.tabs { border-radius: 999px; background: var(--surface); padding: 5px; border-color: transparent; box-shadow: var(--lift); }
.tabs button { border-radius: 999px; border: 0; background: transparent; box-shadow: none; color: var(--text-dim); }
.tabs button:hover { color: var(--heading); background: var(--paper); }
.tabs button.on { background: var(--night); color: #fff; }
.chip { border-radius: 999px; font-weight: 600; background: var(--surface); border-color: var(--line); color: var(--text-dim); }
.chip.level { background: var(--night); color: #fff; border-color: transparent; }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.official { color: var(--cyan); border-color: rgba(31, 111, 184, .3); background: rgba(31, 111, 184, .08); }
.chip.original { color: var(--signal); border-color: rgba(35, 70, 255, .3); background: var(--signal-soft); }
.chip.reported { color: var(--amber); border-color: rgba(184, 110, 0, .3); background: var(--amber-soft); }
.chip.warn { color: var(--coral); border-color: rgba(214, 54, 31, .3); background: var(--coral-soft); }
.switch span { background: var(--emerald); }
.switch input:checked + span { background: var(--signal); }
.switch input:checked + span::after { background: #fff; }

/* ---------- dashboard: gallery hero ---------- */
.hero-x { margin-bottom: 10px; }
.hero-x .hx-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-x h1.hello { font-size: clamp(3.6rem, 10vw, 9rem); font-weight: 400; letter-spacing: -0.055em; line-height: .86; margin: 0; color: var(--heading); text-shadow: none; animation: none; }
.hello .wave-ch { display: inline-block; animation: letterUp 1000ms var(--ease) both; animation-delay: calc(var(--c) * 34ms + 150ms); }
@keyframes letterUp { from { opacity: 0; transform: translateY(70%); } }
.hero-x .painting { height: clamp(300px, 58vh, 640px); margin-top: 30px; box-shadow: 0 40px 80px -50px rgba(12, 13, 24, .8); animation: paintIn 1400ms 200ms var(--ease) both; }
@keyframes paintIn { from { clip-path: inset(12% 6% 12% 6% round 22px); transform: scale(.98); } to { clip-path: inset(0 0 0 0 round 22px); transform: none; } }
.hx-cue { display: flex; justify-content: space-between; align-items: center; padding: 18px 2px 8px; font: 500 .8rem/1 var(--body); color: var(--heading); letter-spacing: .04em; }
.hx-cue i { font-style: normal; font-size: 1.4rem; font-weight: 300; line-height: 1; }
.statement { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 60px); align-items: start; padding: 54px 0 46px; }
.statement .big-lead { font-family: var(--display); font-weight: 400; font-size: clamp(1.55rem, 2.7vw, 2.4rem); line-height: 1.12; letter-spacing: -0.025em; color: var(--heading); margin: 0; text-wrap: balance; }
.statement .big-lead b { font-weight: 600; color: var(--signal); }
.statement .cta { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.next-task { border-radius: 20px; background: var(--surface); border: 1px solid transparent; box-shadow: var(--lift); transition: transform 400ms var(--spring), box-shadow 300ms; margin-top: 0; }
.next-task:hover { transform: translateX(6px); box-shadow: 0 24px 40px -28px rgba(35, 70, 255, .6); }
.next-task .k { color: var(--text-faint); }
.dash-marquee { margin: 6px 0 34px; }

/* bento */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; gap: 16px; }
.bento > * { min-width: 0; }
.b-count { grid-column: span 4; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; }
.b-ready { grid-column: span 8; }
.b-word { grid-column: span 5; }
.b-quote { grid-column: span 7; }
.b-stat { grid-column: span 3; }
.b-plan { grid-column: span 5; }
.b-week { grid-column: span 4; }
.b-tip { grid-column: span 3; }
.b-side { grid-column: span 4; }

/* night card: the countdown is the dark painting frame of the page */
.b-count { background: var(--night); color: #c9cdf0; box-shadow: 0 30px 60px -40px rgba(12, 13, 24, .9); }
.b-count .faint, .b-count .dim, .b-count .cd-small, .b-count p { color: #9aa0c4; }
.b-count .btn-primary { background: var(--chrome); color: var(--night); box-shadow: none; }
.b-count .btn-primary:hover { background: var(--surface); color: var(--night); }
.cd-ring { position: relative; width: 190px; height: 190px; margin: 4px auto 10px; }
.cd-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.cd-ring .bg { stroke: rgba(236, 238, 247, .12); }
.cd-ring .fg { stroke: var(--chrome); transition: stroke-dashoffset 1800ms var(--ease); filter: drop-shadow(0 0 10px rgba(244, 189, 26, .6)); }
.cd-ring .mid { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; }
.cd-ring .mid b { font-family: var(--numfont); font-size: 3.8rem; font-weight: 300; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.cd-ring .mid span { font-size: .8rem; color: #9aa0c4; }
.cd-small { display: flex; gap: 8px; justify-content: center; font-family: var(--numfont); font-variant-numeric: tabular-nums; font-size: .9rem; }
.cd-small b { color: #fff; font-weight: 600; }
.cd-small b.tick { animation: tick 500ms var(--spring); display: inline-block; }
@keyframes tick { from { transform: translateY(-40%); opacity: .2; } }

.word-card .w-big { font-family: var(--serif); font-size: 2.5rem; color: var(--heading); line-height: 1.1; margin: 6px 0 2px; letter-spacing: -.01em; }
.word-card .w-ar { font-family: var(--arabic); direction: rtl; font-size: 1.35rem; color: var(--signal); }
.word-card .w-ex { font-family: var(--serif); color: var(--text-dim); margin-top: 10px; font-size: 1rem; }

/* quote of the day: a small painting beside the words */
.b-quote { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 24px; padding: 12px; align-items: stretch; }
.b-quote .painting { min-height: 260px; border-radius: 18px; }
.b-quote .bq-body { padding: 16px 14px 14px 0; display: flex; flex-direction: column; }
.b-quote .bq-body h3 { margin-bottom: 14px; }
.b-quote .qt p { font-size: clamp(1.15rem, 1.7vw, 1.45rem); }

/* the tip is a cobalt block */
.b-tip { background: var(--signal); color: #e3e8ff; box-shadow: 0 30px 50px -36px rgba(35, 70, 255, 1); }
.b-tip h3 { color: #fff; font-family: var(--display); font-weight: 500; font-size: 1.25rem; }
.tip-card .tip-n { font-family: var(--numfont); font-size: .8rem; color: var(--chrome); }
.tip-card p { font-size: .98rem; color: #e3e8ff; margin: 8px 0 0; }
.b-tip a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.week-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 8px; }
.week-bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week-bars i { width: 100%; max-width: 28px; border-radius: 999px; background: var(--night); min-height: 6px; transform-origin: bottom; animation: barUp 1100ms var(--spring) both; animation-delay: calc(var(--k) * 70ms + 300ms); }
.week-bars i.today { background: var(--signal); }
.week-bars span { font-size: .72rem; color: var(--text-faint); }
@keyframes barUp { from { transform: scaleY(0); } }
.gauge-panel { background: var(--surface); }
.gauge svg { transition: transform 500ms var(--spring); }
.gauge:hover svg { transform: scale(1.06) rotate(-3deg); }
.gauge .ring-bg { stroke: var(--paper); }
.gauge .ring-fg { transition: stroke-dashoffset 1800ms var(--ease); }
.gauge .pass-tick { stroke: var(--chrome); }
.gauge .lbl { font-size: .92rem; font-weight: 600; }
.stat { padding: 22px 24px; }
.stat .v { font-size: 2.9rem; font-weight: 300; letter-spacing: -.03em; }
.stat .k { color: var(--text-dim); }
.stat .bar { height: 4px; background: var(--paper); }
.stat .bar i { background: var(--signal); transition: width 1500ms var(--ease); }
.list li { transition: background 250ms, transform 300ms var(--ease); border-radius: 12px; }
.list li:hover { background: var(--paper-2); transform: translateX(3px); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--chrome); }
.dot.bad { background: var(--coral); animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse { 50% { transform: scale(1.3); } }
.hero-main .ticker, .ticker { display: none; }
.gauge-legend span { color: var(--text-dim); }

@media (max-width: 1100px) {
  .b-count, .b-word, .b-plan, .b-week, .b-tip, .b-side { grid-column: span 6; }
  .b-ready, .b-quote { grid-column: span 12; } .b-stat { grid-column: span 6; }
  .statement { grid-template-columns: 1fr; padding: 40px 0 34px; }
}
@media (max-width: 720px) {
  .bento > * { grid-column: span 12 !important; }
  .b-quote { grid-template-columns: 1fr; } .b-quote .painting { min-height: 200px; } .b-quote .bq-body { padding: 4px 10px 12px; }
  .hero-x .painting { height: 46vh; }
}

/* ---------- questions ---------- */
.q { background: var(--surface); border: 1px solid transparent; border-radius: 20px; box-shadow: var(--lift); transition: border-color 300ms var(--ease), box-shadow 400ms var(--ease), transform 300ms var(--ease); }
.q:focus-within { border-color: rgba(35, 70, 255, .3); }
.opt { border-radius: 14px; background: var(--paper-2); border-color: transparent; transition: background 220ms, border-color 220ms, transform 300ms var(--spring); }
.opt:hover { transform: translateX(4px); border-color: var(--line-2); background: var(--surface); }
.opt.sel { background: var(--signal-soft); border-color: var(--signal); }
.q.correct { border-color: rgba(15, 138, 95, .55); animation: rightGlow 1100ms var(--ease); }
.q.wrong { border-color: rgba(214, 54, 31, .55); animation: shake 500ms var(--ease); }
@keyframes rightGlow { 0% { box-shadow: 0 0 0 0 rgba(15, 138, 95, .35); } 100% { box-shadow: 0 0 0 18px rgba(15, 138, 95, 0); } }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.opt.is-answer { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-wrong { border-color: rgba(214, 54, 31, .55); background: var(--coral-soft); }
.explain { border-radius: 12px; border-left-color: var(--cyan); background: rgba(31, 111, 184, .07); color: var(--text); animation: rise 450ms var(--ease) both; }
.explain .verdict.ok { color: var(--ok); }
.mistake .r { color: var(--ok); }
.fb-item { background: var(--paper-2); }
.fb-item.good { border-left-color: var(--ok); }
mark.err { background: var(--coral-soft); color: var(--heading); }
.score-banner { background: var(--surface); }
.score-banner .big { font-size: 4.8rem; font-weight: 300; line-height: .9; color: var(--signal); }
.instructions { border-radius: 14px; background: rgba(31, 111, 184, .07); border-color: rgba(31, 111, 184, .18); }
.text-sheet, .ad, .tmpl, .marked { background: #fffdf6; color: #1b1c2a; box-shadow: inset 0 0 0 1px rgba(12, 13, 24, .06), var(--lift); }
.text-sheet { border-radius: 18px; font-family: var(--serif); }
.text-sheet h4, .ad b { color: var(--night); font-family: var(--display); }
.ad { border-radius: 12px; }
.player { border-radius: 22px; background: var(--surface); border-color: transparent; box-shadow: var(--lift); }
.player .play { background: var(--signal); color: #fff; transition: transform 300ms var(--spring), box-shadow 300ms; }
.player .play:hover { transform: scale(1.1); box-shadow: 0 0 0 8px var(--signal-soft); background: var(--signal); }
.player.playing .play { animation: playPulse 1.6s ease-in-out infinite; }
@keyframes playPulse { 0% { box-shadow: 0 0 0 0 rgba(35, 70, 255, .4); } 70%, 100% { box-shadow: 0 0 0 12px rgba(35, 70, 255, 0); } }
.player .wave i { background: rgba(35, 70, 255, .2); }
.player.playing .wave i { background: var(--signal); }
.player.playing .wave i:nth-child(3n) { animation-delay: -.3s; background: var(--chrome); } .player.playing .wave i:nth-child(3n+1) { animation-delay: -.6s; }
.timer { font-weight: 500; font-size: 1.6rem; }
.timer .t-bg { stroke: var(--paper); }
.timer .t-fg { stroke: var(--signal); }
.timer.crit { color: var(--coral); }
.flashcard .face { border-radius: 28px; border: 0; box-shadow: var(--lift); }
.flashcard .front { background: var(--surface); }
.flashcard .back { background: var(--paper-2); }
.flashcard .word { font-family: var(--serif); font-weight: 400; }
.flashcard .ar { color: var(--signal); }
.flashcard:hover { transform: rotateY(6deg) rotateX(3deg); }
.flashcard.flipped:hover { transform: rotateY(174deg) rotateX(3deg); }
.art-der { color: #2346ff; } .art-die { color: #d6361f; } .art-das { color: #b86e00; }
.lookup-pop { background: var(--surface); border: 0; border-radius: 22px; box-shadow: 0 40px 80px -30px rgba(12, 13, 24, .45), 0 0 0 1px var(--line); animation: popIn 420ms var(--spring) both; }
.lookup-pop .lp-ar { color: var(--signal); }
.lp-word { font-family: var(--serif); font-weight: 400; font-size: 1.7rem !important; }
.modal-back { background: rgba(12, 13, 24, .35); backdrop-filter: blur(8px); }
.modal { background: var(--surface); border: 0; border-radius: 28px; box-shadow: 0 40px 100px -30px rgba(12, 13, 24, .6); animation: modalIn 520ms var(--spring); }
.toast { border-radius: 999px; background: var(--night); color: #fff; font-weight: 600; border: 0; padding: 12px 20px; animation: toastIn 560ms var(--spring); box-shadow: 0 16px 40px -14px rgba(12, 13, 24, .6); }
.toast.warn { background: var(--chrome); color: var(--night); }
@keyframes toastIn { from { opacity: 0; transform: translateY(24px) scale(.85); } }
.milestone .m-card { border-radius: 30px; background: var(--night); color: #fff; border: 0; box-shadow: 0 40px 100px -30px rgba(12, 13, 24, .8); }
.milestone .m-card h2 { font-size: 2.6rem; color: var(--chrome); }
.spark:nth-child(3n) { background: var(--chrome); } .spark:nth-child(3n+1) { background: var(--signal); }
.heat i { background: rgba(12, 13, 24, .06); }
.heat i.l1 { background: rgba(35, 70, 255, .22); } .heat i.l2 { background: rgba(35, 70, 255, .45); } .heat i.l3 { background: rgba(35, 70, 255, .72); } .heat i.l4 { background: var(--signal); }
.chart .axis { stroke: var(--line-2); }
.chart text { fill: var(--text-faint); }
.day-card { background: var(--surface); border-color: transparent; box-shadow: var(--lift); }
.day-card.today { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal) inset, var(--lift); }
.prose th, table.data th, .md th { background: var(--paper-2); }
.prose .rule { background: var(--signal-soft); border-color: rgba(35, 70, 255, .22); }
.prose .note { background: rgba(31, 111, 184, .06); border-color: rgba(31, 111, 184, .2); }
.md code { background: var(--paper); }
.skeleton { background: linear-gradient(90deg, rgba(12, 13, 24, .04), rgba(12, 13, 24, .09), rgba(12, 13, 24, .04)); background-size: 200% 100%; }
.loading i { border-color: var(--emerald); border-top-color: var(--signal); }
.vocab-table th { background: var(--paper-2); }
.vocab-table tr:hover td { background: var(--signal-soft); }
.pdf-page { box-shadow: 0 20px 40px -24px rgba(12, 13, 24, .5); }
.grade-row .good { border-color: rgba(15, 138, 95, .4); }

/* ---------- command palette ---------- */
.cmdk-back { position: fixed; inset: 0; z-index: 1300; background: rgba(12, 13, 24, .3); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fadeIn 200ms var(--ease); }
.cmdk { width: min(640px, 100%); border-radius: 24px; overflow: hidden; background: var(--surface); border: 0; box-shadow: 0 40px 100px -30px rgba(12, 13, 24, .6), 0 0 0 1px var(--line); animation: modalIn 380ms var(--spring); }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cmdk-in svg { width: 20px; height: 20px; color: var(--text-faint); flex: none; }
.cmdk-in input { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 1.1rem; padding: 4px 0; color: var(--heading); }
.cmdk-list { max-height: min(56vh, 460px); overflow-y: auto; padding: 8px; }
.cmdk-g { font-size: .72rem; color: var(--text-faint); padding: 10px 12px 4px; font-weight: 600; }
.cmdk-it { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer; color: var(--text); }
.cmdk-it svg { width: 18px; height: 18px; color: var(--text-faint); flex: none; }
.cmdk-it .s { margin-left: auto; font-size: .78rem; color: var(--text-faint); }
.cmdk-it mark { background: none; color: var(--signal); font-weight: 700; }
.cmdk-it.on { background: var(--night); color: #fff; }
.cmdk-it.on svg { color: var(--chrome); }
.cmdk-it.on .s { color: #9aa0c4; }
.cmdk-it.on mark { color: var(--chrome); }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--text-faint); }
.cmdk-empty { padding: 26px; text-align: center; color: var(--text-dim); }
.keys-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: center; }
.keys-grid kbd { margin-right: 3px; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1500; overflow: hidden; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: confetti var(--t, 1.4s) cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

/* ---------- motion ---------- */
.view { animation: viewIn 700ms var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.view .reveal { animation: rise 800ms var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.sr { opacity: 0; transform: translateY(40px); transition: opacity 900ms var(--ease), transform 900ms var(--ease); }
.sr.in { opacity: 1; transform: none; }
@keyframes headline { from { opacity: 0; transform: translateY(40%); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 -30% 0); } }

/* ---------- exam guide ---------- */
.g-hero { position: relative; overflow: hidden; padding: 0; margin-bottom: 26px; border: 0; background: none; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: end; }
.g-hero::before { display: none; }
.g-hero > * { position: relative; }
.g-hero h1 { font-size: clamp(2.8rem, 6vw, 5.4rem); max-width: 12ch; letter-spacing: -0.045em; }
.g-hero p { max-width: 60ch; color: var(--text-dim); font-size: 1.05rem; }
.g-hero .painting { height: clamp(260px, 42vh, 440px); }
.g-hero .flagline { display: none; }
.g-nav { position: sticky; top: 64px; z-index: 20; display: flex; gap: 4px; overflow-x: auto; padding: 6px; margin: 0 0 30px; border-radius: 999px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--lift); scrollbar-width: none; }
.g-nav a { white-space: nowrap; padding: 7px 14px; border-radius: 999px; color: var(--text-dim); font-size: .86rem; font-weight: 600; transition: background 250ms, color 250ms; }
.g-nav a:hover { color: var(--heading); text-decoration: none; background: var(--paper); }
.g-nav a.on { background: var(--night); color: #fff; }
.g-sec { margin-bottom: 64px; scroll-margin-top: 130px; }
.g-sec > h2 { margin-bottom: 10px; }
.g-sec > .lede { color: var(--text-dim); max-width: 72ch; margin-bottom: 20px; }
.mod-card .mc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.mod-card .mc-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); flex: none; transition: transform 500ms var(--spring); }
.mod-card:hover .mc-ic { transform: rotate(-10deg) scale(1.12); }
.mod-card .mc-ic svg { width: 22px; height: 22px; }
.mod-card h3 { margin: 0; }
.mod-card .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 14px; }
.mod-card .facts div { padding: 10px; border-radius: 12px; background: var(--paper-2); text-align: center; }
.mod-card .facts b { display: block; font-family: var(--numfont); font-size: 1.6rem; color: var(--heading); line-height: 1.1; font-weight: 400; }
.mod-card .facts span { font-size: .72rem; color: var(--text-faint); }
.parts-bar { display: flex; height: 26px; border-radius: 999px; overflow: hidden; gap: 2px; }
.parts-bar i { display: grid; place-items: center; font-style: normal; font-size: .7rem; font-weight: 700; color: #fff; background: var(--c); transform-origin: left; animation: partIn 900ms var(--ease) both; animation-delay: calc(var(--k) * 90ms + 300ms); white-space: nowrap; overflow: hidden; }
.parts-bar i:nth-child(even) { opacity: .75; }
@keyframes partIn { from { transform: scaleX(0); } }
.calc { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; align-items: center; }
.calc input[type=range] { width: 100%; height: 34px; }
.calc .big { font-family: var(--numfont); font-size: 6rem; line-height: .9; font-weight: 300; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--signal); }
.calc .big.fail { color: var(--coral); }
.calc .grade { font-family: var(--display); font-size: 1.35rem; color: var(--heading); font-weight: 500; }
.calc .meter { position: relative; height: 12px; border-radius: 10px; background: var(--paper); margin-top: 16px; overflow: hidden; }
.calc .meter i { position: absolute; inset: 0 auto 0 0; border-radius: 10px; transition: width 500ms var(--spring), background 400ms; }
.calc .meter::after { content: ""; position: absolute; left: 60%; top: -4px; bottom: -4px; width: 2px; background: var(--night); opacity: .5; }
.teil { border-left: 3px solid var(--c, var(--signal)); }
.teil .t-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.teil .t-head h4 { margin: 0; font-size: 1.15rem; }
.teil ul { margin: 6px 0 0; padding-left: 1.1em; }
.teil li { margin: 5px 0; }
.teil .trap { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--coral-soft); border: 1px solid rgba(214, 54, 31, .2); font-size: .9rem; }
.teil .trap b { color: var(--coral); }
.phr { display: flex; align-items: baseline; gap: 12px; padding: 9px 10px; border-radius: 12px; cursor: pointer; transition: background 220ms; }
.phr:hover { background: var(--signal-soft); }
.phr .de { flex: 1; font-family: var(--serif); font-size: 1.04rem; font-weight: 400; }
.phr .en { flex: 1; color: var(--text-dim); font-size: .88rem; }
.phr .spk { opacity: 0; color: var(--signal); transition: opacity 200ms; }
.phr:hover .spk { opacity: 1; }
.phr.speaking { background: rgba(244, 189, 26, .2); }
.tmpl { font-family: var(--serif); font-size: 1.02rem; line-height: 1.85; white-space: pre-wrap; padding: 22px 24px; border-radius: 18px; }
.tmpl .slot { background: var(--signal-soft); color: var(--signal-2); border-radius: 4px; padding: 0 4px; font-family: var(--body); font-size: .88em; }
.tmpl .cn { color: var(--pink); font-weight: 700; }
.flips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.flip { perspective: 1000px; height: 170px; cursor: pointer; }
.flip .in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 700ms var(--spring); }
.flip.on .in { transform: rotateY(180deg); }
.flip:hover .in { transform: rotateY(8deg) rotateX(4deg); }
.flip.on:hover .in { transform: rotateY(172deg) rotateX(4deg); }
.flip .fa, .flip .fb { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; justify-content: center; }
.flip .fa { background: var(--surface); box-shadow: var(--lift); text-align: center; align-items: center; }
.flip .fa b { font-family: var(--display); font-size: 1.55rem; color: var(--heading); font-weight: 500; }
.flip .fa small { color: var(--text-faint); margin-top: 6px; }
.flip .fb { transform: rotateY(180deg); background: var(--night); color: #c9cdf0; font-size: .88rem; }
.flip .fb .ex { font-family: var(--serif); color: #fff; margin-top: 6px; }
.flip .fb .pos { color: var(--chrome); font-weight: 700; font-size: .78rem; }
.flip .fb b, .flip .fb .de { color: #fff; }
.vtable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.vtable th, .vtable td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.vtable th { color: var(--text-dim); font-size: .8rem; font-weight: 600; }
.vtable tbody tr { transition: background 200ms; }
.vtable tbody tr:hover { background: var(--signal-soft); }
.vtable .case-akk { color: var(--signal); font-weight: 700; } .vtable .case-dat { color: var(--ok); font-weight: 700; }
.trap-card { position: relative; padding-left: 52px; }
.trap-card .tn { position: absolute; left: 16px; top: 18px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--numfont); font-weight: 600; font-size: .85rem; background: var(--night); color: #fff; }
.trap-card .bad { color: var(--coral); text-decoration: line-through; text-decoration-color: rgba(214, 54, 31, .5); font-family: var(--serif); }
.trap-card .good { color: var(--ok); font-family: var(--serif); }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 8px; border-radius: 12px; cursor: pointer; transition: background 200ms; }
.checklist label:hover { background: var(--paper-2); }
.checklist input { margin-top: 4px; }
.checklist input:checked + span { color: var(--text-faint); text-decoration: line-through; }
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--van); border-radius: 2px; }
.timeline .st { position: relative; padding: 0 0 18px; }
.timeline .st::before { content: ""; position: absolute; left: -27px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--signal); }
.timeline .st b { color: var(--heading); }
.timeline .st .d { font-family: var(--numfont); color: var(--signal); font-size: .85rem; }
.bands { display: flex; gap: 4px; margin-top: 10px; }
.bands div { flex: 1; text-align: center; padding: 10px 4px; border-radius: 12px; font-size: .78rem; background: var(--paper-2); }
.bands div b { display: block; font-family: var(--numfont); font-size: 1.1rem; color: var(--heading); }
.bands div.fail { background: var(--coral-soft); } .bands div.fail b { color: var(--coral); }
.bands div.top { background: var(--ok-soft); } .bands div.top b { color: var(--ok); }

/* ---------- marked writing (red pen) ---------- */
.marked { font-family: var(--serif); font-size: 1.02rem; line-height: 2; padding: 22px 24px; border-radius: 18px; white-space: pre-wrap; }
.marked .x { color: #c8102e; text-decoration: line-through; text-decoration-color: rgba(200, 16, 46, .6); }
.marked .fix { color: #0a7a52; font-family: var(--body); font-size: .82em; font-weight: 700; margin: 0 2px; }
.marked .good { background: rgba(15, 138, 95, .16); border-radius: 3px; padding: 0 2px; }
.crit-row { display: grid; grid-template-columns: 130px 64px 1fr; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.crit-row:last-child { border-bottom: 0; }
.crit-row .band { font-family: var(--numfont); font-weight: 600; text-align: center; border-radius: 10px; padding: 4px 0; }
.band-A { background: var(--ok-soft); color: var(--ok); } .band-B { background: rgba(31, 111, 184, .1); color: var(--cyan); } .band-C { background: var(--amber-soft); color: var(--amber); } .band-D, .band-E { background: var(--coral-soft); color: var(--coral); }
.crit-total { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; }
.crit-total b { font-family: var(--numfont); font-size: 2.6rem; font-weight: 300; line-height: 1; }

/* ---------- topic bank ---------- */
.topics-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: end; margin-bottom: 30px; }
.topics-hero .painting { height: clamp(220px, 34vh, 360px); }
.topics-hero h1 { font-size: clamp(2.8rem, 6vw, 5.2rem); letter-spacing: -0.045em; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.topic-card { cursor: pointer; display: flex; flex-direction: column; gap: 10px; min-height: 200px; color: var(--text); }
.topic-card .t-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 1.4rem; background: var(--paper); }
.topic-card .t-q { font-family: var(--display); font-size: 1.22rem; font-weight: 500; color: var(--heading); line-height: 1.22; letter-spacing: -.01em; }
.topic-card .t-cat { font-size: .78rem; color: var(--text-faint); }
.topic-card .t-go { margin-top: auto; font-size: .82rem; color: var(--signal); font-weight: 600; }
.topic-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.topic-head .t-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 2rem; background: var(--surface); box-shadow: var(--lift); flex: none; }
.vchips { display: flex; flex-wrap: wrap; gap: 8px; }
.vchip { display: inline-flex; flex-direction: column; padding: 8px 14px; border-radius: 16px; background: var(--paper-2); border: 1px solid transparent; cursor: pointer; transition: transform 300ms var(--spring), border-color 250ms, background 250ms; }
.vchip:hover { transform: translateY(-3px); border-color: var(--signal); background: var(--surface); }
.vchip b { font-family: var(--serif); font-weight: 400; color: var(--heading); font-size: 1rem; }
.vchip span { font-size: .76rem; color: var(--text-faint); }
.procon { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.procon h4 { display: flex; align-items: center; gap: 8px; }
.procon h4 svg { width: 18px; height: 18px; flex: none; }
.procon .pro h4 { color: var(--ok); } .procon .con h4 { color: var(--coral); }
.procon .phr { padding-left: 0; }
.folien { counter-reset: f; display: grid; gap: 10px; }
.folie { position: relative; padding: 14px 16px 14px 60px; border-radius: 18px; background: var(--paper-2); border: 1px solid transparent; }
.folie::before { counter-increment: f; content: counter(f); position: absolute; left: 14px; top: 12px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--numfont); font-weight: 500; color: #fff; background: var(--night); }
.folie small { display: block; color: var(--text-faint); font-size: .76rem; margin-bottom: 2px; }
.folie span { font-family: var(--serif); color: var(--heading); }
@media (max-width: 860px) { .procon { grid-template-columns: 1fr; } .crit-row { grid-template-columns: 1fr 60px; } .crit-row p { grid-column: 1 / -1; } }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .g-hero, .topics-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { margin-top: -18px; }
  .exam-bar { top: 60px; }
  .bands { flex-wrap: wrap; } .bands div { flex: 1 1 30%; }
  .calc { grid-template-columns: 1fr; } .g-nav { top: 60px; } .phr { flex-direction: column; gap: 2px; } .calc .big { font-size: 4.4rem; }
  .cmdk-btn span { display: none; }
  .sidebar { background: var(--paper-2); box-shadow: none; }
  .sidebar.open { box-shadow: 30px 0 60px -30px rgba(12, 13, 24, .45); }
  .topics-hero h1, .g-hero h1 { font-size: 2.8rem; }
}
@media (max-width: 520px) { h1 { font-size: 2.5rem; } .cmdk-btn { display: none; } .hero-x h1.hello { font-size: 3.6rem; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root:not(.allow-motion) *, :root:not(.allow-motion) *::before, :root:not(.allow-motion) *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  :root:not(.allow-motion) .sr { opacity: 1; transform: none; }
}
:root.reduce-motion .sr { opacity: 1; transform: none; }

/* ============================================================================
   DARK MODE — "Starry night": the gallery after closing time. Night-blue walls,
   faint stars, and Van Gogh's chrome yellow as the light. Active items invert
   to pale paper so they still stand out.
   ============================================================================ */
:root.dark {
  color-scheme: dark;
  --paper: #090a14;
  --paper-2: #11132a;
  --surface: #12142a;
  --night: #04050c;
  --forest: #1a1d38;
  --emerald: #262a52;
  --emerald-2: #353a6a;
  --line: rgba(236, 238, 247, 0.08);
  --line-2: rgba(236, 238, 247, 0.16);
  --glass: #12142a;
  --card: #12142a;
  --text: #d7daf0;
  --text-dim: #a6abcf;
  --text-faint: #8288b2;
  --heading: #f3f4fb;
  --signal: #6f8cff;
  --signal-2: #4a6bff;
  --signal-soft: rgba(111, 140, 255, 0.14);
  --signal-glow: rgba(111, 140, 255, 0.4);
  --chrome: #f6c33a;
  --cyan: #62aef0;
  --sky: #62aef0;
  --pink: #f06bb0;
  --ok: #3fd19a;
  --ok-soft: rgba(63, 209, 154, 0.13);
  --coral: #ff6d57;
  --coral-soft: rgba(255, 109, 87, 0.13);
  --amber: #f3b93f;
  --amber-soft: rgba(246, 195, 58, 0.14);
  --lift: 0 0 0 1px rgba(236, 238, 247, .05) inset, 0 24px 48px -30px rgba(0, 0, 0, .9);
}
:root.dark body::before { /* a faint, fixed starfield */
  display: block; opacity: .55;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, #f6c33a 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 64%, #c9d4ff 50%, transparent 51%), radial-gradient(1px 1px at 88% 72%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 56% 36%, #f6c33a 50%, transparent 51%), radial-gradient(1px 1px at 22% 86%, #fff 50%, transparent 51%),
    radial-gradient(900px 600px at 85% -10%, rgba(35, 70, 255, .16), transparent 60%);
  background-size: 480px 480px, 480px 480px, 480px 480px, 480px 480px, 480px 480px, 480px 480px, 100% 100%;
}
:root.dark .topbar { background: rgba(9, 10, 20, .78); }
:root.dark .exam-bar { background: rgba(14, 16, 34, .92); }
:root.dark .g-nav { background: rgba(18, 20, 42, .88); }
:root.dark .modal-back, :root.dark .cmdk-back { background: rgba(0, 0, 0, .55); }
:root.dark .nav a.active, :root.dark .tabs button.on, :root.dark .g-nav a.on, :root.dark .cmdk-it.on, :root.dark .chip.level, :root.dark .toast { background: #eceef7; color: #0c0d18; }
:root.dark .nav a.active svg, :root.dark .cmdk-it.on svg { color: #2346ff; }
:root.dark .cmdk-it.on .s { color: #545872; } :root.dark .cmdk-it.on mark { color: #2346ff; }
:root.dark .btn-primary { background: #3a5bff; box-shadow: 0 12px 28px -14px rgba(58, 91, 255, .9); }
:root.dark .btn-primary:hover { background: #eceef7; color: #0c0d18; }
:root.dark button:hover, :root.dark .btn:hover { border-color: var(--text-dim); }
:root.dark .btn-ghost:hover { background: rgba(255, 255, 255, .06); }
:root.dark .b-count { background: var(--night); box-shadow: 0 0 0 1px var(--line), 0 30px 60px -40px #000; }
:root.dark .b-tip { background: #2a46e8; }
:root.dark .week-bars i { background: #3d4378; } :root.dark .week-bars i.today { background: var(--chrome); }
:root.dark .folie::before, :root.dark .trap-card .tn { background: #3a5bff; }
:root.dark .flip .fb { background: #1b2050; }
:root.dark .milestone .m-card { background: var(--night); box-shadow: 0 0 0 1px var(--line-2), 0 40px 100px -30px #000; }
:root.dark .text-sheet, :root.dark .ad, :root.dark .tmpl, :root.dark .marked { background: #16182f; color: #e9e6d8; box-shadow: inset 0 0 0 1px rgba(246, 195, 58, .12); }
:root.dark .text-sheet h4, :root.dark .ad b { color: #fff; }
:root.dark .marked .x { color: #ff7d8e; text-decoration-color: rgba(255, 125, 142, .6); } :root.dark .marked .fix { color: #4fe0a6; }
:root.dark .tmpl .slot { color: #aebcff; }
:root.dark .calc .meter::after { background: #fff; }
:root.dark .art-der { color: #8aa0ff; } :root.dark .art-die { color: #ff7d66; } :root.dark .art-das { color: #f3b93f; }
:root.dark .hero-x .painting { box-shadow: 0 0 0 1px var(--line), 0 40px 90px -40px rgba(35, 70, 255, .45); }
:root.dark .pdf-page { box-shadow: 0 0 0 1px var(--line), 0 20px 40px -24px #000; }
:root.dark ::-webkit-scrollbar-thumb { background: rgba(236, 238, 247, .14); background-clip: padding-box; }
html.dark { scrollbar-color: var(--emerald-2) var(--paper); }
/* theme change: a quick cross-fade instead of a hard flash */
:root.theme-anim, :root.theme-anim *, :root.theme-anim *::before, :root.theme-anim *::after { transition: background-color 500ms var(--ease), color 500ms var(--ease), border-color 500ms var(--ease), box-shadow 500ms var(--ease) !important; }

/* ---------- theme toggle (topbar) ---------- */
.theme-btn { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; background: var(--surface); border-color: transparent; box-shadow: var(--lift); }
.theme-btn svg { width: 20px; height: 20px; overflow: visible; }
.theme-btn .sun { transform-origin: 12px 12px; transition: transform 700ms var(--spring), opacity 300ms; }
.theme-btn .moon { transform-origin: 12px 12px; transition: transform 700ms var(--spring), opacity 300ms; opacity: 0; transform: rotate(-90deg) scale(.4); }
:root.dark .theme-btn .sun { opacity: 0; transform: rotate(90deg) scale(.4); }
:root.dark .theme-btn .moon { opacity: 1; transform: none; color: var(--chrome); }

/* ============================================================================
   FUN — funny German words, reactions, easter eggs
   ============================================================================ */
.b-fun { grid-column: span 12; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; overflow: hidden; }
.b-fun .fun-emo { font-size: 2.5rem; white-space: nowrap; letter-spacing: -0.18em; padding-right: .18em; line-height: 1; width: 92px; height: 92px; display: grid; place-items: center; border-radius: 28px; background: var(--paper-2); animation: wobble 4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.06); } }
.b-fun .fun-w { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.4rem); color: var(--heading); line-height: 1.05; margin: 4px 0 6px; }
.b-fun .fun-lit { font-size: .95rem; color: var(--text-dim); }
.b-fun .fun-lit b { color: var(--signal); font-weight: 600; }
.b-fun .fun-ex { font-family: var(--serif); color: var(--text); margin-top: 8px; font-size: .98rem; }
.b-fun .fun-k { font-size: .78rem; color: var(--text-faint); }
.b-fun .fun-act { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 720px) { .b-fun { grid-template-columns: 1fr; } .b-fun .fun-act { flex-direction: row; } }
.emoji-rain { position: fixed; inset: 0; pointer-events: none; z-index: 1600; overflow: hidden; }
.emoji-rain i { position: absolute; top: -60px; font-style: normal; font-size: var(--s, 32px); animation: rainDown var(--t, 2.6s) cubic-bezier(.3, .1, .6, 1) forwards; }
@keyframes rainDown { to { transform: translate(var(--dx, 0), 112vh) rotate(var(--r, 360deg)); } }
.brand.spin .brand-mark { animation: brandSpin 900ms var(--spring); }
@keyframes brandSpin { to { transform: rotate(720deg) scale(1.2); } }
.react-toast { position: fixed; left: 50%; bottom: 34px; z-index: 1400; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 12px 20px 12px 14px; border-radius: 999px;
  background: var(--surface); color: var(--heading); box-shadow: 0 20px 50px -20px rgba(12, 13, 24, .55), 0 0 0 1px var(--line); font-weight: 600; animation: reactIn 600ms var(--spring) both; }
.react-toast .re { font-size: 1.7rem; animation: reactEmo 900ms var(--spring) both; }
.react-toast.out { animation: reactOut 400ms var(--ease) forwards; }
@keyframes reactIn { from { opacity: 0; transform: translate(-50%, 30px) scale(.8); } }
@keyframes reactEmo { from { transform: scale(0) rotate(-40deg); } }
@keyframes reactOut { to { opacity: 0; transform: translate(-50%, 20px) scale(.9); } }
.topic-card .t-ic, .topic-head .t-ic { white-space: nowrap; letter-spacing: -0.22em; padding-right: .22em; transition: transform 500ms var(--spring); }
.topic-card .t-ic { width: 82px; height: 64px; font-size: 1.85rem; border-radius: 20px; background: var(--tg, var(--paper)); }
.topic-head .t-ic { width: 92px; height: 76px; font-size: 2.1rem; background: var(--tg, var(--surface)); }
.topic-card:hover .t-ic { transform: rotate(-8deg) scale(1.12); }
.voice-ways { display: grid; gap: 12px; margin: 14px 0; }
.voice-ways > div { padding: 14px 16px; border-radius: 16px; background: var(--paper-2); }
.voice-ways p { margin: 6px 0 0; color: var(--text-dim); font-size: .92rem; }
.voice-ways b { color: var(--heading); }

/* ============================================================================
   ACCOUNTS — sign-in screen, account chip, study race, admin page
   ============================================================================ */
:root.auth-mode body > :not(#auth):not(#intro):not(#ribbon):not(script):not(.toasts):not(.modal-back) { display: none !important; }
#auth { position: fixed; inset: 0; z-index: 900; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); background: var(--paper); }
#auth.au-out { animation: au-out 650ms var(--ease-io) forwards; }
@keyframes au-out { to { opacity: 0; transform: scale(1.02); filter: blur(6px); } }
.au-art { position: relative; margin: 14px 0 14px 14px; border-radius: 28px; overflow: hidden; }
.au-art .painting { position: absolute; inset: 0; border-radius: 28px; }
.au-art .painting .hint { top: auto; bottom: 22px; right: 22px; }
.au-art .painting figcaption { left: auto; right: 22px; bottom: 54px; }
.au-brand { position: absolute; left: 28px; top: 24px; z-index: 3; display: flex; gap: 12px; align-items: center; color: #fff; font: 600 1rem/1 var(--display); letter-spacing: .14em; }
.au-brand .brand-mark { width: 34px; height: 34px; }
.au-art::after { content: ""; position: absolute; inset: 40% 0 0; z-index: 2; pointer-events: none; background: linear-gradient(to top, rgba(6, 8, 24, .82), rgba(6, 8, 24, .35) 55%, transparent); }
.au-quote { position: absolute; left: 28px; right: 28px; bottom: 90px; z-index: 3; max-width: 560px; color: #fff; pointer-events: none; }
.au-quote .qt { margin: 0; padding: 0; border: 0; background: none; color: #fff; }
.au-quote .qt p, .au-quote .qt footer, .au-quote .qt b, .au-quote .qt small { color: #fff !important; }
.au-quote .qt p { font: 400 clamp(1.4rem, 2.6vw, 2.3rem)/1.12 var(--serif); letter-spacing: -0.01em; margin: 0; text-shadow: 0 2px 30px rgba(0, 0, 0, .45); }
.au-quote .qt .qt-en { font: 400 1rem/1.4 var(--body); opacity: .8; margin-top: 10px; }
.au-quote .qt footer { margin-top: 14px; font: 500 .9rem var(--body); opacity: .9; }
.au-side { display: grid; place-items: center; padding: clamp(24px, 5vw, 72px); overflow: auto; }
.au-card { width: min(440px, 100%); }
.au-card.shake { animation: au-shake 420ms var(--ease); }
@keyframes au-shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.au-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 999px; background: var(--surface); box-shadow: var(--lift); margin-bottom: 40px; }
.au-tabs[hidden] { display: none; }
.au-tabs button { position: relative; z-index: 1; display: block; width: 100%; text-align: center; border: 0 !important; background: none !important; box-shadow: none !important; min-height: 0; margin: 0; padding: 11px 0; border-radius: 999px; font: 600 .92rem var(--body); color: var(--text-dim); cursor: pointer; transition: color 300ms var(--ease); }
.au-tabs button[aria-selected="true"] { color: #fff; }
.au-ink { position: absolute; left: 5px; top: 5px; bottom: 5px; width: calc(50% - 5px); border-radius: 999px; background: var(--night); transition: transform 520ms var(--spring); }
:root.dark .au-ink { background: var(--signal); }
.au-title { font-size: clamp(2.8rem, 5vw, 4.4rem); line-height: .95; letter-spacing: -0.045em; margin: 0 0 16px; }
.au-lead { color: var(--text-dim); font-size: 1.02rem; line-height: 1.55; margin: 0 0 30px; max-width: 40ch; }
.au-form { display: grid; gap: 16px; }
.au-f { display: grid; gap: 7px; }
.au-f[hidden] { display: none; }
.au-f > span:first-child { font-size: .82rem; font-weight: 600; color: var(--text-dim); }
.au-f input { width: 100%; box-sizing: border-box; padding: 15px 18px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--heading); font: 500 1.02rem var(--body); transition: border-color 200ms, box-shadow 200ms; }
.au-f input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 5px var(--signal-soft); }
.au-pw { position: relative; display: block; }
.au-pw input { padding-right: 52px; }
.au-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--text-faint); cursor: pointer; }
.au-eye:hover { background: var(--paper); color: var(--heading); }
.au-eye svg { width: 19px; height: 19px; }
.au-err { min-height: 1.3em; color: var(--coral); font-size: .9rem; font-weight: 500; }
.au-err:empty { min-height: 0; }
.au-go { justify-self: stretch; justify-content: center; padding: 16px 22px; font-size: 1.02rem; margin-top: 4px; }
.au-go.busy span::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.au-foot { color: var(--text-faint); font-size: .88rem; margin: 22px 0 0; line-height: 1.5; }
.au-wait { text-align: left; }
.au-wait-ic { font-size: 3.2rem; margin-bottom: 18px; animation: wobble 3s ease-in-out infinite; }
@media (max-width: 860px) {
  #auth { grid-template-columns: 1fr; grid-template-rows: 26vh auto; overflow: auto; }
  .au-art { margin: 10px 10px 0; }
  .au-quote { bottom: 22px; } .au-quote .qt .qt-en, .au-art .painting .hint, .au-art .painting figcaption { display: none; }
  .au-quote .qt p { font-size: 1.25rem; }
  .au-side { place-items: start center; padding: 28px 20px 40px; }
  .au-tabs { margin-bottom: 26px; }
}

/* account chip in the sidebar */
.acct { display: flex; align-items: center; gap: 10px; margin: 14px 10px 0; padding: 10px; border-radius: 18px; background: var(--surface); box-shadow: var(--lift); }
.acct-av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 600 .8rem/1 var(--display); letter-spacing: .04em; color: #fff;
  background: linear-gradient(135deg, #2346ff, #1f6fb8 70%, #f4bd1a 130%); }
.race-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 600 .82rem/1 var(--display); color: #fff; background: linear-gradient(135deg, #2346ff, #1f6fb8 70%, #f4bd1a 130%); }
.race-row.me .race-av { background: linear-gradient(135deg, #f4bd1a, #e0941a); color: var(--night); }
.acct-av.big { width: 52px; height: 52px; font-size: 1rem; }
.acct-av.live { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ok); }
.acct-who { display: grid; min-width: 0; flex: 1; line-height: 1.2; }
.acct-who b { color: var(--heading); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-who small { color: var(--text-faint); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-btn { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--paper); color: var(--text-dim); display: grid; place-items: center; cursor: pointer; transition: transform 500ms var(--spring), background 200ms; }
.acct-btn:hover { transform: rotate(60deg); background: var(--night); color: #fff; }
.acct-btn svg { width: 17px; height: 17px; }

/* study race on the dashboard */
.b-buddy { grid-column: span 12; }
.race { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.race-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 20px; background: var(--paper-2); }
.race-row.me { background: var(--signal-soft); }
.race-main { flex: 1; min-width: 0; }
.race-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.race-top b { color: var(--heading); } .race-top small { color: var(--text-faint); font-weight: 400; }
.race-top .num { font-size: 1.35rem; color: var(--heading); }
.race-track { height: 10px; border-radius: 99px; background: var(--line); margin: 10px 0 8px; overflow: hidden; }
.race-track i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--van); transform-origin: left; animation: race-grow 1400ms var(--ease) both; animation-delay: calc(var(--k) * 140ms + 200ms); }
.race-row.me .race-track i { background: linear-gradient(90deg, var(--signal), var(--chrome)); }
@keyframes race-grow { from { transform: scaleX(0); } }
.race-sub { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--text-dim); }

/* admin page */
.ad-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.ad-h { font-size: clamp(3.4rem, 8vw, 7rem); letter-spacing: -0.055em; line-height: .9; margin: 0 0 14px; }
.ad-count { display: grid; grid-template-columns: auto auto; gap: 2px 10px; align-items: baseline; }
.ad-count b { font-size: 3rem; color: var(--heading); line-height: 1; }
.ad-count .ad-pend { color: var(--coral); }
.ad-count span { color: var(--text-dim); }
.ad-pending { margin-bottom: 18px; border: 2px solid var(--chrome); }
.ad-pending li { align-items: center; gap: 12px; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 18px; }
.ad-member header { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.ad-member h3 { margin: 0; font-size: 1.3rem; }
.ad-member.me { box-shadow: inset 0 0 0 2px var(--signal-soft), var(--lift); }
.ad-live { color: var(--ok); font-weight: 600; }
.ad-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; margin: 0 0 16px; }
.ad-stats div { padding: 10px 12px; border-radius: 14px; background: var(--paper-2); }
.ad-stats dt { font-size: .72rem; color: var(--text-faint); }
.ad-stats dd { margin: 4px 0 0; font-size: 1.05rem; color: var(--heading); }
.ad-danger:hover { background: var(--coral); border-color: var(--coral); color: #fff; }
.ad-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.5; }
.ad-url { font-family: var(--numfont); color: var(--signal); }
@media (max-width: 560px) { .ad-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
:root.dark .race-row, :root.dark .ad-stats div { background: rgba(255, 255, 255, .05); }
:root.dark .race-row.me { background: rgba(35, 70, 255, .18); }

/* ============================================================================
   STUDIO STARRY 2.0 — the gallery opens
   ============================================================================ */
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --e { syntax: '<number>'; inherits: true; initial-value: 0; }

/* signature moment: the dashboard painting opens from a framed canvas to the edges of the page as you scroll */
.hero-x { --gut: clamp(18px, 4vw, 52px); }
.hero-x h1.hello { transform: translateY(calc(var(--p) * 46px)); opacity: calc(1 - var(--p) * .45); will-change: transform; }
.hero-x .painting { margin-inline: calc(-1 * var(--gut)); border-radius: 0; box-shadow: none;
  --side: calc(var(--gut) * (1 - var(--p)) + var(--e) * 6%);
  clip-path: inset(calc(var(--e) * 9%) var(--side) calc(var(--e) * 9%) var(--side) round calc(24px * (1 - var(--p)) + 2px));
  animation: heroOpen 1600ms 120ms var(--ease) both; }
@keyframes heroOpen { from { --e: 1; } to { --e: 0; } }
.hero-x .painting figcaption { left: calc(var(--gut) * (1 - var(--p)) + 20px); bottom: 20px; }
.hero-x .painting .hint { right: calc(var(--gut) * (1 - var(--p)) + 20px); }

/* museum wall label on the painting: today at a glance */
.placard { position: absolute; z-index: 3; right: calc(var(--gut) * (1 - var(--p)) + 22px); bottom: 22px; width: 268px; padding: 16px 18px 14px;
  background: rgba(247, 247, 250, .95); color: #0c0d18; border-radius: 3px; box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 24px 44px -22px rgba(0, 0, 0, .7);
  animation: placardIn 900ms 1000ms var(--ease) both; }
@keyframes placardIn { from { opacity: 0; transform: translateY(16px) rotate(-1.5deg); } }
.pl-t { font: italic 400 1.3rem/1.1 var(--serif); color: #0c0d18; }
.pl-d { font-size: .78rem; color: #545872; margin: 3px 0 12px; }
.placard dl { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; margin: 0; padding-top: 10px; border-top: 1px solid rgba(12, 13, 24, .12); }
.placard dt { font-size: .68rem; color: #6d7293; }
.placard dd { margin: 1px 0 0; font: 500 1rem/1.2 var(--numfont); color: #0c0d18; }
.pl-bar { height: 3px; background: rgba(12, 13, 24, .1); margin-top: 13px; border-radius: 3px; overflow: hidden; }
.pl-bar i { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, #2346ff, #f4bd1a); transform-origin: left; animation: barGrow 1400ms 1500ms var(--ease) both; }
@keyframes barGrow { from { transform: scaleX(0); } }

/* a statement lights up word by word as it crosses the screen */
.scrub .sw { color: color-mix(in srgb, var(--heading) 20%, transparent); transition: color 450ms var(--ease); }
.scrub .sw.on { color: var(--heading); }
.scrub b .sw.on { color: var(--signal); }

/* finale: the last thing on the dashboard */
.finale { --gut: clamp(18px, 4vw, 52px); position: relative; margin: 64px calc(-1 * var(--gut)) 0; min-height: clamp(400px, 64vh, 640px); display: grid; overflow: hidden; isolation: isolate; }
.finale .painting { position: absolute; inset: 0; border-radius: 0; z-index: 0; }
.finale .painting figcaption { left: auto; right: 22px; bottom: 22px; }
.finale::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to top, rgba(6, 8, 24, .82), rgba(6, 8, 24, .2) 58%, transparent 80%); }
.fin-in { position: relative; z-index: 2; align-self: end; padding: clamp(26px, 5vw, 64px); pointer-events: none; }
.fin-in a { pointer-events: auto; }
.fin-h { font-size: clamp(3.8rem, 11vw, 10.5rem); line-height: .84; letter-spacing: -0.06em; color: #fff !important; margin: 0 0 20px; font-weight: 400; }
.fin-en { color: rgba(255, 255, 255, .86); font-size: 1.12rem; margin: 0 0 26px; max-width: 46ch; }
.finale .btn-primary { background: var(--chrome); color: var(--night); box-shadow: 0 16px 34px -16px rgba(244, 189, 26, .9); }
.finale .btn-primary:hover { background: #fff; color: var(--night); }
.finale.sr { transform: none; }
.finale.sr .fin-h { transform: translateY(60px); opacity: 0; transition: transform 1200ms var(--ease), opacity 900ms; }
.finale.sr.in .fin-h { transform: none; opacity: 1; }

/* brush wipe between pages */
#wipe { position: fixed; inset: 0; z-index: 4000; pointer-events: none; visibility: hidden; overflow: hidden; }
#wipe.in { visibility: visible; pointer-events: auto; }
#wipe .w-gold, #wipe .w-blue { position: absolute; inset: -2% 0; transform: translateX(calc(-100% - 90px)); }
#wipe .w-gold { background: var(--chrome); }
#wipe .w-blue { background: var(--signal); display: grid; place-items: center; }
#wipe .w-edge { position: absolute; left: 100%; top: 0; width: 70px; height: 100%; margin-left: -1px; fill: var(--signal); transform: scaleX(-1); }
#wipe .w-gold::after { content: ""; position: absolute; left: 100%; top: 0; bottom: 0; width: 46px; background: var(--chrome);
  -webkit-mask: radial-gradient(circle at 0 50%, #000 70%, transparent 71%) 0 0 / 46px 38px repeat-y; mask: radial-gradient(circle at 0 50%, #000 70%, transparent 71%) 0 0 / 46px 38px repeat-y; }
#wipe .w-label { font: 400 clamp(2.4rem, 7.5vw, 6.8rem)/.95 var(--display); letter-spacing: -0.045em; color: #fff; text-align: center; padding: 0 6vw; opacity: 0; }
#wipe .w-star { position: absolute; right: 7vw; top: 9vh; color: var(--chrome); font-size: 2.2rem; opacity: 0; }
#wipe.in .w-gold { animation: wIn 340ms var(--ease-io) both; }
#wipe.in .w-blue { animation: wIn 340ms 40ms var(--ease-io) both; }
#wipe.in .w-label { animation: wLabel 600ms 150ms var(--ease) both; }
#wipe.in .w-star { animation: wStar 900ms 120ms var(--ease) both; }
#wipe.in.out { pointer-events: none; }
#wipe.in.out .w-blue { animation: wOut 560ms 60ms var(--ease-io) both; }
#wipe.in.out .w-gold { animation: wOut 560ms 130ms var(--ease-io) both; }
#wipe.in.out .w-label, #wipe.in.out .w-star { animation: none; opacity: 1; }
@keyframes wIn { from { transform: translateX(calc(-100% - 90px)); } to { transform: translateX(0); } }
@keyframes wOut { from { transform: translateX(0); } to { transform: translateX(calc(100% + 90px)); } }
@keyframes wLabel { from { opacity: 0; transform: translateY(40%) skewY(4deg); } to { opacity: 1; transform: none; } }
@keyframes wStar { from { opacity: 0; transform: scale(.3) rotate(-120deg); } to { opacity: 1; transform: none; } }
:root.dark #wipe .w-blue { background: #1a2fd0; } :root.dark #wipe .w-edge { fill: #1a2fd0; }

/* magnetic buttons lean toward the cursor (translate, so hover transforms keep working) */
.btn-primary, .btn.pill, .au-go { transition: background 250ms var(--ease), transform 350ms var(--spring), box-shadow 300ms var(--ease), color 250ms, border-color 250ms, translate 700ms var(--spring); }
.magnet { transition: background 250ms var(--ease), transform 350ms var(--spring), box-shadow 300ms var(--ease), color 250ms, border-color 250ms, translate 140ms linear; }

/* reading progress: a hairline under the top bar fills as you scroll */
@supports (animation-timeline: scroll()) {
  .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--van); transform-origin: left; transform: scaleX(0);
    animation: scrollProg linear both; animation-timeline: scroll(root); }
  @keyframes scrollProg { to { transform: scaleX(1); } }
}

/* paper grain: the page is a sheet, not a screen (static, no blending, so scrolling stays cheap) */
body::after { content: ""; position: fixed; inset: 0; z-index: 3500; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"); }
:root.dark body::after { opacity: .06; }

@media (max-width: 720px) {
  .placard { left: calc(var(--gut) * (1 - var(--p)) + 12px); right: calc(var(--gut) * (1 - var(--p)) + 12px); bottom: 12px; width: auto; padding: 12px 14px 10px; }
  .placard dl { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
  .placard dd { font-size: .86rem; } .pl-t { font-size: 1.05rem; } .pl-d { margin-bottom: 8px; }
  .hero-x .painting figcaption { display: none; }
  .hero-x .painting { height: 58vh; }
  .fin-h { font-size: 3.6rem; }
}
@media (prefers-reduced-motion: reduce) { #wipe { display: none; } }
:root.reduce-motion #wipe { display: none; }
:root.reduce-motion .hero-x .painting { animation: none; }

/* admin: links + sign-up switch */
.ad-invite .panel-head { flex-wrap: wrap; gap: 10px; }
.ad-switch { display: inline-flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--text-dim); cursor: pointer; }
.ad-switch b { color: var(--heading); min-width: 4.5em; }
.ad-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 18px; }
.ad-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px; border-radius: 18px; background: var(--signal-soft); }
.ad-link.off { background: var(--paper-2); }
.ad-link .k { flex-basis: 100%; font-size: .74rem; font-weight: 600; color: var(--text-faint); }
.ad-link .ad-url { word-break: break-all; }
:root.dark .ad-link.off { background: rgba(255, 255, 255, .05); }
