/*
  chemwithvikee styles, v3 "lab bench".
  Built from the chemwithvikee logo (navy, orange, slate) with UI UX Pro Max education guidance.
  Layout: a full-width navy hero band, then light content; chapters are periodic-table tiles,
  each with its own colour (set per chapter in js/main.js, CHAPTER_STYLE).
  Theme: light by default; class="dark" on <html> switches to dark (set by the head script / toggle).
*/
:root {
  --navy: #13233a;
  --navy-2: #1c3352;
  --navy-3: #0c1828;
  --orange: #ff7a3d;          /* fills; navy text on it is 6:1 */
  --orange-2: #ff9a66;
  --orange-ink: #c2410c;      /* orange text on light surfaces, 5.2:1 */
  --orange-soft: #fff1e8;
  --slate: #9fb3c8;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #13233a;
  --muted: #556479;
  --line: #dde4ee;
  --good: #15803d;
  --good-bg: #e8f6ee;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  --focus: #2563eb;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(19, 35, 58, .06), 0 2px 8px rgba(19, 35, 58, .05);
  --shadow: 0 2px 4px rgba(19, 35, 58, .05), 0 12px 32px -12px rgba(19, 35, 58, .18);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
.dark {
  --orange-ink: #ff9a66;
  --orange-soft: #3a2416;
  --bg: #0d1726;
  --surface: #14223a;
  --surface-2: #1b2c48;
  --text: #e8eef6;
  --muted: #a9b8cb;
  --line: #263a5a;
  --good: #4ade80;
  --good-bg: #12301f;
  --bad: #f87171;
  --bad-bg: #3a1717;
  --focus: #7aa7ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 14px 32px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.65; font-size: 1rem; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--orange-ink); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: 20px; }
@media (min-width: 640px) { .wrap { padding-inline: 32px; } }
.mono { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 16px; background: var(--orange); color: var(--navy); border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
a, button, input, select, textarea, label { touch-action: manipulation; }

/* highlighted phrase: orange underline swash */
.hl { color: inherit; font-weight: 700; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--orange) 45%, transparent) 62%); padding: 0 .1em; }

