/*
  chemwithvikee styles, built on ChaiUI (https://ui.chaicode.com).
  Plain-CSS port of the ChaiUI tokens and recipes: dark by default (class="dark" on <html>),
  near-black neutrals, one cream highlight, warm hairline cards with no shadow,
  asymmetric buttons, and orange only in the logo, link hovers and hairlines.
*/
:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --brand: oklch(66.6% 0.179 58.318);

  --highlight: oklch(0.476 0.114 61.907);      /* yellow-800 */
  --card-edge: rgb(120 53 15 / 0.15);          /* amber-900/15 */
  --card-edge-hover: rgb(120 53 15 / 0.3);
  --card-fill: rgb(255 255 255 / 0.7);

  --lead: #404040;                             /* neutral-700 */
  --subtle: #4b5563;                           /* gray-600 */
  --hairline: #e5e7eb;                         /* gray-200 */
  --glass: #ffffff;
  --solid-bg: #171717;
  --solid-fg: #ffffff;
  --solid-hover: rgb(0 0 0 / 0.9);
  --outline-hover: #f5f5f5;
  --muted-btn-bg: #d4d4d866;
  --muted-btn-fg: #52525b;
  --seg-on-bg: #ffedd5;                        /* orange-100 */
  --seg-on-fg: #7c2d12;                        /* orange-900 */
  --badge-bg: #fafafa;
  --badge-fg: #262626;
  --footer-line: #d97706;                      /* amber-600, used at 10% */
  --good: #15803d;
  --bad: #b91c1c;
  --warn: #a16207;

  --font-sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-brand: "Onest", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --brand: oklch(75% 0.183 55.934);

  --highlight: oklch(0.954 0.038 75.164);      /* orange-100 */
  --card-edge: rgb(255 247 237 / 0.15);        /* orange-50/15 */
  --card-edge-hover: rgb(255 247 237 / 0.3);
  --card-fill: rgb(0 0 0 / 0.1);

  --lead: #a3a3a3;                             /* neutral-400 */
  --subtle: #d1d5db;                           /* gray-300 */
  --hairline: #374151;                         /* gray-700 */
  --glass: rgb(0 0 0 / 0.5);
  --solid-bg: #ffffff;
  --solid-fg: #000000;
  --solid-hover: #e5e5e5;
  --outline-hover: rgb(0 0 0 / 0.9);
  --muted-btn-bg: #71717a33;
  --muted-btn-fg: #d4d4d8;
  --seg-on-bg: rgb(124 45 18 / 0.4);           /* orange-900/40 */
  --seg-on-fg: #ffedd5;
  --badge-bg: #1c1917;                         /* stone-900 */
  --badge-fg: #f5f5f5;
  --footer-line: #fdba74;                      /* orange-300, used at 10% */
  --good: #4ade80;
  --bad: #f87171;
  --warn: #facc15;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
:focus-visible { outline: 3px solid color-mix(in oklch, var(--ring) 50%, transparent); outline-offset: 2px; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: 24px; }
@media (min-width: 640px) { .wrap { padding-inline: 48px; } }
.mono { font-family: var(--font-mono); font-size: .8rem; color: var(--muted-foreground); }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* the cream highlight phrase: one per paragraph */
.hl {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  text-transform: capitalize;
  color: var(--highlight);
}

