/* QuizlyNotes v2 — "paper, ink and highlighter"
   ------------------------------------------------------------------------- */

:root {
  --paper: #f6f3ea;
  --paper-2: #ece7d8;
  --surface: #fffdf7;
  --ink: #1d1b16;
  --ink-2: #48443a;
  --muted: #6c6658;
  --line: #ddd6c4;
  --line-2: #c9c0a8;
  --hl: #ffe066;
  --hl-soft: #fff2b0;
  --mark-ink: inherit;
  --mark-band: var(--hl);
  --hl-fill: color-mix(in srgb, var(--hl) 22%, transparent);
  --hl-fill-strong: color-mix(in srgb, var(--hl) 50%, transparent);
  --inverse-bg: var(--ink);
  --inverse-ink: var(--paper);
  --accent: #2443c9;
  --good: #1f7a45;
  --good-bg: #e2f1e5;
  --bad: #b8382a;
  --bad-bg: #f7e2dd;
  --rule: rgba(36, 67, 201, 0.10);
  --margin-line: rgba(200, 60, 50, 0.35);
  --shadow: 0 1px 2px rgba(29, 27, 22, .06), 0 10px 30px -18px rgba(29, 27, 22, .35);
  --shadow-lift: 0 2px 4px rgba(29, 27, 22, .06), 0 18px 40px -20px rgba(29, 27, 22, .45);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
  --r-sm: 8px;
  --wrap: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15140f;
    --paper-2: #211f18;
    --surface: #1d1c16;
    --ink: #f1ede2;
    --ink-2: #d2ccbc;
    --muted: #a29b89;
    --line: #34312a;
    --line-2: #4a463c;
    --hl: #e8c63c;
    --hl-soft: #4a4020;
    --mark-ink: #f2cf45;
    --mark-band: rgba(242, 207, 69, 0.20);
    --hl-fill: rgba(242, 207, 69, 0.12);
    --hl-fill-strong: rgba(242, 207, 69, 0.22);
    --inverse-bg: #0c0b08;
    --inverse-ink: #f1ede2;
    --accent: #93a6ff;
    --good: #63c486;
    --good-bg: #1b3124;
    --bad: #f0846f;
    --bad-bg: #3b201a;
    --rule: rgba(147, 166, 255, 0.08);
    --margin-line: rgba(240, 132, 111, 0.30);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .7);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #15140f;
  --paper-2: #211f18;
  --surface: #1d1c16;
  --ink: #f1ede2;
  --ink-2: #d2ccbc;
  --muted: #a29b89;
  --line: #34312a;
  --line-2: #4a463c;
  --hl: #e8c63c;
  --hl-soft: #4a4020;
  --mark-ink: #f2cf45;
  --mark-band: rgba(242, 207, 69, 0.20);
  --hl-fill: rgba(242, 207, 69, 0.12);
  --hl-fill-strong: rgba(242, 207, 69, 0.22);
  --inverse-bg: #0c0b08;
  --inverse-ink: #f1ede2;
  --accent: #93a6ff;
  --good: #63c486;
  --good-bg: #1b3124;
  --bad: #f0846f;
  --bad-bg: #3b201a;
  --rule: rgba(147, 166, 255, 0.08);
  --margin-line: rgba(240, 132, 111, 0.30);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .7);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--hl); color: #1d1b16; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hide-sm { }
.sr-only { position: absolute !important; 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: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }
kbd { font: 500 .8em var(--sans); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: var(--surface); }

.eyebrow { font: 600 .75rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .75rem; }
.display { font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -.02em; margin-bottom: 1rem; font-variation-settings: "opsz" 144; }
.display--sm { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.lede { font-size: 1.125rem; color: var(--ink-2); max-width: 38em; }
mark, .hl {
  color: var(--mark-ink);
  background: linear-gradient(104deg, transparent 0 .2em, var(--mark-band) .2em calc(100% - .15em), transparent calc(100% - .15em)) 0 72% / 100% 42% no-repeat;
  padding: 0 .08em;
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  padding: .65em 1.15em; border-radius: 999px; font-weight: 600; font-size: .95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background-color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--primary:hover { box-shadow: 0 6px 18px -8px rgba(29,27,22,.6); }
.btn--hl { background: var(--hl); color: #1d1b16; border-color: #1d1b16; }
.btn--ghost { background: transparent; }
.btn--danger { background: transparent; color: var(--bad); border-color: currentColor; }
.btn--danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn--sm { padding: .45em .9em; font-size: .875rem; }
.btn--lg { padding: .85em 1.5em; font-size: 1.05rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Header ------------------------------------------------------------------ */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.is-scrolled, .site-header--app { border-bottom-color: var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }
.logo__word { font: 600 1.2rem/1 var(--serif); letter-spacing: -.01em; }
.logo__word span { font-style: italic; font-weight: 500; }
.site-nav { display: flex; gap: 1.25rem; margin-left: 1rem; }
.site-nav a, .app-nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500; }
.site-nav a:hover, .app-nav a:not(.btn):hover, .app-nav a[aria-current] { color: var(--ink); }
.app-nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: 4px; text-underline-offset: 6px; }
.site-header__actions { margin-left: auto; display: flex; gap: .5rem; }
.app-nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--hl); color: #1d1b16; display: grid; place-items: center; font-weight: 600; overflow: hidden; border: 1px solid var(--line-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 48px; height: 48px; font-size: 1.2rem; flex: none; }
.menu__panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lift); padding: 6px; display: grid; }
.menu__panel a, .menu__panel button { display: block; width: 100%; text-align: left; padding: .55rem .75rem; border-radius: 6px; background: none; border: 0; text-decoration: none; cursor: pointer; font-size: .95rem; }
.menu__panel a:hover, .menu__panel button:hover { background: var(--paper-2); }
.menu__who { padding: .6rem .75rem .7rem; margin: 0 0 4px; border-bottom: 1px solid var(--line); display: grid; font-size: .9rem; }
.menu__who span { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; }

/* Toasts ------------------------------------------------------------------ */
.toasts { position: fixed; z-index: 60; top: 76px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: .7rem 2.5rem .7rem 1rem; border-radius: var(--r-sm); box-shadow: var(--shadow-lift); position: relative; animation: drop .25s ease; }
.toast--error { background: var(--bad); color: #fff; }
.toast__close { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: inherit; font-size: 1.3rem; cursor: pointer; opacity: .8; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* Footer ------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem; padding: 3rem 0 1.5rem; font-size: .95rem; }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.site-footer__grid nav { display: grid; gap: .4rem; align-content: start; }
.site-footer__grid nav a { color: var(--ink-2); text-decoration: none; }
.site-footer__grid nav a:hover { color: var(--ink); text-decoration: underline; }
.site-footer__grid p { max-width: 30em; margin-top: .75rem; }
.footer-h { font: 600 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.site-footer__bottom { display: flex; justify-content: space-between; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.app-footer { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; padding-bottom: 1.5rem; margin-top: 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.app-footer nav { display: flex; gap: 1rem; }
.app-footer a { text-decoration: none; }
.app-footer a:hover { color: var(--ink); }

/* Landing ----------------------------------------------------------------- */
.hero { padding: 3.5rem 0 4rem; }
.hero__grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center; }
.ticks { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .5rem; }
.ticks li { position: relative; padding-left: 1.75rem; color: var(--ink-2); }
.ticks li::before { content: ""; position: absolute; left: 0; top: .3em; width: 1.05em; height: 1.05em; border-radius: 50%; background: var(--good-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%231f7a45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/80% no-repeat; }
.crumbs { display: flex; gap: .5rem; font-size: .875rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.card-paper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lift);
  position: relative;
}
.tryit { padding: 0; overflow: hidden; }
.tryit::before { content: ""; position: absolute; inset: -14px 14px auto -14px; height: 100%; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); transform: rotate(-2.2deg); z-index: -1; }
.tryit__tabs, .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 6px 6px 0; }
.tryit__tabs button, .tabs button { background: none; border: 0; padding: .7rem 1rem; font-weight: 600; font-size: .92rem; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tryit__tabs button[aria-selected="true"], .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--hl); }
.tryit__panel { padding: 1rem; }
.tryit textarea {
  width: 100%; border: 0; resize: vertical; min-height: 190px; background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    repeating-linear-gradient(to bottom, transparent 0 calc(1.6em - 1px), var(--rule) calc(1.6em - 1px) 1.6em);
  background-blend-mode: normal; line-height: 1.6; padding: .25rem .25rem; outline: none;
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(1.6em - 1px), var(--rule) calc(1.6em - 1px) 1.6em);
  background-attachment: local;
}
.tryit__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .75rem; border-top: 1px dashed var(--line); }
.tryit__actions { display: flex; align-items: center; gap: 1rem; }
.tryit__upload { display: grid; justify-items: center; text-align: center; gap: .5rem; padding: 2.5rem 1.5rem; color: var(--ink-2); }
.tryit__loading { position: absolute; inset: 0; background: var(--surface); display: grid; place-items: center; }