/* ---------- header (sits on the navy band) ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--navy); color: #fff; transition: box-shadow .25s; }
.site-header.scrolled { box-shadow: 0 8px 24px -12px rgba(0, 0, 0, .45); }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.logo svg { width: 34px; height: 34px; flex: none; }
.wordmark { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; }
.wordmark .w { color: var(--slate); }
.wordmark .v { color: var(--orange); }
.header-right { display: flex; align-items: center; gap: 6px; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: #d5deea; text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 14px; border-radius: 999px; transition: background .2s, color .2s; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav a.active { background: var(--orange); color: var(--navy); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; transition: background .2s; }
.icon-btn:hover { background: rgba(255, 255, 255, .16); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  .nav { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 8px 16px 16px; background: var(--navy); display: none; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .5); }
  .nav.open { display: flex; }
  .nav a { border-radius: var(--radius-sm); padding: 12px 14px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 2px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease), box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active:not([disabled]) { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
/* primary action: orange */
.btn-solid { background: var(--orange); color: var(--navy); box-shadow: 0 8px 20px -10px rgba(255, 122, 61, .9); }
.btn-solid:hover { background: var(--orange-2); color: var(--navy); }
/* secondary: outline */
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-outline:hover { border-color: var(--text); }
.on-navy .btn-outline, .hero .btn-outline, .page-hero .btn-outline, .cta-band .btn-outline { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.on-navy .btn-outline:hover, .hero .btn-outline:hover, .cta-band .btn-outline:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }
/* on cards: navy */
.btn-soft { background: var(--navy); color: #fff; }
.btn-soft:hover { background: var(--navy-2); color: #fff; }
.dark .btn-soft { background: var(--orange); color: var(--navy); }
.btn-muted { background: var(--surface-2); color: var(--text); }
.btn-muted:hover { background: var(--line); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- periodic tile (chapter badge) ---------- */
.tile {
  --t: var(--navy);
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 12px;
  background: color-mix(in srgb, var(--t) 12%, var(--surface)); border: 2px solid color-mix(in srgb, var(--t) 55%, transparent);
  color: color-mix(in srgb, var(--t) 80%, var(--text));
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; line-height: 1;
}
.tile small { position: absolute; top: 4px; left: 6px; font-size: .62rem; font-weight: 700; font-family: var(--mono); opacity: .85; }
.tile-lg { width: 76px; height: 76px; border-radius: 16px; font-size: 1.7rem; }
.tile-lg small { font-size: .72rem; top: 6px; left: 8px; }
.dark .tile { color: color-mix(in srgb, var(--t) 45%, var(--text)); }

/* ---------- hero (home) ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(700px 400px at 85% 10%, rgba(255, 122, 61, .22), transparent 65%), radial-gradient(600px 400px at 0% 100%, rgba(122, 167, 255, .16), transparent 60%), var(--navy); }
.hero::before { /* faint periodic-table grid */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%); mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
.hero .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; padding-block: 56px 120px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); font-size: .88rem; font-weight: 600; color: #d5deea; width: fit-content; }
.hero-badge i { width: 10px; height: 10px; margin-left: 6px; border-radius: 999px; background: var(--orange); box-shadow: 0 0 0 4px rgba(255, 122, 61, .25); }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.9rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin: 18px 0 16px; }
.hero h1 em { font-style: normal; color: var(--orange); }
.hero .lead { font-size: clamp(1.02rem, 1.6vw, 1.18rem); color: #c9d5e3; max-width: 34em; margin: 0 0 28px; }
.hero .lead .hl { color: #fff; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-art { position: relative; }
.hero-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .35)); }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; padding-block: 36px 104px; gap: 24px; }
  .hero-art { max-width: 340px; margin-inline: auto; order: -1; }
}
.bubble { animation: rise 3.2s ease-in infinite; }
.bubble:nth-of-type(2) { animation-delay: 1.1s; }
.bubble:nth-of-type(3) { animation-delay: 2.1s; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-70px); opacity: 0; } }
.float { animation: float 6s ease-in-out infinite; }
.float.f2 { animation-delay: -2s; }
.float.f3 { animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* stat cards overlapping the hero edge */
.stat-strip { position: relative; z-index: 2; margin-top: -64px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat-strip > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; display: flex; align-items: center; gap: 14px; }
.stat-strip .s-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--orange-soft); color: var(--orange-ink); }
.stat-strip .s-ico svg { width: 24px; height: 24px; }
.stat-strip b { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-strip span { color: var(--muted); font-size: .92rem; }
@media (max-width: 700px) { .stat-strip { grid-template-columns: 1fr; gap: 10px; } .stat-strip > div { padding: 14px 18px; } }

/* ---------- sections ---------- */
.section { padding-block: 72px 0; }
.section:last-of-type { padding-bottom: 80px; }
.section-head { margin-bottom: 28px; max-width: 46rem; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 8px; }
.section-head h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); font-weight: 800; }
.section-head p { color: var(--muted); font-size: 1.05rem; margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }

/* class panels with chapter tiles */
.class-card { display: flex; flex-direction: column; gap: 16px; padding: 0; overflow: hidden; }
.class-card .cc-head { padding: 22px 24px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--navy-2)); position: relative; }
.class-card .cc-head::after { content: attr(data-big); position: absolute; right: 18px; bottom: -18px; font-size: 5.5rem; font-weight: 800; letter-spacing: -0.05em; color: rgba(255, 255, 255, .07); line-height: 1; }
.class-card.matric .cc-head { background: linear-gradient(135deg, #c2410c, #ff7a3d); }
.class-card .cc-head .chip { background: rgba(255, 255, 255, .14); color: #fff; }
.class-card h3 { font-size: 1.45rem; font-weight: 800; margin: 10px 0 0; }
.chapter-list { list-style: none; margin: 0; padding: 0 16px; display: grid; gap: 6px; }
.chapter-list a { display: flex; align-items: center; gap: 14px; padding: 8px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; transition: background .2s; }
.chapter-list a:hover { background: var(--surface-2); }
.chapter-list .tile { width: 44px; height: 44px; font-size: 1rem; }
.chapter-list .arrow { margin-left: auto; color: var(--muted); opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .2s; }
.chapter-list a:hover .arrow, .chapter-list a:focus-visible .arrow { opacity: 1; transform: none; }
.class-card .actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 24px 24px; margin-top: auto; }

/* how it works: numbered steps */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { position: relative; padding: 28px 24px 24px; }
.step .num { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; background: var(--orange); color: var(--navy); font-weight: 800; font-size: 1.1rem; margin-bottom: 14px; box-shadow: 0 0 0 6px var(--orange-soft); }
.step h3 { font-size: 1.15rem; font-weight: 800; }
.step p { color: var(--muted); margin: 0; }

/* call to action band */
.cta-band { margin-top: 72px; border-radius: 24px; padding: 40px; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; background: radial-gradient(400px 240px at 100% 0, rgba(255, 122, 61, .35), transparent 70%), linear-gradient(135deg, var(--navy), var(--navy-2)); }
.cta-band h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin: 0 0 6px; }
.cta-band p { color: #c9d5e3; margin: 0; }
.cta-band .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, label.lbl { font-weight: 700; font-size: .9rem; }
.req { color: var(--muted); font-weight: 500; }
.input { width: 100%; min-width: 0; min-height: 46px; padding: 0 14px; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); outline: none; transition: border-color .2s, box-shadow .2s; }
textarea.input { min-height: 130px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--orange-ink); }
.form-status { margin: 12px 0 0; font-size: .92rem; color: var(--muted); }

