/* HayNexa — mobile-first stylesheet
   Palette from the logo: ink navy, royal, aqua. Ember is reserved for the streak. */
:root {
  --ink: #0A1650;
  --ink-2: #13226E;
  --royal: #1747D1;
  --royal-2: #2F63F0;
  --aqua: #14C8C4;
  --aqua-soft: #DDF7F6;
  --paper: #F3F6FD;
  --surface: #FFFFFF;
  --line: #DCE3F4;
  --line-strong: #C3CEEA;
  --text: #121A3D;
  --muted: #4A5578;
  --faint: #7D88AA;
  --ember: #FF6B1A;
  --ember-soft: #FFF0E6;
  --good: #0E9F6E;
  --good-soft: #E3F7EF;
  --bad: #DC2F3E;
  --bad-soft: #FDECEE;
  --warn: #B7791F;
  --warn-soft: #FFF6E0;
  --tint: #EAF0FF;
  --tint-2: #EEF3FF;
  --tint-3: #F7F9FF;
  --exam-bg: #EEF2FC;
  --topbar-bg: rgba(255, 255, 255, .86);
  --good-ink: #075E42;
  --bad-ink: #8E1622;
  --warn-ink: #7A4F0E;
  --warn-line: #F3D9A4;
  --mark-bg: #FFF1A8;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --r-lg: 22px;   /* major surfaces */
  --r-md: 14px;   /* cards inside surfaces */
  --r-sm: 10px;   /* controls */
  --shadow: 0 1px 0 rgba(10, 22, 80, .04), 0 12px 32px -18px rgba(10, 22, 80, .35);
  --shadow-lift: 0 18px 40px -20px rgba(23, 71, 209, .55);
  --gutter: 16px;
  --max: 1160px;
  --tabbar-h: 66px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--royal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 6.5vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
@media (max-width: 959px) { .hide-sm { display: none !important; } }
@media (min-width: 960px) { .hide-lg { display: none !important; } }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 26px; height: 26px; }

/* ------------------------------------------------------------ top bar --- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 38px; height: 38px; }
.brand span { font: 800 1.3rem/1 var(--font-display); letter-spacing: -.03em; }
@media (max-width: 400px) { .topbar .brand span { font-size: 1.12rem; } .topbar .btn.sm { padding: 0 12px; } }
.brand span b { color: var(--royal); font-weight: 800; }
.nav-links { display: none; gap: 4px; margin-left: 18px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--paper); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ember); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font: 700 .85rem var(--font-display); flex: none; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; }

/* mobile drawer (guests) */
.drawer { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.drawer .scrim { position: absolute; inset: 0; background: rgba(10, 22, 80, .45); opacity: 0; transition: opacity .25s; }
.drawer .panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(84vw, 340px); background: var(--surface); padding: 22px; transform: translateX(100%); transition: transform .32s var(--ease); display: flex; flex-direction: column; gap: 6px; }
.drawer.open { pointer-events: auto; }
.drawer.open .scrim { opacity: 1; }
.drawer.open .panel { transform: none; }
.drawer .panel a.link { padding: 14px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; display: flex; gap: 12px; align-items: center; }
.drawer .panel a.link:hover { background: var(--paper); }

/* bottom tab bar (signed-in, phones) — the "app" feel */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); text-decoration: none; font-size: .72rem; font-weight: 700; position: relative; }
.tabbar a.active { color: var(--royal); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--royal); }
.tabbar a.cta .bubble { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, var(--royal), var(--aqua)); margin-top: -26px; box-shadow: var(--shadow-lift); }
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }

/* ------------------------------------------------------------- buttons --- */
.btn {
  --bg: var(--royal); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--bg); color: var(--fg); font: 700 1rem var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s; -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:hover { color: var(--fg); box-shadow: var(--shadow-lift); }
.btn:active { transform: scale(.97); }
.btn.ghost { --bg: var(--surface); --fg: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { box-shadow: none; border-color: var(--royal); }
.btn.ink { --bg: var(--ink); }
.btn.aqua { --bg: var(--aqua); --fg: var(--ink); }
.btn.ember { --bg: var(--ember); }
.btn.danger { --bg: var(--bad-soft); --fg: var(--bad); }
.btn.danger:hover { box-shadow: none; --bg: #fbd5da; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--royal); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------- forms --- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 700; font-size: .92rem; color: var(--ink); }
.field .hint { font-size: .82rem; color: var(--faint); }
.field .err, .err { font-size: .84rem; color: var(--bad); font-weight: 600; }
.req { color: var(--bad); }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 1rem var(--font-body); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 4px rgba(23, 71, 209, .14); }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--bad); }
.grid-2, .grid-3 { display: grid; gap: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check:has(input:checked) { border-color: var(--royal); background: var(--tint); color: var(--royal); }
.check:has(input:focus-visible) { outline: 3px solid var(--aqua); outline-offset: 2px; }
.check .tick { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.check:has(input:checked) .tick { background: var(--royal); border-color: var(--royal); }
.check:has(input:checked) .tick::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--royal); }

.photo-drop { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--paper); cursor: pointer; }
.photo-drop .preview { width: 72px; height: 72px; border-radius: 50%; background: var(--surface) center/cover; border: 2px solid var(--line); display: grid; place-items: center; color: var(--faint); flex: none; }
.photo-drop input { position: absolute; opacity: 0; width: 1px; }