.section { padding: 4rem 20px; }
.section--narrow { max-width: 780px; }
.section-title { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.015em; margin-bottom: 1.25rem; }
.band { background: var(--paper-2); padding: 4rem 0; border-block: 1px solid var(--line); }
.band--ink { background: var(--inverse-bg); color: var(--inverse-ink); border: 0; }
.band--ink p { color: color-mix(in srgb, var(--inverse-ink) 78%, transparent); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: s; }
.steps__item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; }
.steps__n { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--hl); color: #1d1b16; font: 600 1rem var(--serif); margin-bottom: .9rem; }
.steps__item h3 { font-size: 1.1rem; }
.steps__item p { color: var(--ink-2); margin: 0; }

.split { display: grid; grid-template-columns: .8fr 1.2fr; gap: 3rem; align-items: start; }
.qtypes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.band .qtypes { grid-template-columns: repeat(3, 1fr); }
.qtypes__item { border-top: 2px solid var(--ink); padding-top: .85rem; }
.qtypes__tag { font: 500 .8rem var(--serif); color: var(--muted); }
.qtypes__item h3 { font-size: 1.05rem; margin: .15rem 0 .35rem; }
.qtypes__item p { color: var(--ink-2); font-size: .95rem; margin: 0; }

.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.feature h3 { font-family: var(--serif); font-size: 1.2rem; }
.feature h3::before { content: ""; display: block; width: 28px; height: 6px; background: var(--hl); border-radius: 3px; margin-bottom: .9rem; }
.feature p { font-size: .95rem; margin: 0; }

.link-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 3rem; }
.link-card { display: grid; gap: .35rem; align-content: start; padding: 1.25rem 2.75rem 1.25rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; position: relative; transition: border-color .15s, transform .15s, box-shadow .15s; }
.link-card .eyebrow { margin: 0; }
.link-card strong { font: 600 1.1rem/1.3 var(--serif); }
.link-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.link-card__arrow { position: absolute; right: 1.1rem; top: 1.15rem; font-size: 1.2rem; transition: transform .15s; }
.link-card:hover .link-card__arrow { transform: translateX(3px); }

.faq { border-top: 1px solid var(--line); }
.faq__item { border-bottom: 1px solid var(--line); }
.faq__item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary h3 { font: 600 1.05rem/1.4 var(--sans); margin: 0; }
.faq__item summary::after { content: "+"; font: 400 1.5rem/1 var(--sans); color: var(--muted); transition: transform .2s; }
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__item p { color: var(--ink-2); padding-bottom: 1rem; margin: 0; max-width: 60ch; }

.cta { background: var(--inverse-bg); color: var(--inverse-ink); border: 1px solid var(--line); border-radius: calc(var(--r) * 1.5); padding: 3rem 2rem; text-align: center; display: grid; justify-items: center; gap: .25rem; }
.cta h2 { font: 600 clamp(1.6rem, 3vw, 2.2rem)/1.15 var(--serif); }
.cta p { color: color-mix(in srgb, var(--inverse-ink) 75%, transparent); }

.prose { font-size: 1.05rem; }
.prose h2 { font: 600 1.6rem/1.25 var(--serif); margin: 2.2rem 0 .7rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.2rem; }
.prose a { color: var(--accent); }

/* App pages --------------------------------------------------------------- */
.page { padding-top: 2rem; padding-bottom: 2rem; }
.page--narrow { max-width: 780px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.page-title { font: 600 clamp(1.8rem, 3.5vw, 2.4rem)/1.1 var(--serif); letter-spacing: -.015em; margin: 0 0 .35rem; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: .75rem; }
.back:hover { color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; margin-bottom: 1.25rem; }
.panel--danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.block__title { font: 600 1.15rem var(--serif); margin: 0 0 .75rem; }
.block { margin-top: 2.25rem; }
.block__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.block__head .block__title { margin: 0; }
.block--quiet { border-top: 1px solid var(--line); padding-top: 1rem; }

.empty { text-align: center; padding: 3.5rem 1rem; display: grid; justify-items: center; gap: .25rem; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface); }
.empty h2 { font: 600 1.6rem var(--serif); }
.empty__art { position: relative; width: 140px; height: 100px; margin-bottom: 1rem; }
.mini-card { position: absolute; inset: 10px 10px 0 20px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 8px; padding: 18px 14px; display: grid; gap: 8px; align-content: start; }
.mini-card span { height: 6px; border-radius: 3px; background: var(--line); }
.mini-card span:first-child { background: var(--hl); width: 70%; height: 9px; }
.mini-card--back { background: var(--paper-2); transform: rotate(-8deg); inset: 4px 24px 8px 6px; }

/* Forms */
.field { display: grid; gap: .35rem; margin: 0 0 1rem; min-width: 0; border: 0; padding: 0; }
.field__label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea, .title-input, .subject-input input {
  width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .6rem .75rem; line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; }
