/* Layout: top bar + single content column (max 1120px); bank/reviewer use a filter rail beside results on wide screens.
   Palette: porcelain ground, graphite ink, articulating-paper blue as the one accent, gingiva rose used sparingly for the brand mark. */
:root {
  /* Palette: clean white ground, calming blue primary, teal accent, navy ink. Layout: top bar + single 1120px column; feature pages use cards on a soft grid. */
  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-2: #edf2f8;
  --ink: #10233a;
  --ink-2: #48607a;
  --ink-3: #7a8ca2;
  --line: #dbe4ee;
  --accent: #2f6fd6;
  --accent-ink: #ffffff;
  --accent-soft: #e5eefc;
  --teal: #0f9d94;
  --teal-soft: #daf3f0;
  --rose: #c4536b;
  --spark: #f2b8c5;
  --good: #16865a;
  --good-soft: #def4ea;
  --bad: #c0392b;
  --bad-soft: #fbe6e3;
  --warn: #9a6200;
  --warn-soft: #fcf1dc;
  --focus: #2f6fd6;
  --shadow: 0 1px 2px rgba(16, 35, 58, .05), 0 6px 20px rgba(16, 35, 58, .06);
  --shadow-lg: 0 2px 4px rgba(16, 35, 58, .06), 0 16px 40px rgba(16, 35, 58, .10);
  --hero-grad: linear-gradient(135deg, #e8f0fd 0%, #e2f6f3 100%);

  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --s-xs: .75rem; --s-sm: .875rem; --s-md: 1rem; --s-lg: 1.25rem; --s-xl: 1.6rem; --s-2xl: 2.2rem;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1622; --surface: #122033; --surface-2: #1a2b42; --ink: #e6eef7; --ink-2: #aebfd2; --ink-3: #8195ad;
    --line: #253a54; --accent: #7fa8f0; --accent-ink: #0b1626; --accent-soft: #1d3150; --teal: #45c9bd; --teal-soft: #143a3a; --rose: #e0839a; --spark: #b84a61;
    --good: #5fd19a; --good-soft: #15352a; --bad: #ff8f80; --bad-soft: #3d1f1b; --warn: #f0b955; --warn-soft: #3a2d12;
    --focus: #7fa8f0; --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 8px 28px rgba(0,0,0,.45);
    --hero-grad: linear-gradient(135deg, #142640 0%, #12302f 100%); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1622; --surface: #122033; --surface-2: #1a2b42; --ink: #e6eef7; --ink-2: #aebfd2; --ink-3: #8195ad;
  --line: #253a54; --accent: #7fa8f0; --accent-ink: #0b1626; --accent-soft: #1d3150; --teal: #45c9bd; --teal-soft: #143a3a; --rose: #e0839a; --spark: #b84a61;
  --good: #5fd19a; --good-soft: #15352a; --bad: #ff8f80; --bad-soft: #3d1f1b; --warn: #f0b955; --warn-soft: #3a2d12;
  --focus: #7fa8f0; --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 8px 28px rgba(0,0,0,.45);
  --hero-grad: linear-gradient(135deg, #142640 0%, #12302f 100%); color-scheme: dark;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: var(--s-md); line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 650; line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--s-2xl); }
h2 { font-size: var(--s-xl); }
h3 { font-size: var(--s-lg); font-weight: 500; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-size: .92em; }
.muted { color: var(--ink-2); }
.small { font-size: var(--s-sm); }
.eyebrow { font-family: var(--f-mono); font-size: var(--s-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* shell */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding-block: .6rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-mark .tile { fill: var(--accent); }
.brand-mark .tooth { fill: var(--accent-ink); }
.brand-mark .spark { fill: var(--spark); }
.brand-text { display: grid; line-height: 1.05; }
.brand-name { font-family: "Poppins", var(--f-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.brand-name i { font-style: normal; font-weight: 500; color: var(--accent); margin-right: .1em; }
.brand-sub { font-family: "Poppins", var(--f-body); font-weight: 500; font-size: .6rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink-2); padding: .4rem .65rem; border-radius: 7px; font-size: var(--s-sm); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a.nav-quiet { color: var(--ink-3); }
.nav-toggle { display: none; }
@media (max-width: 940px) {
  .nav-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .8rem; cursor: pointer; }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: .4rem; }
  .nav.open { display: flex; }
  .nav a { padding: .6rem .7rem; font-size: var(--s-md); }
}

main {
  flex: 1; width: 100%; max-width: 1120px; margin: 0 auto;
  padding-block: 1.75rem 3rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 1.75rem; outline: none;
}
.foot {
  border-top: 1px solid var(--line); color: var(--ink-3); font-size: var(--s-xs); display: grid; gap: .3rem;
  padding-block: 1.1rem 1.6rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.foot p { max-width: 90ch; margin: 0 auto; width: 100%; max-width: 1120px; }

.loading, .empty { display: flex; align-items: center; gap: .75rem; color: var(--ink-2); padding: 2rem 0; }
.empty { flex-direction: column; align-items: flex-start; gap: .6rem; padding: 1.4rem; border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { scroll-behavior: auto !important; transition: none !important; } }
.error-box { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--ink); border-radius: var(--r); padding: 1rem 1.2rem; }

/* page head */
.page-head { display: grid; gap: .45rem; }
.page-head p { max-width: 68ch; color: var(--ink-2); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.spread { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer; text-decoration: none;
  border-radius: 8px; padding: .55rem 1rem; font-weight: 600; font-size: var(--s-sm); border: 1px solid transparent; line-height: 1.2;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-text { background: none; border: none; color: var(--accent); padding: .35rem .4rem; }
.btn-danger { background: var(--surface); border-color: var(--bad); color: var(--bad); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn-sm { padding: .35rem .7rem; font-size: var(--s-xs); }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.3rem; display: grid; gap: .9rem; min-width: 0; }
.panel-head { display: flex; gap: .6rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1rem; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--surface); padding: .9rem 1rem; display: grid; gap: .15rem; }
.stat b { font-family: var(--f-display); font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: var(--s-xs); color: var(--ink-2); }

/* home hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.5rem; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.hero p { color: var(--ink-2); max-width: 56ch; margin-top: .7rem; }
.hero .row { margin-top: 1.1rem; }
.arch { width: 100%; max-width: 360px; justify-self: center; color: var(--ink-3); }
.arch .t { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.arch .t.hot { fill: var(--accent-soft); stroke: var(--accent); }
.arch text { font-family: var(--f-mono); font-size: 9px; fill: var(--ink-3); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .arch { max-width: 260px; } }

.notice { display: flex; gap: .7rem; align-items: flex-start; border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--r); padding: .8rem 1rem; font-size: var(--s-sm); }
.notice b { white-space: nowrap; }

/* subject list */
.subject-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .8rem; }
.subject-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; display: grid; gap: .55rem; align-content: start; min-width: 0; }
.subject-card h3 { font-size: 1.1rem; }
.subject-card .meta { display: flex; justify-content: space-between; gap: .5rem; font-size: var(--s-xs); color: var(--ink-3); font-family: var(--f-mono); }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.good > i { background: var(--good); }
.bar.bad > i { background: var(--bad); }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { font-size: var(--s-xs); padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }

/* chips / badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 5px; letter-spacing: .02em; white-space: nowrap; }
.badge.draft { background: var(--surface-2); color: var(--ink-2); }
.badge.source-checked { background: var(--accent-soft); color: var(--accent); }
.badge.expert-reviewed { background: var(--good-soft); color: var(--good); }
.badge.needs-revision { background: var(--warn-soft); color: var(--warn); }
.badge.flag { background: var(--warn-soft); color: var(--warn); }
.diff { font-family: var(--f-mono); font-size: .7rem; color: var(--ink-3); }
.diff::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .3rem; background: currentColor; vertical-align: 1px; }
.diff.Easy { color: var(--good); } .diff.Intermediate { color: var(--warn); } .diff.Advanced { color: var(--bad); }

/* bank layout */
.bank { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (max-width: 860px) { .bank { grid-template-columns: 1fr; } }
.filters { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); display: grid; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
@media (max-width: 860px) { .filters { position: static; } }
.field { display: grid; gap: .3rem; }
.field label, .field .lab { font-size: var(--s-xs); font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: .5rem .65rem; min-width: 0; }
textarea.input { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.subject-filter { display: grid; gap: .1rem; max-height: 460px; overflow: auto; }
.subject-filter button { display: flex; justify-content: space-between; gap: .5rem; text-align: left; background: none; border: none; border-radius: 6px; padding: .4rem .5rem; cursor: pointer; font-size: var(--s-sm); color: var(--ink-2); }
.subject-filter button:hover { background: var(--surface-2); }
.subject-filter button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.subject-filter .count { font-family: var(--f-mono); font-size: var(--s-xs); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { background: var(--surface); border: none; padding: .4rem .7rem; font-size: var(--s-xs); cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.q-list { display: grid; gap: .6rem; }
.q-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; display: grid; gap: .45rem; min-width: 0; }
.q-item .top { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: var(--s-xs); color: var(--ink-3); }
.q-item .stem { font-weight: 500; }
.q-item details summary { cursor: pointer; font-size: var(--s-sm); color: var(--accent); }
.q-item details[open] summary { margin-bottom: .5rem; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
mark { background: var(--warn-soft); color: inherit; border-radius: 2px; padding: 0 1px; }

/* quiz setup */
.setup { display: grid; gap: 1rem; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
.mode-card { display: grid; gap: .25rem; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: .8rem .9rem; cursor: pointer; text-align: left; }
.mode-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mode-card b { font-size: var(--s-sm); }
.mode-card span { font-size: var(--s-xs); color: var(--ink-2); }

/* quiz runner */
.runner { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 1.4rem; align-items: start; }
@media (max-width: 860px) { .runner { grid-template-columns: 1fr; } }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; display: grid; gap: 1.1rem; min-width: 0; }
.q-card .stem { font-size: 1.12rem; font-weight: 500; line-height: 1.5; }
.progress-line { display: grid; gap: .4rem; }
.progress-line .row { justify-content: space-between; font-size: var(--s-xs); color: var(--ink-2); }
.options { display: grid; gap: .55rem; }
.opt {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .7rem; align-items: start; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--bg); padding: .7rem .85rem; line-height: 1.45;
}
.opt:hover:not([disabled]) { border-color: var(--ink-3); }
.opt .k { font-family: var(--f-mono); font-weight: 500; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); font-size: var(--s-sm); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-checked="true"] .k { background: var(--accent); color: var(--accent-ink); }
.opt.is-correct { border-color: var(--good); background: var(--good-soft); }
.opt.is-correct .k { background: var(--good); color: var(--surface); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .k { background: var(--bad); color: var(--surface); }
.opt[disabled] { cursor: default; }
.feedback { border-radius: 9px; padding: 1rem 1.1rem; display: grid; gap: .6rem; background: var(--bg); border: 1px solid var(--line); }
.feedback .verdict { font-weight: 700; }
.feedback .verdict.good { color: var(--good); } .feedback .verdict.bad { color: var(--bad); }
.feedback ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .25rem; }
.refs { font-size: var(--s-sm); color: var(--ink-2); display: grid; gap: .2rem; }
.refs ol { margin: 0; padding-left: 1.2rem; }
.q-nav { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.palette { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; gap: .8rem; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); }
@media (max-width: 860px) { .palette { position: static; } }
.dots { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: .3rem; }
.dot { height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-family: var(--f-mono); font-size: var(--s-xs); cursor: pointer; color: var(--ink-2); }
.dot.answered { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.dot.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.dot.ok { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.dot.no { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: .6rem; font-size: var(--s-xs); color: var(--ink-3); }
.confirm { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 9px; padding: .8rem 1rem; display: grid; gap: .6rem; font-size: var(--s-sm); }

/* results */
.score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.4rem; align-items: center; }
.ring { width: 132px; height: 132px; }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { font-family: var(--f-display); font-weight: 650; fill: var(--ink); font-size: 26px; }
.ring .sub { font-family: var(--f-body); font-size: 10px; fill: var(--ink-3); font-weight: 400; }
@media (max-width: 520px) { .score { grid-template-columns: 1fr; } }
.review-item { border-top: 1px solid var(--line); padding-top: 1rem; display: grid; gap: .6rem; }
.review-item:first-child { border-top: none; padding-top: 0; }
.mini-opts { display: grid; gap: .3rem; font-size: var(--s-sm); }
.mini-opts div { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: .4rem; padding: .35rem .5rem; border-radius: 6px; }
.mini-opts .c { background: var(--good-soft); }
.mini-opts .w { background: var(--bad-soft); }
.mini-opts b { font-family: var(--f-mono); }

/* bars table */
.hbars { display: grid; gap: .65rem; }
.hbar { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 4.5rem; gap: .8rem; align-items: center; font-size: var(--s-sm); }
.hbar .v { text-align: right; font-family: var(--f-mono); font-size: var(--s-xs); color: var(--ink-2); }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .hbar { grid-template-columns: minmax(0, 1fr) 4rem; } .hbar .bar { grid-column: 1 / -1; grid-row: 2; } }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: var(--s-sm); }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--s-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* form layout */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: .8rem; align-items: end; }
.form-error { color: var(--bad); font-size: var(--s-xs); }

/* planner */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 760px) { .week { grid-template-columns: 1fr; } }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .6rem; display: grid; gap: .4rem; align-content: start; min-height: 110px; min-width: 0; }
.day.today { border-color: var(--accent); }
.day .d { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--ink-3); display: flex; justify-content: space-between; }
.session { border-radius: 6px; background: var(--surface-2); padding: .4rem .5rem; font-size: var(--s-xs); display: grid; gap: .15rem; }
.session.done { opacity: .6; text-decoration: line-through; }
.session .act { display: flex; gap: .3rem; }
.session button { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-size: var(--s-xs); }

/* reviewer */
.rev-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .rev-layout { grid-template-columns: 1fr; } }
.rev-list { display: grid; gap: .3rem; max-height: 70vh; overflow: auto; }
.rev-list button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: .5rem .6rem; cursor: pointer; display: grid; gap: .2rem; font-size: var(--s-xs); }
.rev-list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.rev-list .s { font-size: var(--s-sm); color: var(--ink); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; font-size: var(--s-sm); z-index: 20; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== v2: accounts, dashboard, daily features ===== */
.topbar { row-gap: .35rem; }
.nav { order: 3; width: 100%; margin-left: -.65rem; }
.account-chip { display: flex; gap: .4rem; align-items: center; }
.chip-btn { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--ink); padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); max-width: 220px; }
.chip-btn:hover { background: var(--surface-2); }
.chip-name { font-size: var(--s-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
@media (max-width: 940px) { .nav { margin-left: 0; } .chip-name { display: none; } .chip-btn { padding: .2rem; } .account-chip .btn { padding: .35rem .6rem; } }
@media (max-width: 420px) { .account-chip .btn-ghost { display: none; } }

.banner { background: var(--warn-soft); border-bottom: 1px solid var(--warn); font-size: var(--s-sm); display: grid; gap: .2rem;
  padding-block: .55rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.banner p { max-width: 1120px; margin: 0 auto; width: 100%; }

.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.dash-head h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.streak { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: .55rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .9rem; }
.streak svg { width: 30px; height: 30px; fill: var(--rose); grid-row: span 2; }
.streak b { font-family: var(--f-display); font-size: 1.35rem; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: .9rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.05rem 1.1rem; display: grid; gap: .5rem; align-content: start; text-decoration: none; color: var(--ink); min-width: 0; }
a.tile:hover { border-color: var(--accent); }
.tile h2 { font-size: 1.25rem; }
.tile .tile-cta { color: var(--accent); font-weight: 600; font-size: var(--s-sm); text-decoration: none; justify-self: start; }
.tile-hero { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile-hero .eyebrow, .tile-hero .tile-cta { color: var(--accent-ink); opacity: .9; }
.tile-hero:hover { filter: brightness(1.06); }
.dots5 { display: flex; gap: .4rem; }
.dots5 i { width: 22px; height: 8px; border-radius: 4px; background: var(--surface-2); }
.tile-hero .dots5 i { background: rgba(255,255,255,.28); }
.dots5 i.ok { background: var(--good); } .dots5 i.no { background: var(--bad); }
.tile-hero .dots5 i.ok { background: #8ff0be; } .tile-hero .dots5 i.no { background: #ffb4a8; }
.dots5.big i { width: 44px; height: 10px; } .dots5 i.cur { outline: 2px solid var(--accent); outline-offset: 2px; }
.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.week-dots span { aspect-ratio: 1; max-width: 100%; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 600; background: var(--surface-2); color: var(--ink-3); }
.week-dots span.on { background: var(--good); color: var(--surface); }
.week-dots span.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 54px; }
.spark i { flex: 1; background: var(--surface-2); border-radius: 2px 2px 0 0; min-height: 3px; }
.spark i.on { background: var(--accent); }
.spark.wide { height: 70px; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
ul.plain li { display: flex; justify-content: space-between; gap: .6rem; font-size: var(--s-sm); border-bottom: 1px dashed var(--line); padding-bottom: .3rem; }
ul.plain li:last-child { border-bottom: none; }

.heat { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { border-radius: 3px; background: var(--surface-2); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.heat i.l3 { background: color-mix(in srgb, var(--accent) 78%, var(--surface-2)); }
.heat i.l4 { background: var(--accent); }
.heat i.future { opacity: .35; }

.case { display: grid; }
.case-body { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; display: grid; gap: 1rem; max-width: 820px; }
.scenario { font-size: 1.08rem; line-height: 1.6; }
.findings { margin: .35rem 0 0; padding-left: 1.1rem; display: grid; gap: .25rem; }
.flashcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem 1.6rem; min-height: 220px; display: grid; gap: .8rem; align-content: center; box-shadow: var(--shadow); }
.flashcard.flipped { border-color: var(--accent); background: var(--accent-soft); }
.fc-front { font-size: 1.2rem; font-weight: 500; }
.fc-back { font-size: 1.15rem; }
.fc-opts { margin: 0; padding-left: 1.4rem; display: grid; gap: .2rem; color: var(--ink-2); }
.card-list { display: grid; gap: .6rem; }
.auth { max-width: 460px; width: 100%; margin: 0 auto; display: grid; gap: 1rem; }
.auth form.panel { gap: .8rem; }
.prose { max-width: 720px; display: grid; gap: .8rem; }
.prose h2 { font-size: 1.2rem; margin-top: .6rem; }
.prose ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.panel.danger { border-color: var(--bad); }
code { font-family: var(--f-mono); font-size: .85em; background: var(--surface-2); padding: .1rem .3rem; border-radius: 4px; word-break: break-all; }
details.review-item summary { cursor: pointer; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
label.tag { display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; }

/* ===== v3: visual refresh ===== */
body { -webkit-font-smoothing: antialiased; }
.topbar { box-shadow: 0 1px 0 var(--line), 0 4px 18px rgba(16,35,58,.04); border-bottom: none; }
.panel, .tile, .subject-card, .q-item, .q-card, .filters, .palette, .day, .stats, .table-wrap { box-shadow: var(--shadow); border-color: var(--line); }
.panel, .tile, .subject-card, .q-card { border-radius: var(--r); }
a.tile, .feature, .subject-card, .post, .sp { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
a.tile:hover, .feature:hover, .subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn { border-radius: 10px; transition: background .15s ease, box-shadow .15s ease, transform .1s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--teal) 28%, transparent); }
.btn-teal:hover { filter: brightness(1.06); }
.btn-lg { padding: .8rem 1.25rem; font-size: var(--s-md); }
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-weight: 600; font-size: var(--s-xs); }
.ill { display: block; max-width: 100%; height: auto; }
.center { text-align: center; }
.h3 { font-size: 1.05rem; font-family: var(--f-display); font-weight: 650; margin: 0; }
@media (prefers-reduced-motion: reduce) { a.tile:hover, .feature:hover, .subject-card:hover { transform: none; } }

/* landing */
.hero2 { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem; align-items: center; background: var(--hero-grad); border-radius: 24px; padding: clamp(1.4rem, 4vw, 3rem); position: relative; overflow: hidden; }
.hero2 h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.08; margin-top: .9rem; }
.hero2 p { color: var(--ink-2); max-width: 54ch; margin-top: .9rem; font-size: 1.05rem; }
.hero-ctas { margin-top: 1.4rem; }
.hero2-art { justify-self: center; width: 100%; max-width: 460px; }
.hero-img { width: 100%; animation: float 7s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .hero-img { animation: none; } }
@media (max-width: 820px) { .hero2 { grid-template-columns: 1fr; } .hero2-art { max-width: 320px; order: -1; } }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem 1.2rem; text-decoration: none; color: var(--ink); display: grid; gap: .45rem; align-content: start; box-shadow: var(--shadow); }
.feature .ill { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--accent-soft); border-radius: 12px; }
.feature h3 { font-size: 1.15rem; font-weight: 650; }
.feature p { color: var(--ink-2); font-size: var(--s-sm); }
@media (max-width: 560px) {
  .feature { grid-template-columns: 96px 1fr; column-gap: .9rem; row-gap: .25rem; }
  .feature .ill { grid-row: 1 / span 3; aspect-ratio: 1; object-fit: cover; }
  .benefits-art .ill { max-height: 210px; width: 100%; object-fit: cover; border-radius: var(--r); }
}
.tile-cta { color: var(--accent); font-weight: 600; font-size: var(--s-sm); }
.benefits { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; }
.benefits h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: .4rem 0 1rem; }
.benefit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.benefit-list li { padding-left: 2rem; position: relative; color: var(--ink-2); }
.benefit-list li::before { content: ""; position: absolute; left: 0; top: .2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--teal-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%230f9d94' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat; }
.benefit-list b { color: var(--ink); }
@media (max-width: 820px) { .benefits { grid-template-columns: 1fr; } .benefits-art { max-width: 340px; } }
.community-band { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 1.5rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow); }
.community-band h2 { font-size: clamp(1.3rem, 2.6vw, 1.8rem); margin: .35rem 0 .6rem; }
.community-band p { color: var(--ink-2); margin-bottom: 1rem; }
.community-band .ill { max-width: 280px; justify-self: center; }
.community-band.slim .ill { max-width: 200px; }
@media (max-width: 720px) { .community-band { grid-template-columns: 1fr; } .community-band .ill { order: -1; max-width: 220px; } }

/* dashboard */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; background: var(--hero-grad); border-radius: 22px; padding: clamp(1.2rem, 3vw, 2rem); }
.dash-hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: .3rem 0 .4rem; }
.dash-hero .row { margin-top: 1rem; }
.dash-rings { display: grid; gap: .6rem; }
.ring-stat { display: grid; grid-template-columns: 56px auto; gap: .7rem; align-items: center; background: var(--surface); border-radius: 14px; padding: .5rem .9rem .5rem .5rem; box-shadow: var(--shadow); min-width: 210px; }
.ring-stat svg { width: 56px; height: 56px; }
.ring-stat circle { fill: none; stroke-width: 8; }
.ring-stat .track { stroke: var(--surface-2); }
.ring-stat .val { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .8s ease; }
.ring-stat.teal .val { stroke: var(--teal); }
.ring-stat.flame .val { stroke: #f08a6e; }
.ring-stat b { font-family: var(--f-display); font-size: 1.35rem; display: block; line-height: 1.1; }
.ring-stat b small { font-size: .8rem; color: var(--ink-3); font-weight: 500; }
.ring-stat span { font-size: var(--s-xs); color: var(--ink-2); }
@media (max-width: 760px) { .dash-hero { grid-template-columns: 1fr; } .dash-rings { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } .ring-stat { min-width: 0; } }
.tile-hero { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--teal))); position: relative; overflow: hidden; }
.tile-art { position: absolute; right: -6px; bottom: -6px; width: 110px; opacity: .9; pointer-events: none; }
.subj-progress { display: grid; gap: .45rem; }
.sp { display: grid; grid-template-columns: 36px minmax(0, 9rem) minmax(0, 1fr) 3rem; gap: .7rem; align-items: center; text-decoration: none; color: var(--ink); padding: .25rem; border-radius: 10px; }
.sp:hover { background: var(--surface-2); }
.sp-name { font-size: var(--s-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp .v { text-align: right; font-size: var(--s-xs); color: var(--ink-2); font-family: var(--f-mono); }
@media (max-width: 480px) { .sp { grid-template-columns: 32px minmax(0, 1fr) 2.6rem; } .sp .bar { grid-column: 2 / -1; grid-row: 2; } }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.badge-card { display: grid; justify-items: center; text-align: center; gap: .2rem; padding: .6rem .4rem; border-radius: 12px; background: var(--surface-2); }
.badge-card .ill { width: 52px; height: 52px; }
.badge-card b { font-size: var(--s-xs); }
.badge-card span { font-size: .68rem; color: var(--ink-3); line-height: 1.3; }
.badge-card.locked .ill { filter: grayscale(1); opacity: .35; }
.empty.slim { padding: .8rem; border: none; background: transparent; align-items: center; text-align: center; }
.empty .ill, .empty > img { max-width: 200px; margin: 0 auto .2rem; }
.empty { align-items: center; text-align: center; }
.page-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-hero .ill { width: 170px; flex: none; }
@media (max-width: 600px) { .page-hero .ill { display: none; } }
.subj-head { display: flex; gap: .75rem; align-items: center; }
.subj-head .meta { justify-content: flex-start; gap: .8rem; }
.subj-ic { flex: none; border-radius: 12px; }
.subject-filter .si { display: inline-flex; align-items: center; gap: .45rem; }

/* ===== community ===== */
.bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; text-decoration: none; background: var(--surface-2); font-size: 1.05rem; }
.bell:hover { background: var(--accent-soft); }
.bell-n { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.comm-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--hero-grad); border-radius: 20px; padding: clamp(1rem, 3vw, 1.6rem) clamp(1rem, 3vw, 1.8rem); }
.comm-hero h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .3rem 0 .4rem; }
.comm-hero p { color: var(--ink-2); max-width: 60ch; }
.comm-hero img { width: 200px; flex: none; }
@media (max-width: 640px) { .comm-hero img { display: none; } }
.community-join { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.4rem; box-shadow: var(--shadow); }
.community-join h2 { margin-bottom: .4rem; }
.community-join .row { margin-top: 1rem; }
.comm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 1.4rem; align-items: start; }
@media (max-width: 900px) { .comm-layout { grid-template-columns: 1fr; } .comm-side { order: -1; } .cat-list { display: flex !important; overflow-x: auto; padding-bottom: .3rem; } .cat-list button { white-space: nowrap; } .conduct-mini { display: none; } }
.comm-main { display: grid; gap: 1rem; min-width: 0; }
.comm-side { display: grid; gap: 1rem; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 96px); }
@media (max-width: 900px) { .comm-side { position: static; } }
.cat-list { display: grid; gap: .15rem; }
.cat-list button { display: flex; align-items: center; gap: .5rem; background: none; border: none; text-align: left; padding: .4rem .5rem; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: var(--s-sm); }
.cat-list button:hover { background: var(--surface-2); }
.cat-list button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cat-ic { width: 20px; height: 20px; border-radius: 6px; flex: none; }
.conduct-mini ul { margin: .4rem 0; padding-left: 1.1rem; display: grid; gap: .25rem; }
.composer { gap: .7rem; }
.composer-top { display: flex; gap: .7rem; align-items: flex-start; }
.composer textarea { min-height: 5rem; }
.composer-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.composer-bar select { width: auto; max-width: 220px; }
.composer-bar .btn-primary { margin-left: auto; }
.composer-img { display: flex; gap: .6rem; align-items: flex-end; }
.composer-img img { max-height: 160px; border-radius: 10px; border: 1px solid var(--line); }
.file-btn { cursor: pointer; }
.preview { background: var(--surface-2); border-radius: 10px; padding: .7rem .8rem; min-height: 5rem; }
.feed-tools { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
#feed { display: grid; gap: 1rem; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem .5rem; box-shadow: var(--shadow); display: grid; gap: .7rem; min-width: 0; }
.post-head { display: flex; justify-content: space-between; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }
.post-author { display: flex; gap: .6rem; align-items: center; text-decoration: none; color: var(--ink); min-width: 0; }
.post-author > span { display: grid; line-height: 1.25; }
.av { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: .9rem; color: #fff; object-fit: cover;
  background: linear-gradient(135deg, hsl(var(--h, 215) 62% 52%), hsl(calc(var(--h, 215) + 40) 60% 45%)); }
.av.sm { width: 32px; height: 32px; font-size: .75rem; }
.av.lg { width: 84px; height: 84px; font-size: 1.8rem; }
.cat-tag { display: inline-flex; align-items: center; gap: .35rem; background: var(--accent-soft); color: var(--accent); border: none; border-radius: 999px; padding: .25rem .65rem .25rem .3rem; font-size: var(--s-xs); font-weight: 600; cursor: pointer; }
.cat-tag .cat-ic { width: 18px; height: 18px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.post-body a { word-break: break-all; }
.post-img { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.post-img img { width: 100%; max-height: 460px; object-fit: contain; display: block; }
.post-img.missing { padding: 1rem; text-align: center; }
.post-stats { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.post-stats a { color: var(--ink-2); text-decoration: none; }
.rx-summary { display: inline-flex; gap: .1rem; align-items: center; }
.post-actions { display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; }
.pa { background: none; border: none; border-radius: 8px; padding: .45rem .65rem; font-size: var(--s-sm); font-weight: 600; color: var(--ink-2); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.pa:hover { background: var(--surface-2); color: var(--ink); }
.pa.on { color: var(--accent); }
.pa.mod { color: var(--warn); }
.rx-wrap { position: relative; display: inline-flex; }
.rx-more { padding-inline: .35rem; }
.rx-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 4; display: flex; gap: .15rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .3rem; box-shadow: var(--shadow-lg); }
.rx-menu button { background: none; border: none; font-size: 1.35rem; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; transition: transform .12s ease, background .12s; }
.rx-menu button:hover, .rx-menu button:focus-visible { transform: scale(1.18); background: var(--surface-2); }
.rx-menu button[aria-checked="true"] { background: var(--accent-soft); }
.post-slot:empty, .c-slot:empty { display: none; }
.report-form { display: grid; gap: .5rem; background: var(--surface-2); border-radius: 10px; padding: .8rem; }
.report-form fieldset { border: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.comments { gap: .8rem; }
.comment-form { display: grid; gap: .4rem; }
ol.thread, ol.replies { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
ol.replies { margin: .6rem 0 0 2.6rem; padding-left: .8rem; border-left: 2px solid var(--line); }
.comment { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; }
.c-main { background: var(--surface-2); border-radius: 12px; padding: .55rem .8rem; min-width: 0; }
.c-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: .2rem 0; }
.c-meta a { color: var(--ink); text-decoration: none; }
.c-actions { display: flex; gap: .8rem; }
.c-actions .btn-text, .btn-text { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; font-size: inherit; }
.c-actions .mod { color: var(--warn); }
.comment.flash .c-main { animation: flash 2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.c-slot { margin-top: .4rem; }
ul.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
ul.notes li { display: flex; justify-content: space-between; gap: .8rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; }
ul.notes li.unread { border-color: var(--accent); background: var(--accent-soft); }
ul.notes a { color: var(--ink); text-decoration: none; min-width: 0; }
.member { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.mod-list { display: grid; gap: .8rem; }
.mod-item blockquote { margin: 0; background: var(--surface-2); border-left: 3px solid var(--warn); border-radius: 8px; padding: .6rem .8rem; }
/* moderator tools */
.input-inline { display: inline-block; width: auto; padding: .2rem .5rem; margin-left: .35rem; }
.mod-menu fieldset { display: grid; gap: .35rem; }
.mod-panel { margin: 1rem 0; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.mod-h { margin: 1.6rem 0 .6rem; }
.mod-log { list-style: none; padding: 0; display: grid; gap: .45rem; }
.mod-log li { padding: .55rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.pa.mod, .btn-text.mod { color: var(--accent); }
.mod-tabs { flex-wrap: wrap; margin-bottom: 1rem; }
.mod-body > .panel + .panel { margin-top: 1rem; }
.student-list { display: grid; gap: .6rem; margin: .6rem 0; }
.student-row .row { align-items: flex-start; }
.badge.pin-badge { background: var(--accent-soft); color: var(--accent); }
.badge.lock-badge { background: color-mix(in srgb, var(--ink-2) 12%, transparent); color: var(--ink-2); }
.post.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow); }
.pinned-list { display: grid; gap: inherit; margin-bottom: 1rem; }
.pause-notice { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.update-bar { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50; display: flex; gap: .8rem; align-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 999px; padding: .5rem .6rem .5rem 1.1rem; max-width: calc(100vw - 32px); }

/* ===== AI Study Guide ===== */
.ok-text { color: var(--good); } .warn-text { color: var(--warn); }
.mono { font-family: var(--mono, ui-monospace, monospace); font-size: .8rem; }
.study-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: .4rem 0 .8rem; }
.sstep { display: flex; gap: .55rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .75rem; font-size: var(--s-sm); }
.sstep span { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.mode-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .7rem; margin: .6rem 0; }
.mode-opt { display: grid; gap: .25rem; border: 1.5px solid var(--line); border-radius: var(--r); padding: .8rem .9rem; cursor: pointer; background: var(--surface); }
.mode-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mode-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mode-opt:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.key-row { margin-top: .4rem; }
.drop { display: grid; gap: .3rem; place-items: center; text-align: center; padding: 1.8rem 1rem; border: 2px dashed var(--line); border-radius: var(--r); cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop b { font-size: 1.05rem; color: var(--accent); }
.read-prog, .report { margin-top: .8rem; }
.report-list { list-style: none; padding: 0; display: grid; gap: .3rem; }
.report-list li::before { content: "• "; color: var(--ink-3, var(--ink-2)); }
.doc-list, .q-list { display: grid; gap: .7rem; }
.run-panel.live { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.stage-line { list-style: none; padding: 0; margin: 0 0 .7rem; display: flex; flex-wrap: wrap; gap: .35rem; counter-reset: st; }
.stage-line li { counter-increment: st; font-size: var(--s-sm); padding: .3rem .65rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.stage-line li::before { content: counter(st) ". "; }
.stage-line li.cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.stage-line li.done { background: var(--good-soft); color: var(--good); }
.stage-line li.done::before { content: "✓ "; }
.bar.big { height: 10px; border-radius: 5px; margin-bottom: .5rem; }
.bar.inline { display: inline-block; width: 120px; vertical-align: middle; margin-left: .5rem; }
.run-stats { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-bottom: .5rem; }
.run-log ul { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .2rem; }
.paste-panel { margin-top: .9rem; padding: .9rem 1rem; border-radius: var(--r); background: var(--accent-soft); display: grid; gap: .55rem; }
.paste-panel textarea { background: var(--surface); }
.study-tabs { flex-wrap: wrap; margin: .9rem 0; }
.study-toc ol { margin: .4rem 0 0; padding-left: 1.3rem; display: grid; gap: .2rem; }
.summary-sec + .summary-sec { margin-top: .8rem; }
.md h3, .md h4, .md h5 { margin: 1rem 0 .35rem; font-size: 1rem; }
.md p { margin: .35rem 0; } .md ul, .md ol { margin: .3rem 0 .5rem; padding-left: 1.3rem; }
.pref { color: var(--ink-2); font-size: .8em; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; margin: .5rem 0; }
.md-table { border-collapse: collapse; font-size: var(--s-sm); min-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); }
.cov-table .bar { margin-top: .2rem; min-width: 60px; }
.row.wrap { flex-wrap: wrap; }
.qcard header { flex-wrap: wrap; gap: .4rem; }
.q-stem { margin: .5rem 0; } .q-stem p:first-child { margin-top: 0; }
.opts { display: grid; gap: .35rem; margin: .4rem 0 .6rem; }
.opt { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.opt:hover { border-color: var(--accent); }
.opt input { margin-top: .25rem; }
.match { display: grid; gap: .35rem; margin-bottom: .6rem; }
.q-ans textarea { margin-bottom: .5rem; }
.fb { margin-top: .6rem; padding: .7rem .85rem; border-radius: 9px; background: var(--surface-2); border-left: 4px solid var(--accent); }
.fb.good { border-left-color: var(--good); background: var(--good-soft); } .fb.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
[data-tf].on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pager { justify-content: center; margin: 1rem 0; }
.palette { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .6rem; }
.palette button { min-width: 2.1rem; height: 2.1rem; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; }
.palette button.ans { background: var(--accent-soft); border-color: var(--accent); }
.palette button.cur { outline: 2px solid var(--accent); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.big-score b { font-size: 2.4rem; }
.exam-form { display: grid; gap: .8rem; }
.exam-form fieldset, .panel fieldset { border: 1px solid var(--line); border-radius: 9px; padding: .5rem .8rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.guide .steps { display: grid; gap: .45rem; padding-left: 1.3rem; }
.guide + .guide { margin-top: .8rem; }
.faq dt { font-weight: 600; margin-top: .6rem; } .faq dd { margin: .2rem 0 0; color: var(--ink-2); }
.study-gate { max-width: 640px; }
@media (max-width: 560px) { .qb-filters .input-inline { flex: 1 1 45%; } .run-stats { gap: .2rem .8rem; } .big-score b { font-size: 2rem; } }
.guide, .study-toc, .faq { overflow-wrap: anywhere; }
.guide .md-table { min-width: 520px; }
.tbl-wrap { max-width: 100%; }
#view > *, .guide, .panel { min-width: 0; }
.tbl-wrap { width: 100%; overflow-x: auto; }
.guide .notice, .run-panel .notice, .report .notice, #up-status .notice { flex-wrap: wrap; }
.guide .notice b, .run-panel .notice b, #up-status .notice b { white-space: normal; }
.wait-line { color: var(--accent); font-variant-numeric: tabular-nums; min-height: 1.2em; margin: .2rem 0; }

/* ASU course groups */
.year-tabs { flex-wrap: wrap; margin: 0 0 .8rem; }
.year-tabs .count { opacity: .7; font-size: .85em; margin-left: .25rem; }
.course-note { margin: 0 0 1rem; }
.title-ar { margin: .1rem 0 .2rem; font-size: .95rem; color: var(--ink-2); }
.sf-group { border-top: 1px solid var(--line); padding: .3rem 0; }
.sf-group > summary { cursor: pointer; font-weight: 600; font-size: var(--s-sm); color: var(--ink); padding: .35rem .2rem; }
.sf-group > summary .count { float: right; opacity: .7; font-weight: 400; }
.sf-group > button { width: 100%; }

/* Lecture recordings */
.tstamp { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 .3rem; white-space: nowrap; }
.transcript .tline { margin: .25rem 0; line-height: 1.55; }
.transcript .tline.unclear, span.unclear { background: var(--warn-soft, #fff4d6); border-radius: 4px; }
.lq .lq-opts { display: grid; gap: .4rem; margin: .5rem 0; }
.lq .explain { margin-top: .4rem; }
.flash { min-height: 220px; display: grid; place-items: center; text-align: center; border: 2px solid var(--line); border-radius: 14px; padding: 1.5rem; cursor: pointer; background: var(--surface); margin-bottom: .8rem; }
.flash.flipped { border-color: var(--teal); background: var(--teal-soft); }
.flash-face p { font-size: 1.15rem; margin: .6rem 0; }
.md-body h3, .md-body h4 { margin-top: 1rem; }
.lec-entry { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .notice { flex-wrap: wrap; } .notice b { white-space: normal; } .notice > span { min-width: 0; } }

/* ---------- AI Tutor (prototype) ---------- */
.tutor-page { display: grid; gap: 1rem; min-width: 0; }
.tutor { display: flex; flex-direction: column; gap: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem; height: min(80dvh, 820px); min-height: 460px; min-width: 0; }
.tutor-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.tutor-status { margin: 0; }
.tutor-tools { gap: .4rem; flex-wrap: wrap; }
.tutor-modes { display: flex; width: 100%; }
.tutor-modes button { flex: 1 1 0; padding: .55rem .4rem; font-size: var(--s-sm); font-weight: 600; min-width: 0; }
.tutor-privacy { margin: 0; }
.tutor-setup { display: grid; gap: .5rem; }
.tutor-setup:empty { display: none; }
.tutor-setrow { gap: .4rem; flex-wrap: wrap; align-items: center; }
.tutor-setrow select { flex: 1 1 11rem; min-width: 0; max-width: 100%; }
.tutor-log { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: .6rem; padding: .3rem .1rem; min-height: 8rem; overscroll-behavior: contain; }
.tempty { margin: auto 0; text-align: center; }
.tmsg { max-width: min(92%, 46rem); display: grid; gap: .2rem; min-width: 0; }
.tmsg .tbody { background: var(--surface-2); border-radius: 12px; padding: .55rem .8rem; overflow-wrap: anywhere; min-width: 0; }
.tmsg .tbody > p:first-child, .tmsg .tbody > :first-child { margin-top: 0; }
.tmsg .tbody > :last-child { margin-bottom: 0; }
.tmsg.student { align-self: flex-end; }
.tmsg.student .tbody { background: var(--accent); color: var(--accent-ink); }
.tmsg.patient .tbody { background: var(--teal-soft); }
.tmsg.meta .tbody { background: transparent; border: 1px dashed var(--line); color: var(--ink-2); font-size: var(--s-sm); }
.tmsg.maya, .tmsg.patient { align-self: flex-start; }
.tmeta { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tmsg.student .tmeta { justify-content: flex-end; }
.tnote { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: .3rem .6rem; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; margin-top: .5rem; display: grid; gap: .35rem; min-width: 0; }
.tcard-top { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tstem { margin: 0; font-weight: 500; }
.tcard ul { margin: .2rem 0; padding-inline-start: 1.2rem; }
.tmcq .opt { width: 100%; text-align: start; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.tchip { display: inline-flex; align-items: center; font-family: var(--f-mono); font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
.tchip:hover { border-color: var(--accent); }
.tchips { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .4rem; }
.tref { color: var(--ink-2); }
.tutor-bar { display: grid; gap: .35rem; border-top: 1px solid var(--line); padding-top: .55rem; flex: 0 0 auto; }
.tutor-interim { min-height: 1.1em; font-style: italic; }
.tutor-form { display: flex; gap: .4rem; align-items: flex-end; min-width: 0; }
.tutor-form textarea { flex: 1 1 auto; min-width: 0; resize: none; max-height: 140px; line-height: 1.4; }
.tutor-mic.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.tutor-voice { gap: .4rem; flex-wrap: wrap; align-items: center; }
.tutor-help summary { cursor: pointer; font-weight: 600; }
@media (max-width: 560px) {
  .tutor { padding: .6rem; height: calc(100dvh - 7.5rem); min-height: 420px; }
  .tutor-modes button { font-size: var(--s-xs); padding: .45rem .25rem; white-space: normal; line-height: 1.2; overflow-wrap: anywhere; }
  .tmsg { max-width: 100%; }
  .tutor-form .btn { padding-inline: .6rem; }
}
