/* Study Hub. One stylesheet. Study-desk vocabulary drawn flat: index cards,
   bubble sheets, highlighters, red pen, sticky notes, a gold star.
   Tokens first; every colour below comes from them. */

@font-face {
  font-family: "Recursive";
  src: url("fonts/recursive.woff2") format("woff2");
  font-weight: 300 1000;
  font-display: swap;
}

:root {
  --desk: #edf1f7;
  --paper: #ffffff;
  --ink: #1d2b5c;
  --ink-2: #47547f;
  --ink-3: #6f7a9e;
  --rule: #b3cbeb;
  --rule-soft: #d9e2ef;
  --red: #d33545;
  --hl-yellow: #ffe46b;
  --hl-green: #8ee59a;
  --hl-pink: #ff9ccf;
  --hl-blue: #a9dcff;
  --graphite: #343947;
  --sticky: #ffe98a;
  --gold: #f2b705;
  --gold-edge: #b98700;
  --focus: #2f6fe0;
  --on-hl: #1d2b5c;
  --shadow: 0 1px 0 var(--rule-soft), 0 12px 28px -18px rgba(29, 43, 92, 0.45);
  --radius: 6px;
  --casual: "CASL" 1;
  --font: "Recursive", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #131c38; --paper: #1c2749; --ink: #e8ecf8; --ink-2: #bcc4de; --ink-3: #8b97bb;
    --rule: #34497c; --rule-soft: #2a3862; --red: #ff6f7c; --hl-yellow: #f3d64a;
    --hl-green: #6fd886; --hl-pink: #ff88c3; --hl-blue: #5fb3f0; --graphite: #dde2f2;
    --sticky: #e8d36b; --gold: #f7c531; --gold-edge: #c79a14; --focus: #8fb4ff;
    --shadow: 0 1px 0 #0c1329, 0 14px 30px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #131c38; --paper: #1c2749; --ink: #e8ecf8; --ink-2: #bcc4de; --ink-3: #8b97bb;
  --rule: #34497c; --rule-soft: #2a3862; --red: #ff6f7c; --hl-yellow: #f3d64a;
  --hl-green: #6fd886; --hl-pink: #ff88c3; --hl-blue: #5fb3f0; --graphite: #dde2f2;
  --sticky: #e8d36b; --gold: #f7c531; --gold-edge: #c79a14; --focus: #8fb4ff;
  --shadow: 0 1px 0 #0c1329, 0 14px 30px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ------------------------------------------------------------- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variation-settings: "CASL" 0, "MONO" 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 780; letter-spacing: -0.015em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 0.8em; }
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.18em; text-decoration-thickness: 2px; }
a:hover { text-decoration-color: var(--red); }
code { font-family: ui-monospace, monospace; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }

.page { width: 100%; max-width: 48rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-wide { max-width: 76rem; }
.page-auth { max-width: 28rem; padding-top: 2.5rem; }
.page-focus { max-width: 44rem; padding-top: 0.5rem; }
.lede { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: var(--step--1); font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.section-h { font-size: var(--step-1); margin: 2rem 0 0.75rem; display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.h-aside { font-size: var(--step--1); font-weight: 500; color: var(--ink-3); }
.crumbs { font-size: var(--step--1); color: var(--ink-3); margin: 0 0 0.35rem; }
.crumbs a { color: var(--ink-2); }
.note-line { color: var(--ink-2); font-size: 0.95rem; margin-top: 0.75rem; }
.warn-line { color: var(--red); font-weight: 600; }

/* ------------------------------------------------------------ chrome ---- */
.staging-band {
  background: repeating-linear-gradient(-45deg, #ffcf3f 0 12px, #ffbf00 12px 24px);
  color: #2b2100; text-align: center; font-weight: 700; font-size: var(--step--1); padding: 0.3rem 1rem;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem max(1rem, env(safe-area-inset-left)); max-width: 76rem; margin: 0 auto; width: 100%;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; font-weight: 820; font-size: 1.15rem; font-variation-settings: "CASL" 1; }
.brand-mark { width: 2rem; height: 2rem; }
.bm-back { fill: var(--rule-soft); }
.bm-card { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.bm-red { stroke: var(--red); stroke-width: 1.5; }
.bm-line { stroke: var(--rule); stroke-width: 1.5; stroke-linecap: round; }
.topnav { display: flex; align-items: center; gap: 1rem; font-size: 0.95rem; }
.topnav a { text-decoration: none; color: var(--ink-2); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav a:hover { color: var(--ink); }
.theme-toggle { background: none; border: 0; padding: 0.25rem; cursor: pointer; color: var(--ink-2); display: inline-flex; }
.theme-toggle svg { width: 1.3rem; height: 1.3rem; fill: currentColor; }
.foot { text-align: center; color: var(--ink-3); font-size: var(--step--1); padding: 1.5rem 1rem 2rem; }
.flashes { max-width: 48rem; margin: 0 auto; padding: 0 1rem; }
.flash { background: var(--paper); border-left: 4px solid var(--hl-green); padding: 0.6rem 0.9rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.flash-error { border-left-color: var(--red); }

/* ----------------------------------------------------------- controls --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 680; font-size: 0.98rem; line-height: 1.2;
  padding: 0.62rem 1.05rem; min-height: 2.75rem;
  border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-quiet { border-color: transparent; background: transparent; text-decoration: underline; text-decoration-color: var(--rule); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-small { min-height: 2.25rem; padding: 0.4rem 0.8rem; font-size: 0.9rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 620; font-size: 0.95rem; }
input, select, textarea {
  font: inherit; font-weight: 450; color: var(--ink); background: var(--paper);
  border: 2px solid var(--rule); border-radius: 8px; padding: 0.6rem 0.75rem; min-height: 2.75rem; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--hl-blue); }
input[aria-invalid="true"] { border-color: var(--red); }
.field-error, .form-error { color: var(--red); font-weight: 600; font-size: 0.9rem; }
.radio { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 500; }
.radio input { width: auto; min-height: 0; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 10rem; }

/* ----------------------------------------------------------- paper ------ */
.index-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.auth-card h1 { font-variation-settings: "CASL" 1; }
.auth-card { border-top: 3px solid var(--red); }
.auth-alt { margin: 1.25rem 0 0; color: var(--ink-2); font-size: 0.95rem; }
.empty { text-align: center; }
.draft-tag { font-size: 0.72rem; font-weight: 700; vertical-align: middle; background: var(--hl-blue); color: var(--on-hl); padding: 0.1rem 0.45rem; border-radius: 4px; letter-spacing: 0; }

/* ruled index-card lines, reused by the deck and the flashcards */
.ruled {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--red), var(--red)),
    repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), var(--rule) calc(2rem - 1px) 2rem);
  background-size: 100% 2px, 100% 100%;
  background-position: 0 3.1rem, 0 3.1rem;
  background-repeat: no-repeat, no-repeat;
}

/* ------------------------------------------------------------ home ------ */
.home-hero { display: grid; gap: 1.5rem; align-items: center; margin: 0.5rem 0 1rem; }
@media (min-width: 720px) { .home-hero { grid-template-columns: 1.3fr 1fr; } }
.deck { position: relative; display: block; text-decoration: none; min-height: 13.5rem; margin: 0.5rem 0.75rem 0.75rem; }
.deck-card { position: absolute; inset: 0; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.deck-3 { transform: rotate(-4deg) translate(-6px, 6px); background: var(--rule-soft); }
.deck-2 { transform: rotate(2.5deg) translate(4px, 3px); }
.deck-1 {
  position: relative; display: flex; flex-direction: column; min-height: 13.5rem; padding: 0.85rem 1.4rem 1.25rem;
  transition: transform 0.2s ease;
  background-image:
    linear-gradient(var(--red), var(--red)),
    repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), var(--rule) calc(2rem - 1px) 2rem);
  background-size: 100% 2px, 100% 100%; background-position: 0 2.9rem, 0 2.9rem; background-repeat: no-repeat, no-repeat;
}
.deck:hover .deck-1, .deck:focus-visible .deck-1 { transform: translateY(-4px) rotate(-0.6deg); }
.deck-kicker { font-size: var(--step--1); color: var(--ink-3); font-weight: 600; height: 2.1rem; display: flex; align-items: center; }
.deck-line { font-variation-settings: "CASL" 1; font-weight: 760; font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 2rem; margin-top: 0.1rem; }
.deck-sub { color: var(--ink-2); line-height: 2rem; }
.deck-go { margin-top: auto; align-self: flex-start; font-weight: 750; color: var(--red); line-height: 2rem; border-bottom: 2px solid var(--red); }
.greet h1 { font-variation-settings: "CASL" 1; font-size: var(--step-3); }
.streak { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; color: var(--ink-2); }
.streak-empty { color: var(--ink-2); }
.tally { display: inline-flex; gap: 0.35rem; align-items: center; }
.tally-group { width: 1.9rem; height: 1.5rem; }
.tally-group path { stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; fill: none; }
.tally-group .tally-slash { stroke: var(--red); }
.tally-num { font-weight: 800; font-size: 1.4rem; }

.test-list { list-style: none; padding: 0; margin: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.test-list li + li { border-top: 1px solid var(--rule-soft); }
.test-row { display: flex; gap: 1rem; justify-content: space-between; align-items: center; padding: 1rem 1.1rem; text-decoration: none; }
.test-row:hover .tr-title { text-decoration: underline; text-decoration-color: var(--red); }
.tr-main { display: flex; flex-direction: column; min-width: 0; }
.tr-class { font-size: var(--step--1); color: var(--ink-3); font-weight: 600; }
.tr-title { font-weight: 760; font-size: var(--step-1); }
.tr-when { color: var(--ink-2); font-size: 0.92rem; }
.tr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex-shrink: 0; }
.tr-pct { font-size: var(--step--1); color: var(--ink-2); }
.tr-due { font-size: var(--step--1); font-weight: 700; background: var(--hl-yellow); color: var(--on-hl); padding: 0 0.4rem; border-radius: 3px; }
.exam-soon { color: var(--red); font-weight: 700; }

/* ------------------------------------------------------ meters --------- */
.meter { display: inline-block; width: 5.5rem; height: 0.55rem; border-radius: 999px; background: var(--rule-soft); overflow: hidden; flex-shrink: 0; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--hl-yellow); width: 0; }
.meter-weak .meter-fill { background: var(--hl-pink); }
.meter-learning .meter-fill { background: var(--hl-yellow); }
.meter-known .meter-fill { background: var(--hl-green); }
.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}.w50{width:50%}.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: var(--step--1); color: var(--ink-3); margin-top: 0.6rem; }
.lg::before { content: ""; display: inline-block; width: 0.8rem; height: 0.55rem; border-radius: 99px; margin-right: 0.35rem; }
.lg-weak::before { background: var(--hl-pink); }
.lg-learning::before { background: var(--hl-yellow); }
.lg-known::before { background: var(--hl-green); }