/* ---------- page shell + backdrop ---------- */
.page { position: relative; isolation: isolate; overflow-x: clip; min-height: 100vh; display: flex; flex-direction: column; }
.page > main { flex: 1; }
.chai-backdrop {
  position: absolute; top: 0; left: 50%;
  width: 2842px; max-width: none;
  transform: translateX(-50%);
  z-index: -10; pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
:root:not(.dark) .chai-backdrop { filter: invert(1) hue-rotate(180deg); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: transparent;
  transition: background .3s, backdrop-filter .3s;
}
.site-header.scrolled {
  background: color-mix(in oklch, var(--background) 60%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 20px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--foreground); }
.logo:hover { color: var(--foreground); }
.logo svg { width: 32px; height: 32px; flex: none; }
.wordmark { font-family: var(--font-brand); font-size: 1.25rem; font-weight: 500; letter-spacing: -0.025em; }
.wordmark .w { color: var(--muted-foreground); }
.wordmark .v { color: var(--brand); }
.header-right { display: flex; align-items: center; gap: 4px; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: var(--muted-foreground); text-decoration: none; font-weight: 500; font-size: .95rem;
  padding: 8px 12px; transition: color .2s;
}
.nav a:hover { color: var(--brand); }
.nav a.active { color: var(--foreground); }
.icon-btn {
  display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--foreground); border-radius: calc(var(--radius) - 2px);
  cursor: pointer; transition: color .2s;
}
.icon-btn:hover { color: var(--brand); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .nav {
    position: absolute; top: 72px; left: 16px; right: 16px; flex-direction: column; align-items: stretch;
    padding: 8px; display: none;
    border: 1px solid var(--card-edge); border-radius: var(--radius);
    background: color-mix(in oklch, var(--background) 85%, transparent);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  .nav.open { display: flex; }
  .nav a { padding: 8px 12px; font-size: 1rem; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border: 1px solid transparent;
  font: inherit; font-size: .875rem; font-weight: 500; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, opacity .2s;
}
.btn svg { width: 16px; height: 16px; margin-left: -4px; flex: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
/* the one main action on a screen */
.btn-solid { border-radius: 0 var(--radius) 0 var(--radius); background: var(--solid-bg); color: var(--solid-fg); }
.btn-solid:hover { background: var(--solid-hover); color: var(--solid-fg); }
/* beside it: mirrored corners */
.btn-outline { border-radius: var(--radius) 0 var(--radius) 0; border-color: var(--border); background: transparent; color: var(--foreground); }
.btn-outline:hover { background: var(--outline-hover); color: var(--foreground); }
/* on cards: the shadcn default */
.btn-soft {
  height: 32px; min-width: 96px; padding: 0 12px; border-radius: calc(var(--radius) - 2px);
  background: var(--primary); color: var(--primary-foreground);
  font-family: var(--font-display); font-weight: 600;
}
.btn-soft:hover { opacity: .9; color: var(--primary-foreground); }
.btn-muted {
  height: 32px; padding: 0 14px; border-radius: calc(var(--radius) - 2px);
  background: var(--muted-btn-bg); color: var(--muted-btn-fg); font-family: var(--font-display);
}
.btn-muted:hover { color: var(--foreground); }
.btn-ghost { border-radius: calc(var(--radius) - 2px); background: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }

/* ---------- animated badge (orange glint on the border only) ---------- */
.chai-badge { position: relative; display: inline-flex; width: fit-content; overflow: hidden; border-radius: 999px; padding: 1px; }
.chai-badge::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 300px; height: 20px; border-radius: 999px;
  background: linear-gradient(to right, transparent, transparent, #f97316);
  transform: translate(-50%, -50%);
  animation: chai-spin 4s linear infinite;
}
.chai-badge span {
  position: relative; z-index: 1; border-radius: 999px; padding: 8px 16px;
  background: var(--badge-bg); color: var(--badge-fg); font-size: .875rem; font-weight: 500;
}
@keyframes chai-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- hero (one central element) ---------- */
.hero { display: flex; gap: 32px; padding-block: 40px 24px; }
.hero-text { display: flex; flex-direction: column; gap: 16px; margin-block: auto; flex: 3; min-width: 0; }
.hero h1 { font-size: 42px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
@media (min-width: 768px) { .hero h1 { font-size: 3.75rem; } }
@media (min-width: 1024px) { .hero h1 { font-size: 4.5rem; } }
.hero .lead { margin: 8px 0 0; max-width: 48rem; font-size: 1rem; color: var(--lead); }
@media (min-width: 768px) { .hero .lead { font-size: 1.25rem; } }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }
.hero-media {
  flex: 2; display: grid; place-items: center; min-width: 0;
  -webkit-mask-image: radial-gradient(60% 60%, #000 70%, transparent);
  mask-image: radial-gradient(60% 60%, #000 70%, transparent);
}
.hero-media svg { width: min(320px, 100%); height: auto; }
@media (max-width: 767px) {
  .hero { flex-direction: column; padding-top: 16px; }
  .hero-media { order: -1; }
  .hero-media svg { width: 140px; }
}

/* ---------- stat strip ---------- */
.stat-strip { display: flex; flex-wrap: wrap; gap: 0; margin-top: 40px; border-block: 1px solid var(--card-edge); }
.stat-strip div { flex: 1 1 140px; padding: 20px 8px; text-align: center; }
.stat-strip div + div { border-left: 1px solid var(--card-edge); }
.stat-strip b { display: block; font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.stat-strip span { color: var(--muted-foreground); font-size: .9rem; }

/* ---------- section heads ---------- */
.section { padding-block: 64px 0; }
@media (min-width: 640px) { .section { padding-top: 80px; } }
.section:last-child { padding-bottom: 80px; }
.section-head { margin-bottom: 28px; }
.section-head h2 { font-size: 1.5rem; font-weight: 500; margin: 0 0 6px; }
@media (min-width: 640px) { .section-head h2 { font-size: 30px; } }
.section-head p { margin: 0; color: var(--subtle); max-width: 48rem; }
@media (min-width: 640px) { .section-head p { font-size: 1.125rem; } }

/* ---------- page title (listing style) ---------- */
.page-title { padding-block: 32px 8px; display: grid; gap: 12px; }
.page-title h1 { font-size: 1.5rem; font-weight: 500; margin: 0; }
.page-title p { margin: 0; max-width: 48rem; color: var(--lead); font-size: 1rem; }
@media (min-width: 640px) {
  .page-title { text-align: center; justify-items: center; }
  .page-title h1 { font-size: 1.875rem; }
  .page-title p { font-size: 1.125rem; }
}
@media (min-width: 768px) { .page-title p { font-size: 1.25rem; } }

/* ---------- grids ---------- */
.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: 24px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- the warm hairline card: no shadow ---------- */
.card {
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--card-edge);
  background: var(--card-fill);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  padding: 24px;
  transition: border-color .3s, opacity .3s;
}
.card:hover { border-color: var(--card-edge-hover); }
@media (min-width: 640px) {
  .card.listing { opacity: .9; }
  .card.listing:hover { opacity: 1; }
}
.chip {
  display: inline-block; border: 1px solid var(--hairline); border-radius: 4px;
  padding: 2px 8px; font-size: 11px; color: var(--muted-foreground);
}

.class-card { display: flex; flex-direction: column; gap: 12px; }
.class-card .chip { align-self: flex-start; }
.class-card h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; margin: 0; }
.class-card ol { margin: 0; padding-left: 1.4em; color: var(--muted-foreground); font-size: .95rem; }
.class-card ol li { margin: 3px 0; }
.class-card ol a { text-decoration: none; }
.class-card .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }

.feature .icon {
  width: 40px; height: 40px; border-radius: calc(var(--radius) - 2px); display: grid; place-items: center;
  border: 1px solid var(--card-edge); color: var(--foreground); margin-bottom: 14px;
}
.feature .icon svg { width: 20px; height: 20px; }
.feature h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.feature p { color: var(--muted-foreground); margin: 0; font-size: .95rem; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, label.lbl { font-weight: 500; font-size: .875rem; }
.input {
  width: 100%; min-width: 0; height: 36px; padding: 0 12px;
  font: inherit; font-size: .875rem; color: var(--foreground);
  background: var(--glass); border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent); }
.check { display: flex; gap: 10px; align-items: center; font-size: .9rem; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--foreground); }

/* ---------- segmented ---------- */
.seg { display: flex; overflow: hidden; border: 1px solid var(--hairline); border-radius: calc(var(--radius) - 2px); background: var(--glass); }
.seg button {
  flex: 1; font: inherit; font-size: .875rem; font-weight: 500; border: 0; background: transparent;
  color: var(--muted-foreground); padding: 7px 14px; cursor: pointer; transition: color .2s, background .2s;
}
.seg button + button { border-left: 1px solid var(--hairline); }
.seg button:hover { color: var(--foreground); }
.seg button.on { background: var(--seg-on-bg); color: var(--seg-on-fg); }

/* ---------- 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(--foreground); }
.contact-item:hover { color: var(--foreground); }
.contact-item .ci-icon {
  width: 40px; height: 40px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--card-edge);
  display: grid; place-items: center; flex: none;
}
.contact-item .ci-icon svg { width: 20px; height: 20px; }
.contact-item small { display: block; color: var(--muted-foreground); font-size: .8rem; }
.contact-item span { font-weight: 600; word-break: break-word; }
.contact-item .note { font-weight: 400; color: var(--muted-foreground); }

/* ---------- footer (faded orange hairline) ---------- */
.site-footer { position: relative; font-family: var(--font-display); font-size: .875rem; color: var(--muted-foreground); padding-block: 40px; margin-top: 80px; }
.site-footer::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 100%; max-width: 1440px; height: 1px;
  transform: translateX(-50%); background: var(--footer-line); opacity: .1;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%, #000 60%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 40%, #000 60%, transparent 100%);
}
.site-footer .wrap { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.site-footer .tagline { margin: 10px 0 0; max-width: 22rem; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer nav a { text-decoration: none; }

/* ---------- notes ---------- */
.notes-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; padding-block: 24px 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: 2px; }
.ch-list button {
  width: 100%; text-align: left; font: inherit; font-size: .92rem; border: 0; background: transparent; color: var(--muted-foreground);
  padding: 8px 10px; border-radius: calc(var(--radius) - 2px); cursor: pointer; display: flex; gap: 10px; align-items: baseline;
  transition: color .2s, background .2s;
}
.ch-list button:hover { color: var(--foreground); background: var(--muted); }
.ch-list button.on { background: var(--muted); color: var(--foreground); font-weight: 600; }
.ch-list .num { font-family: var(--font-mono); font-size: .75rem; min-width: 20px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted-foreground); font-size: .9rem; }

.note { padding: 32px; }
@media (max-width: 640px) { .note { padding: 20px; } }
.note-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 8px; }
.note-top > div:first-child { min-width: 0; flex: 1 1 320px; }
.note-top h2 { font-size: 1.5rem; font-weight: 500; margin: 6px 0 8px; }
@media (min-width: 640px) { .note-top h2 { font-size: 1.875rem; } }
.note-top p { color: var(--lead); margin: 0; max-width: 46em; }
.note-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note h3 { font-size: 1.15rem; font-weight: 600; margin: 32px 0 12px; }
.note ul { padding-left: 1.2em; margin: 0; }
.note li { margin: 6px 0; }
.note li::marker { color: var(--muted-foreground); }
.defs { display: grid; gap: 8px; }
.def { background: var(--muted); border-radius: calc(var(--radius) - 2px); padding: 12px 16px; }
.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(--font-mono); font-size: .875rem; background: var(--muted); border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px); padding: 10px 14px; overflow-x: auto; white-space: nowrap;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 500; color: var(--muted-foreground); }
tr:last-child td { border-bottom: 0; }
.solved { border: 1px dashed var(--card-edge-hover); border-radius: var(--radius); padding: 16px 18px; margin: 10px 0; }
.solved .q { font-weight: 600; margin-bottom: 6px; }
.solved .s { color: var(--lead); }
.tip { border: 1px solid var(--card-edge); background: var(--card-fill); border-radius: var(--radius); padding: 14px 18px; margin-top: 28px; }
.note-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.note-foot .btn { white-space: normal; height: auto; min-height: 36px; padding-block: 8px; text-align: left; }