/* ------------------------------------------------------------- flashes --- */
.flashes { position: fixed; top: 72px; left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 var(--gutter); pointer-events: none; }
.flash { pointer-events: auto; width: min(560px, 100%); display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; animation: flashIn .45s var(--ease) both; }
.flash.success { border-left: 4px solid var(--good); }
.flash.error { border-left: 4px solid var(--bad); }
.flash.warning { border-left: 4px solid var(--warn); }
.flash.info { border-left: 4px solid var(--royal); }
.flash button { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.flash.out { animation: flashOut .3s ease forwards; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
@keyframes flashOut { to { opacity: 0; transform: translateY(-10px); } }

/* --------------------------------------------------------------- hero ---- */
.hero { position: relative; background: var(--ink); color: #fff; overflow: hidden; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -2; background: radial-gradient(80% 60% at 85% 10%, rgba(20, 200, 196, .28), transparent 60%), radial-gradient(70% 70% at 0% 100%, rgba(47, 99, 240, .45), transparent 65%); }
.hero .wrap { display: grid; gap: 34px; padding-top: 44px; padding-bottom: 56px; }
.hero h1 { color: #fff; max-width: 15ch; }
.hero h1 .line { display: block; overflow: hidden; }
.hero h1 .line > span { display: inline-block; animation: rise .9s var(--ease) both; }
.hero h1 .line:nth-child(2) > span { animation-delay: .12s; }
.hero h1 .line:nth-child(3) > span { animation-delay: .24s; }
.hero .lede { color: #C9D4FA; font-size: 1.12rem; max-width: 46ch; animation: fadeUp .9s .35s var(--ease) both; }
.hero .ctas { display: flex; gap: 10px; flex-wrap: wrap; animation: fadeUp .9s .45s var(--ease) both; }
.hero .btn.ghost { --bg: transparent; --fg: #fff; border-color: rgba(255, 255, 255, .35); }
.hero .btn.ghost:hover { border-color: #fff; }
.hero .audience { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; animation: fadeUp .9s .55s var(--ease) both; }
.hero .audience span { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #E3E9FF; font-size: .85rem; font-weight: 600; }
.trajectory { position: absolute; inset: auto 0 0 0; height: 62%; z-index: -1; pointer-events: none; }
.trajectory path.trail { fill: none; stroke: url(#trailGrad); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw 2.2s .3s var(--ease) forwards; opacity: .9; }
.trajectory path.trail-soft { fill: none; stroke: rgba(20, 200, 196, .16); stroke-width: 44; stroke-linecap: round; stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw 2.2s .3s var(--ease) forwards; }
.trajectory .marker { opacity: 0; animation: pop .5s 2.2s var(--ease) forwards; transform-box: fill-box; transform-origin: center; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { transform: translateY(105%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 70% { opacity: 1; transform: scale(1.12); } 100% { opacity: 1; transform: scale(1); } }

/* sample question shown in hero */
.qcard { background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: 18px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); animation: fadeUp 1s .6s var(--ease) both; max-width: 440px; }
.qcard .meta { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.qcard .q { font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.qcard .opt { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; margin-top: 8px; font-size: .95rem; }
.qcard .opt b { width: 26px; height: 26px; border-radius: 8px; background: var(--paper); display: grid; place-items: center; font-size: .8rem; color: var(--muted); flex: none; }
.qcard .opt.pick { border-color: var(--good); background: var(--good-soft); animation: pickIn .5s 1.6s both; }
.qcard .opt.pick b { background: var(--good); color: #fff; }
@keyframes pickIn { from { border-color: var(--line); background: #fff; } }
.qcard .foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .9rem; color: var(--muted); }

/* ------------------------------------------------------------ sections --- */
.section { padding: 56px 0; }
.section.tight { padding: 36px 0; }
.section.white { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 26px; }
.section-head p { color: var(--muted); font-size: 1.06rem; }

.counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.counts > div { background: var(--surface); padding: 18px; }
.counts strong { display: block; font: 800 1.8rem/1 var(--font-display); color: var(--ink); letter-spacing: -.02em; }
.counts span { color: var(--muted); font-size: .9rem; }

/* test formats as rows of an exam sheet */
.formats { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.format { display: grid; gap: 14px; padding: 22px; border-top: 1px solid var(--line); }
.format:first-child { border-top: 0; }
.format .size { white-space: nowrap; font: 800 2.6rem/1 var(--font-display); color: var(--royal); letter-spacing: -.04em; }
.format .size small { font-size: .9rem; color: var(--muted); font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.format p { color: var(--muted); margin: 0; }
.dist { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.dist i { display: block; height: 100%; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.dist-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 6px; }
.s-phy { --c: #1747D1; background: #1747D1; }
.s-che { --c: #14C8C4; background: #14C8C4; }
.s-zoo { --c: #6C4DF0; background: #6C4DF0; }
.s-bot { --c: #22A06B; background: #22A06B; }

.features { display: grid; gap: 14px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--tint); color: var(--royal); display: grid; place-items: center; flex: none; }
.feature h3 { font-size: 1.05rem; margin-bottom: 4px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }

/* leaderboard */
.board { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.board li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.board li:first-child { border-top: 0; }
.board li.me { background: var(--tint-2); }
.board .rank { width: 28px; font: 800 1.05rem var(--font-display); color: var(--faint); text-align: center; }
.board li:nth-child(1) .rank { color: #D4A017; }
.board li:nth-child(2) .rank { color: #8A94A8; }
.board li:nth-child(3) .rank { color: #B5651D; }
.board .who { flex: 1; min-width: 0; }
.board .who strong { display: block; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .who span { font-size: .82rem; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.flame-count { display: inline-flex; align-items: center; gap: 4px; font: 800 1.05rem var(--font-display); color: var(--ember); }
.flame-count svg { width: 18px; height: 18px; }

/* about */
.leaders { display: grid; gap: 18px; }
.leader { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.leader .portrait { width: 96px; height: 116px; border-radius: 16px; object-fit: cover; background: linear-gradient(160deg, var(--ink), var(--royal)); color: #fff; display: grid; place-items: center; font: 800 1.8rem var(--font-display); }
.leader .role { color: var(--royal); font-weight: 700; font-size: .9rem; }
.leader blockquote { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }
.team-list { list-style: none; margin: 0; padding: 0; columns: 1; column-gap: 32px; }
.team-list li { break-inside: avoid; display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.team-list li strong { color: var(--ink); }
.team-list li span { color: var(--muted); }
.prose { max-width: 68ch; }
.prose p { color: var(--muted); font-size: 1.05rem; }

/* ------------------------------------------------------------- surfaces -- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.card.pad-lg { padding: 26px; }
.card h2 { font-size: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.page-head { padding: 26px 0 16px; }
.page-head h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); margin-bottom: 4px; }
.page-head p { color: var(--muted); margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--paper); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.royal { background: var(--tint); color: var(--royal); border-color: transparent; }
.chip.ember { background: var(--ember-soft); color: var(--ember); border-color: transparent; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--line-strong); margin: 0 auto 10px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.kpi strong { display: block; font: 800 1.6rem/1.1 var(--font-display); color: var(--ink); letter-spacing: -.02em; }
.kpi span { font-size: .85rem; color: var(--muted); }

/* tables become stacked cards on phones */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; color: var(--faint); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (max-width: 759px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--faint); font-size: .82rem; font-weight: 700; text-align: left; }
  .table.stack td.lead { display: block; text-align: left; font-weight: 700; color: var(--ink); padding-bottom: 6px; }
  .table.stack td.lead::before { display: none; }
}
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 18px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar > * { flex: 1 1 160px; }
.toolbar .btn { flex: 0 0 auto; }

/* --------------------------------------------------------- dashboard ----- */
.dash-grid { display: grid; gap: 16px; }
.streak-card { position: relative; overflow: hidden; background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 20px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.streak-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 107, 26, .35), transparent 70%); }
.streak-card h2 { color: #fff; margin: 0; font-size: 1.1rem; }
.streak-card p { margin: 4px 0 0; color: #C9D4FA; font-size: .92rem; }
.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255, 255, 255, .12); }
.ring .fill { stroke: var(--ember); stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .center strong { display: block; font: 800 2rem/1 var(--font-display); }
.ring .center span { font-size: .72rem; color: #C9D4FA; }
.flame { width: 26px; height: 26px; color: var(--ember); transform-origin: 50% 90%; animation: flicker 1.8s ease-in-out infinite; }
.flame.dead { color: rgba(255, 255, 255, .3); animation: none; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08, 1.12) rotate(2deg); } }
.reward-banner { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r-md); background: linear-gradient(120deg, var(--ember), #FFB020); color: #fff; animation: pop .6s var(--ease) both; }
.reward-banner strong { display: block; }
.reward-banner .btn { margin-left: auto; --bg: #fff; --fg: var(--ember); }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar .d { aspect-ratio: 1; border-radius: 7px; background: var(--paper); border: 1px solid var(--line); }
.calendar .d.l1 { background: #FFD9C2; border-color: transparent; }
.calendar .d.l2 { background: #FFA36B; border-color: transparent; }
.calendar .d.l3 { background: var(--ember); border-color: transparent; }
.calendar .d.today { outline: 2px solid var(--royal); outline-offset: 1px; }

.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .grid text { fill: var(--faint); font-size: 11px; }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke: var(--royal); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.6s var(--ease) forwards; }
.chart circle { fill: #fff; stroke: var(--royal); stroke-width: 2.5; }
.chart .xl { fill: var(--faint); font-size: 10.5px; }

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick a { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; transition: border-color .2s, transform .2s var(--ease); }
.quick a:hover { border-color: var(--royal); transform: translateY(-2px); }
.quick a .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--royal); }
.quick a.daily { background: linear-gradient(140deg, var(--royal), var(--ink)); color: #fff; border: 0; }
.quick a.daily .ico { background: rgba(255, 255, 255, .15); color: #fff; }
.quick a small { font-weight: 600; color: var(--muted); }
.quick a.daily small { color: #C9D4FA; }

.resume { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-md); background: var(--warn-soft); border: 1px solid var(--warn-line); }

/* ------------------------------------------------------------ test hub --- */
.hub { display: grid; gap: 16px; }
.hub-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.hub-block .top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.hub-block .big { font: 800 2.4rem/1 var(--font-display); color: var(--royal); letter-spacing: -.04em; min-width: 64px; }
.subject-acc { border: 1px solid var(--line); border-radius: var(--r-md); margin-top: 10px; overflow: hidden; }
.subject-acc summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.subject-acc summary::-webkit-details-marker { display: none; }
.subject-acc summary .chev { margin-left: auto; transition: transform .25s; }
.subject-acc[open] summary .chev { transform: rotate(180deg); }
.subject-acc .topics { border-top: 1px solid var(--line); }
.topic-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.topic-row:first-child { border-top: 0; }
.topic-row .name { flex: 1 1 180px; }
.topic-row form { display: flex; gap: 6px; }
.set-list { display: grid; gap: 10px; }
.set-item { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); flex-wrap: wrap; }
.set-item .yr { font: 800 1.3rem var(--font-display); color: var(--ink); min-width: 56px; }

/* --------------------------------------------------------------- exam ---- */
body.exam-mode { background: var(--exam-bg); }
.exam-bar { position: sticky; top: 0; z-index: 55; background: var(--ink); color: #fff; }
.exam-bar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.exam-bar .title { min-width: 0; flex: 1; }
.exam-bar .title strong { display: block; font: 700 .98rem var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-bar .title span { font-size: .78rem; color: #AFC0F5; }
.timer { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); font: 800 1.05rem var(--font-display); font-variant-numeric: tabular-nums; }
.timer.low { background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(220, 47, 62, .25); } }
.exam-progress { height: 4px; background: rgba(255, 255, 255, .12); }
.exam-progress i { display: block; height: 100%; width: 0; background: var(--aqua); transition: width .3s var(--ease); }
.exam-layout { display: grid; gap: 16px; padding-top: 18px; padding-bottom: 120px; }
.question { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.js .question { display: none; }
.js .question.current { display: block; animation: qIn .35s var(--ease); }
@keyframes qIn { from { opacity: 0; transform: translateX(14px); } }
.question .qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: .85rem; font-weight: 700; }
.question .qtext { font-size: 1.12rem; font-weight: 700; color: var(--ink); line-height: 1.5; margin-bottom: 16px; white-space: pre-line; }
.option { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 14px; margin-top: 10px; border-radius: var(--r-md); border: 1.5px solid var(--line-strong); background: var(--surface); font: 1rem/1.45 var(--font-body); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s, transform .12s; -webkit-tap-highlight-color: transparent; min-height: 56px; }
.option:hover { border-color: var(--royal); }
.option:active { transform: scale(.99); }
.option .letter { width: 32px; height: 32px; border-radius: 10px; background: var(--paper); display: grid; place-items: center; font: 800 .9rem var(--font-display); color: var(--muted); flex: none; transition: background .15s, color .15s; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option.selected, .option:has(input:checked) { border-color: var(--royal); background: var(--tint-2); }
.option.selected .letter, .option:has(input:checked) .letter { background: var(--royal); color: #fff; }
.qnav { display: flex; gap: 10px; margin-top: 18px; }
.qnav .btn { flex: 1; }
.palette { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.palette .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.palette button { aspect-ratio: 1; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); font: 700 .85rem var(--font-display); color: var(--muted); cursor: pointer; }
.palette button.answered { background: var(--royal); border-color: var(--royal); color: #fff; }
.palette button.current { outline: 3px solid var(--aqua); outline-offset: 1px; }
.palette .legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
.save-state { font-size: .8rem; color: var(--faint); }
.save-state.err { color: var(--bad); }
.exam-submit { position: fixed; left: 0; right: 0; bottom: 0; z-index: 56; background: var(--surface); border-top: 1px solid var(--line); padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); }
.exam-submit .wrap { display: flex; gap: 10px; align-items: center; padding: 0; }

.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: var(--gutter); background: rgba(10, 22, 80, .55); }
.modal.open { display: grid; }
.modal .box { width: min(440px, 100%); background: var(--surface); border-radius: var(--r-lg); padding: 22px; animation: pop .35s var(--ease); }

/* protection layer */
.protected { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.watermark { position: fixed; inset: 0; z-index: 54; pointer-events: none; overflow: hidden; opacity: .07; }
.watermark div { position: absolute; inset: -50%; display: flex; flex-wrap: wrap; gap: 70px 90px; transform: rotate(-24deg); font: 700 15px var(--font-body); color: var(--ink); align-content: flex-start; }
.shield { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; text-align: center; background: var(--ink); color: #fff; padding: 24px; }
.shield.on { display: grid; }
.shield h2 { color: #fff; }
.shield p { color: #C9D4FA; }
@media print { body * { display: none !important; } body::after { content: "Printing is disabled on HayNexa."; display: block !important; } }

/* -------------------------------------------------------------- report --- */
.score-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; display: grid; gap: 18px; }
.score-big { font: 800 3.4rem/1 var(--font-display); color: var(--ink); letter-spacing: -.04em; }
.score-big small { font-size: 1.2rem; color: var(--faint); letter-spacing: 0; }
.score-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--paper); }
.score-bar .c { background: var(--good); }
.score-bar .w { background: var(--bad); }
.score-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); }
.score-legend b { color: var(--ink); }
.review { display: grid; gap: 12px; }
.review-item { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line-strong); border-radius: var(--r-md); padding: 16px; }
.review-item.right { border-left-color: var(--good); }
.review-item.wrong { border-left-color: var(--bad); }
.review-item .qtext { font-weight: 700; color: var(--ink); margin-bottom: 10px; white-space: pre-line; }
.review-item ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review-item li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--paper); font-size: .95rem; }
.review-item li b { width: 24px; flex: none; color: var(--muted); }
.review-item li.correct { background: var(--good-soft); color: var(--good-ink); font-weight: 700; }
.review-item li.picked-wrong { background: var(--bad-soft); color: var(--bad-ink); font-weight: 700; text-decoration: line-through; text-decoration-thickness: 1px; }
.review-item .expl { margin-top: 10px; font-size: .9rem; color: var(--muted); padding: 10px 12px; border-radius: 10px; background: var(--tint-3); border: 1px dashed var(--line-strong); }
.once-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink); font-size: .92rem; }

/* --------------------------------------------------------------- notes --- */
.note-grid { display: grid; gap: 12px; }
.note-card { display: block; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .2s; }
.note-card:hover { border-color: var(--royal); color: var(--text); }
.note-card h3 { font-size: 1.05rem; margin: 8px 0 4px; }
.note-card p { color: var(--muted); font-size: .92rem; margin: 0; }
.note-card.important { border-left: 4px solid var(--ember); }
.note-body { font-size: 1.06rem; line-height: 1.75; max-width: 70ch; }
.note-body h2 { font-size: 1.5rem; margin-top: 1.2em; }
.note-body h3 { font-size: 1.2rem; margin-top: 1.1em; }
.note-body h4 { margin-top: 1em; }
.note-body ul, .note-body ol { padding-left: 1.3em; }
.note-body li { margin: .25em 0; }
.note-body mark { background: var(--mark-bg); padding: 0 3px; border-radius: 3px; }
.note-body code { background: var(--paper); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.callout { display: flex; flex-direction: column; gap: 2px; margin: 1em 0; padding: 12px 16px; border-radius: var(--r-md); background: var(--ember-soft); border-left: 4px solid var(--ember); }
.callout strong { color: var(--ember); font-size: .85rem; }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; }
.pills a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ----------------------------------------------------------------- auth -- */
.auth { min-height: calc(100vh - 62px); display: grid; }
.auth-side { display: none; }
.auth-main { padding: 28px var(--gutter) 48px; display: flex; justify-content: center; }
.auth-box { width: 100%; max-width: 520px; }
.auth-box.wide { max-width: 720px; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); transition: background .3s; }
.steps span.on { background: linear-gradient(90deg, var(--royal), var(--aqua)); }
.js .step { display: none; }
.js .step.current { display: block; animation: qIn .35s var(--ease); }
.step-title { font: 700 1.05rem var(--font-display); color: var(--ink); margin-bottom: 14px; }
.step-nav { display: flex; gap: 10px; margin-top: 22px; }
.step-nav .btn { flex: 1; }
.no-js-only { display: none; }

/* ---------------------------------------------------------------- panel -- */
.panel-shell { display: grid; gap: 0; }
.panel-nav { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 62px; z-index: 40; }
.panel-nav .scroller { display: flex; gap: 4px; overflow-x: auto; padding: 8px var(--gutter); scrollbar-width: none; }
.panel-nav .scroller::-webkit-scrollbar { display: none; }
.panel-nav a { flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.panel-nav a:hover { background: var(--paper); color: var(--ink); }
.panel-nav a.active { background: var(--ink); color: #fff; }
.panel-nav .sep { display: none; }
.panel-main { padding: 18px var(--gutter) 56px; min-width: 0; }
.qtext-cell { max-width: 520px; color: var(--ink); }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.inline { display: inline; }
.result-box { margin-top: 16px; }
.result-box ul { margin: 6px 0 0; padding-left: 1.2em; font-size: .9rem; color: var(--muted); }
.dup-warn { display: none; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-weight: 700; font-size: .9rem; }
.dup-warn.on { display: block; animation: pop .3s var(--ease); }
.answer-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.answer-picker label { display: grid; place-items: center; height: 48px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); font: 800 1.05rem var(--font-display); cursor: pointer; position: relative; }
.answer-picker input { position: absolute; opacity: 0; }
.answer-picker label:has(input:checked) { background: var(--good); border-color: var(--good); color: #fff; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; background: var(--paper); padding: 2px 6px; border-radius: 6px; }
details.inline-edit summary { cursor: pointer; color: var(--royal); font-weight: 700; list-style: none; }
details.inline-edit summary::-webkit-details-marker { display: none; }
details.inline-edit[open] { padding: 12px; border-radius: var(--r-md); background: var(--paper); margin: 8px 0; }

/* -------------------------------------------------------------- footer --- */
.footer { background: var(--ink); color: #AFC0F5; padding: 40px 0 28px; margin-top: 40px; }
.footer .wrap { display: grid; gap: 22px; }
.footer a { color: #fff; text-decoration: none; }
.footer .brand span { color: #fff; }
.footer .brand span b { color: var(--aqua); }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer .fine { font-size: .82rem; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 18px; }

.error-page { text-align: center; padding: 70px var(--gutter); }
.error-page .code-num { font: 800 5rem/1 var(--font-display); background: linear-gradient(120deg, var(--royal), var(--aqua)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* reveal on scroll (one subtle entrance per page section) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ------------------------------------------------------- breakpoints ----- */
@media (min-width: 560px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .counts { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .note-grid { grid-template-columns: 1fr 1fr; }
  .team-list { columns: 2; }
}
@media (min-width: 760px) {
  :root { --gutter: 28px; }
  .format { grid-template-columns: 210px 1fr 1.1fr; align-items: center; }
  .features { grid-template-columns: 1fr 1fr; gap: 26px 34px; }
  .leaders { grid-template-columns: 1fr 1fr; }
  .leader { grid-template-columns: 130px 1fr; }
  .leader .portrait { width: 130px; height: 156px; }
  .score-hero { grid-template-columns: auto 1fr; align-items: center; }
  .footer .wrap { grid-template-columns: 1.4fr 1fr; }
}
@media (min-width: 960px) {
  .nav-links { display: flex; }
  .hero .wrap { grid-template-columns: 1.15fr .85fr; align-items: center; padding-top: 72px; padding-bottom: 96px; }
  .hero .qcard { justify-self: end; }
  .tabbar { display: none; }
  body.has-tabbar { padding-bottom: 0; }
  .dash-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .dash-grid .span-2 { grid-column: 1 / -1; }
  .exam-layout { grid-template-columns: 1fr 300px; align-items: start; }
  .exam-layout .palette { position: sticky; top: 84px; }
  .auth { grid-template-columns: 1fr 1.1fr; }
  .auth-side { display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: 48px; }
  .auth-side h2 { color: #fff; font-size: 2.2rem; max-width: 14ch; }
  .auth-side p { color: #C9D4FA; max-width: 40ch; }
  .auth-side .trajectory { height: 70%; }
  .auth-main { align-items: center; }
  .panel-shell { grid-template-columns: 236px 1fr; }
  .panel-nav { position: sticky; top: 62px; height: calc(100vh - 62px); border-bottom: 0; border-right: 1px solid var(--line); }
  .panel-nav .scroller { flex-direction: column; overflow: visible; padding: 18px 14px; }
  .panel-nav .sep { display: block; font-size: .78rem; color: var(--faint); font-weight: 700; padding: 14px 12px 4px; }
  .panel-main { padding: 26px 34px 60px; }
  .note-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .trajectory path.trail, .trajectory path.trail-soft, .chart .line { stroke-dashoffset: 0; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ===================================================== v2 additions ===== */
[hidden] { display: none !important; }
.s-mat { --c: #E0A21B; background: #E0A21B; }

/* hero leaderboard (replaces the sample question card) */
.hero-board { background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: 18px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); animation: fadeUp 1s .6s var(--ease) both; width: 100%; max-width: 440px; }
.hero-board h2 { font-size: 1.15rem; margin: 0; }
.hero-board .row a { font-size: .85rem; font-weight: 700; }
.hero-board .board { border: 0; margin-top: 8px; }
.hero-board .board li { padding: 10px 2px; }
.hero-board .empty { padding: 22px 8px; }
.hero-board .foot { display: flex; gap: 6px; align-items: center; margin: 8px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .86rem; color: var(--muted); }
.hero-board .foot .icon { color: var(--ember); }
@media (min-width: 960px) { .hero .hero-board { justify-self: end; } }

/* programs */
.program-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.program-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; text-decoration: none; color: var(--text); transition: border-color .2s, transform .25s var(--ease); }
.program-card:hover { border-color: var(--royal); transform: translateY(-3px); color: var(--text); }
.program-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.program-mark { display: grid; place-items: center; aspect-ratio: 16 / 9; background: linear-gradient(140deg, var(--ink), var(--royal) 70%, var(--aqua)); color: #fff; font: 800 2.2rem/1 var(--font-display); letter-spacing: -.03em; }
.program-card > div { padding: 14px 16px 18px; }
.program-card h3 { margin: 0 0 4px; }
.program-card p { margin: 0; color: var(--muted); font-size: .92rem; }

/* blog */
.post-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.post-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; text-decoration: none; color: var(--text); transition: border-color .2s; }
.post-card:hover { border-color: var(--royal); color: var(--text); }
.post-card img, .post-cover-blank { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-cover-blank { display: block; background: radial-gradient(80% 90% at 90% 0%, rgba(20, 200, 196, .35), transparent 60%), var(--ink); }
.post-body { padding: 14px 16px 18px; }
.post-body h3 { margin: 6px 0; font-size: 1.1rem; }
.post-body p { margin: 0; color: var(--muted); font-size: .92rem; }
.article { font-size: 1.06rem; }
.article .lead { font-size: 1.15rem; color: var(--muted); }
.article-cover { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--r-lg); margin-bottom: 16px; }
.md-img { margin: 1.2em 0; }
.md-img img { border-radius: var(--r-md); border: 1px solid var(--line); max-height: 520px; width: auto; }
.cover-preview { max-width: 320px; border-radius: var(--r-md); border: 1px solid var(--line); }

/* question pictures */
.q-img { max-width: 100%; max-height: 360px; width: auto; border-radius: var(--r-md); border: 1px solid var(--line); margin: 0 0 12px; background: #fff; }

/* editor */
.editor { border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.editor:focus-within { border-color: var(--royal); box-shadow: 0 0 0 4px rgba(23, 71, 209, .14); }
.editor-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--paper); border-bottom: 1px solid var(--line); align-items: center; }
.editor-bar button, .editor-bar .upload-btn { min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font: 600 .85rem var(--font-body); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.editor-bar button:hover, .editor-bar .upload-btn:hover { border-color: var(--royal); }
.editor-status { font-size: .8rem; color: var(--muted); margin-left: 4px; }
.editor textarea { border: 0; border-radius: 0; box-shadow: none !important; min-height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92rem; }

/* tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 700 .9rem var(--font-body); color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* past papers picker */
.picker { margin-bottom: 8px; }
.picker-title { font-size: 1rem; color: var(--muted); margin: 14px 0 8px; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.year-grid a { display: grid; place-items: center; min-height: 52px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; font: 800 1.1rem var(--font-display); color: var(--ink); }
.year-grid a:first-child { font-size: .9rem; font-family: var(--font-body); }
.year-grid a.on { background: var(--royal); color: #fff; border-color: var(--royal); }
.answer-only { display: none; }
[data-answer-box].open .answer-only { display: block; }
[data-answer-box].open li.answer-key { background: var(--good-soft); color: var(--good-ink); font-weight: 700; }

/* recommendations, subject bars, time per day */
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--paper); font-size: .94rem; }
.tips li .icon { margin-top: 3px; }
.tips li.focus { background: var(--ember-soft); }
.tips li.focus .icon { color: var(--ember); }
.tips li.good .icon { color: var(--good); }
.subj-bars { display: grid; gap: 14px; }
.subj-row .score-bar { height: 10px; margin-top: 6px; }
.daybars { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.daybar { display: grid; grid-template-columns: 48px 1fr 70px; gap: 8px; align-items: center; font-size: .85rem; }
.daybar .d { color: var(--faint); font-variant-numeric: tabular-nums; }
.daybar .bar { height: 10px; border-radius: 6px; background: var(--paper); overflow: hidden; }
.daybar .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--royal), var(--aqua)); }
.daybar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.report-range { align-items: flex-end; }
.report-range .field { flex: 1 1 150px; }
.report-tools .share { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* full test plan */
.plan-total { font-size: 1.05rem; }
.plan-subject summary { cursor: pointer; list-style: none; }
.plan-subject summary::-webkit-details-marker { display: none; }
.plan-num { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.plan-num input { width: 90px; min-height: 40px; }
.plan-topics { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.plan-topic { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--paper); }
.plan-topic input { width: 80px; min-height: 38px; }

.danger-zone summary { cursor: pointer; color: var(--bad); }
.quick { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .quick { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .quick { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); } }
.dash-grid .span-2 { grid-column: 1 / -1; }
.table .num { white-space: nowrap; }
@media (min-width: 960px) { .panel-nav { overflow-y: auto; align-self: start; } }
@media (max-width: 759px) {
  .table.stack td { display: block; text-align: right; }
  .table.stack td::before { float: left; margin-right: 12px; }
  .table.stack td .actions { justify-content: flex-end; }
}
.program-mark { font-size: clamp(1.5rem, 3vw, 2rem); padding: 0 12px; text-align: center; }

/* ===================================================== v3 additions ===== */
.hero .btn.app { --bg: rgba(20, 200, 196, .16); --fg: #fff; border-color: rgba(20, 200, 196, .55); }
.hero .btn.app:hover { --bg: var(--aqua); --fg: var(--ink); box-shadow: none; }
@media (min-width: 560px) { .counts { grid-template-columns: repeat(var(--cols, 4), 1fr); } }
.feature .ico.ember { background: var(--ember-soft); color: var(--ember); }

/* contact details */
.contact-card { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.contact-card h2 { font-size: 1.1rem; margin-bottom: 6px; }
.contact-line { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; }
.contact-line:first-of-type { border-top: 0; }
.contact-line small { display: block; font-weight: 600; color: var(--faint); font-size: .78rem; }
.contact-line .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--tint); color: var(--royal); display: grid; place-items: center; flex: none; }
a.contact-line:hover { color: var(--royal); }
.footer-contact { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.footer-contact a { color: #fff; }

/* get app page */
.app-hero { display: flex; gap: 18px; align-items: center; padding: 30px 0 22px; }
.app-hero img { border-radius: 22px; box-shadow: var(--shadow-lift); }
.app-hero h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: 0 0 4px; }
.app-hero p { margin: 0; }
.steps-list { margin: 6px 0 0; padding-left: 1.2em; color: var(--muted); }
.steps-list li { margin: 4px 0; }

/* admin: website settings, referrals */
.toggle-group { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px 14px; margin: 0; }
.toggle-group legend { padding: 0 6px; }
.feature-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.feature-row:first-of-type { border-top: 0; }
.feature-preview .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--tint); color: var(--royal); display: grid; place-items: center; }
.rank-badge { width: 28px; height: 28px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); display: grid; place-items: center; font: 800 .85rem var(--font-display); color: var(--ink); flex: none; }
.ref-group summary { cursor: pointer; list-style: none; }
.ref-group summary::-webkit-details-marker { display: none; }
.ref-group[open] .chev { transform: rotate(180deg); }
.year-grid a small { display: block; font: 600 .7rem var(--font-body); opacity: .7; margin-top: 2px; }
.year-grid a { flex-direction: column; text-align: center; line-height: 1.15; padding: 6px 4px; }
.year-grid a:hover { border-color: var(--royal); }
.hub-block .big .icon { width: 44px; height: 44px; }
.footer nav { align-content: flex-start; align-self: start; }
@media (min-width: 960px) {
  .panel-shell { background: linear-gradient(90deg, var(--surface) 235px, var(--line) 235px, var(--line) 236px, transparent 236px); }
  .panel-nav { border-right: 0; background: transparent; }
}


/* ============================================================ dark mode == */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0A0F1F;
  --surface: #121A30;
  --line: #24304F;
  --line-strong: #34426A;
  --text: #E4E9F7;
  --muted: #A9B3D1;
  --faint: #7F8BAE;
  --ink: #EEF2FF;
  --royal: #5B8CFF;
  --royal-2: #7AA2FF;
  --tint: #1B2647;
  --tint-2: #1A2442;
  --tint-3: #161F3A;
  --exam-bg: #0A0F1F;
  --topbar-bg: rgba(14, 20, 40, .88);
  --good-soft: #10352B;
  --good-ink: #8EE9C4;
  --bad-soft: #3A1820;
  --bad-ink: #FFB1BA;
  --warn-soft: #3A2E12;
  --warn-ink: #F6D58E;
  --warn-line: #5A4719;
  --ember-soft: #3A2414;
  --aqua-soft: #0F3436;
  --mark-bg: #6B5A12;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 32px -18px rgba(0, 0, 0, .8);
}
:root[data-theme="dark"] body { background: var(--paper); }
/* dark navy surfaces keep their own colour, text on them stays white */
:root[data-theme="dark"] .hero, :root[data-theme="dark"] .streak-card, :root[data-theme="dark"] .footer,
:root[data-theme="dark"] .exam-bar, :root[data-theme="dark"] .auth-side, :root[data-theme="dark"] .shield { background: #070B18; }
:root[data-theme="dark"] .btn { --bg: #3E6FF0; }
:root[data-theme="dark"] .btn.ghost { --bg: var(--surface); --fg: var(--text); }
:root[data-theme="dark"] .btn.ink { --bg: #22305A; }
:root[data-theme="dark"] .btn.aqua { --bg: var(--aqua); --fg: #06122E; }
:root[data-theme="dark"] .btn.ember { --bg: var(--ember); }
:root[data-theme="dark"] .btn.danger { --bg: var(--bad-soft); --fg: var(--bad-ink); }
:root[data-theme="dark"] .hero .btn.ghost { --bg: transparent; --fg: #fff; }
:root[data-theme="dark"] .panel-nav a.active, :root[data-theme="dark"] .pills a.on, :root[data-theme="dark"] .tabs button[aria-selected="true"] { background: #3E6FF0; border-color: #3E6FF0; color: #fff; }
:root[data-theme="dark"] .avatar { background: #2A3A6B; }
:root[data-theme="dark"] .quick a.daily { background: linear-gradient(140deg, #2D5BE0, #16224A); }
:root[data-theme="dark"] .program-mark, :root[data-theme="dark"] .post-cover-blank { filter: saturate(.9) brightness(.9); }
:root[data-theme="dark"] .error-page .code-num { background: linear-gradient(120deg, #5B8CFF, var(--aqua)); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="dark"] .watermark div { color: #fff; }
:root[data-theme="dark"] img.q-img { background: #fff; }
:root[data-theme="dark"] .chart circle { fill: var(--surface); }
:root[data-theme="dark"] .brand span { color: var(--ink); }
:root[data-theme="dark"] .footer { color: #A9B3D1; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { color-scheme: dark; }
.theme-toggle .icon:last-child { display: none; }
:root[data-theme="dark"] .theme-toggle .icon:first-child { display: none; }
:root[data-theme="dark"] .theme-toggle .icon:last-child { display: block; color: #FFD25E; }
.app-cta { --bg: var(--aqua); --fg: #06122E; }
@media (max-width: 400px) { .theme-toggle { width: 38px; height: 38px; } }

/* ======================================================== get app page == */
.app-page { background: radial-gradient(70% 90% at 90% 10%, rgba(20, 200, 196, .16), transparent 60%), linear-gradient(180deg, #EAF4FF, var(--paper)); padding: 34px 0 30px; overflow: hidden; }
:root[data-theme="dark"] .app-page { background: radial-gradient(70% 90% at 90% 10%, rgba(20, 200, 196, .14), transparent 60%), linear-gradient(180deg, #0E1730, var(--paper)); }
.app-grid { display: grid; gap: 34px; align-items: center; }
.app-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--aqua-soft); border: 1px solid rgba(20, 200, 196, .45); color: var(--ink); font-size: .82rem; font-weight: 700; }
.app-page h1 { margin: 14px 0 12px; font-size: clamp(2rem, 5.6vw, 3.1rem); max-width: 16ch; }
.app-page .lede { color: var(--muted); max-width: 52ch; }
.install-card { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); max-width: 460px; }
.install-btn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--aqua); color: #06122E; text-decoration: none; transition: transform .15s var(--ease), box-shadow .2s; }
.install-btn:hover { color: #06122E; box-shadow: 0 14px 30px -14px rgba(20, 200, 196, .9); }
.install-btn:active { transform: scale(.98); }
.install-btn small { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .04em; opacity: .75; }
.install-btn strong { font: 800 1.05rem var(--font-display); }
.install-note { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; font-size: .82rem; color: var(--faint); }
.install-done { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; font-weight: 700; color: var(--good); }
.store-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.store-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: #0A1650; color: #fff; text-decoration: none; font-weight: 700; }
.store-btn small { display: block; font-size: .66rem; opacity: .75; font-weight: 600; }
.store-btn:hover { color: #fff; }
.phone-mock { justify-self: center; width: 250px; padding: 9px; border-radius: 38px; background: #0A1650; box-shadow: 0 40px 70px -30px rgba(10, 22, 80, .7); animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-8px); } }
.phone-screen { background: var(--paper); border-radius: 30px; padding: 14px 12px 18px; min-height: 420px; display: flex; flex-direction: column; gap: 10px; }
.pm-top { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .85rem; }
.pm-top strong { flex: 1; text-align: center; }
.pm-streak { display: inline-flex; align-items: center; gap: 2px; padding: 3px 8px; border-radius: 999px; background: var(--ember-soft); color: var(--ember); font-weight: 800; font-size: .75rem; }
.pm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pm-title { font: 800 .95rem var(--font-display); color: var(--ink); margin-top: 4px; }
.pm-sub { font-size: .72rem; color: var(--muted); }
.pm-btn { align-self: stretch; margin-top: 8px; text-align: center; padding: 8px; border-radius: 10px; background: var(--aqua); color: #06122E; font-weight: 800; font-size: .8rem; }
.pm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pm-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.pm-stats strong { display: block; font: 800 1rem var(--font-display); color: var(--royal); }
.pm-stats span { font-size: .68rem; color: var(--muted); }
.pm-list { display: grid; gap: 6px; margin-top: auto; }
.pm-list i { display: block; height: 10px; border-radius: 6px; background: var(--line); }
.pm-list i:nth-child(2) { width: 80%; } .pm-list i:nth-child(3) { width: 60%; }
.install-guides { display: grid; gap: 14px; margin-top: 18px; }
.guide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.guide h3 { margin: 10px 0 8px; }
.guide ol { margin: 0; padding-left: 1.2em; color: var(--muted); font-size: .93rem; }
.guide li { margin: 6px 0; }
.guide li strong { color: var(--ink); }
.guide-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--aqua-soft); color: var(--ink); display: grid; place-items: center; }
@media (min-width: 760px) { .install-guides { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .app-grid { grid-template-columns: 1.2fr .8fr; } .app-page { padding: 56px 0 50px; } .phone-mock { width: 270px; } }
@media (prefers-reduced-motion: reduce) { .phone-mock { animation: none; } }

/* =========================================== carousels (programs, blog) == */
.slide-btns { display: flex; gap: 6px; }
.slide-btns .icon-btn[disabled] { opacity: .35; cursor: default; }
[data-carousel-box].no-scroll .slide-btns { display: none; }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; padding: 2px 2px 12px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.carousel > * { flex: 0 0 82%; scroll-snap-align: start; min-width: 0; }
@media (min-width: 560px) { .carousel > * { flex-basis: calc((100% - 14px) / 2); } }
@media (min-width: 960px) { .carousel > * { flex-basis: calc((100% - 42px) / 4); } .post-grid.carousel > * { flex-basis: calc((100% - 28px) / 3); } }
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.carousel-head { align-items: flex-end; gap: 12px; }
.program-card img, .post-card img { background: var(--tint); }
.program-card > .program-mark, .post-card > .post-cover-blank { display: grid; width: 100%; aspect-ratio: 16 / 9; }

/* ==================================================== spin, approval == */
.spin-layout { display: grid; gap: 22px; align-items: start; }
.wheel-box { position: relative; max-width: 380px; margin: 0 auto; width: 100%; }
.wheel { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 30px rgba(10, 22, 80, .35)); }
.wheel-label { fill: #fff; font: 700 7.2px var(--font-body); paint-order: stroke; stroke: rgba(0, 0, 0, .25); stroke-width: 1.4px; }
.wheel-pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; z-index: 2;
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--ember); filter: drop-shadow(0 3px 3px rgba(0,0,0,.3)); }
.spin-result { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; padding: 14px; border-radius: var(--r-md); background: var(--ember-soft); animation: pop .5s var(--ease); }
.spin-result strong { font: 800 1.15rem var(--font-display); color: var(--ember); }
.swatch { width: 16px; height: 16px; border-radius: 5px; flex: none; }
@media (min-width: 860px) { .spin-layout { grid-template-columns: 1fr 1fr; } }
.approval-card { display: flex; gap: 18px; align-items: center; padding: 20px; border-radius: var(--r-lg); background: linear-gradient(120deg, #0A1650, #16307A); color: #fff; }
.approval-card h2 { color: #fff; margin: 0 0 6px; }
.approval-card p { color: #C9D4FA; margin: 0; }
.approval-card .ring .track { stroke: rgba(255, 255, 255, .15); }
.approval-card .ring .center { color: var(--aqua); }
.quick.locked > span { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px dashed var(--line-strong); color: var(--faint); font-weight: 700; }
.quick.locked .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--paper); }
.feedback-card { margin-top: 16px; }
.msg-item { padding: 10px 0; border-top: 1px solid var(--line); }
.msg-item:first-of-type { border-top: 0; padding-top: 0; }
.msg-reply { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--good-soft); color: var(--good-ink); font-size: .92rem; }
@media (max-width: 559px) { .approval-card { flex-direction: column; text-align: center; } }
.wheel { transform-origin: 50% 50%; }
.locked-list dd { margin: 0; font-weight: 700; color: var(--ink); }
.otp-input { font: 800 1.6rem var(--font-display); letter-spacing: .5em; text-align: center; }
.otp-step { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.otp-step span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--line); color: var(--muted); }
.otp-step span.on { background: var(--royal); color: #fff; }
.otp-step span.done { background: var(--good); color: #fff; }
.otp-step i { width: 40px; height: 3px; border-radius: 2px; background: var(--line); }
.otp-step i.on { background: var(--royal); }

/* ========================================================= rich editor == */
.rich { border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.rich:focus-within { border-color: var(--royal); box-shadow: 0 0 0 4px rgba(23, 71, 209, .12); }
.rich-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--tint-3); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.rb-group { display: flex; gap: 2px; padding-right: 6px; border-right: 1px solid var(--line); align-items: center; }
.rb-group:last-child { border-right: 0; }
.rb-right { margin-left: auto; }
.rich-bar button, .rich-bar .rb-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 9px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--ink); font: 600 .88rem var(--font-body); cursor: pointer; }
.rich-bar button:hover, .rich-bar .rb-btn:hover { background: var(--surface); border-color: var(--line); }
.rich-bar button.on { background: var(--ink); color: var(--surface); }
.rich-bar .rb-text { background: var(--ink); color: var(--surface); }
.rich-bar .rb-text:hover { background: var(--ink); }
.rb-insert button, .rb-insert .rb-btn { border-color: #B8E5C9; color: #1C8A4C; background: var(--surface); }
:root[data-theme="dark"] .rb-insert button, :root[data-theme="dark"] .rb-insert .rb-btn { border-color: #2C6B46; color: #7BE0A5; }
.rich-area, .rich-preview { min-height: 380px; max-height: 70vh; overflow-y: auto; padding: 22px 26px; outline: none; font-size: 1.05rem; line-height: 1.75; }
.rich-area.is-empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; display: block; font-size: 1.1rem; }
.rich-area.drop { background: var(--tint); }
.rich-area figure.selected { outline: 3px solid var(--aqua); outline-offset: 4px; border-radius: 8px; }
.rich-foot { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--faint); background: var(--tint-3); }
.img-tools { display: flex; gap: 6px; align-items: center; padding: 6px 10px; background: var(--aqua-soft); border-bottom: 1px solid var(--line); }
.img-tools button { min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; color: var(--ink); }
.danger-text { color: var(--bad) !important; }
.rich.full { position: fixed; inset: 0; z-index: 300; border-radius: 0; display: flex; flex-direction: column; }
.rich.full .rich-area, .rich.full .rich-preview { flex: 1; max-height: none; padding: 30px max(26px, calc(50vw - 380px)); }
body.editor-open { overflow: hidden; }

/* article content (editor output) */
.article figure { margin: 1.4em 0; }
.article figure img { border-radius: var(--r-md); width: 100%; height: auto; border: 1px solid var(--line); }
.article figcaption { font-size: .88rem; color: var(--muted); text-align: center; margin-top: 6px; }
.article figure.img-left, .article figure.img-right { width: 46%; max-width: 360px; margin-top: .3em; }
.article figure.img-left { float: left; margin-right: 22px; }
.article figure.img-right { float: right; margin-left: 22px; }
.article figure.video { position: relative; aspect-ratio: 16 / 9; }
.article figure.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--r-md); }
.article h2, .article hr { clear: both; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.article blockquote { margin: 1.2em 0; padding: 10px 18px; border-left: 4px solid var(--aqua); background: var(--tint-3); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--muted); font-style: italic; }
.article a { word-break: break-word; }
.article::after { content: ""; display: block; clear: both; }
@media (max-width: 559px) {
  .article figure.img-left, .article figure.img-right { float: none; width: 100%; max-width: none; margin: 1.2em 0; }
  .rich-area, .rich-preview { padding: 16px; }
  .rb-group { border-right: 0; padding-right: 0; }
  .rb-right { margin-left: 0; }
}
.prize-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.color-pick { width: 46px; height: 46px; padding: 3px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.msg-card.unread { border-left: 4px solid var(--royal); }
.nav-links a { white-space: nowrap; }
@media (min-width: 960px) and (max-width: 1279px) {
  .nav-links { margin-left: 8px; gap: 0; }
  .nav-links a { padding: 8px 9px; font-size: .9rem; }
  .app-cta span { display: none; }
  .app-cta { padding: 0 11px; }
}
:root[data-theme="dark"] .btn.app-cta { --bg: var(--aqua); --fg: #06122E; }
:root[data-theme="dark"] .hero .btn.app { --bg: rgba(20, 200, 196, .16); --fg: #fff; }
:root[data-theme="dark"] .hero .btn.app:hover { --bg: var(--aqua); --fg: #06122E; }
:root[data-theme="dark"] .nav-links a:hover, :root[data-theme="dark"] .nav-links a.active { background: var(--tint); color: var(--ink); }
.drawer .panel button.link { background: none; border: 0; font: inherit; cursor: pointer; text-align: left; padding: 14px 12px; border-radius: 12px; color: var(--ink); font-weight: 600; display: flex; gap: 12px; align-items: center; }
.drawer .panel button.link:hover { background: var(--paper); }
.article figcaption:empty { display: none; }
.rich-area figcaption:empty { display: block; min-height: 1.2em; }
.rich-area figcaption:empty::before { content: "Add a caption (optional)"; color: var(--faint); }
