/* Dark navy is the default theme; [data-theme="light"] switches to white. */
:root {
  color-scheme: dark;
  --bg: #06111f;
  --bg-2: #0c1c33;
  --surface: #0a182c;
  --navy: #0b1f3a;
  --blue: #3d7dff;
  --sky: #dce8fb;
  --heading: #ffffff;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, .76);
  --ink-3: rgba(255, 255, 255, .55);
  --line: rgba(255, 255, 255, .10);
  --input-border: rgba(255, 255, 255, .14);
  --placeholder: rgba(255, 255, 255, .3);
  --link: #9cc0ff;
  --eyebrow: #b8d0ff;
  --chip-bg: rgba(255, 255, 255, .05);
  --good: #6fe3a8;
  --warn: #ffc27a;
  --grad: linear-gradient(90deg, #ffffff 0%, #8db6ff 100%);
  --glyph-bg: #ffffff;
  --glyph-fg: #0b1f3a;
  --panel-a: #1f4b8f;
  --panel-b: #0e2546;
  --th-bg: #13315c;
  --nav-bg: rgba(16, 38, 70, .72);
  --footer-bg: #040b16;
  --aurora-1: rgba(40, 110, 255, .30);
  --aurora-2: rgba(30, 70, 140, .30);
  --aurora-3: rgba(120, 170, 255, .14);
  --grain: .045;
  --glare: rgba(255, 255, 255, .10);
  --g-bg: linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.03) 50%, rgba(255,255,255,.06) 100%);
  --g-border: rgba(255, 255, 255, .12);
  --g-blur: blur(20px) saturate(160%);
  --g-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 26px 60px -32px rgba(0,0,0,.9);
  --g-shadow-hover: inset 0 1px 0 rgba(255,255,255,.24), 0 30px 64px -28px rgba(0,0,0,.95);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 24px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f3f6fb;
  --surface: #ffffff;
  --blue: #1f5fd6;
  --heading: #0b1f3a;
  --ink: #0b1f3a;
  --ink-2: #3a4a63;
  --ink-3: #6b7a90;
  --line: #e1e7f0;
  --input-border: #d3dcea;
  --placeholder: #a7b2c3;
  --link: #1f5fd6;
  --eyebrow: #13315c;
  --chip-bg: #ffffff;
  --good: #1f8a5b;
  --warn: #b5651d;
  --grad: linear-gradient(90deg, #0b1f3a 0%, #1f5fd6 100%);
  --glyph-bg: #0b1f3a;
  --glyph-fg: #ffffff;
  --panel-a: #1d4580;
  --panel-b: #0b1f3a;
  --th-bg: #0b1f3a;
  --nav-bg: rgba(11, 31, 58, .92);
  --footer-bg: #0b1f3a;
  --aurora-1: rgba(31, 95, 214, .16);
  --aurora-2: rgba(11, 31, 58, .10);
  --aurora-3: rgba(120, 170, 255, .14);
  --grain: .02;
  --glare: rgba(31, 95, 214, .07);
  --g-bg: linear-gradient(135deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,.72) 100%);
  --g-border: rgba(11, 31, 58, .09);
  --g-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 1px 2px rgba(11,31,58,.05), 0 18px 44px -24px rgba(11,31,58,.28);
  --g-shadow-hover: 0 1px 0 #fff inset, 0 24px 50px -24px rgba(11,31,58,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  min-height: 100vh;
}
a { color: var(--link); text-underline-offset: 3px; }
::selection { background: rgba(61, 125, 255, .35); }
.wrap { width: min(920px, 100% - 32px); margin-inline: auto; }

/* ---------- atmosphere ---------- */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.aurora { position: fixed; inset: -20%; z-index: -1; pointer-events: none; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(40px); }
.aurora span:nth-child(1) { width: 60vmax; height: 60vmax; left: -22vmax; top: -30vmax; background: radial-gradient(circle, var(--aurora-1), transparent 62%); animation: drift1 30s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { width: 52vmax; height: 52vmax; right: -24vmax; top: 6vmax; background: radial-gradient(circle, var(--aurora-2), transparent 62%); animation: drift2 36s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { width: 48vmax; height: 48vmax; left: 24vmax; bottom: -30vmax; background: radial-gradient(circle, var(--aurora-3), transparent 62%); animation: drift3 42s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.1); } }
@keyframes drift2 { to { transform: translate3d(-16vmax, 12vmax, 0) scale(.92); } }
@keyframes drift3 { to { transform: translate3d(10vmax, -14vmax, 0) scale(1.06); } }