/* ---------- quiz ---------- */
.quiz-shell { padding-block: 24px 0; }
.setup { max-width: 760px; margin: 0 auto; }
.setup h2 { font-size: 1.25rem; font-weight: 600; 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-foreground); font-size: .875rem; margin: 0 0 16px; }

.history { max-width: 760px; margin: 28px auto 0; }
.history h3 { font-size: 1rem; font-weight: 600; }
.history ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--card-edge); border-radius: calc(var(--radius) - 2px); font-size: .9rem; }
.history li small { color: var(--muted-foreground); }
.history li .score { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.quiz { max-width: 820px; margin: 0 auto; }
.quiz-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.timer { font-family: var(--font-mono); font-size: .875rem; border: 1px solid var(--hairline); padding: 4px 12px; border-radius: calc(var(--radius) - 2px); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); border-color: var(--bad); }
.progress { height: 4px; background: var(--muted); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress div { height: 100%; background: var(--foreground); transition: width .25s; }
.q-card { padding: 28px; }
@media (max-width: 560px) { .q-card { padding: 18px; } }
.q-meta { margin-bottom: 8px; }
.q-text { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; font: inherit; color: var(--foreground);
  background: var(--card-fill); border: 1px solid var(--card-edge); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; transition: border-color .2s;
}
.opt:hover { border-color: var(--card-edge-hover); }
.opt .key {
  width: 28px; height: 28px; flex: none; border-radius: calc(var(--radius) - 4px); display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .8rem; border: 1px solid var(--border); color: var(--muted-foreground);
}
.opt.sel { border-color: var(--foreground); }
.opt.sel .key { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.opt.right { border-color: var(--good); }
.opt.right .key { color: var(--good); border-color: var(--good); }
.opt.wrong { border-color: var(--bad); }
.opt.wrong .key { color: var(--bad); border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.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: 6px; margin-top: 22px; }
.palette button {
  width: 34px; height: 34px; border-radius: calc(var(--radius) - 4px); border: 1px solid var(--border); background: transparent;
  font-family: var(--font-mono); font-size: .78rem; color: var(--muted-foreground); cursor: pointer;
}
.palette button.done { background: var(--muted); color: var(--foreground); }
.palette button.cur { border-color: var(--foreground); color: var(--foreground); }

.result-hero { text-align: center; padding: 36px 24px; }
.ring { width: 150px; height: 150px; margin: 0 auto 16px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-hero h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 4px; }
.result-hero p { color: var(--muted-foreground); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 24px 0; border-block: 1px solid var(--card-edge); }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 14px 8px; text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted-foreground); font-size: .85rem; }
.stat.good b { color: var(--good); }
.stat.bad b { color: var(--bad); }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.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.15rem; font-weight: 600; }
.review-head .seg { width: auto; }
.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: 1rem; margin-bottom: 12px; }
.review-item .opt { padding: 9px 12px; cursor: default; }
.explain { margin-top: 12px; background: var(--muted); border-radius: calc(var(--radius) - 2px); padding: 10px 14px; font-size: .92rem; color: var(--lead); }
.explain b { color: var(--foreground); }
/* status as text and a thin outline, never filled */
.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; text-transform: uppercase; }
.badge.ok { color: var(--good); }
.badge.no { color: var(--bad); }
.badge.skip { color: var(--muted-foreground); }
.time-up { color: var(--bad); font-size: .875rem; margin: 0 0 8px; }