/* --------------------------------------------------- test header/tabs --- */
.test-head h1 { font-size: var(--step-3); margin-bottom: 0.25rem; }
.test-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--ink-2); font-size: 0.95rem; }
.tabs { display: flex; gap: 0.25rem; margin: 1.1rem 0 0.5rem; border-bottom: 2px solid var(--rule-soft); }
.tab { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 0.8rem; text-decoration: none; font-weight: 650; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab svg .filled { fill: currentColor; }
.tab.is-on { color: var(--ink); border-bottom-color: var(--red); }
.tab-count { font-size: 0.72rem; background: var(--hl-yellow); color: var(--on-hl); border-radius: 99px; padding: 0 0.4rem; font-weight: 800; }
@media (max-width: 699px) {
  /* thumb reach: the four sections of a test live in a bar at the bottom on phones */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; border: 0;
    background: var(--paper); box-shadow: 0 -1px 0 var(--rule-soft), 0 -8px 20px -12px rgba(0,0,0,.25);
    padding: 0.2rem 0.25rem calc(0.2rem + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .tab { flex-direction: column; gap: 0.1rem; font-size: 0.72rem; padding: 0.45rem 0.25rem; border-bottom: 0; border-top: 3px solid transparent; margin: 0; flex: 1; position: relative; }
  .tab.is-on { border-top-color: var(--red); }
  .tab-count { position: absolute; top: 0.2rem; left: calc(50% + 0.5rem); }
  body:has(.tabs) .foot { padding-bottom: 6rem; }
}

/* ------------------------------------------------------------ today ---- */
.plan-steps { list-style: none; padding: 0; margin: 0; counter-reset: step; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.plan-step { counter-increment: step; display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1rem; }
.plan-step + .plan-step { border-top: 1px solid var(--rule-soft); }
.plan-step::before {
  content: counter(step); flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%;
  border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 0.95rem;
}
.plan-step.is-done::before { content: ""; background: var(--hl-green); border-color: var(--hl-green); }
.plan-what { flex: 1; font-weight: 700; display: flex; flex-direction: column; }
.plan-why { font-weight: 450; color: var(--ink-2); font-size: 0.92rem; }
.topic-check { list-style: none; padding: 0; margin: 0; }
.tc-row a { display: grid; grid-template-columns: 1.3rem 1fr auto auto; gap: 0.75rem; align-items: center; padding: 0.6rem 0.25rem; text-decoration: none; border-bottom: 1px solid var(--rule-soft); }
.topic-check.compact .tc-row a { grid-template-columns: 1fr auto auto; }
.tc-box { width: 1.2rem; height: 1.2rem; border: 2px solid var(--ink-3); border-radius: 4px; }
.tc-known .tc-box { background: var(--hl-green); border-color: var(--hl-green); }
.tc-learning .tc-box { background: linear-gradient(135deg, var(--hl-yellow) 50%, transparent 50%); border-color: var(--ink-3); }
.tc-weak .tc-box { border-color: var(--hl-pink); }
.tc-title { font-weight: 600; }
.tc-ch { color: var(--ink-3); font-size: var(--step--1); white-space: nowrap; }
.prof-pin { font-size: 0.72rem; font-weight: 750; background: var(--sticky); color: #3d3200; padding: 0.05rem 0.4rem; border-radius: 2px; white-space: nowrap; }
.attempt-list { list-style: none; padding: 0; margin: 0; }
.attempt-list a { display: flex; justify-content: space-between; padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--rule-soft); text-decoration: none; }

/* -------------------------------------------------------- mode tiles ---- */
.mode-grid, .sheet-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-top: 1rem; }
.mode-tile, .sheet-tile { display: flex; flex-direction: column; gap: 0.2rem; padding: 1.1rem 1.2rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; transition: transform 0.12s ease; }
.mode-tile:hover, .sheet-tile:hover { transform: translateY(-2px); }
.mt-name, .st-name { font-weight: 760; font-size: var(--step-1); }
.mt-big { font-weight: 850; font-size: var(--step-4); line-height: 1; font-variation-settings: "CASL" 1; }
.mode-review { border-top: 3px solid var(--red); }
.mt-desc, .st-meta { color: var(--ink-2); font-size: 0.93rem; }
.sheet-tile { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 0.9rem; }
.sheet-tile .st-name, .sheet-tile .st-meta { flex-basis: calc(100% - 3.9rem); }
.st-letter { width: 3rem; height: 3rem; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-weight: 850; font-size: 1.35rem; grid-row: span 2; }
.sheet-tile .st-letter { align-self: flex-start; }
.st-letter svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-weak .st-letter { border-color: var(--red); color: var(--red); }
.sheet-tile.is-empty { opacity: 0.6; pointer-events: none; }
.cram-pick { max-width: 30rem; }
.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.chip { padding: 0.4rem 0.85rem; border-radius: 99px; border: 2px solid var(--rule); text-decoration: none; font-weight: 620; font-size: 0.92rem; background: var(--paper); }
.browse { margin-top: 2rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.25rem 1rem; }
.browse summary { cursor: pointer; font-weight: 700; padding: 0.7rem 0; }
.browse-list { padding-left: 1.4rem; }
.browse-list li { padding: 0.5rem 0; border-top: 1px solid var(--rule-soft); display: flex; flex-direction: column; }
.bf { font-weight: 650; }
.bb { color: var(--ink-2); }

/* ------------------------------------------------------ focus pages ---- */
.focus-page .foot { display: none; }
.focus-bar { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; margin-bottom: 0.4rem; }
.focus-exit { font-weight: 700; color: var(--ink-2); }
.focus-title { margin: 0; text-align: center; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-count { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 3.5rem; text-align: right; }
.progress { height: 0.35rem; background: var(--rule-soft); border-radius: 99px; overflow: hidden; margin-bottom: 1rem; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--hl-green); transition: width 0.3s ease; }
.loading { text-align: center; color: var(--ink-3); padding: 3rem 0; }
.key-hint { text-align: center; color: var(--ink-3); font-size: var(--step--1); margin-top: 1.25rem; }
@media (hover: none) { .key-hint { display: none; } }

/* ------------------------------------------------------- flashcards ---- */
.fc-stage { perspective: 1400px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.flashcard { position: relative; width: 100%; min-height: min(21rem, 58vh); cursor: pointer; transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(.3,.7,.3,1); }
.flashcard.is-flipped { transform: rotateY(180deg); }
.flashcard.is-dragging { transition: none; }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.75rem 1.4rem 1.2rem;
  display: flex; flex-direction: column;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--red), var(--red)),
    repeating-linear-gradient(to bottom, transparent 0 calc(2.1rem - 1px), var(--rule) calc(2.1rem - 1px) 2.1rem);
  background-size: 100% 2px, 100% 100%; background-position: 0 2.6rem, 0 2.6rem; background-repeat: no-repeat, no-repeat;
}
.fc-back { transform: rotateY(180deg); }
.fc-top { height: 1.9rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: var(--step--1); color: var(--ink-3); font-weight: 600; }
.fc-new { color: var(--red); }
.fc-text { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; font-variation-settings: "CASL" 1; font-weight: 640; font-size: clamp(1.3rem, 4.8vw, 1.75rem); line-height: 2.1rem; padding: 0.7rem 0; overflow-wrap: anywhere; }
.fc-back .fc-text { font-size: clamp(1.1rem, 4vw, 1.4rem); font-weight: 560; text-align: left; justify-content: flex-start; }
.fc-src { font-size: var(--step--1); color: var(--ink-3); line-height: 1.3; }
.fc-tap { text-align: center; font-size: var(--step--1); color: var(--ink-3); }
.fc-stamp { position: absolute; top: 1.2rem; padding: 0.2rem 0.6rem; border: 3px solid; border-radius: 6px; font-weight: 850; font-size: 1.2rem; opacity: 0; transform: rotate(-10deg); pointer-events: none; font-variation-settings: "CASL" 1; }
.fc-stamp-no { left: 1rem; color: var(--red); }
.fc-stamp-yes { right: 1rem; color: #1f9a45; transform: rotate(10deg); }
.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 1.1rem; }
.rate-row.two { grid-template-columns: 1fr 1fr; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 0.05rem; font: inherit; font-weight: 720; padding: 0.55rem 0.25rem; min-height: 3.4rem; border-radius: 12px; border: 2px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.rate small { font-weight: 500; color: var(--ink-3); font-size: 0.78rem; }
.rate-1, .rate-missed { border-color: var(--red); color: var(--red); }
@media (hover: none) { .rate-row.two small { display: none; } }
.rate-4, .rate-got { border-color: #1f9a45; }
.rate:active { transform: translateY(1px); }
.rate-row[aria-hidden="true"] { visibility: hidden; }
.card-tools { display: flex; justify-content: center; margin-top: 0.75rem; }
.link-btn { background: none; border: 0; font: inherit; color: var(--ink-3); text-decoration: underline; cursor: pointer; font-size: 0.9rem; padding: 0.4rem; }
.done { text-align: center; padding: 2rem 1rem; }
.done h2 { font-variation-settings: "CASL" 1; font-size: var(--step-3); }
.done-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
@media (prefers-reduced-motion: reduce) {
  .flashcard { transition: none; }
  .flashcard.is-flipped { transform: none; }
  .flashcard.is-flipped .fc-front { visibility: hidden; }
  .fc-back { transform: none; visibility: hidden; }
  .flashcard.is-flipped .fc-back { visibility: visible; }
}

/* ---------------------------------------------------- practice test ---- */
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
@media (min-width: 960px) {
  .page-focus:has(.quiz-app) { max-width: 66rem; }
  .quiz-layout { grid-template-columns: minmax(0, 1fr) 15.5rem; align-items: start; }
  .sheet-toggle { display: none; }
  .answer-sheet[hidden] { display: block !important; }
}
.q-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.25rem 1.1rem; }
.q-meta { display: flex; justify-content: space-between; gap: 0.5rem; font-size: var(--step--1); color: var(--ink-3); font-weight: 600; margin-bottom: 0.6rem; }
.q-num { color: var(--red); font-weight: 800; }
.q-stem { font-size: var(--step-1); font-weight: 650; line-height: 1.4; margin-bottom: 1rem; }
.choices { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.choice { display: flex; align-items: flex-start; gap: 0.8rem; width: 100%; text-align: left; font: inherit; color: var(--ink); background: transparent; border: 2px solid transparent; border-radius: 12px; padding: 0.55rem 0.6rem; cursor: pointer; }
.choice:hover { background: var(--desk); }
.bubble { flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--ink-2); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; color: var(--ink-2); transition: background 0.15s; }
.choice-text { padding-top: 0.2rem; line-height: 1.4; }
.choice.is-picked .bubble { background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--graphite) 80%, transparent), var(--graphite) 70%); border-color: var(--graphite); color: var(--paper); }
.choice.is-right { background: linear-gradient(100deg, transparent 0.2rem, color-mix(in srgb, var(--hl-green) 70%, transparent) 0.4rem, color-mix(in srgb, var(--hl-green) 70%, transparent) calc(100% - 0.3rem), transparent); }
.choice.is-right .choice-text { color: var(--on-hl); }
.choice.is-wrong .choice-text { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.choice.is-wrong .bubble { border-color: var(--red); box-shadow: 0 0 0 3px var(--red); }
.choices.is-locked .choice { cursor: default; }
.choices.is-locked .choice:hover { background: transparent; }
.choices.is-locked .choice.is-right:hover { background: linear-gradient(100deg, transparent 0.2rem, color-mix(in srgb, var(--hl-green) 70%, transparent) 0.4rem, color-mix(in srgb, var(--hl-green) 70%, transparent) calc(100% - 0.3rem), transparent); }
.explain { margin-top: 1rem; border-left: 4px solid var(--rule); padding: 0.2rem 0 0.2rem 0.9rem; }
.explain-h { font-weight: 800; margin-bottom: 0.2rem; }
.explain-h.ok { color: #1f9a45; }
.explain-h.no { color: var(--red); }
.explain-src { font-size: var(--step--1); color: var(--ink-3); }
.q-nav { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 1.1rem; flex-wrap: wrap; }
.q-nav .spacer { flex: 1; }
.feedback-toggle { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 550; color: var(--ink-2); margin: 0 0 0.9rem; }
.feedback-toggle input { width: auto; min-height: 0; }
.sheet-toggle { width: 100%; margin-top: 0.25rem; }
.answer-sheet { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.9rem; border-top: 3px solid var(--red); }
.as-h { font-weight: 750; font-size: 0.95rem; margin-bottom: 0.6rem; display: flex; justify-content: space-between; }
.as-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.35rem 0.3rem; }
.as-cell { display: flex; align-items: center; justify-content: center; gap: 0.25rem; font: inherit; font-size: 0.72rem; font-weight: 700; color: var(--ink-3); background: none; border: 0; padding: 0.25rem 0; cursor: pointer; border-radius: 6px; font-variant-numeric: tabular-nums; }
.as-cell i { width: 0.95rem; height: 0.95rem; border-radius: 50%; border: 1.5px solid var(--ink-3); display: inline-block; }
.as-cell.is-done i { background: var(--graphite); border-color: var(--graphite); }
.as-cell.is-ok i { background: var(--hl-green); border-color: #1f9a45; }
.as-cell.is-no i { background: var(--hl-pink); border-color: var(--red); }
.as-cell.is-here { color: var(--ink); background: var(--desk); }
.as-submit { width: 100%; margin-top: 0.9rem; }
.turn-in { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-top: 1rem; border-left: 4px solid var(--red); }

/* ---------------------------------------------------------- results ---- */
.grade { position: relative; overflow: hidden; display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; margin: 0.5rem 0 1rem; }
.grade-mark { width: 8.5rem; height: 8.5rem; flex-shrink: 0; border: 4px solid var(--red); border-radius: 50% 46% 52% 48% / 48% 52% 47% 53%; transform: rotate(-6deg); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--red); font-variation-settings: "CASL" 1; }
.gm-score { font-weight: 850; font-size: 2.4rem; line-height: 1; }
.gm-score span { font-size: 1.2rem; }
.gm-pct { font-weight: 700; }
.grade-text { flex: 1; min-width: 14rem; }
.grade-text h1 { font-size: var(--step-2); }
.grade-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.gold-star { position: absolute; top: 0.6rem; right: 0.6rem; width: 4.6rem; height: 4.6rem; animation: stick 0.7s cubic-bezier(.2,1.6,.4,1) 0.25s both; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.gold-star path { fill: var(--gold); stroke: var(--gold-edge); stroke-width: 3; stroke-linejoin: round; }
@keyframes stick { from { transform: scale(1.8) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(12deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gold-star { animation: none; transform: rotate(12deg); } }
.review-list { padding-left: 1.3rem; }
.rv { padding: 1rem 0; border-bottom: 1px solid var(--rule-soft); }
.rv-stem { font-weight: 650; }
.rv-choices { list-style: none; padding: 0; margin: 0 0 0.6rem; display: flex; flex-direction: column; gap: 0.25rem; }
.rv-choices li { padding: 0.25rem 0.5rem; border-radius: 6px; }
.rv-right, .rv-right-line { background: color-mix(in srgb, var(--hl-green) 65%, transparent); color: var(--on-hl); }
.rv-right-line { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px; }
.rv-wrong { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.rv-tag { font-size: 0.72rem; font-weight: 800; text-decoration: none; display: inline-block; margin-left: 0.3rem; color: var(--red); }
.rv-right .rv-tag { color: var(--on-hl); }
.rv-why { color: var(--ink-2); }
.rv-src { font-size: var(--step--1); color: var(--ink-3); }

/* ------------------------------------------------------------ notes ---- */
.notes-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-top: 1rem; }
@media (min-width: 1000px) {
  .notes-page .page { max-width: 70rem; }
  .notes-layout { grid-template-columns: 15rem minmax(0, 44rem); justify-content: center; }
  .notes-toc { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow: auto; }
}
.notes-toc { font-size: 0.93rem; }
.toc-details summary { font-weight: 800; cursor: pointer; padding: 0.3rem 0; }
.toc-ch { font-weight: 700; color: var(--ink-3); font-size: var(--step--1); margin: 0.8rem 0 0.2rem; }
.notes-toc ul { list-style: none; padding: 0; margin: 0; }
.toc-link { display: block; padding: 0.28rem 0.5rem; margin-left: -0.5rem; border-left: 4px solid var(--rule-soft); text-decoration: none; }
.toc-weak { border-left-color: var(--hl-pink); }
.toc-learning { border-left-color: var(--hl-yellow); }
.toc-known { border-left-color: var(--hl-green); }
.prof-dot { display: inline-block; width: 0.6rem; height: 0.6rem; background: var(--sticky); border: 1px solid #b9a22a; transform: rotate(8deg); }
.print-btn { margin-top: 0.75rem; padding-left: 0; }
.notes { font-size: 1.08rem; line-height: 1.68; }
.overview { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.4rem; margin-bottom: 1.5rem; border-top: 3px solid var(--red); }
.ov-intro { font-size: 1.12rem; }
.must-know h2 { font-size: var(--step-1); font-variation-settings: "CASL" 1; margin-top: 0.8rem; }
.must-know ul { padding-left: 0; list-style: none; margin: 0; }
.must-know li { padding: 0.35rem 0 0.35rem 1.9rem; position: relative; border-bottom: 1px solid var(--rule-soft); }
.must-know li::before { content: ""; position: absolute; left: 0.1rem; top: 0.62rem; width: 1.05rem; height: 1.05rem; border: 2px solid var(--ink-2); border-radius: 3px; }
.ch-h { font-size: var(--step-2); margin: 2.5rem 0 0.25rem; display: flex; flex-direction: column; }
.ch-h span { font-size: var(--step-0); font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.topic { padding: 1.4rem 0 1.2rem; border-bottom: 2px dashed var(--rule-soft); scroll-margin-top: 1rem; }
.topic:target .topic-h h3 { background: var(--hl-yellow); color: var(--on-hl); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.topic-h { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.topic-h h3 { margin-bottom: 0.4rem; font-size: 1.35rem; }
.topic-summary { font-weight: 560; }
.term { background: var(--hl-yellow); color: var(--on-hl); padding: 0 0.18em; border-radius: 0.2em 0.35em 0.25em 0.3em; box-decoration-break: clone; -webkit-box-decoration-break: clone; cursor: help; }
.term:focus-visible { outline-offset: 1px; }
.term-pop { position: absolute; z-index: 40; max-width: min(22rem, calc(100vw - 2rem)); background: var(--ink); color: var(--paper); padding: 0.7rem 0.85rem; border-radius: 10px; font-size: 0.93rem; line-height: 1.45; box-shadow: 0 10px 24px -8px rgba(0,0,0,.45); }
.term-pop b { display: block; margin-bottom: 0.15rem; }
.sticky-note { background: var(--sticky); color: #3d3200; padding: 0.9rem 1rem 1rem; margin: 0.5rem 0 1rem; transform: rotate(-0.8deg); box-shadow: 0 10px 16px -12px rgba(0,0,0,.5); font-variation-settings: "CASL" 1; font-size: 1.02rem; line-height: 1.5; max-width: 34rem; }
.sticky-note b { display: block; }
.block-title { font-weight: 750; margin: 1rem 0 0.3rem; }
.bullets { padding-left: 1.3rem; }
.bullets li { margin-bottom: 0.3rem; }
.bullets li::marker { color: var(--red); }
.example, .mnemonic { border-left: 4px solid var(--rule); padding: 0.1rem 0 0.1rem 1rem; margin: 1rem 0; }
.mnemonic { border-left-color: var(--hl-pink); }
.example-label { font-weight: 800; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 0.1rem; }
.compare-wrap { overflow-x: auto; margin: 1rem 0; }
.compare { border-collapse: collapse; width: 100%; font-size: 0.97rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule-soft); }
.compare thead th { border-bottom: 2px solid var(--red); font-weight: 800; }
.compare tbody th { font-weight: 700; }
@media (max-width: 599px) {
  /* phones: each row becomes a small card, column names become labels */
  .compare, .compare tbody, .compare tr, .compare th, .compare td { display: block; width: 100%; }
  .compare thead { display: none; }
  .compare { background: none; box-shadow: none; }
  .compare tr { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 0.6rem; padding: 0.35rem 0.85rem 0.55rem; border-left: 4px solid var(--red); }
  .compare th, .compare td { border: 0; padding: 0.3rem 0; }
  .compare tbody th { font-size: 1.05rem; }
  .compare td:empty { display: none; }
  .compare td::before, .compare th[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 0.78rem; font-weight: 750; color: var(--ink-3); }
  .compare-wrap { overflow: visible; }
}
.glossary { margin: 1.1rem 0 0.5rem; padding: 0.4rem 1rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 0.97rem; }
.glossary div { padding: 0.45rem 0; border-bottom: 1px solid var(--rule-soft); }
.glossary div:last-child { border-bottom: 0; }
.glossary dt { font-weight: 780; display: inline; }
.glossary dt::after { content: ": "; }
.glossary dd { display: inline; margin: 0; }
.topic-f { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.topic-src { color: var(--ink-3); font-size: var(--step--1); flex-basis: 100%; }
.notes-end { color: var(--ink-3); font-size: 0.92rem; margin-top: 2rem; }

/* ------------------------------------------------------------- flags ---- */
.flag-panel { position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; justify-content: center; padding: 1rem; background: color-mix(in srgb, var(--desk) 60%, transparent); }
.flag-form { background: var(--paper); border-radius: 14px; box-shadow: 0 -4px 30px rgba(0,0,0,.25); padding: 1.1rem; width: 100%; max-width: 30rem; display: flex; flex-direction: column; gap: 0.5rem; }
.flag-h { font-weight: 800; margin: 0 0 0.2rem; }
.flag-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 99px; font-weight: 650; z-index: 60; }

/* ------------------------------------------------------------- account/admin */
.account-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.account-grid h2 { font-size: var(--step-1); margin: 0; }
.danger-zone { border-top: 3px solid var(--red); }
.admin-sec { margin: 2rem 0; }
.admin-sec h2 { font-size: var(--step-1); }
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.admin-table th { font-weight: 800; }
.admin-table .bad, .bad summary { color: var(--red); }
.is-disabled td { color: var(--ink-3); }
.role { font-size: 0.72rem; font-weight: 800; background: var(--rule-soft); padding: 0 0.35rem; border-radius: 3px; }
.pub-on { font-weight: 800; color: #1f9a45; }
.pub-off { font-weight: 700; color: var(--ink-3); }
.flag-list { list-style: none; padding: 0; margin: 0; }
.flag-list li { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.9rem 1rem; margin-bottom: 0.7rem; }
.fl-text { font-weight: 650; }
.fl-meta, .fl-note { color: var(--ink-2); font-size: 0.9rem; }
.confirm-input { max-width: 12rem; }

/* ------------------------------------------------------------- print ---- */
@media print {
  :root { --desk: #fff; --paper: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --rule-soft: #ccc; --shadow: none; }
  body { font-size: 11pt; }
  .topbar, .tabs, .notes-toc, .foot, .topic-f, .staging-band, .flashes, .crumbs, .term-pop { display: none !important; }
  .notes-layout { display: block; }
  .page { max-width: none; padding: 0; }
  .topic { break-inside: auto; border-bottom: 1px solid #ccc; }
  .topic-h, .ch-h { break-after: avoid; }
  .compare, .glossary, .sticky-note, .overview { break-inside: avoid; box-shadow: none; border: 1px solid #bbb; }
  .term, .sticky-note, .meter { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sticky-note { transform: none; }
  .meter { display: none; }
}
