:root {
  color-scheme: light;
  --ink: #17223b;
  --muted: #53617b;
  --blue: #2449bf;
  --pale: #edf2ff;
  --line: #dbe2ef;
  --paper: #fff;
  --green: #176343;
  --red: #9c293a;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f5f7fc; }
main { width: min(100%, 940px); margin: auto; padding: 0 clamp(16px, 4vw, 36px) 32px; }
a { color: var(--blue); }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid #6280e5; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 7vw, 3.8rem); line-height: 1.05; letter-spacing: -.045em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }

.site-header { padding: 18px 0 24px; }
.site-header nav { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; font-size: .9rem; }
.site-header nav a { text-decoration: none; }
.brand { font-weight: 800; color: var(--ink); }
.eyebrow { color: var(--blue); font-size: .77rem; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 8px; }
.intro { margin-top: 10px; color: var(--muted); }
.account-sync { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.account-sync > p { flex: 1 1 240px; min-width: 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.account-sync .actions { flex-shrink: 0; }
.account-sync .btn { font-size: .88rem; }
.sync-dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: clamp(18px, 4vw, 28px); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 16px 60px #17223b33; }
.sync-dialog::backdrop { background: #17223b77; }
.sync-field { display: grid; gap: 5px; }
.sync-field label { font-size: .93rem; font-weight: 650; }
.sync-field input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.sync-message:empty { display: none; }
.sync-message { overflow-wrap: anywhere; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 10px clamp(7px, 2vw, 16px); border-bottom: 3px solid transparent; font-size: .93rem; font-weight: 700; text-decoration: none; color: var(--muted); }
.tabs a[aria-current="page"] { border-color: var(--blue); color: var(--blue); }
.count, .badge { display: inline-block; border-radius: 999px; padding: 1px 8px; background: var(--pale); color: var(--blue); font-size: .75rem; white-space: nowrap; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: clamp(14px, 3vw, 24px); margin-bottom: 12px; box-shadow: 0 3px 16px #213a7410; }
.row, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.muted, footer { color: var(--muted); font-size: .88rem; }
footer { margin-top: 22px; }
.notice { color: #6d4607; background: #fff4d8; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }

.btn, .set, .answer { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 650; }
.btn:hover:not(:disabled), .set:hover, .answer:hover:not(:disabled) { border-color: var(--blue); }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn[aria-pressed="true"] { background: var(--pale); color: var(--blue); border-color: #adbeef; }
.sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.set { flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; text-align: left; }
.set strong { font-size: .97rem; }
.set span { color: var(--muted); font-weight: 500; font-size: .78rem; }
.progress { display: block; width: 100%; height: 8px; accent-color: var(--blue); }
.passage { font: 1.16rem/1.62 Georgia, "Times New Roman", serif; white-space: pre-wrap; }
.passage-blurb { font: 1rem/1.6 Georgia, "Times New Roman", serif; white-space: pre-wrap; margin-bottom: 1.2em; }
.passage-blurb cite { font-style: italic; }
.passage cite { font-style: italic; }
.format-note { margin-bottom: 1.2em; }
.passage-copyright { margin-top: .55em; font: .8rem/1.4 Georgia, "Times New Roman", serif; }
.passage u { text-underline-offset: .15em; }
.passage.poem { white-space: normal; }
.verse-line { display: block; white-space: pre-wrap; padding-inline-start: 1.25em; text-indent: -1.25em; }
.verse-break { display: block; height: 1em; }
.reading-blocks > * + * { margin-top: .85rem; }
.reading-blocks > .passage-blurb { margin-bottom: 1.2em; }
.question-figure { margin-inline: 0; margin-bottom: 0; }
.question-figure a { display: inline-block; max-width: 100%; text-decoration: none; }
.question-figure img { display: block; max-width: 100%; height: auto; background: #fff; }
.figure-zoom { display: inline-block; padding-block: .4rem; font-size: .88rem; text-decoration: underline; }
.question-figure figcaption { margin-top: .4rem; color: var(--muted); font-size: .9rem; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.table-scroll table { border-collapse: collapse; table-layout: auto; font-size: .95rem; }
.table-scroll caption { margin-bottom: .5rem; text-align: start; font-weight: 650; }
.table-scroll th, .table-scroll td { border: 1px solid var(--line); padding: .45rem .65rem; text-align: start; white-space: pre-wrap; min-width: 3.5rem; }
.table-scroll th { background: #f5f7fc; }
.prompt { font-weight: 700; }
.options { display: grid; gap: 8px; }
.option-row { min-width: 0; display: grid; gap: 6px; }
.answer { width: 100%; justify-content: flex-start; gap: 9px; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
.answer:disabled { opacity: 1; }
.answer[data-result="correct"] { background: #eaf8ef; border-color: #79b89b; color: var(--green); }
.answer[data-result="wrong"] { background: #fff0f2; border-color: #dea0aa; color: var(--red); }
.answer[data-result="selected"] { background: var(--pale); border-color: #adbeef; }
.answer[data-result="reference"] { background: #f5f7fc; border-color: #adbeef; }
.letter { flex: 0 0 27px; display: grid; place-items: center; height: 27px; border-radius: 50%; border: 1px solid currentColor; font-size: .83rem; font-weight: 750; }
.option-gloss { padding: 0 0 3px 6px; color: var(--muted); font-size: .9rem; }
.option-gloss .btn { font-size: .85rem; }
.feedback { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f5f7fe; }
.feedback p + p { margin-top: 5px; }
.feedback .source-note { white-space: pre-wrap; }
.option-analysis { margin-top: 8px; }
.option-analysis summary { cursor: pointer; font-weight: 650; }
.option-analysis ol { margin: 6px 0 0; padding-inline-start: 25px; }
.option-analysis li + li { margin-top: 4px; }
.good { color: var(--green); }
.bad { color: var(--red); }

.items { display: grid; gap: 8px; }
.item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.item > :first-child { flex: 1 1 200px; }
.word-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.word-check input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--blue); flex-shrink: 0; }
.word-check span { overflow-wrap: anywhere; }
.word-check strong { display: block; }
.word-filter { width: min(100%, 330px); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.flashcard { text-align: center; padding-block: 28px; }
.flashcard .actions { justify-content: center; }
.flash-term { font-size: clamp(1.45rem, 5vw, 2.4rem); line-height: 1.25; overflow-wrap: anywhere; }

@media (max-width: 480px) {
  .site-header { padding-bottom: 16px; }
  .site-header nav { margin-bottom: 20px; }
  .account-sync { align-items: flex-start; }
  .account-sync .actions { width: 100%; }
  .tabs { gap: 0; }
  .tabs .count { padding-inline: 5px; }
  .passage { font-size: 1.1rem; }
}