/* segmented control */
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--surface-2); }
.seg button { flex: 1; min-height: 40px; font: inherit; font-size: .9rem; font-weight: 700; border: 0; border-radius: 999px; background: transparent; color: var(--muted); padding: 0 16px; cursor: pointer; transition: background .2s, color .2s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-list { display: grid; gap: 12px; }
.contact-item { display: flex; gap: 14px; align-items: center; padding: 16px 18px; text-decoration: none; color: var(--text); transition: transform .2s var(--ease), box-shadow .2s; }
a.contact-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.contact-item .ci-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--orange-soft); color: var(--orange-ink); }
.contact-item .ci-icon svg { width: 22px; height: 22px; }
.contact-item small { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.contact-item span { font-weight: 700; word-break: break-word; }
.contact-item .note { font-weight: 500; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { margin-top: 80px; background: var(--navy-3); color: var(--slate); padding-block: 44px; font-size: .92rem; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.site-footer .logo { color: #fff; }
.site-footer .tagline { margin: 12px 0 0; max-width: 24rem; }
.site-footer nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer nav a { color: #d5deea; text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.site-footer nav a:hover { color: var(--orange); }
.site-footer p { margin: 0; }

/* ---------- inner page hero ---------- */
.page-hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(520px 280px at 90% 0%, rgba(255, 122, 61, .25), transparent 70%), var(--navy); }
.page-hero::before { content: ""; position: absolute; inset: 0; opacity: .06; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000); }
.page-hero .wrap { position: relative; padding-block: 36px 44px; }
.page-hero h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; margin: 6px 0 8px; }
.page-hero p { color: #c9d5e3; margin: 0; max-width: 40rem; font-size: 1.05rem; }
.page-hero .eyebrow { color: var(--orange); }
.page-hero .hl { color: #fff; }

/* ---------- notes ---------- */
.notes-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; padding-block: 28px 0; align-items: start; }
@media (max-width: 900px) { .notes-layout { grid-template-columns: 1fr; } }
.ch-nav { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow: auto; padding: 16px; display: grid; gap: 12px; }
@media (max-width: 900px) { .ch-nav { position: static; max-height: none; } }
.ch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ch-list button { width: 100%; min-height: 48px; text-align: left; font: inherit; font-size: .93rem; font-weight: 600; border: 0; background: transparent; color: var(--text); padding: 6px 8px; border-radius: 12px; cursor: pointer; display: flex; gap: 12px; align-items: center; transition: background .2s; }
.ch-list button:hover { background: var(--surface-2); }
.ch-list button.on { background: color-mix(in srgb, var(--t, var(--orange)) 12%, var(--surface)); box-shadow: inset 3px 0 0 var(--t, var(--orange)); }
.ch-list .tile { width: 38px; height: 38px; font-size: .9rem; border-radius: 10px; }
.ch-list .tile small { font-size: .52rem; top: 2px; left: 4px; }
.ch-list .num { display: none; }
.empty { color: var(--muted); font-size: .92rem; }

.note { padding: 0; overflow: hidden; }
.note-top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; flex-wrap: wrap; padding: 28px 32px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--t, var(--orange)) 10%, var(--surface)), var(--surface)); }
.note-top .nt-main { display: flex; gap: 18px; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.note-top h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin: 2px 0 6px; }
.note-top p { color: var(--muted); margin: 0; }
.note-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note-body { padding: 8px 32px 32px; }
@media (max-width: 640px) { .note-top { padding: 20px; } .note-body { padding: 4px 20px 24px; } }
.note h3 { font-size: 1.2rem; font-weight: 800; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
.note h3::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--t, var(--orange)); flex: none; transform: rotate(45deg); }
.note ul { padding-left: 1.25em; margin: 0; }
.note li { margin: 7px 0; }
.note li::marker { color: var(--t, var(--orange)); }
.defs { display: grid; gap: 10px; }
.def { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; border-left: 4px solid color-mix(in srgb, var(--t, var(--orange)) 70%, transparent); }
.def b { display: block; margin-bottom: 2px; }
.eq-list { display: grid; gap: 8px; }
.eq-list + ul, ul + .eq-list, .defs + ul, ul + .table-wrap, .eq-list + .table-wrap { margin-top: 12px; }
.eq { font-family: var(--mono); font-size: .9rem; background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px; overflow-x: auto; white-space: nowrap; }
.dark .eq { background: #0a1322; border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.solved { border: 2px dashed color-mix(in srgb, var(--orange) 55%, transparent); border-radius: 14px; padding: 16px 18px; margin: 12px 0; background: var(--orange-soft); }
.solved .q { font-weight: 700; margin-bottom: 6px; }
.tip { border-radius: 14px; padding: 16px 18px 16px 52px; margin-top: 28px; position: relative; background: var(--navy); color: #e8eef6; }
.tip::before { content: "!"; position: absolute; left: 16px; top: 15px; width: 24px; height: 24px; border-radius: 999px; background: var(--orange); color: var(--navy); font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.tip .hl { color: #fff; }
.note-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.note-foot .btn { white-space: normal; text-align: left; height: auto; padding-block: 10px; }

/* ---------- quiz ---------- */
.quiz-shell { padding-block: 28px 0; }
.setup { max-width: 780px; margin: 0 auto; }
.setup h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: 18px; }
.setup .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 560px) { .setup .row { grid-template-columns: 1fr; } }
.setup .row > div { display: grid; gap: 6px; }
.setup .hint { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.history { max-width: 780px; margin: 28px auto 0; }
.history h3 { font-size: 1.05rem; font-weight: 800; }
.history ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: .92rem; }
.history li small { color: var(--muted); }
.history li .score { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }

.quiz { max-width: 840px; margin: 0 auto; }
.quiz-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.timer { font-family: var(--mono); font-weight: 700; font-size: .9rem; background: var(--surface); border: 1.5px solid var(--line); padding: 6px 14px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); border-radius: 999px; transition: width .3s var(--ease); }
.q-card { padding: 28px; }
@media (max-width: 560px) { .q-card { padding: 18px; } }
.q-meta { display: inline-block; margin-bottom: 10px; padding: 3px 10px; border-radius: 999px; background: var(--orange-soft); color: var(--orange-ink); font-weight: 700; }
.q-text { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; line-height: 1.45; }
.options { display: grid; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: center; width: 100%; min-height: 54px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; cursor: pointer; transition: border-color .2s, background .2s, transform .15s var(--ease); }
.opt:hover:not([disabled]) { border-color: color-mix(in srgb, var(--navy) 40%, var(--line)); transform: translateX(2px); }
.dark .opt:hover:not([disabled]) { border-color: var(--slate); }
.opt:active:not([disabled]) { transform: scale(.99); }
.opt .key { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.opt.sel { border-color: var(--navy); background: color-mix(in srgb, var(--navy) 6%, var(--surface)); }
.opt.sel .key { background: var(--navy); color: #fff; }
.dark .opt.sel { border-color: var(--orange); background: var(--orange-soft); }
.dark .opt.sel .key { background: var(--orange); color: var(--navy); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.right .key { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.dark .opt.right .key, .dark .opt.wrong .key { color: #0d1726; }
.opt[disabled] { cursor: default; }
.opt .opt-note { margin-left: auto; padding-left: 10px; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.opt.right .opt-note { color: var(--good); }
.opt.wrong .opt-note { color: var(--bad); }
.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.q-nav > div { display: flex; gap: 10px; flex-wrap: wrap; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.palette button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; }
.palette button.done { background: var(--navy); border-color: var(--navy); color: #fff; }
.dark .palette button.done { background: var(--slate); border-color: var(--slate); color: var(--navy); }
.palette button.cur { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.kbd-hint { margin: 16px 0 0; font-size: .85rem; color: var(--muted); }
.kbd-hint kbd { font-family: var(--mono); font-size: .78rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--surface-2); }

.result-hero { text-align: center; padding: 36px 24px; position: relative; overflow: hidden; }
.result-hero.great { background: radial-gradient(400px 200px at 50% 0, color-mix(in srgb, var(--orange) 18%, transparent), transparent 70%), var(--surface); }
.ring { width: 160px; height: 160px; margin: 0 auto 16px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring svg circle:last-child { transition: stroke-dashoffset 1s var(--ease); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.3rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.result-hero h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.result-hero h2:focus { outline: none; }
.result-hero p { color: var(--muted); margin: 0; }
.grade-pill { display: inline-block; margin-top: 10px; padding: 4px 14px; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 800; }
.dark .grade-pill { background: var(--orange); color: var(--navy); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface-2); border-radius: 14px; padding: 14px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.good { background: var(--good-bg); } .stat.good b { color: var(--good); }
.stat.bad { background: var(--bad-bg); } .stat.bad b { color: var(--bad); }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.time-up { color: var(--bad); font-weight: 700; margin: 0 0 8px; }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; gap: 12px; flex-wrap: wrap; }
.review-head h3 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.review { margin-top: 14px; display: grid; gap: 14px; }
.review-item { padding: 20px; }
.review-item .top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.review-item .q-text { font-size: 1.02rem; margin-bottom: 12px; }
.review-item .opt { min-height: 46px; cursor: default; }
.review-item .opt:hover { transform: none; }
.explain { margin-top: 12px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: .93rem; color: var(--muted); }
.explain b { color: var(--text); }
.badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.no { background: var(--bad-bg); color: var(--bad); }
.badge.skip { background: var(--surface-2); color: var(--muted); }

/* confetti for scores of 80% and above */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: 0; animation: drop 1.8s ease-in forwards; }
@keyframes drop { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(320px) rotate(540deg); } }

/* ---------- scroll reveal (JS adds .reveal only when motion is allowed) ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- touch screens: 44px targets ---------- */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .nav a { min-height: 44px; display: flex; align-items: center; }
  .seg button { min-height: 44px; }
  .site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .ch-nav, .note-actions, .note-foot, .page-hero { display: none !important; }
  .notes-layout { display: block; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .note-top { background: none; }
  .eq, .tip { background: #fff; color: #000; border: 1px solid #999; }
}

/* =========================================================
   Numericals
   ========================================================= */
/* the 4-step method strip */
.method { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .method { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .method { grid-template-columns: 1fr; } }
.method li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.method b { width: 32px; height: 32px; flex: none; border-radius: 999px; display: grid; place-items: center; background: var(--orange); color: var(--navy); font-weight: 800; }
.method span { font-size: .88rem; color: var(--muted); line-height: 1.45; }
.method strong { display: block; color: var(--text); font-size: .95rem; }

.ch-list .num-sub { display: block; font-size: .76rem; font-weight: 600; color: var(--muted); }
.sub-lead { color: var(--muted); margin: -4px 0 14px; font-size: .95rem; }
.practice-score { margin-left: auto; font-size: .82rem; font-weight: 800; padding: 3px 12px; border-radius: 999px; background: var(--good-bg); color: var(--good); }

/* formula sheet */
.formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.formula { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-top: 3px solid var(--t, var(--orange)); display: grid; gap: 4px; }
.formula span { font-size: .85rem; font-weight: 700; color: var(--muted); }
.formula code { font-family: var(--mono); font-size: .92rem; color: var(--text); white-space: normal; }

/* worked examples */
.worked-list, .practice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.worked, .practice { border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; background: var(--surface); }
.wq { font-weight: 700; font-size: 1.02rem; margin: 0 0 12px; line-height: 1.5; }
.qno { display: inline-block; margin-right: 10px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; background: color-mix(in srgb, var(--t, var(--orange)) 14%, var(--surface)); color: color-mix(in srgb, var(--t, var(--orange)) 80%, var(--text)); vertical-align: 2px; }
.dark .qno { color: color-mix(in srgb, var(--t, var(--orange)) 45%, var(--text)); }
.gf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (max-width: 560px) { .gf { grid-template-columns: 1fr; } }
.gf > div { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: .93rem; }
.gf b { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.gf ul { margin: 0; padding-left: 1.1em; }
.gf li { margin: 2px 0; }
.wsteps { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
.wsteps li { counter-increment: s; position: relative; padding: 10px 14px 10px 46px; border-radius: 12px; background: color-mix(in srgb, var(--t, var(--orange)) 6%, var(--surface)); border: 1px solid color-mix(in srgb, var(--t, var(--orange)) 22%, var(--line)); animation: stepIn .3s var(--ease); }
.wsteps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--t, var(--orange)); color: #fff; }
@keyframes stepIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.answer-box { padding: 12px 16px; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 700; margin-bottom: 12px; animation: stepIn .3s var(--ease); }
.answer-box span { display: inline-block; margin-right: 10px; padding: 2px 10px; border-radius: 999px; background: var(--orange); color: var(--navy); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.answer-box:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.dark .answer-box { background: #0a1322; border: 1px solid var(--line); }
.w-actions, .p-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* practice */
.practice.is-done { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.practice.is-done .qno { background: var(--good-bg); color: var(--good); }
.ans-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ans-row .input { flex: 1 1 180px; max-width: 260px; font-family: var(--mono); }
.ans-row .unit { font-weight: 700; color: var(--muted); min-width: 2ch; }
.feedback { margin: 10px 0 6px; font-weight: 700; font-size: .93rem; min-height: 1.4em; }
.feedback.ok { color: var(--good); }
.feedback.ok::before { content: "✓ "; }
.feedback.no { color: var(--bad); }
.hint, .solution { margin: 8px 0 0; padding: 10px 14px; border-radius: 12px; font-size: .93rem; }
.hint { background: var(--orange-soft); border-left: 4px solid var(--orange); }
.solution { background: var(--surface-2); border-left: 4px solid var(--t, var(--orange)); }

/* home page band */
.num-band { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding: 32px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.num-band::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: linear-gradient(var(--orange), #2563eb); }
@media (max-width: 860px) { .num-band { grid-template-columns: 1fr; padding: 24px; } }
.num-band h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.num-band p { color: var(--muted); margin: 0 0 20px; }
.num-chapters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 480px) { .num-chapters { grid-template-columns: 1fr; } }
.num-chapters a { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; text-decoration: none; color: var(--text); transition: background .2s; }
.num-chapters a:hover { background: var(--surface-2); }
.num-chapters .tile { width: 42px; height: 42px; font-size: .95rem; }
.num-chapters b { display: block; font-size: .92rem; line-height: 1.3; }
.num-chapters small { color: var(--muted); font-size: .8rem; }

@media print { .method, .w-actions, .p-actions, .ans-row, .feedback { display: none !important; } .wsteps li, .answer-box, .solution { display: block !important; } }

/* ---------- HSC additions ---------- */
.hsc-tag { margin-left: 2px; padding: 3px 8px; border-radius: 999px; background: var(--orange); color: var(--navy); font-size: .72rem; font-weight: 800; letter-spacing: .06em; line-height: 1; }
.nav a.nav-ext { border: 1.5px solid rgba(255, 255, 255, .22); }
.nav a.nav-ext:hover { border-color: var(--orange); }
.site-footer .tagline a { color: var(--orange-2); }
/* long HSC equations wrap instead of scrolling sideways on phones */
.eq { white-space: normal; overflow-wrap: anywhere; }