/* ---------- usability layer (UI UX Pro Max rules, kept inside the ChaiUI look) ---------- */
html { scroll-padding-top: 88px; }                       /* sticky header never covers a jump target */
.page { min-height: 100dvh; }
main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; }
.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; }
.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 16px;
  background: var(--solid-bg); color: var(--solid-fg); border-radius: 0 var(--radius) 0 var(--radius); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--solid-fg); }
a, button, input, select, textarea, label, summary { touch-action: manipulation; }
.btn, .opt, .icon-btn { transition: background-color .2s, color .2s, border-color .2s, opacity .2s, transform .1s; }
.btn:active:not([disabled]), .opt:active:not([disabled]) { transform: scale(.98); }
.req { color: var(--muted-foreground); font-weight: 400; }
.form-status { margin: 12px 0 0; font-size: .9rem; color: var(--lead); }
.kbd-hint { margin: 14px 0 0; font-size: .85rem; color: var(--muted-foreground); }
.kbd-hint kbd { font-family: var(--font-mono); font-size: .78rem; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.opt .opt-note { margin-left: auto; padding-left: 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.opt.right .opt-note { color: var(--good); }
.opt.wrong .opt-note { color: var(--bad); }
.note h2:focus, .result-hero h2:focus { outline: none; }

/* phones: 16px fields (stops iOS zoom-on-focus) */
@media (max-width: 760px) { .input { font-size: 16px; } }
/* touch screens: 44px targets, 8px+ spacing; desktop keeps ChaiUI's compact sizes */
@media (pointer: coarse) {
  .btn, .btn-soft, .btn-muted, .input { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .nav a { min-height: 44px; display: flex; align-items: center; }
  .seg button, .ch-list button { min-height: 44px; }
  .palette { gap: 8px; }
  .palette button { width: 44px; height: 44px; }
  .opt { min-height: 48px; }
  .check input { width: 22px; height: 22px; }
  .class-card ol a, .site-footer nav a { display: inline-block; padding-block: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .site-header, .site-footer, .ch-nav, .note-actions, .note-foot, .page-title, .chai-backdrop { display: none !important; }
  .notes-layout { display: block; padding: 0; }
  .card { border: 0; background: none; backdrop-filter: none; }
}
