/* Overhoor: exercise-book paper, fountain-pen ink, a highlighter and a teacher's red pen. */

@font-face { font-family: "Lora"; src: url("../fonts/Lora-Variable.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("../fonts/Lora-Italic-Variable.woff") format("woff"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f7f9fc;
  --grid: #e1e8f2;
  --sheet: #ffffff;
  --ink: #1a2440;
  --ink-soft: #46526f;
  --ink-faint: #737e99;
  --line: #d3dbe8;
  --blue: #2340b0;
  --blue-hover: #1a3290;
  --blue-soft: #e7ecfa;
  --marker: #ffe24d;
  --marker-ink: #1a2440;
  --red: #c42d26;
  --red-soft: #fbe8e6;
  --green: #1b7a46;
  --green-soft: #e1f3e8;
  --card: #ffffff;
  --card-rule: #cfdcf0;
  --card-top: #e0645c;
  --shadow: 0 1px 0 rgba(26, 36, 64, .06), 0 10px 24px -16px rgba(26, 36, 64, .35);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 4px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1528;
    --grid: #182139;
    --sheet: #151d33;
    --ink: #e6ebf7;
    --ink-soft: #b2bcd5;
    --ink-faint: #8792ad;
    --line: #2a3554;
    --blue: #93a8ff;
    --blue-hover: #b4c3ff;
    --blue-soft: #1f2a50;
    --marker: #f0d23f;
    --marker-ink: #141b30;
    --red: #ff7d70;
    --red-soft: #3a1f22;
    --green: #5fd197;
    --green-soft: #143327;
    --card: #1b2440;
    --card-rule: #2c3a60;
    --card-top: #ff7d70;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 28px -16px rgba(0, 0, 0, .8);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.75rem, 3.2vw + 1rem, 2.5rem); letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: .95rem; font-weight: 600; color: var(--ink-soft); }
p { margin: 0 0 1em; }
kbd { font-family: var(--sans); font-size: .72em; border: 1px solid currentColor; border-radius: 3px; padding: 0 .3em; margin-left: .5em; opacity: .55; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--marker); color: var(--marker-ink); padding: 8px 12px; z-index: 50; }
.skip-link:focus { left: 8px; }
.muted { color: var(--ink-soft); }
.hint { color: var(--ink-faint); font-size: .875rem; }
.optional { color: var(--ink-faint); font-weight: 400; font-size: .85em; }
.hl { background: linear-gradient(transparent 52%, var(--marker) 52%, var(--marker) 92%, transparent 92%); padding: 0 .12em; color: inherit; }
.inline-form { display: inline; margin: 0; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 460px; }
.wrap-text { max-width: 760px; }
main.wrap { padding-top: 32px; padding-bottom: 64px; }

/* ---------- top bar ---------- */
.topbar { background: var(--sheet); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.wordmark span { background: linear-gradient(100deg, transparent 2%, var(--marker) 3%, var(--marker) 96%, transparent 97%) 0 62% / 100% 46% no-repeat; padding: 0 .15em; }
.wordmark:hover { color: var(--ink); }
.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: .95rem; }
.topnav a { color: var(--ink-soft); text-decoration: none; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 3px; }
.topnav-cta { color: var(--blue) !important; font-weight: 600; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer; }
.linklike:hover { color: var(--ink); text-decoration: underline; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: .8rem; font-weight: 600; }
.lang-switch a { padding: 2px 9px; color: var(--ink-faint); }
.lang-switch a[aria-current="true"] { background: var(--ink); color: var(--sheet); }
.lang-switch a:hover { text-decoration: none; color: var(--ink); }
.lang-switch a[aria-current="true"]:hover { color: var(--sheet); }

.flash { max-width: 1080px; margin: 16px auto 0; padding: 10px 14px; border-left: 4px solid var(--green); background: var(--sheet); box-shadow: var(--shadow); width: calc(100% - 2 * var(--gutter)); }
.flash-error { border-left-color: var(--red); }

.footer { border-top: 1px solid var(--line); background: var(--sheet); color: var(--ink-faint); font-size: .85rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
.footer-inner p { margin: 0; max-width: 64ch; }

/* ---------- sheets, sections ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 24px; margin-bottom: 24px; }
@media (max-width: 600px) { .section { padding: 18px; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.crumb { font-size: .9rem; margin-bottom: 6px; }
.crumb a { color: var(--ink-soft); }
.empty-state { padding: 40px 28px; text-align: left; }
.empty-state h1, .empty-state h2 { margin-bottom: .4em; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 1em 0 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; padding: 10px 16px; border-radius: 6px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; background: transparent; color: var(--ink); min-height: 44px; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover { color: #0f1528; } }
.btn-secondary { border-color: var(--blue); color: var(--blue); background: var(--sheet); }
.btn-secondary:hover { background: var(--blue-soft); color: var(--blue); }
.btn-quiet { color: var(--ink-soft); border-color: var(--line); background: var(--sheet); }
.btn-quiet:hover { color: var(--ink); border-color: var(--ink-faint); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-danger-quiet { color: var(--red); border-color: var(--red); background: var(--sheet); }
.btn-danger-quiet:hover { background: var(--red-soft); color: var(--red); }
.btn-done { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.btn-lg { font-size: 1.05rem; padding: 13px 22px; min-height: 50px; }
.btn-block { width: 100%; }
.btn.is-busy { opacity: .75; cursor: progress; }

/* ---------- forms ---------- */
.form .field { margin-bottom: 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .dropzone legend { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; padding: 0; }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--sheet); border: 1.5px solid var(--line); border-radius: 6px; padding: 10px 12px; min-height: 44px;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: 3px solid var(--blue-soft); outline-offset: 0; }
textarea { resize: vertical; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.form-error { color: var(--red); background: var(--red-soft); border-left: 4px solid var(--red); padding: 10px 14px; border-radius: 0 4px 4px 0; }
.hp { position: absolute; left: -5000px; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { margin: 0; }

.segmented { display: inline-flex; flex-wrap: wrap; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.seg { padding: 8px 16px; cursor: pointer; font-weight: 500; color: var(--ink-soft); text-decoration: none; border-right: 1px solid var(--line); min-height: 40px; display: inline-flex; align-items: center; margin: 0 !important; }
.seg:last-child { border-right: 0; }
.segmented input:checked + .seg, .seg.is-on { background: var(--ink); color: var(--sheet); }
.segmented input:focus-visible + .seg { outline: 3px solid var(--marker); outline-offset: -3px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--blue); }

.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 20px; margin: 0 0 22px; transition: border-color .15s, background-color .15s; }
.dropzone.is-over { border-color: var(--blue); background: var(--blue-soft); }
.dropzone-text { margin-bottom: 10px; color: var(--ink-soft); }
.dropzone-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.file-list { list-style: none; margin: 12px 0 8px; padding: 0; font-size: .9rem; }
.file-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.file-list .size { color: var(--ink-faint); white-space: nowrap; }
.file-list .bad { color: var(--red); }
.delete-hint { margin-top: -8px; margin-bottom: 18px; }

.auth-sheet { padding: 28px; }
.auth-switch { margin-top: 16px; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; padding: 24px 0 56px; }
.hero h1 { font-size: clamp(2.1rem, 4vw + 1rem, 3.4rem); line-height: 1.08; margin-bottom: .45em; }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-art { position: relative; min-height: 430px; }
.art-card { position: absolute; width: 74%; left: 0; top: 0; transform: rotate(-5deg); z-index: 1; align-items: flex-start; justify-content: flex-start; text-align: left; padding: 52px 26px 0; }
.art-test { position: absolute; right: 0; bottom: 0; width: 80%; background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px 24px 28px; transform: rotate(2deg); z-index: 2; border-radius: 2px; }
.art-test-head { font-family: var(--serif); font-weight: 600; margin-bottom: 12px; }
.art-lines { list-style: none; margin: 0; padding: 0; }
.art-lines li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--card-rule); }
.art-line { height: 7px; border-radius: 4px; background: var(--grid); }
.w80 { width: 80%; } .w70 { width: 70%; } .w60 { width: 60%; } .w50 { width: 50%; }
.tick { font-weight: 700; width: 1.2em; text-align: center; }
.tick.ok { color: var(--green); } .tick.bad { color: var(--red); }
.art-test .grade-mark { position: absolute; right: 18px; top: -26px; transform: rotate(-6deg); }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-bottom: 32px; }
  .hero-art { min-height: 380px; max-width: 440px; }
}
.steps { margin: 8px 0 40px; }
.step-list { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding: 0; margin: 0; }
.step-list li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 14px; }
.step-list li::before { content: counter(step); font-family: var(--serif); font-weight: 700; font-size: 2.2rem; line-height: 1; color: var(--blue); display: block; margin-bottom: 10px; }
.step-list p { color: var(--ink-soft); margin: 0; }
@media (max-width: 720px) { .step-list { grid-template-columns: 1fr; gap: 20px; } }
.promise { padding: 24px 28px; border-left: 5px solid var(--green); }
.promise p { margin: 0; color: var(--ink-soft); max-width: 70ch; }