.field input[type="radio"], .field input[type="checkbox"] { width: auto; padding: 0; border: 0; background: none; box-shadow: none; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl-fill-strong); }
.field--inline { margin: 0; }
.field--short { max-width: 220px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-error { color: var(--bad); background: var(--bad-bg); padding: .6rem .8rem; border-radius: var(--r-sm); font-size: .92rem; margin: .75rem 0 0; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.inline-form { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.radio-card { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); margin-bottom: .5rem; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--ink); background: color-mix(in srgb, var(--hl) 14%, var(--surface)); }
.radio-card input { margin-top: .3rem; accent-color: var(--ink); }
.radio-card span { display: grid; }
.radio-card .muted { font-size: .9rem; }
.new-form .tabs { margin: -1.5rem -1.5rem 1.25rem; padding: 6px 6px 0; }
.dropzone { display: grid; justify-items: center; gap: .35rem; text-align: center; padding: 2.5rem 1rem; border: 2px dashed var(--line-2); border-radius: var(--r); cursor: pointer; margin-bottom: 1.25rem; transition: border-color .15s, background .15s; color: var(--ink-2); }
.dropzone:hover, .dropzone.is-over { border-color: var(--ink); background: var(--hl-fill); }
.dropzone.has-file { border-style: solid; border-color: var(--good); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone__title { font-weight: 600; color: var(--ink); }

.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: var(--paper-2); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: .4rem 1rem; border-radius: 999px; font-weight: 500; font-size: .9rem; color: var(--ink-2); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; }
.checks label { display: flex; gap: .5rem; align-items: center; font-size: .95rem; }
.checks input, .delete-toggle input { accent-color: var(--ink); width: 1rem; height: 1rem; }

/* Library */
.toolbar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.toolbar__right { display: flex; gap: .5rem; }
.toolbar input, .toolbar select { padding: .45rem .75rem; border-radius: 999px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: .35rem .85rem; font-size: .9rem; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.set-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.set-card__link {
  display: grid; height: 100%; grid-template-rows: auto 1fr auto auto; gap: .35rem;
  padding: 1.15rem 1.15rem 1rem; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.set-card__link::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--hl); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.set-card__link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.set-card__link:hover::before { transform: scaleX(1); }
.set-card__subject { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.set-card__title { font: 600 1.2rem/1.25 var(--serif); margin: 0; }
.set-card__meta { color: var(--muted); font-size: .88rem; margin: 0; }
.set-card__foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding-top: .75rem; margin-top: .25rem; border-top: 1px dashed var(--line); }
.scorebar { display: flex; align-items: center; gap: .5rem; flex: 1; }
.scorebar__track { flex: 1; max-width: 110px; height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.scorebar__fill { display: block; height: 100%; width: var(--w); background: var(--good); border-radius: 3px; }
.scorebar__label { font-size: .85rem; font-weight: 600; min-width: 2.5em; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--paper-2); }
.pill--due { background: var(--hl); color: #1d1b16; }
.pill--warn { background: var(--hl-soft); color: var(--ink); }
.due-text { color: var(--ink); background: var(--hl-soft); padding: 0 .3em; border-radius: 3px; }

/* Set overview */
.set-layout { display: grid; grid-template-columns: 230px 1fr; gap: 2.5rem; align-items: start; }
.set-aside { position: sticky; top: 84px; }
.side-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.side-list a { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .65rem; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-size: .92rem; }
.side-list a:hover { background: var(--paper-2); color: var(--ink); }
.side-list a[aria-current] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--hl), 0 0 0 1px var(--line); }
.side-list__score { color: var(--muted); font-size: .82rem; font-weight: 500; }
.set-head { margin-bottom: 1.5rem; }
.callout { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.25rem 1.5rem; background: color-mix(in srgb, var(--hl) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--hl) 80%, var(--line)); border-radius: var(--r); }
.callout p { margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 1.25rem; }
.stat { background: var(--surface); padding: 1rem 1.15rem; display: grid; gap: .1rem; }
.stat__n { font: 600 1.7rem/1.1 var(--serif); }
.stat__n small { font-size: .55em; color: var(--muted); font-weight: 500; }
.stat__l { font-size: .82rem; color: var(--muted); }
.action-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.action-card { display: grid; gap: .2rem; padding: 1.25rem; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action-card strong { font: 600 1.25rem var(--serif); }
.action-card span:last-child { color: var(--muted); font-size: .92rem; }
.action-card__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); margin-bottom: .5rem; }
.action-card--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.action-card--primary span:last-child { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.action-card--primary .action-card__icon { background: var(--hl); color: #1d1b16; }
.history { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; gap: 10px; overflow-x: auto; }
.history__item { flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.history__val { font-size: .8rem; font-weight: 600; }
.history__bar { width: 100%; height: calc(var(--h) * 0.9px); background: color-mix(in srgb, var(--good) 55%, var(--paper-2)); border-radius: 4px 4px 0 0; }
.history__item:last-child .history__bar { background: var(--good); }
.history__when { font-size: .72rem; color: var(--muted); white-space: nowrap; border-top: 1px solid var(--line); padding-top: 4px; width: 100%; text-align: center; }
.notes-read__group { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: .75rem; }
.notes-read__group > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1rem 1.25rem; }
.notes-read__group > summary::-webkit-details-marker { display: none; }
.notes-read__group > summary h3 { font: 600 1.1rem var(--serif); margin: 0; }
.notes-read__sec { padding: 0 1.25rem 1rem; }
.notes-read__sec h4 { font-size: .98rem; margin: .5rem 0 .4rem; }
.points { margin: 0; padding: 0; list-style: none; }
.points li { position: relative; padding-left: 1.1rem; margin: .45rem 0; line-height: 1.55; color: var(--ink-2); }
.points li::before { content: ""; position: absolute; left: .2rem; top: .68em; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.points .lvl-2 { margin-left: 1.25rem; font-size: .96em; }
.points .lvl-2::before { background: transparent; border: 1.5px solid var(--muted); }
.points .lvl-3 { margin-left: 2.5rem; font-size: .93em; color: var(--muted); }
.points .lvl-3::before { width: 6px; height: 1.5px; border-radius: 0; background: var(--muted); top: .8em; }
.manage summary { cursor: pointer; color: var(--muted); font-size: .92rem; }
.manage__form { margin: 1rem 0; align-items: end; }

/* Notes editor */
.editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.editor-head__fields { flex: 1; min-width: 260px; display: grid; gap: .5rem; }
.title-input { font: 600 clamp(1.6rem, 3vw, 2.2rem)/1.2 var(--serif) !important; border: 1px solid transparent !important; background: transparent !important; padding: .2rem .4rem !important; margin-left: -.4rem; }
.title-input:hover { border-color: var(--line) !important; }
.title-input:focus { outline: none; border-color: var(--ink) !important; background: var(--surface) !important; }
.subject-input { display: flex; align-items: center; gap: .5rem; max-width: 320px; }
.subject-input input { padding: .35rem .6rem; }
.save-state { margin: .5rem 0 0; white-space: nowrap; }
.save-state.is-saving::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--hl); margin-right: .4rem; animation: pulse 1s infinite; }
.save-state.is-error { color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.topic { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 1rem; overflow: hidden; }
.topic__head { display: flex; align-items: center; gap: .5rem; padding: .75rem .75rem .75rem 1rem; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.topic__head input { flex: 1; font: 600 1.2rem var(--serif); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: .3rem .4rem; min-width: 0; }
.topic__head input:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 6px; padding: .35rem .55rem; cursor: pointer; color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.icon-btn--hl { color: var(--ink); background: var(--hl-soft); }
.icon-btn--hl:hover { background: var(--hl); color: #1d1b16; }
.sec { padding: 1.1rem 1rem 1.2rem; border-bottom: 1px dashed var(--line); position: relative; }
.sec:last-of-type { border-bottom: 0; }
.sec__head { display: flex; gap: .5rem; align-items: center; margin-bottom: .35rem; }
.sec__head input { flex: 1; font-weight: 600; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: .25rem .4rem; min-width: 0; }
.sec__head input:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.pts { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .45rem; cursor: text; max-width: 80ch; }
/* Points mirror the quiz notes: level 1 = key point with a highlight bar,
   level 2 = a card, level 3 = a smaller detail under its card. */
.pt { position: relative; border-radius: var(--r-sm); }
.pt.lvl-1 { padding-left: .85rem; border-left: 3px solid var(--hl); margin-top: .55rem; }
.pt.lvl-1:first-child { margin-top: 0; }
.pt.lvl-2 { background: var(--paper); border: 1px solid var(--line); padding: .15rem .3rem; }
.pt.lvl-3 { margin-left: 1.4rem; padding-left: .7rem; border-left: 1.5px solid var(--line-2); }
.pt__view, .pt__text { line-height: 1.55; color: var(--ink); }
.pt__view { padding: .3rem .5rem; border-radius: 6px; cursor: text; white-space: pre-wrap; overflow-wrap: anywhere; }
.pt__view:hover { background: var(--hl-fill); }
.pt__view:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pt__view strong { font-weight: 650; color: var(--ink); }
.pt__placeholder { color: var(--muted); }
.pt.lvl-1 .pt__view, .pt.lvl-1 .pt__text { font-size: 1.04rem; font-weight: 500; }
.pt.lvl-2 .pt__view, .pt.lvl-2 .pt__text { font-size: .97rem; }
.pt.lvl-3 .pt__view, .pt.lvl-3 .pt__text { font-size: .92rem; color: var(--muted); }
.pt__text {
  display: block; width: 100%; border: 1px solid transparent; border-radius: 6px; background: transparent;
  padding: .3rem .5rem; resize: none; overflow: hidden; font: inherit;
}
.pt__text:focus { outline: none; border-color: var(--line-2); background: var(--surface); }
.pt__text::placeholder { color: var(--muted); }
.pt { display: flex; align-items: flex-start; gap: .25rem; }
.pt__body { flex: 1; min-width: 0; }
.pt__tools { display: flex; align-items: center; gap: .15rem; padding-top: .2rem; opacity: 0; transition: opacity .12s; }
.pt:hover .pt__tools, .pt:focus-within .pt__tools { opacity: 1; }
@media (hover: none) { .pt__tools { opacity: .75; } }
.pt__level { font: 500 .78rem var(--sans); color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: .2rem .3rem; cursor: pointer; }
.pt__level:hover, .pt__level:focus { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.pt__btn { width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.pt__btn:hover, .pt__btn:focus-visible { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.pt__btn--del:hover, .pt__btn--del:focus-visible { color: var(--bad, #b3261e); }
.sec__add { margin-top: .5rem; }
@media (max-width: 600px) {
  .pt { flex-wrap: wrap; }
  .pt__tools { width: 100%; justify-content: flex-end; padding: 0 .3rem .2rem; }
  .pt:not(.is-editing):not(:focus-within) .pt__tools { display: none; }
}
.pt:not(.is-editing) .pt__text { display: none; }
.pt.is-editing .pt__view { display: none; }
.topic__actions { display: flex; gap: .25rem; flex-wrap: wrap; }
.topic__note { display: flex; gap: .5rem; align-items: center; padding: .5rem 1rem; font-size: .88rem; background: var(--hl-fill); border-bottom: 1px solid var(--line); }
.editor-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.editor-bar .editor-help { margin: 0; }
.topic__foot { padding: .5rem 1rem .75rem; }
.topic.is-busy { opacity: .55; pointer-events: none; }
.add-topic { margin-bottom: 6rem; }
.gen-bar { position: sticky; bottom: 0; z-index: 20; padding: .75rem 0 1rem; background: linear-gradient(to top, var(--paper) 70%, transparent); }
.gen-bar__inner { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: .5rem .5rem .5rem 1.25rem; box-shadow: var(--shadow-lift); }
.gen-bar .form-error { margin: 0; flex: 1; border-radius: 999px; }
.gen-options { margin-right: auto; position: relative; }
.gen-options > summary { cursor: pointer; font-weight: 600; font-size: .92rem; list-style: none; }
.gen-options > summary::after { content: " ▾"; color: var(--muted); }
.gen-options__panel { position: absolute; bottom: calc(100% + 16px); left: -1.25rem; width: min(420px, 90vw); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-lift); padding: 1.25rem; }

/* Overlay + loader */
.overlay { position: fixed; inset: 0; z-index: 80; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(4px); display: grid; place-items: center; }
.overlay[hidden] { display: none; }
.loader { display: grid; justify-items: center; text-align: center; gap: .5rem; padding: 2rem; }
.loader__cards { position: relative; width: 84px; height: 64px; margin-bottom: 1rem; }
.loader__cards span { position: absolute; inset: 0; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--surface); animation: shuffle 1.8s ease-in-out infinite; }
.loader__cards span:nth-child(1) { animation-delay: 0s; }
.loader__cards span:nth-child(2) { animation-delay: .6s; }
.loader__cards span:nth-child(3) { animation-delay: 1.2s; background: var(--hl); }
@keyframes shuffle {
  0%, 100% { transform: translate(0, 0) rotate(-6deg); z-index: 1; }
  33% { transform: translate(18px, -10px) rotate(6deg); z-index: 3; }
  66% { transform: translate(-6px, 4px) rotate(-2deg); z-index: 2; }
}
.loader__msg { font: 600 1.25rem var(--serif); margin: 0; min-height: 1.5em; }

/* Quiz player ------------------------------------------------------------- */
.player-wrap { max-width: 760px; padding-top: 1.5rem; padding-bottom: 3rem; }
.player-head { margin-bottom: 1rem; }
.player-head--row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.player-head .back { margin: 0; }
.player-title { font: 600 1.8rem/1.2 var(--serif); }
.progress { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.progress__track { flex: 1; height: 8px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--ink); border-radius: 4px; transition: width .35s ease; }
.progress__label { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 1.75rem; animation: stepIn .3s ease;
}
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } }
.step__kind { display: inline-flex; gap: .4rem; align-items: center; font-size: .75rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; }
.step__topic { font-size: .8rem; color: var(--muted); }
.step__q { font: 500 clamp(1.25rem, 2.6vw, 1.5rem)/1.4 var(--serif); margin: 0 0 1.25rem; }
.step--notes { padding: 2rem 2.25rem 1.75rem; }
.notes-title { font: 600 1.6rem/1.2 var(--serif); margin-bottom: .35rem; }
.notes-sub { font: 600 1.05rem/1.35 var(--sans); color: var(--ink-2); margin: 0 0 1.1rem; }
.notes-sub--cont { color: var(--muted); }
.chunks { display: grid; gap: 1.35rem; max-width: 64ch; }
.chunk__lead { font-size: 1.08rem; line-height: 1.55; font-weight: 500; margin: 0 0 .6rem; padding-left: .85rem; border-left: 3px solid var(--hl); }
.chunk__lead:last-child { margin-bottom: 0; }
.chunk__items { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.chunk__item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .6rem .85rem; }
.chunk__item > p { margin: 0; line-height: 1.55; color: var(--ink); }
.chunk__subs { margin: .4rem 0 0; padding-left: 1rem; color: var(--muted); font-size: .93rem; line-height: 1.5; }
.chunk__subs li { margin: .2rem 0; }
.chunks strong { font-weight: 650; color: var(--ink); }
.page-dots { display: flex; gap: 6px; }
.page-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); transition: background .2s, width .2s; }
.page-dots span.is-on { width: 22px; border-radius: 4px; background: var(--ink); }
.options { display: grid; gap: .6rem; }
.opt {
  display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left; padding: .85rem 1rem;
  background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; font-size: 1rem; line-height: 1.4;
  transition: border-color .12s, background .12s, transform .12s;
}
.opt:hover:not([disabled]) { border-color: var(--ink); }
.opt__key { flex: none; width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-2); font-size: .8rem; font-weight: 600; color: var(--muted); }
.opt[disabled] { cursor: default; }
.opt.is-correct { border-color: var(--good); background: var(--good-bg); }
.opt.is-correct .opt__key { background: var(--good); border-color: var(--good); color: #fff; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.is-wrong .opt__key { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt.is-dim { opacity: .55; }
.tf { grid-template-columns: 1fr 1fr; }
.tf .opt { justify-content: center; font-weight: 600; padding: 1.1rem; }
.blank-sentence { font: 500 clamp(1.2rem, 2.5vw, 1.45rem)/2.1 var(--serif); margin: 0 0 1.25rem; }
.blank-input { font: inherit; font-family: var(--sans); font-size: 1rem; width: 9em; border: 0; border-bottom: 2px solid var(--ink); background: var(--hl-fill); padding: .1rem .35rem; border-radius: 4px 4px 0 0; }
.blank-input:focus { outline: none; background: var(--hl-fill-strong); }
.blank-input.is-correct { border-color: var(--good); background: var(--good-bg); }
.blank-input.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.answer-input { width: 100%; font-size: 1.05rem; padding: .8rem 1rem; border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.answer-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl-fill-strong); }
.answer-input.is-correct { border-color: var(--good); background: var(--good-bg); }
.answer-input.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.order-item { display: flex; align-items: center; gap: .6rem; padding: .6rem .6rem .6rem .9rem; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-sm); cursor: grab; touch-action: none; user-select: none; }
.order-item { position: relative; }
.order-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.order-item.is-dragging { z-index: 2; cursor: grabbing; border-color: var(--ink); box-shadow: 0 12px 28px -12px rgba(0,0,0,.45); }
.order-item.is-shifting { transition: transform .15s ease; }
.order-item__grip { color: var(--muted); display: grid; place-items: center; padding: 0 .25rem; }
.order-item:hover .order-item__grip { color: var(--ink); }
.order-item__n { font: 600 .9rem var(--serif); color: var(--muted); width: 1.2rem; }
.order-item__text { flex: 1; }
.order-item__btns { display: flex; gap: 2px; }
.order-item__btns button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.order-item__btns button:hover:not([disabled]) { border-color: var(--ink); }
.order-item__btns button[disabled] { opacity: .35; cursor: default; }
.order-item.is-correct { border-color: var(--good); background: var(--good-bg); }
.order-item.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.order-item__fix { font-size: .82rem; color: var(--bad); font-weight: 600; }
.match-rows, .cat-rows { display: grid; gap: .6rem; }
.match-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .75rem; align-items: center; padding: .6rem .75rem; border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.match-row__term { font-weight: 600; }
.match-select { width: 100%; padding: .55rem .6rem; border: 1px solid var(--line-2); border-radius: 6px; background: var(--paper); }
.match-select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl-fill-strong); }
.match-row.is-correct, .cat-row.is-correct { border-color: var(--good); background: var(--good-bg); }
.match-row.is-wrong, .cat-row.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.match-row__fix { grid-column: 2; font-size: .88rem; font-weight: 600; color: var(--good); }
.opt__box { border-radius: 4px; }
.opt--check[aria-pressed="true"] { border-color: var(--ink); background: var(--hl-fill); }
.opt--check[aria-pressed="true"] .opt__box { background: var(--ink); border-color: var(--ink); }
.opt--check[aria-pressed="true"] .opt__box::after { content: "✓"; color: var(--paper); font-size: .8rem; }
.opt--check.is-correct { border-color: var(--good); background: var(--good-bg); }
.opt--check.is-correct .opt__box { background: var(--good); border-color: var(--good); }
.opt--check.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt--check.is-wrong .opt__box { background: var(--bad); border-color: var(--bad); }
.opt--check.is-correct .opt__box::after, .opt--check.is-wrong .opt__box::after { color: #fff; }
.opt.is-missed { border-color: var(--good); border-style: dashed; }
.opt.is-missed .opt__key::after { content: "!"; color: var(--good); }
.cat-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem .75rem; border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.cat-row__item { font-weight: 500; flex: 1 1 200px; }
.segmented--cats { display: flex; flex-wrap: wrap; gap: 3px; }
.cat-btn { border: 0; background: transparent; padding: .4rem .85rem; border-radius: 999px; font-weight: 500; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.cat-btn:hover:not([disabled]) { color: var(--ink); }
.cat-btn[aria-pressed="true"], .cat-btn[aria-pressed="true"]:hover:not([disabled]) { background: var(--ink); color: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.cat-btn[disabled] { cursor: default; }
.cat-btn.is-answer { outline: 2px solid var(--good); outline-offset: -2px; }
.num-row { display: flex; align-items: center; gap: .75rem; }
.answer-input--num { max-width: 220px; font-variant-numeric: tabular-nums; }
.num-row__unit { font-weight: 600; color: var(--ink-2); }
.keypoints { margin-top: 1rem; padding: 1rem 1.15rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); display: grid; gap: .55rem; }
.keypoints__title { font-weight: 600; margin: 0 0 .15rem; }
.keypoint { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.keypoint input { margin-top: .3rem; width: 1rem; height: 1rem; accent-color: var(--good); }
.feedback { margin-top: 1.25rem; padding: 1rem 1.15rem; border-radius: var(--r-sm); border-left: 4px solid; animation: stepIn .25s ease; }
.feedback--good { background: var(--good-bg); border-color: var(--good); }
.feedback--bad { background: var(--bad-bg); border-color: var(--bad); }
.feedback__title { font-weight: 700; margin: 0 0 .2rem; }
.feedback p { margin: 0; }
.feedback__answer { margin-top: .3rem !important; }
.feedback__override { margin-top: .6rem !important; }
.step__actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.step__hint { font-size: .85rem; color: var(--muted); }
.results { text-align: center; }
.results__score { font: 600 clamp(3.5rem, 10vw, 5.5rem)/1 var(--serif); letter-spacing: -.03em; margin: .5rem 0; }
.results__ring { --p: 0; width: 180px; height: 180px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--paper-2) 0); }
.results__ring > div { width: 150px; height: 150px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.results__ring .results__score { font-size: 2.8rem; margin: 0; }
.results__actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: 1.5rem 0 .5rem; }
.review { text-align: left; margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.review h3 { font: 600 1.2rem var(--serif); }
.review__item { padding: .85rem 0; border-bottom: 1px dashed var(--line); }
.review__item p { margin: .1rem 0; }
.review__a { color: var(--good); font-weight: 600; }
.guest-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .75rem 1rem; background: color-mix(in srgb, var(--hl) 25%, var(--surface)); border: 1px solid var(--hl); border-radius: var(--r); margin-bottom: 1.5rem; }
.guest-banner p { margin: 0; }

/* Flashcards ------------------------------------------------------------- */
.deck { display: grid; gap: 1.25rem; }
.fc-scene { perspective: 1400px; }
.fc {
  position: relative; width: 100%; min-height: 320px; cursor: pointer; transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2,.7,.2,1); border: 0; background: none; padding: 0; text-align: center;
}
.fc.is-flipped { transform: rotateY(180deg); }
.fc__face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center; padding: 2.5rem 2rem 2rem; border-radius: var(--r); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lift); font: 500 clamp(1.25rem, 3vw, 1.6rem)/1.45 var(--serif);
  background:
    linear-gradient(to bottom, transparent 3.2rem, var(--margin-line) 3.2rem, var(--margin-line) calc(3.2rem + 1.5px), transparent calc(3.2rem + 1.5px)),
    repeating-linear-gradient(to bottom, var(--surface) 0 calc(2rem - 1px), var(--rule) calc(2rem - 1px) 2rem);
}
.fc__face--back { transform: rotateY(180deg); background: var(--surface); }
.fc__label { position: absolute; top: 1rem; left: 1.25rem; font: 600 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fc__tap { position: absolute; bottom: .9rem; left: 0; right: 0; font: 400 .82rem var(--sans); color: var(--muted); }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.grade { padding: .75rem .5rem; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 600; display: grid; gap: .1rem; }
.grade small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.grade:hover { border-color: var(--ink); }
.grade--again { color: var(--bad); }
.grade--easy { color: var(--good); }
.deck__hint { text-align: center; font-size: .85rem; color: var(--muted); }

.seg-links { display: inline-flex; gap: 2px; padding: 3px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 1.25rem; }
.seg-links a { padding: .35rem .9rem; border-radius: 999px; text-decoration: none; font-size: .9rem; font-weight: 500; color: var(--ink-2); }
.seg-links a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.player-head--row .seg-links { margin: 0; }

/* Study modes (set page) */
.modes { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; }
.mode { grid-column: span 2; display: grid; align-content: start; gap: .15rem; padding: 1.1rem; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.mode:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--ink); }
.mode strong { font: 600 1.12rem var(--serif); }
.mode span:last-child { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.mode__icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); margin-bottom: .45rem; }
.mode--primary, .modes .mode:nth-child(2) { grid-column: span 3; }
.mode--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mode--primary span:last-child { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.mode--primary .mode__icon { background: var(--hl); color: #1d1b16; }

/* Games */
.player-wrap--wide { max-width: 920px; }
.game-intro { text-align: center; padding: 2.5rem 1.75rem; }
.game-intro .muted { max-width: 34em; margin-inline: auto; }
.game-best { font-weight: 600; margin: .25rem 0 0; }
.game-best--new { color: var(--good); }
.game-board { display: grid; gap: 1rem; }
.game-hud { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-weight: 600; }
.game-clock { font: 600 1.6rem var(--serif); font-variant-numeric: tabular-nums; transition: color .2s; }
.game-clock.is-penalty { color: var(--bad); }
.game-score { font: 600 1.5rem var(--serif); font-variant-numeric: tabular-nums; }
.game-streak { font-size: .9rem; color: var(--muted); }
.game-streak.is-hot { color: var(--ink); background: var(--hl-fill-strong); padding: .15rem .6rem; border-radius: 999px; }
.progress__fill--time { background: var(--good); transition: width .1s linear; }
.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.match-tile {
  min-height: 120px; padding: .85rem; border-radius: var(--r); border: 1.5px solid var(--line-2); background: var(--surface);
  cursor: pointer; font-size: .92rem; line-height: 1.4; display: grid; place-items: center; text-align: center;
  transition: transform .12s, border-color .12s, background .12s, opacity .3s;
}
.match-tile span { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.match-tile--front { font: 600 1rem/1.35 var(--serif); }
.match-tile:hover:not([disabled]) { border-color: var(--ink); transform: translateY(-1px); }
.match-tile.is-selected { border-color: var(--ink); background: var(--hl-fill); box-shadow: 0 0 0 2px var(--ink) inset; }
.match-tile.is-wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake .35s; }
.match-tile.is-matched { border-color: var(--good); background: var(--good-bg); opacity: 0; transform: scale(.94); pointer-events: none; transition: opacity .35s .15s, transform .35s .15s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.step--speed { padding: 1.5rem 1.75rem; }

/* Card editor */
.edit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; margin: 0 0 1rem; position: relative; }
.edit-card__kind { font: 600 .8rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: .75rem; float: left; }
.edit-card > .field:first-of-type, .edit-card > .grid-2:first-of-type { clear: both; }
.edit-card--new { border-style: dashed; }
.edit-card--new h2 { float: none; }
.edit-card.is-deleted { opacity: .45; }
.edit-card.is-deleted .field { pointer-events: none; }
.delete-toggle { float: right; display: inline-flex; gap: .4rem; align-items: center; font-size: .88rem; color: var(--bad); cursor: pointer; }
.sticky-actions { position: sticky; bottom: 1rem; display: flex; justify-content: flex-end; }
.sticky-actions .btn { box-shadow: var(--shadow-lift); }

.settings-row .who { display: flex; gap: 1rem; align-items: center; }
.settings-row p { margin: 0; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 960px) {
  .hero__grid, .split { grid-template-columns: 1fr; gap: 2rem; }
  .features { grid-template-columns: 1fr 1fr; }
  .band .qtypes { grid-template-columns: 1fr 1fr; }
  .set-layout { grid-template-columns: 1fr; gap: 1rem; }
  .set-aside { position: static; }
  .side-list { display: flex; overflow-x: auto; gap: .4rem; padding-bottom: .25rem; }
  .side-list a { white-space: nowrap; border: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .site-nav { display: none; }
  .hide-sm { display: none; }
  .hero { padding-top: 2rem; }
  .steps { grid-template-columns: 1fr; }
  .qtypes, .band .qtypes { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__grid > div:first-child { grid-column: 1 / -1; }
  .grid-2, .checks { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .action-cards { grid-template-columns: 1fr; }
  .modes { grid-template-columns: 1fr 1fr; }
  .mode, .mode--primary, .modes .mode:nth-child(2) { grid-column: span 1; }
  .mode--primary { grid-column: 1 / -1; }
  .match-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .match-tile { min-height: 96px; font-size: .85rem; padding: .6rem; }
  .step { padding: 1.25rem; }
  .step--notes { padding: 1.4rem 1.15rem 1.25rem; }
  .chunk__item { padding: .55rem .7rem; }
  .grades { grid-template-columns: 1fr 1fr; }
  .match-row { grid-template-columns: 1fr; gap: .4rem; }
  .match-row__fix { grid-column: 1; }
  .toolbar__right { width: 100%; }
  .toolbar__right .field { flex: 1; }
  .toolbar__right input, .toolbar__right select { width: 100%; }
  .gen-bar__inner { border-radius: var(--r); padding: .75rem; }
  .gen-bar__inner .btn { flex: 1; }
  .gen-options { width: 100%; }
  .gen-options__panel { left: 0; }
  .app-nav { gap: .75rem; }
  .app-nav > a:not(.btn) { display: none; }
  .site-header__inner { gap: .75rem; }
  .tryit::before { display: none; }
  .editor-bar .editor-help { display: none; }
  .topic__head { flex-wrap: wrap; }
  .topic__head input { flex-basis: 100%; }
  .page-head > .btn { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* --- Plans & billing ------------------------------------------------------ */
.btn--block { display: flex; width: 100%; }
.is-current { cursor: default; opacity: .75; }
.center-block { margin-inline: auto; }
.pro-badge { display: inline-flex; align-items: center; font: 700 .7rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: .32rem .55rem; border-radius: 999px; background: var(--hl); color: #1d1b16; }
.pro-badge--sm { font-size: .6rem; padding: .2rem .4rem; margin-left: .25rem; }
.trial-chip { font-size: .82rem; font-weight: 600; text-decoration: none; padding: .35rem .7rem; border-radius: 999px; background: var(--hl-fill-strong); color: var(--ink); white-space: nowrap; }
.upgrade-link { font-weight: 600; text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.plan-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .85rem 1.1rem; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.plan-banner p { margin: 0; }
.plan-banner--trial { background: var(--hl-fill); border-color: color-mix(in srgb, var(--hl) 60%, var(--line)); }
.meter { display: grid; gap: .4rem; flex: 1; min-width: 220px; }
.meter__label { font-size: .92rem; }
.meter__track { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; max-width: 360px; }
.meter__fill { display: block; height: 100%; width: var(--w); background: var(--ink); border-radius: 3px; }
.plan-note { margin: .4rem 0 0; color: var(--ink-2); }
.plan-note a { color: inherit; }

.pricing__head { display: grid; justify-items: center; gap: .25rem; margin-bottom: 2rem; }
.pricing__head .lede { text-align: center; }
.pricing__reason { margin-bottom: .75rem; }
.billing-toggle { margin-top: .75rem; }
.save-tag { font-style: normal; font-size: .75rem; font-weight: 700; color: var(--good); margin-left: .3rem; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; max-width: 860px; margin: 0 auto 1rem; align-items: start; }
.plan { position: relative; display: grid; gap: .6rem; padding: 1.75rem; border: 1px solid var(--line-2); border-radius: calc(var(--r) * 1.25); background: var(--surface); }
.plan--pro { border: 2px solid var(--ink); box-shadow: var(--shadow-lift); }
.plan__badge { position: absolute; top: -.8rem; left: 1.5rem; margin: 0; font: 700 .72rem var(--sans); letter-spacing: .06em; text-transform: uppercase; background: var(--hl); color: #1d1b16; padding: .3rem .65rem; border-radius: 999px; }
.plan__name { font: 600 1.5rem var(--serif); margin: 0; }
.plan__price { margin: 0; }
.plan__price strong { font: 600 2.4rem/1 var(--serif); letter-spacing: -.02em; }
.plan__price span { color: var(--muted); font-size: .92rem; }
.plan__list { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .55rem; }
.plan__list li { position: relative; padding-left: 1.6rem; color: var(--ink-2); font-size: .95rem; }
.plan__list li::before { content: ""; position: absolute; left: 0; top: .25em; width: 1.05em; height: 1.05em; border-radius: 50%; background: var(--good-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%231f7a45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/80% no-repeat; }
.plan__list b { color: var(--ink); }
.redeem { display: flex; justify-content: center; gap: .5rem; margin: 1.5rem auto; flex-wrap: wrap; }
.redeem input { min-width: 220px; }
.redeem-inline { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.invite-strip { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; max-width: 860px; margin: 2rem auto 3rem; padding: 1.25rem 1.5rem; border: 1px dashed var(--line-2); border-radius: var(--r); }
.invite-strip p { margin: 0; }
.share-box { display: grid; gap: .75rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.share-box .block__title { margin-bottom: .25rem; }
.share-box p { margin: 0; }
.share-box__row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.share-box__url { flex: 1 1 260px; min-width: 0; padding: .5rem .7rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); font-size: .9rem; color: var(--ink-2); }
.upgrade { width: min(460px, calc(100% - 32px)); border: 1px solid var(--line-2); border-radius: calc(var(--r) * 1.25); padding: 1.75rem; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
.upgrade::backdrop { background: rgba(10, 10, 8, .55); backdrop-filter: blur(2px); }
.upgrade .block__title { margin-top: .75rem; font-size: 1.4rem; }
.upgrade__close { position: absolute; top: .6rem; right: .75rem; }
.upgrade__close button { background: none; border: 0; font-size: 1.5rem; color: var(--muted); cursor: pointer; }
.upgrade__perks { padding-left: 1.1rem; color: var(--ink-2); display: grid; gap: .3rem; margin: 0 0 1.25rem; }
.upgrade .btn-row { margin-bottom: .75rem; }
.pro-gate { gap: .5rem; }
.quiz-clock { text-align: right; font: 600 1rem var(--serif); font-variant-numeric: tabular-nums; color: var(--muted); margin: -.75rem 0 .75rem; }
@media (max-width: 720px) {
  .plans { grid-template-columns: 1fr; }
  .trial-chip { display: none; }
  .upgrade-link { display: none; }
}

/* Product screenshots, comparison table, key facts */
.small { font-size: .875rem; }
.shots__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.shot { margin: 0; }
.shot img { display: block; width: 100%; height: auto; border-radius: calc(var(--r) * 1.2); border: 1px solid var(--line); background: var(--paper-2); box-shadow: 0 10px 30px -18px rgba(0,0,0,.35); }
.shot figcaption { margin-top: .75rem; color: var(--muted); font-size: .95rem; }
.shot figcaption strong { color: var(--ink); }
.shot--inline { margin: 2rem 0 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.compare { width: 100%; border-collapse: collapse; min-width: 760px; font-size: .95rem; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.compare thead th { font-weight: 600; background: var(--paper-2); }
.compare tbody th { font-weight: 600; width: 22%; }
.compare tr:last-child th, .compare tr:last-child td { border-bottom: 0; }
.compare__us { background: var(--hl-fill); }
.facts { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 1rem; }
.facts > div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--ink-2); }
@media (max-width: 760px) {
  .shots__grid { grid-template-columns: 1fr; }
  .facts > div { grid-template-columns: 1fr; gap: .25rem; }
}

/* Quiz options dialog and skip */
.quiz-options { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.quiz-options .block__title { margin-top: 0; }
.quiz-options__group { padding: 1rem 0; border-top: 1px solid var(--line); }
.quiz-options__group:first-of-type { border-top: 0; padding-top: .25rem; }
.quiz-options__h { font: 600 1rem var(--sans); margin: 0 0 .6rem; }
.quiz-options .field { margin-bottom: 1rem; }
.quiz-options .btn-row { margin-top: .5rem; }
.quiz-options .btn-row form { margin: 0; }
.switch { display: flex; gap: .6rem; align-items: center; font-weight: 500; cursor: pointer; margin-bottom: .4rem; }
.switch input { accent-color: var(--ink); width: 1.1rem; height: 1.1rem; }
.step__skip { color: var(--muted); }
@media (max-width: 600px) { .quiz-options .checks { grid-template-columns: 1fr; } }

/* Set page header: title on the left, edit actions on the right */
.set-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.set-head__text { min-width: 0; flex: 1 1 320px; }
.set-head__actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.set-head__actions .btn svg { margin-right: .1rem; }
.menu-pop { position: relative; }
.menu-pop > summary { list-style: none; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-pop__panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 1rem; box-shadow: var(--shadow-lift); display: grid; gap: .75rem; }
.menu-pop__panel .manage__form { margin: 0; display: grid; gap: .6rem; }
.menu-pop__panel .field { margin: 0; }
.manage__delete { border-top: 1px solid var(--line); padding-top: .75rem; }
@media (max-width: 600px) { .menu-pop__panel { right: auto; left: 0; } }
.manage.menu-pop > summary.btn { color: var(--ink); font-size: .9rem; }

/* Owner statistics page */
.stats-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stats-head .seg-links { display: flex; gap: .5rem; flex-wrap: wrap; }
.stats-head .seg-links a { font-size: .88rem; padding: .35rem .75rem; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; color: var(--ink-2); }
.stats-head .seg-links a:hover { color: var(--ink); border-color: var(--ink); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 2rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; display: grid; gap: .15rem; }
.stat-tile__n { font: 600 2rem/1.1 var(--serif); color: var(--ink); }
.stat-tile__n small { font-size: 1rem; }
.stat-tile__l { font-weight: 600; font-size: .92rem; color: var(--ink); }
.stat-tile__s { font-size: .82rem; color: var(--muted); }
.mini-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.mini-chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.mini-chart figcaption { margin-bottom: .75rem; }
.mini-chart__plot { position: relative; height: 120px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line-2); padding-top: 1.1rem; }
.mini-chart__max { position: absolute; top: 0; left: 0; font-size: .72rem; }
.mini-chart__plot::before { content: ""; position: absolute; left: 0; right: 0; top: 1.1rem; border-top: 1px dashed var(--line); }
.mini-chart__col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; outline: none; }
.mini-chart__bar { display: block; width: 100%; height: var(--h); min-height: 0; background: var(--accent); border-radius: 4px 4px 0 0; }
.mini-chart__bar.is-zero { height: 2px; background: var(--line); border-radius: 1px; }
.mini-chart__col:hover .mini-chart__bar:not(.is-zero), .mini-chart__col:focus-visible .mini-chart__bar:not(.is-zero) { filter: brightness(1.2); }
.mini-chart__col:hover::after, .mini-chart__col:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 5;
  white-space: nowrap; background: var(--inverse-bg); color: var(--inverse-ink); font-size: .75rem; padding: .25rem .5rem; border-radius: 6px; pointer-events: none;
}
.mini-chart__col:first-child:hover::after, .mini-chart__col:nth-child(-n+4):hover::after { left: 0; transform: none; }
.mini-chart__col:last-child:hover::after, .mini-chart__col:nth-last-child(-n+4):hover::after { left: auto; right: 0; transform: none; }
.mini-chart__axis { display: flex; justify-content: space-between; margin-top: .35rem; }
.stats-table-toggle { margin-top: 1rem; }
.stats-table-toggle summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { background: var(--paper-2); font-weight: 600; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table--users { min-width: 860px; }
.data-table__email { display: block; font-weight: 500; overflow-wrap: anywhere; }
.pill--sm { font-size: .72rem; padding: .05rem .45rem; }
.repeat-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: start; }
.hbars { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .5rem; }
.hbars li { display: grid; grid-template-columns: 7rem 1fr 2.5rem; gap: .75rem; align-items: center; font-size: .92rem; }
.hbars__track { height: 14px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.hbars__bar { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 0 4px 4px 0; }
.hbars__n { font-weight: 600; text-align: right; }
.repeat-note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; }
.repeat-note p { margin: 0 0 .5rem; }
@media (max-width: 700px) { .repeat-grid { grid-template-columns: 1fr; } }
.stats-page { --chart: #2443c9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stats-page { --chart: #6f86f0; } }
:root[data-theme="dark"] .stats-page { --chart: #6f86f0; }
.mini-chart__bar, .hbars__bar { background: var(--chart); }
.mini-chart__bar.is-zero { background: var(--line); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; margin-top: 1.25rem; align-items: start; }
.two-col > * { min-width: 0; }
.stats-panel, [data-panel] { min-width: 0; }
.sub-title { font: 600 1rem var(--sans); margin: 1.25rem 0 .5rem; }
.two-col .sub-title:first-child { margin-top: 0; }
.kv { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.kv li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.kv li:last-child { border-bottom: 0; }
.kv--row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 0; background: none; gap: .75rem; }
.kv--row li { flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.kv--row li strong { font: 600 1.6rem/1.1 var(--serif); }
.hbars--funnel li { grid-template-columns: 11rem 1fr 2.5rem 15rem; }
.hbars__note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-page code { font-size: .85em; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .hbars--funnel li { grid-template-columns: 8.5rem 1fr 2rem; }
  .hbars--funnel .hbars__note { grid-column: 1 / -1; margin-top: -.3rem; }
}

/* Stats: extra charts and previews */
.mini-chart__axis--all { display: flex; gap: 2px; }
.mini-chart__axis--all span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; }
.line-chart { position: relative; height: 120px; padding-top: 1.1rem; border-bottom: 1px solid var(--line-2); }
.line-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.line-chart__line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart__area { fill: color-mix(in srgb, var(--chart) 16%, transparent); stroke: none; }
.line-chart__hits { position: absolute; inset: 1.1rem 0 0 0; display: flex; }
.line-chart__hits .mini-chart__col { height: 100%; }
.line-chart__hits .mini-chart__col:hover, .line-chart__hits .mini-chart__col:focus-visible { background: color-mix(in srgb, var(--chart) 10%, transparent); }
.data-table a { color: var(--ink); text-decoration-color: var(--line-2); }
.data-table a:hover { text-decoration-color: var(--ink); }
.data-table--sets td:first-child a { display: block; font-weight: 600; }
.data-table--sets { min-width: 760px; }
.pv-head { margin: .5rem 0 1.5rem; }
.pv-head a { color: inherit; }
.pv-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; position: sticky; top: 0; z-index: 3; background: var(--paper); padding: .5rem 0; }
.pv-tab { font-size: .88rem; padding: .35rem .8rem; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; color: var(--ink-2); }
.pv-tab:hover { color: var(--ink); border-color: var(--ink); }
.pv-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; counter-reset: q; }
.pv-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; counter-increment: q; }
.pv-card__meta { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 .35rem; }
.pv-card__meta .eyebrow { margin: 0; }
.pv-card__meta .eyebrow::before { content: counter(q) ". "; }
.pv-card__q { font-weight: 600; margin: 0 0 .6rem; }
.pv-card__why { margin: .6rem 0 0; }
.pv-opts, .pv-pairs { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.pv-opts li { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .94rem; }
.pv-opts li.is-right { border-color: var(--good); background: var(--good-bg); font-weight: 600; }
.pv-pairs li { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; font-size: .94rem; }
.pv-order { margin: 0; padding-left: 1.3rem; }
.pv-ans { margin: 0; }
.pv-flash { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.pv-flash__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; }
.pv-flash__front { font-weight: 600; margin: 0 0 .4rem; }
.pv-flash__back { margin: 0; color: var(--ink-2); }

/* --- Clarity pass (Oct 12) --------------------------------------------------- */
/* Library: revise tools are cards, subjects are filters, search/sort sit apart. */
.revise-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; margin: 0 0 1.75rem; }
.revise-tile { display: grid; grid-template-columns: auto 1fr auto; gap: .85rem; align-items: center; padding: .85rem 1rem; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.revise-tile:hover { border-color: var(--ink); transform: translateY(-1px); }
.revise-tile strong { display: block; font-weight: 600; }
.revise-tile__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.revise-tile__arrow { color: var(--muted); font-size: 1.1rem; }
.lib-filters { display: grid; gap: .9rem; padding: 1rem 0 1.1rem; margin-bottom: 1.25rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lib-filters__subjects { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.lib-filters__label { font: 600 .75rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-width: 4.5rem; }
.lib-filters__tools { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.lib-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.lib-search svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.lib-search input { width: 100%; padding: .5rem .8rem .5rem 2.1rem; border-radius: 999px; }
.lib-sort { display: flex; align-items: center; gap: .45rem; }
.lib-sort select { padding: .45rem .75rem; border-radius: 999px; }
.chip__n { font-size: .78em; opacity: .65; margin-left: .15rem; }
.chip[aria-pressed="true"] .chip__n { opacity: .85; }
@media (max-width: 600px) {
  .lib-filters__subjects { align-items: flex-start; flex-direction: column; gap: .5rem; }
  .lib-search { flex-basis: 100%; max-width: none; }
  .lib-sort { flex: 1; }
  .lib-sort select { flex: 1; }
}

/* Set page */
.side-label { font: 600 .72rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 1rem 0 .5rem; }
.btn--manage { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); display: inline-flex; align-items: center; gap: .4rem; }
.btn--manage:hover, .menu-pop[open] > .btn--manage { background: var(--accent); color: #fff; border-color: var(--accent); }
.manage.menu-pop > summary.btn--manage { color: var(--accent); font-size: .95rem; }
.manage.menu-pop > summary.btn--manage:hover, .manage.menu-pop[open] > summary.btn--manage { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .manage.menu-pop > summary.btn--manage:hover, :root:not([data-theme="light"]) .manage.menu-pop[open] > summary.btn--manage { color: #15140f; } }
:root[data-theme="dark"] .manage.menu-pop > summary.btn--manage:hover, :root[data-theme="dark"] .manage.menu-pop[open] > summary.btn--manage { color: #15140f; }

/* Quiz launcher with question-count slider */
.quiz-launch { cursor: default; gap: .9rem; }
.quiz-launch:hover { transform: none; }
.quiz-launch__top { display: flex; gap: .85rem; align-items: center; }
.quiz-launch__top .mode__icon { margin: 0; flex: none; }
.quiz-launch__top strong { display: block; }
.quiz-launch__sub { color: color-mix(in srgb, var(--paper) 70%, transparent); font-size: .88rem; }
.quiz-launch__slider { display: grid; gap: .35rem; }
.quiz-launch__label { font-size: .92rem; font-weight: 500; }
.quiz-launch__label output { font-weight: 700; }
.quiz-launch__ends { display: flex; justify-content: space-between; font-size: .76rem; color: color-mix(in srgb, var(--paper) 60%, transparent); }
.quiz-launch input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; --fill: 100%; }
.quiz-launch input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--hl) var(--fill), color-mix(in srgb, var(--paper) 25%, transparent) var(--fill)); }
.quiz-launch input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--paper) 25%, transparent); }
.quiz-launch input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--hl); }
.quiz-launch input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--hl); border: 3px solid var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.quiz-launch input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--hl); border: 3px solid var(--ink); }
.quiz-launch input[type=range]:focus-visible { outline: 2px solid var(--hl); outline-offset: 4px; border-radius: 6px; }
.quiz-launch__go { justify-self: start; }

/* Subject picker */
.subject-picker { display: grid; gap: .4rem; min-width: 0; }
.subject-picker__select, .subject-picker__new { width: 100%; }
.subject-input .subject-picker { min-width: 220px; }
.subject-picker__select, .subject-picker__new {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: .55rem .75rem; line-height: 1.4; font: inherit;
}
.subject-picker__select:focus, .subject-picker__new:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl-fill-strong); }
.subject-input { max-width: 360px; }
/* Quiz launcher spans the full row; the other study modes sit in a row of four. */
.modes { grid-template-columns: repeat(4, 1fr); }
.modes .mode, .modes .mode:nth-child(2) { grid-column: span 1; }
.modes .quiz-launch { grid-column: 1 / -1; grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.4fr) auto; align-items: center; column-gap: 1.75rem; }
.quiz-launch__go { justify-self: end; }
@media (max-width: 860px) {
  .modes .quiz-launch { grid-template-columns: 1fr; }
  .quiz-launch__go { justify-self: start; }
}
@media (max-width: 720px) {
  .modes { grid-template-columns: 1fr 1fr; }
}
.modes > * { min-width: 0; }
.modes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.quiz-launch input[type=range] { min-width: 0; }
@media (max-width: 960px) { .set-layout { grid-template-columns: minmax(0, 1fr); } .set-aside, .set-main { min-width: 0; } }

/* Report a question */
.report { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .6rem; }
.report__open { color: var(--muted); }
.chip--sm { font-size: .8rem; padding: .2rem .6rem; }

/* Stats console layout */
.stats-controls { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.seg-pills { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: var(--paper-2); }
.seg-pills a { padding: .3rem .8rem; border-radius: 999px; font-size: .86rem; text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.seg-pills a[aria-current] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.stats-tabs { position: sticky; top: 0; z-index: 4; display: flex; gap: .25rem; overflow-x: auto; background: var(--paper); border-bottom: 1px solid var(--line); margin: 0 0 1.5rem; padding-top: .25rem; scrollbar-width: none; }
.stats-tabs a { padding: .65rem .9rem; text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stats-tabs a:hover { color: var(--ink); }
.stats-tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--hl); font-weight: 600; }
.stats-panel > .block:first-child, .stats-panel > .stat-tiles:first-child { margin-top: 0; }
.table-tools { display: flex; gap: .5rem; justify-content: space-between; align-items: center; margin: 0 0 .6rem; flex-wrap: wrap; }
.table-tools__filter { flex: 1 1 220px; max-width: 360px; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); }
.table-tools .btn { margin-left: auto; }
th.is-sortable { cursor: pointer; user-select: none; }
th.is-sortable::after { content: " ↕"; color: var(--muted); font-weight: 400; font-size: .8em; }
th[aria-sort="ascending"]::after { content: " ↑"; color: var(--ink); }
th[aria-sort="descending"]::after { content: " ↓"; color: var(--ink); }
th.is-sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cohort td, .cohort th { text-align: center; }
.cohort td:first-child, .cohort th:first-child { text-align: left; }
.cohort__cell { background: color-mix(in srgb, var(--chart) calc(var(--a, 0) * 100%), transparent); font-weight: 600; }
.hbars__label--wide { min-width: 12rem; }
.hbars li:has(.hbars__label--wide) { grid-template-columns: 12rem 1fr 2.5rem; }

/* Cookie choice for the optional Google Ads tag */
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 60; max-width: 34rem; margin-left: auto;
  display: flex; flex-direction: column; gap: .7rem; padding: 1rem 1.1rem; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.cookie-banner[hidden] { display: none; }
.cookie-banner__text { margin: 0; font-size: .9rem; line-height: 1.45; }
.cookie-banner__actions { display: flex; gap: .5rem; justify-content: flex-end; }
.cookie-banner__actions .btn { min-width: 6.5rem; }