/* ---------- glass ---------- */
.card, .glass {
  position: relative;
  background: var(--g-bg);
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-border);
  border-radius: var(--radius);
  box-shadow: var(--g-shadow);
  --mx: 50%; --my: 0%;
}
.card { padding: clamp(18px, 3vw, 28px); }
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(360px circle at var(--mx) var(--my), var(--glare), transparent 60%);
  opacity: 0; transition: opacity .5s var(--ease);
}
.card:hover::before { opacity: 1; }

/* ---------- nav: floating navy capsule ---------- */
.site-header { position: sticky; top: 12px; z-index: 50; display: flex; justify-content: center; padding: 0 16px; margin-top: 12px; }
.site-header .bar {
  display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 6px 0 16px; border-radius: 999px;
  background: var(--nav-bg); border-color: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 16px 40px -18px rgba(11,31,58,.6);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.02em; text-decoration: none; color: #fff; margin-right: 10px; }
.logo-mark {
  width: 22px; height: 22px; border-radius: 7px; background: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--navy);
}
.site-header nav { display: flex; gap: 2px; }
.site-header nav a { padding: 8px 13px; border-radius: 999px; color: rgba(255,255,255,.72); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .3s, color .3s; }
.site-header nav a:hover { color: #fff; background: rgba(255,255,255,.1); }

main { padding: 48px 0 72px; }

/* ---------- type ---------- */
h1 { font-size: clamp(34px, 5.4vw, 56px); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; margin: 0 0 14px; color: var(--heading); }
h2 { font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -.02em; font-weight: 650; margin: 44px 0 14px; color: var(--heading); }
h3 { font-size: 17px; letter-spacing: -.01em; margin: 22px 0 10px; color: var(--heading); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--ink-2); font-size: clamp(17px, 1.6vw, 20px); max-width: 620px; margin: 0 0 8px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--eyebrow);
  padding: 7px 12px 7px 10px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--line);
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--link); box-shadow: 0 0 0 4px rgba(31,95,214,.15); }
.updated { color: var(--ink-3); font-size: 13px; margin: 0 0 26px; }