/* ---------- index card (flashcards and prompts) ---------- */
.index-card {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  background-color: var(--card);
  background-image:
    linear-gradient(var(--card-top), var(--card-top)),
    repeating-linear-gradient(transparent 0, transparent 31px, var(--card-rule) 31px, var(--card-rule) 32px);
  background-size: 100% 2px, 100% 100%;
  background-position: 0 44px, 0 46px;
  background-repeat: no-repeat, repeat;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  aspect-ratio: 5 / 3; padding: 56px 28px 24px; color: var(--ink);
}
.index-card-text { font-family: var(--serif); font-size: clamp(1.25rem, 2.5vw + .6rem, 1.9rem); font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.art-card .index-card-text { font-size: 1.8rem; font-style: italic; }

/* ---------- red pen grade ---------- */
.grade-mark { position: relative; display: inline-grid; place-items: center; width: 150px; height: 94px; }
.grade-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.grade-mark path { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.grade-text { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 2.6rem; color: var(--red); line-height: 1; transform: rotate(-4deg); }
.result-grade .grade-mark { width: 220px; height: 138px; }
.result-grade .grade-text { font-size: 4rem; }
@media (prefers-reduced-motion: no-preference) {
  .page-exam-result .grade-mark path, [data-page="exam-result"] .grade-mark path { stroke-dashoffset: 1; animation: draw 0.9s .25s cubic-bezier(.6, .1, .3, 1) forwards; }
  [data-page="exam-result"] .grade-text { opacity: 0; animation: ink .4s .05s ease-out forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ink { to { opacity: 1; } }
.grade-inline { font-family: var(--serif); font-style: italic; font-weight: 700; color: var(--red); font-size: 1.2em; text-decoration: none; }

/* ---------- calendar block ---------- */
.cal { display: inline-flex; flex-direction: column; align-items: stretch; width: 52px; flex: none; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--sheet); text-align: center; box-shadow: 0 1px 0 var(--line); }
.cal-month { background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.7; }
@media (prefers-color-scheme: dark) { .cal-month { color: #1a1010; } }
.cal-day { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; line-height: 1.35; color: var(--ink); }
.cal-lg { width: 70px; }
.cal-lg .cal-month { font-size: .8rem; }
.cal-lg .cal-day { font-size: 2rem; }

/* ---------- dashboard ---------- */
.streak { margin: 4px 0 0; color: var(--ink-soft); font-weight: 500; }
.streak::before { content: ""; display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--marker); margin-right: .45em; vertical-align: .02em; box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3px var(--marker); }
.set-list { list-style: none; margin: 0; padding: 0; }
.set-list li + li { border-top: 1px solid var(--line); }
.set-row { display: grid; grid-template-columns: auto 1fr minmax(120px, 200px); gap: 18px; align-items: center; padding: 16px 20px; color: inherit; text-decoration: none; }
.set-row:hover { background: var(--blue-soft); color: inherit; }
.set-row-main { display: flex; flex-direction: column; min-width: 0; }
.set-row-title { font-weight: 600; font-size: 1.08rem; color: var(--ink); overflow-wrap: anywhere; }
.set-row-meta { display: flex; gap: 14px; color: var(--ink-soft); font-size: .9rem; flex-wrap: wrap; }
.set-row-meta .soon, .set-countdown-text.soon { color: var(--red); font-weight: 600; }
.set-row-side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.readiness-label { font-size: .85rem; color: var(--ink-soft); text-align: right; }
.dash-note { margin-top: 14px; }
@media (max-width: 560px) {
  .set-row { grid-template-columns: auto 1fr; padding: 14px 16px; }
  .set-row-side { grid-column: 2; }
  .readiness-label { text-align: left; }
}
.meter { display: block; height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; justify-self: end; align-self: flex-end; }
.badge-busy { background: var(--blue-soft); color: var(--blue); }
.badge-error { background: var(--red-soft); color: var(--red); }

/* ---------- study set layout ---------- */
.set-wrap { max-width: 1080px; }
.set-head { margin-bottom: 24px; }
.set-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.set-title { margin: 0 0 4px; }
.set-title a { color: var(--ink); text-decoration: none; }
.set-title a:hover { text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 4px; }
.set-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-soft); margin: 0; }
.set-countdown { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.set-countdown-text { font-size: .85rem; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.modes { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 20px; padding: 10px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
@media (max-width: 760px) { .modes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } }
.mode-group { display: flex; align-items: center; gap: 4px; flex: none; }
.mode-group-name { font-size: .75rem; color: var(--ink-faint); margin-right: 6px; }
.modes a { color: var(--ink-soft); text-decoration: none; padding: 6px 9px; border-radius: 5px; font-size: .92rem; font-weight: 500; white-space: nowrap; }
.modes a:hover { color: var(--ink); background: var(--blue-soft); }
.modes a[aria-current="page"] { color: var(--marker-ink); background: var(--marker); font-weight: 600; }
@media (max-width: 600px) { .set-head-row .cal-lg { width: 56px; } .set-head-row .cal-lg .cal-day { font-size: 1.5rem; } }

.study-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.study-head h2 { margin: 0; }
.study-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- set home ---------- */
.home-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
@media (max-width: 760px) { .home-grid { grid-template-columns: 1fr; gap: 0; } }
.task-list { padding-left: 1.2em; margin: 0 0 16px; }
.task-list li { padding: 3px 0; }
.readiness-big { font-family: var(--serif); font-weight: 700; margin: 0 0 8px; line-height: 1; }
.readiness-big .num { font-size: 3.4rem; }
.readiness-big .pct { font-size: 1.6rem; color: var(--ink-soft); margin-left: 2px; }
.readiness .meter { height: 10px; margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 0; }
.stats div { border-top: 1px solid var(--line); padding-top: 8px; }
.stats dt { font-size: .78rem; color: var(--ink-faint); }
.stats dd { margin: 2px 0 0; font-weight: 600; font-size: 1.15rem; }
.mode-index { margin: 8px 0 32px; }
.mode-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 820px) { .mode-columns { grid-template-columns: 1fr; gap: 12px; } }
.mode-columns h3 { border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 4px; }
.mode-columns ul { list-style: none; margin: 0; padding: 0; }
.mode-columns li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.mode-columns li a { font-weight: 600; text-decoration: none; }
.mode-columns li a:hover { text-decoration: underline; }
.mode-columns li span { font-size: .88rem; color: var(--ink-soft); }
.settings-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.notes { margin: 0; padding-left: 1.2em; color: var(--ink-soft); }

/* ---------- processing ---------- */
.progress-steps { list-style: none; padding: 0; margin: 16px 0; counter-reset: p; }
.progress-steps li { counter-increment: p; display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--ink-faint); border-bottom: 1px dashed var(--line); }
.progress-steps li::before { content: counter(p); width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.progress-steps li.done { color: var(--ink-soft); }
.progress-steps li.done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
.progress-steps li.now { color: var(--ink); font-weight: 600; }
.progress-steps li.now::before { border-color: var(--blue); color: var(--blue); }
@media (prefers-reduced-motion: no-preference) { .progress-steps li.now::before { animation: pulse 1.4s ease-in-out infinite; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--blue-soft); } }
.busy-line { color: var(--blue); font-weight: 500; }

/* ---------- summary ---------- */
.key-points { background: var(--sheet); border: 1px solid var(--line); border-left: 6px solid var(--marker); padding: 18px 22px; margin: 16px 0 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.key-points h3 { margin-bottom: 8px; }
.key-points ul { margin: 0; padding-left: 1.2em; }
.key-points li { padding: 2px 0; }
.prose { max-width: 72ch; }
.sheet.prose { max-width: none; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.35rem; margin: 1.4em 0 .5em; }
.prose h3 { margin: 1.2em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .2em 0; }
.prose strong { background: linear-gradient(transparent 60%, var(--marker) 60%); color: inherit; }
@media (prefers-color-scheme: dark) { .prose strong { background: linear-gradient(transparent 62%, rgba(240, 210, 63, .38) 62%); } }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.glossary { margin: 0; display: grid; grid-template-columns: 1fr; }
.glossary div { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 560px) { .glossary div { grid-template-columns: 1fr; gap: 2px; } }
.hooks { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hooks li { display: flex; flex-direction: column; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 6px; }
.hooks span { color: var(--ink-soft); }
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.topic-name { font-weight: 600; }
.topic-list .muted { grid-column: 1; font-size: .9rem; }
.topic-explain { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: .9rem; }

/* ---------- trainers ---------- */
.trainer { max-width: 620px; margin: 16px auto 0; }
.counter { text-align: center; color: var(--ink-faint); font-size: .9rem; margin-bottom: 10px; }
.flip-card { width: 100%; padding: 0; border: 0; background: none; box-shadow: none; cursor: pointer; perspective: 1400px; display: block; aspect-ratio: 5 / 3; font: inherit; color: inherit; }
.flip-card.index-card { background-image: none; }
.flip-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3, .7, .4, 1); }
.flip-card.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; align-items: center; justify-content: center; text-align: center;
  background-color: var(--card);
  background-image: linear-gradient(var(--card-top), var(--card-top)), repeating-linear-gradient(transparent 0, transparent 31px, var(--card-rule) 31px, var(--card-rule) 32px);
  background-size: 100% 2px, 100% 100%; background-position: 0 44px, 0 46px; background-repeat: no-repeat, repeat;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 56px 28px 24px; }
.flip-back { transform: rotateY(180deg); }
.flip-back .index-card-text { color: var(--blue); }
@media (prefers-reduced-motion: reduce) { .flip-inner { transition: none; } }
.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.rate { border-color: var(--line); background: var(--sheet); flex-direction: column; gap: 2px; }
.rate kbd { margin: 0; }
.rate-again { color: var(--red); border-color: var(--red); }
.rate-again:hover { background: var(--red-soft); }
.rate-hard:hover { background: var(--grid); }
.rate-good { color: var(--green); border-color: var(--green); }
.rate-good:hover { background: var(--green-soft); }
.rate-easy { color: var(--blue); border-color: var(--blue); }
.rate-easy:hover { background: var(--blue-soft); }
@media (max-width: 480px) { .rate-row { grid-template-columns: repeat(2, 1fr); } }
.prompt-card { aspect-ratio: auto; min-height: 200px; }
.answer-form { display: flex; gap: 10px; margin-top: 16px; }
.answer-input { font-size: 1.15rem !important; }
.feedback { min-height: 1.6em; margin-top: 12px; font-weight: 600; text-align: center; }
.feedback.ok { color: var(--green); }
.feedback.almost { color: #a06a00; }
@media (prefers-color-scheme: dark) { .feedback.almost { color: #f0c062; } }
.feedback.bad { color: var(--red); }
.finished { max-width: 620px; margin: 16px auto 0; }
.miss-list { padding-left: 1.2em; color: var(--ink-soft); }
.miss-list strong { color: var(--ink); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.3rem; margin: 0; color: var(--ink-soft); }

.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.match-col { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.match-item { width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--sheet); border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; min-height: 56px; box-shadow: 0 1px 0 var(--line); line-height: 1.35; }
.match-item:hover { border-color: var(--blue); }
.match-item.is-selected { border-color: var(--blue); background: var(--blue-soft); }
.match-item.is-matched { border-color: var(--green); background: var(--green-soft); color: var(--green); cursor: default; opacity: .7; }
.match-item.is-wrong { border-color: var(--red); background: var(--red-soft); }
@media (prefers-reduced-motion: no-preference) { .match-item.is-wrong { animation: shake .3s; } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.match-col:first-child .match-item { font-weight: 600; }
@media (max-width: 520px) { .match-board { gap: 8px; } .match-item { padding: 10px; font-size: .92rem; } }

.cloze-text { font-family: var(--serif); font-size: 1.3rem; line-height: 1.5; }
.cloze-text .blank { display: inline-block; min-width: 5em; border-bottom: 2px solid var(--blue); margin: 0 .15em; color: var(--blue); font-weight: 600; }

.tf-start { max-width: 620px; margin: 16px auto 0; }
.tf-bar { height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.tf-bar span { display: block; height: 100%; width: 100%; background: var(--blue); transform-origin: left; }
.tf-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tf-btn { min-height: 64px; font-size: 1.1rem; border-color: var(--line); background: var(--sheet); }
.tf-true { color: var(--green); border-color: var(--green); }
.tf-true:hover { background: var(--green-soft); }
.tf-false { color: var(--red); border-color: var(--red); }
.tf-false:hover { background: var(--red-soft); }
.flash-ok { animation: none; }

.mc { border: 1px solid var(--line); min-width: 0; }
.mc-question { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; line-height: 1.35; padding: 0; margin-bottom: 14px; float: left; width: 100%; }
.mc-options { clear: both; display: grid; gap: 10px; }
.mc-option { text-align: left; font: inherit; color: var(--ink); background: var(--sheet); border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: baseline; min-height: 50px; }
.mc-option:hover:not(:disabled) { border-color: var(--blue); }
.mc-option .letter { font-weight: 700; color: var(--ink-faint); flex: none; }
.mc-option.is-right { border-color: var(--green); background: var(--green-soft); }
.mc-option.is-wrong { border-color: var(--red); background: var(--red-soft); }
.mc-option:disabled { cursor: default; }
.hint-box { margin: 14px 0 0; padding: 10px 14px; background: var(--blue-soft); border-radius: 6px; color: var(--ink); }
.feedback-box { margin: 14px 0 0; padding: 12px 14px; border-radius: 6px; border-left: 4px solid var(--green); background: var(--green-soft); }
.feedback-box.bad { border-left-color: var(--red); background: var(--red-soft); }
.feedback-box p { margin: 0; }
.feedback-box p + p { margin-top: 6px; }

/* ---------- exam ---------- */
.exam-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
@media (max-width: 760px) { .exam-grid { grid-template-columns: 1fr; gap: 0; } }
.exam-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 32px; margin: 4px 0 16px; }
.exam-facts dt { font-size: .8rem; color: var(--ink-faint); }
.exam-facts dd { margin: 0; font-weight: 600; }
@media (max-width: 520px) { .exam-facts { grid-template-columns: 1fr; } }
.history { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.history a { display: inline-flex; flex-direction: column; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; min-width: 72px; }
.history a:hover { border-color: var(--red); }
.history .muted { font-size: .8rem; }

.exam-paper { background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 2px; padding: 0 32px 32px; max-width: 820px; margin: 0 auto; }
@media (max-width: 600px) { .exam-paper { padding: 0 16px 24px; } }
.exam-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; justify-content: space-between; background: var(--sheet); border-bottom: 1px solid var(--line); padding: 12px 0; margin-bottom: 20px; }
.exam-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.35rem; }
.exam-clock.is-low { color: var(--red); }
.exam-progress { color: var(--ink-faint); font-size: .9rem; flex: 1; }
.exam-part { font-size: 1.15rem; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
.exam-questions { padding-left: 1.6em; margin: 0; }
.exam-q { padding: 14px 0 18px; border-bottom: 1px solid var(--line); }
.exam-q::marker { font-weight: 700; color: var(--ink-faint); }
.exam-q fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.exam-q legend, .open-q { font-weight: 600; margin-bottom: 10px; padding: 0; display: block; line-height: 1.4; }
.option { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.option:hover { background: var(--blue-soft); }
.option input { margin-top: .3em; width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.points { font-weight: 400; font-size: .85rem; color: var(--ink-faint); white-space: nowrap; }
.exam-end { margin-top: 24px; display: flex; justify-content: flex-end; }

.result-head { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: center; }
@media (max-width: 600px) { .result-head { grid-template-columns: 1fr; gap: 8px; } }
.result-score { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.review h3 { margin: 8px 0 12px; }
.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.review-item { background: var(--sheet); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.review-item.is-right { border-left-color: var(--green); }
.review-item.is-wrong { border-left-color: var(--red); }
.review-item.is-half { border-left-color: #d9a400; }
.review-q { font-weight: 600; display: flex; gap: 10px; align-items: baseline; }
.review-q .mark { font-family: var(--serif); font-style: italic; color: var(--red); font-weight: 700; flex: none; }
.is-right .review-q .mark { color: var(--green); }
.review-options { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
.review-options li { padding: 4px 10px; border-radius: 4px; color: var(--ink-soft); }
.review-options .opt-correct { background: var(--green-soft); color: var(--green); font-weight: 600; }
.review-options .opt-chosen:not(.opt-correct) { background: var(--red-soft); color: var(--red); text-decoration: line-through; text-decoration-color: var(--red); }
.tag { font-size: .75rem; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; margin-left: 6px; text-decoration: none; display: inline-block; }
.explanation { color: var(--ink-soft); margin: 6px 0 0; font-size: .95rem; padding-left: 12px; border-left: 2px solid var(--line); }
.answer-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.answer-compare h4 { margin-bottom: 4px; }
.answer-compare p { margin: 0; white-space: pre-wrap; }
.student-answer { font-family: var(--serif); font-style: italic; color: var(--blue); }
@media (max-width: 600px) { .answer-compare { grid-template-columns: 1fr; } }

/* ---------- mistakes ---------- */
.mistake-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 14px; }
.mistake { background: var(--sheet); border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: var(--radius); padding: 16px 18px; }
.mistake.is-cleared { border-left-color: var(--green); opacity: .6; }
.mistake-head { display: flex; justify-content: space-between; gap: 12px; }
.mistake-q { font-weight: 600; margin-bottom: 10px; }
.mistake-count { font-size: .8rem; color: var(--red); white-space: nowrap; }
.mistake .mc-options { margin-bottom: 8px; }
.mistake-answer { padding: 8px 12px; background: var(--green-soft); border-radius: 6px; margin: 8px 0; }

/* ---------- ask & explain ---------- */
.chat { display: flex; flex-direction: column; min-height: 420px; max-width: 820px; }
.chat-log { list-style: none; margin: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; flex: 1; overflow-y: auto; max-height: 60vh; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 12px; line-height: 1.5; }
.msg-user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 3px; white-space: pre-wrap; }
@media (prefers-color-scheme: dark) { .msg-user { color: #0f1528; } }
.msg-tutor { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg-tutor > :last-child { margin-bottom: 0; }
.msg-tutor ul { padding-left: 1.2em; margin: 0; }
.msg-pending { color: var(--ink-faint); font-style: italic; }
.chat-empty { padding: 0 20px; }
.chat-form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { min-height: 48px; }
.explain-score { font-family: var(--serif); font-weight: 700; margin: 0 0 12px; }
.explain-score span:first-child { font-size: 3rem; color: var(--blue); }
.explain-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.explain-cols ul { padding-left: 1.1em; margin: 0; }
.explain-cols li { margin: 4px 0; }
.explain-cols div:nth-child(1) h4 { color: var(--green); }
.explain-cols div:nth-child(2) h4 { color: #a06a00; }
.explain-cols div:nth-child(3) h4 { color: var(--red); }
@media (max-width: 700px) { .explain-cols { grid-template-columns: 1fr; } }
.tip { margin: 16px 0 0; padding: 10px 14px; background: var(--blue-soft); border-radius: 6px; }

/* ---------- plan ---------- */
.plan { list-style: none; padding: 0; margin: 16px 0 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.plan-day { display: grid; grid-template-columns: 92px 1fr 52px; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.plan-day:last-child { border-bottom: 0; }
.plan-day.is-today { background: linear-gradient(90deg, rgba(255, 226, 77, .22), transparent 60%); }
@media (prefers-color-scheme: dark) { .plan-day.is-today { background: linear-gradient(90deg, rgba(240, 210, 63, .12), transparent 60%); } }
.plan-day.is-done .plan-tasks, .plan-day.is-past .plan-tasks { color: var(--ink-faint); }
.plan-day.is-past:not(.is-done) .plan-date strong { color: var(--ink-faint); }
.plan-day.is-done .plan-tasks a { color: var(--ink-faint); }
.plan-date { display: flex; flex-direction: column; line-height: 1.25; }
.plan-date span:first-child { color: var(--ink-faint); font-size: .85rem; align-self: flex-start; }
.plan-date strong { font-size: 1.05rem; }
.plan-today { font-size: .75rem; font-weight: 700; color: var(--marker-ink); background: var(--marker); align-self: flex-start; padding: 0 6px; border-radius: 3px; margin-top: 4px; }
.plan-tasks ul { margin: 0; padding-left: 1.1em; }
.plan-tasks li { padding: 2px 0; }
.plan-exam { font-family: var(--serif); font-weight: 700; color: var(--red); font-size: 1.15rem; margin: 0 0 4px; }
.kind-exam { border-left: 5px solid var(--red); }
.plan-check { justify-self: end; }
.check-btn { width: 36px; height: 36px; border-radius: 6px; border: 2px solid var(--ink-faint); background: var(--sheet); color: var(--green); font-size: 1.2rem; font-weight: 700; cursor: pointer; display: grid; place-items: center; }
.check-btn[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
@media (max-width: 520px) { .plan-day { grid-template-columns: 64px 1fr 40px; gap: 10px; padding: 12px; } }

/* ---------- focus timer ---------- */
.focus-timer { margin-top: 10px; }
.focus-timer-btn { font: inherit; font-size: .85rem; font-weight: 600; background: var(--sheet); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 10px; cursor: pointer; font-variant-numeric: tabular-nums; min-height: 32px; display: inline-flex; align-items: center; gap: 6px; }
.focus-timer-btn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.focus-timer-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.focus-timer-btn.is-running { color: var(--blue); border-color: var(--blue); }
.focus-timer-btn.is-running::before { background: var(--blue); }
.focus-timer-btn.is-break { color: var(--green); border-color: var(--green); }
.focus-timer-btn.is-break::before { background: var(--green); }

/* ---------- account ---------- */
.danger-zone { border-color: var(--red-soft); }
.danger-zone h2 { color: var(--red); }

/* ---------- print ---------- */
.print-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.printable { background: var(--sheet); padding: 32px; border: 1px solid var(--line); }
.print-head { border-bottom: 2px solid var(--ink); margin-bottom: 20px; }
.print-questions > li { margin-bottom: 14px; }
.print-questions ol { margin-top: 4px; }
.write-lines { height: 96px; background: repeating-linear-gradient(transparent 0, transparent 31px, var(--line) 31px, var(--line) 32px); margin-top: 8px; }
.answer-key li { margin-bottom: 6px; }
@media print {
  @page { margin: 18mm; }
  :root { --ink: #000; --ink-soft: #222; --line: #bbb; --sheet: #fff; --marker: #fff2a8; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar, .footer, .flash, .no-print, .focus-timer, .skip-link { display: none !important; }
  .printable { border: 0; padding: 0; }
  main.wrap { padding: 0; max-width: none; }
  .page-break { break-before: page; }
  a { color: #000; text-decoration: none; }
}
