:root {
  color-scheme: light;
  --canvas: #f8f7f3;
  --paper: #fffefa;
  --ink: #20231d;
  --muted: #605f55;
  --line: #deddd4;
  --accent: #354c3c;
  --pale: #edf1e9;
  --bad: #8c3730;
  --bad-bg: #f9eeeb;
  --active-border: #889f8c;
  --input-border: #bdbfb1;
  --hover: #f4f6ef;
  --action: #354c3c;
  --action-hover: #273b2f;
  --focus: #516f58;
  font: 16px/1.5 system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #171a17;
  --paper: #20241f;
  --ink: #eeeee7;
  --muted: #bbbfb2;
  --line: #3e453c;
  --accent: #c1d5bc;
  --pale: #2e3b2e;
  --bad: #f1b3aa;
  --bad-bg: #432b29;
  --active-border: #83a282;
  --input-border: #626d60;
  --hover: #283329;
  --action: #3d5a45;
  --action-hover: #354f3c;
  --focus: #b7d1b3;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .63; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.frame { width: min(1056px, calc(100% - 64px)); margin-inline: auto; }
.bar { display: flex; justify-content: flex-end; align-items: center; min-height: 64px; }
.bar-actions { display: flex; align-items: center; gap: clamp(7px, 2vw, 18px); font-size: .84rem; }
.theme-switch { display: grid; place-items: center; width: 52px; height: 44px; padding: 0; border: 0; background: transparent; border-radius: 6px; }
.theme-track { width: 40px; height: 23px; padding: 2px; border: 1px solid var(--input-border); border-radius: 20px; background: var(--paper); transition: background-color .18s ease, border-color .18s ease; }
.theme-track::after { content: ""; display: block; width: 17px; height: 17px; border-radius: 50%; background: var(--muted); transition: transform .18s ease, background-color .18s ease; }
.theme-switch:hover .theme-track { border-color: var(--focus); }
.theme-switch[aria-checked="true"] .theme-track { background: var(--pale); border-color: var(--active-border); }
.theme-switch[aria-checked="true"] .theme-track::after { transform: translateX(17px); background: var(--accent); }
main { padding-block: clamp(28px, 6vw, 70px) 68px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; line-height: 1.13; }
h1 { font-size: clamp(2.25rem, 6.4vw, 4.75rem); letter-spacing: -.05em; text-wrap: balance; }
h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.035em; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(218px, 258px); gap: clamp(20px, 4vw, 40px); align-items: end; padding-bottom: 28px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; padding-left: 24px; border-left: 1px solid var(--line); font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.metrics strong { display: block; color: var(--accent); font: 2.1rem Georgia, serif; }
.metrics progress { grid-column: 1 / -1; margin: 4px 0 0; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin-top: 6px; }
.mode { position: relative; text-align: left; min-height: 96px; padding: 18px 56px 18px 16px; border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 7px; color: var(--ink); background: transparent; overflow-wrap: anywhere; transition: background-color .18s ease, border-color .18s ease, transform .18s ease; }
.mode:hover, .topic:hover { border-color: var(--active-border); background: var(--hover); }
.mode.primary { grid-column: 1 / -1; min-height: clamp(122px, 15vw, 164px); padding: 24px 70px 24px clamp(18px, 4vw, 34px); margin-bottom: 4px; background: var(--pale); border-color: var(--line); border-radius: 12px; }
.mode.primary:hover { border-color: var(--active-border); }
.mode:active, .action:active, .topic:active { transform: translateY(1px); }
.mode-title { display: block; font-family: Georgia, serif; font-size: clamp(1.25rem, 3vw, 1.75rem); line-height: 1.12; }
.primary .mode-title { font-size: clamp(1.65rem, 4vw, 2.65rem); letter-spacing: -.035em; }
.mode-note { display: block; margin-top: 6px; color: var(--muted); font-size: .88rem; }
.arrow { position: absolute; inset: 50% 18px auto auto; transform: translateY(-50%); color: var(--accent); font-size: 1.3rem; transition: transform .18s ease; }
.primary .arrow { right: clamp(18px, 4vw, 34px); font-size: 1.65rem; }
.mode:hover .arrow { transform: translate(3px, -50%); }
.study, .topics, .auth { margin-inline: auto; }
.study, .topics { max-width: 760px; }
.auth { max-width: 432px; }
.auth h1, .topics h1 { font-size: clamp(2.15rem, 6vw, 3.5rem); margin-block: 0 24px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: clamp(18px, 4.5vw, 36px); }
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: .92rem; }
.field input, .field select, .match select { width: 100%; min-width: 0; padding: 10px 12px; min-height: 46px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 1rem; }
.action { border: 1px solid var(--action); background: var(--action); color: white; border-radius: 6px; padding: 11px 20px; min-height: 46px; font-weight: 650; }
.action:hover { background: var(--action-hover); }
.quiet { color: var(--accent); background: transparent; border: 0; padding: 9px 5px; min-height: 42px; }
.quiet:hover { text-decoration: underline; text-underline-offset: 4px; }
.auth .quiet { justify-self: start; }
.error { color: var(--bad); }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 9px; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
progress { display: block; appearance: none; width: 100%; height: 5px; margin-bottom: 18px; overflow: hidden; border: 0; border-radius: 5px; background: var(--line); color: var(--accent); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; transition: width .22s ease; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
.topic-name { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.question { white-space: pre-line; overflow-wrap: anywhere; margin-bottom: 24px; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.choices { display: grid; gap: 8px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; min-height: 46px; transition: background-color .16s ease, border-color .16s ease; }
.option:has(input:enabled):hover { background: var(--hover); border-color: var(--active-border); cursor: pointer; }
.option input { flex: 0 0 auto; margin: 4px 0 0; width: 17px; height: 17px; accent-color: var(--accent); }
.option:has(input:checked) { background: var(--pale); border-color: var(--active-border); }
.option.good { color: var(--accent); background: var(--pale); border-color: #a3b5a5; }
.option.bad { color: var(--bad); background: var(--bad-bg); border-color: #ceaaa3; }
.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; padding: 8px 0; overflow-wrap: anywhere; }
.controls { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.feedback { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; overflow-wrap: anywhere; animation: reveal .25s ease both; }
.feedback h2 { margin-bottom: 12px; }
.feedback p, .feedback ol { margin: 10px 0; white-space: pre-line; }
.topic-list { display: grid; gap: 7px; margin-top: 14px; }
.topic { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--paper); min-height: 46px; padding: 10px 14px; overflow-wrap: anywhere; }
.topic small { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 640px) {
  .frame { width: calc(100% - 32px); }
  .bar { min-height: 52px; }
  .hero { grid-template-columns: 1fr; gap: 17px; padding-bottom: 17px; }
  .metrics { width: min(100%, 300px); border-left: 0; padding-left: 0; }
  .mode-grid { grid-template-columns: 1fr; gap: 3px; }
  .mode { min-height: 72px; padding: 12px 40px 12px 10px; }
  .arrow { right: 13px; }
  .match { grid-template-columns: 1fr; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}
.question { font-size: clamp(1.48rem, 3.65vw, 2.45rem); letter-spacing: -.025em; line-height: 1.24; }