/* ---------- home ---------- */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: clamp(44px, 8vw, 88px); line-height: .98; letter-spacing: -.045em; max-width: 11ch; }
.hero .lede { margin-bottom: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip-bg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: block; text-decoration: none; color: var(--ink); transition: transform .5s var(--ease), box-shadow .4s, border-color .3s; }
.tile:hover { transform: translateY(-4px) rotate(-.4deg); border-color: rgba(31,95,214,.3); box-shadow: var(--g-shadow-hover); }
.tile:nth-child(even):hover { transform: translateY(-4px) rotate(.4deg); }
.tile h3 { margin: 14px 0 6px; font-size: 18px; }
.tile p { margin: 0; color: var(--ink-3); font-size: 14.5px; line-height: 1.5; }
.tile .go { display: inline-block; margin-top: 12px; color: var(--link); font-weight: 600; font-size: 14px; }
.tile .go span { display: inline-block; transition: transform .4s var(--ease); }
.tile:hover .go span { transform: translateX(5px); }
.glyph {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--glyph-fg); background: var(--glyph-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 10px 22px -12px rgba(0,0,0,.6);
}
.tile:nth-child(3n+2) .glyph { background: var(--blue); color: #fff; }
.tile:nth-child(3n) .glyph { background: var(--sky); color: var(--navy); box-shadow: inset 0 1px 0 #fff; }

/* ---------- calculator ---------- */
.calc label { display: block; font-size: 13.5px; color: var(--ink-3); margin-bottom: 6px; font-weight: 500; }
.calc input, .calc select {
  width: 100%; height: 46px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--input-border); border-radius: 14px;
  transition: border-color .25s, box-shadow .25s;
}
.calc select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.calc select option { background: var(--bg-2); color: var(--ink); }
.calc input::placeholder { color: var(--placeholder); }
.calc input:focus, .calc select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31,95,214,.14); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; gap: 10px; align-items: end; animation: rowin .45s var(--ease); }
@keyframes rowin { from { opacity: 0; transform: translateY(8px); } }
.row .remove {
  height: 46px; border-radius: 14px; cursor: pointer; font-size: 20px; line-height: 1;
  color: var(--ink-3); background: var(--bg-2); border: 1px solid var(--line);
  transition: color .2s, background .2s, transform .3s var(--ease);
}
.row .remove:hover { color: #fff; background: #d64545; transform: rotate(90deg); }
.row-head { display: grid; gap: 10px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; overflow: hidden; isolation: isolate;
  height: 46px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; color: #fff;
  background: linear-gradient(180deg, #4a87f0, var(--blue));
  border: 1px solid var(--blue);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 12px 26px -14px rgba(11,31,58,.9);
  transition: transform .4s var(--ease), box-shadow .3s;
}
.btn::before {
  content: ""; position: absolute; inset: -40% -20%; z-index: -1; pointer-events: none;
  background: linear-gradient(112deg, transparent 38%, rgba(255,255,255,.28) 50%, transparent 62%);
  transform: translateX(-70%); transition: transform 1s var(--ease);
}
.btn:hover::before { transform: translateX(70%); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn.secondary { color: var(--heading); background: var(--chip-bg); border-color: var(--input-border); box-shadow: 0 1px 2px rgba(11,31,58,.06); }
.btn.secondary::before { background: linear-gradient(112deg, transparent 38%, rgba(31,95,214,.10) 50%, transparent 62%); }

/* ---------- result: navy panel ---------- */
.result {
  margin-top: 22px; padding: 22px; border-radius: 20px; display: none; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, var(--panel-a) 0%, var(--panel-b) 55%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 22px 44px -24px rgba(11,31,58,.8);
}
.result.show { display: block; animation: pop .5s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.result p { margin: 0 0 4px; }
.result .big { font-size: clamp(40px, 6vw, 58px); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; margin: 2px 0 6px; color: #fff; }
.result td.big { font-size: clamp(30px, 4.5vw, 42px); }
.result .big.good { color: #8ff0bf; }
.result .big.warn { color: #ffcc8a; }
.result .sub { color: rgba(255,255,255,.72); font-size: 14.5px; }
.result table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
.result td, .result th { text-align: left; padding: 9px 4px; border-top: 1px solid rgba(255,255,255,.14); font-weight: 500; }
.result th { color: rgba(255,255,255,.66); font-weight: 500; }
.result ul { margin: 8px 0 0; padding-left: 20px; color: rgba(255,255,255,.82); }
.result .good { color: #8ff0bf; }
.result .warn { color: #ffcc8a; }
.good { color: var(--good); }
.warn { color: var(--warn); }
.result.celebrate { animation: pop .5s var(--ease), glow 1.6s var(--ease); }
@keyframes glow { 30% { box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 0 0 6px rgba(31,95,214,.16), 0 0 60px rgba(31,95,214,.35); } }
.spark { position: fixed; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; z-index: 80; animation: spark 1.1s var(--ease) forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

.next-step { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.next-step p { margin: 0; flex: 1 1 260px; color: var(--ink-2); }
.ad-slot { min-height: 100px; margin: 22px 0; }

/* ---------- long-form ---------- */
.explain, .prose { max-width: 720px; color: var(--ink-2); }
.explain strong, .prose strong { color: var(--heading); }
.explain table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.explain td, .explain th { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.explain tr:last-child td { border-bottom: 0; }
.explain th { color: #fff; background: var(--th-bg); font-weight: 600; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--heading); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--blue); font-size: 22px; line-height: 1; transition: transform .4s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { margin: 10px 0 0; color: var(--ink-2); }
.related ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-block; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip-bg); color: var(--heading); text-decoration: none; font-size: 14.5px; font-weight: 500; transition: border-color .3s, background .3s, color .3s; }
.related a:hover { border-color: var(--blue); background: var(--blue); color: #fff; }

.site-footer { padding: 30px 0 40px; font-size: 14px; color: rgba(255,255,255,.6); background: var(--footer-bg); }
.site-footer a { color: #fff; }
.site-footer .fine { font-size: 12.5px; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  main { padding-top: 30px; }
  .site-header .bar { padding-left: 14px; }
  .site-header nav a { padding: 8px 9px; font-size: 13.5px; }
  .row-head { display: none; }
  .row { display: flex; flex-wrap: wrap; padding: 12px; border-radius: 18px; background: var(--chip-bg); border: 1px solid var(--line); }
  .row > * { flex: 1 1 0; min-width: 0; }
  .row > input[type="text"], .row > .exam { flex-basis: 100%; }
  .row > .level { flex-grow: 1.7; }
  .row .remove { flex: 0 0 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ---------- theme toggle ---------- */
.theme-toggle {
  width: 40px; height: 40px; margin-left: 4px; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.08);
  transition: background .3s, transform .5s var(--ease);
}
.theme-toggle:hover { background: rgba(255,255,255,.16); transform: rotate(20deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
.disclosure { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
