:root {
  color-scheme: light;
  --text: #252421;
  --muted: #686864;
  --line: #e9e8e5;
  --surface: #f6f6f4;
  --hover: #eeedea;
  --accent: #61527c;
  --accent-light: #ede7f6;
  font: 16px/1.5 "Inter", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: white; }
button { border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; font: inherit; padding: 6px 9px; }
button:hover { background: var(--hover); }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
header { flex: none; padding-inline: clamp(14px, 3vw, 38px); height: 52px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { font-size: 18px; font-weight: 730; text-decoration: none; color: inherit; }
nav { display: flex; gap: 4px; font-size: .875rem; }
nav button { min-height: 36px; }
nav button.active { background: var(--surface); font-weight: 650; }
nav span { color: var(--muted); font-variant-numeric: tabular-nums; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
aside { overflow: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 23px 13px; }
aside h2 { margin: 0 9px 8px; color: var(--muted); font-size: .875rem; font-weight: 600; }
.set { display: flex; width: 100%; text-align: left; justify-content: space-between; align-items: center; gap: 8px; font-size: .875rem; padding: 10px 9px; }
.set.current { background: #eae9e6; font-weight: 650; }
.set small { font-size: .8125rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sidefoot { display: flex; justify-content: space-between; margin: 26px 9px 6px; color: var(--muted); font-size: .8125rem; }
progress { display: block; width: calc(100% - 18px); height: 4px; margin: 0 9px; accent-color: var(--accent); }
main { min-height: 0; height: 100%; }
#practice { height: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; }
.reading { min-height: 75px; flex: 1 1 auto; overflow: auto; padding: clamp(14px, 4vh, 42px) clamp(18px, 5vw, 58px) 14px; }
.context, .toolbar, .pager, .article-meta, .modalhead, .result { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.context { margin-bottom: 9px; font-size: .875rem; color: var(--muted); }
#mobileSets { margin-left: -8px; color: var(--text); font-weight: 650; }
.toolbar { border-bottom: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.toolbar button:first-child, .article-bottom button:first-child { margin-left: -8px; }
.pager button { font-size: 1.35rem; line-height: 1; min-width: 34px; min-height: 34px; }
.pager button:first-child { margin: 0; }
#pageNo { white-space: nowrap; font-variant-numeric: tabular-nums; }
.article-meta { margin-top: 14px; font-size: .8125rem; color: var(--muted); }
article h1, .records h1 { font-size: clamp(1.375rem, 2.6vw, 2rem); line-height: 1.25; margin: 4px 0 16px; letter-spacing: -.025em; }
#lines { font: clamp(1.1875rem, 2vw, 1.5rem)/1.62 Georgia, serif; overflow-wrap: anywhere; }
#lines p { margin: 0 0 .5em; }
#lines .source-heading { color: var(--muted); font-size: .87em; font-style: italic; }
.term { cursor: pointer; color: inherit; text-decoration: underline; text-underline-offset: .19em; text-decoration-thickness: .08em; text-decoration-color: #9e8ab6; border-radius: 2px; box-decoration-break: clone; }
.term.sel, .term:hover { background: var(--accent-light); }
.term.done { text-decoration-color: #8d9c91; }
.article-bottom { display: flex; gap: 4px; margin-top: 4px; color: var(--muted); font-size: .875rem; }
#translation { border-top: 1px solid var(--line); margin-top: 8px; line-height: 1.7; }
#answer { flex: 0 1 auto; max-height: 52%; overflow: auto; margin-inline: clamp(18px, 5vw, 58px); border-top: 1px solid var(--line); padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: white; }
#answer.empty { color: var(--muted); font-size: .875rem; }
.question { font: italic 1.2rem/1.25 Georgia, serif; margin: 0 0 9px; overflow-wrap: anywhere; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.option { display: flex; align-items: center; text-align: left; gap: 8px; min-height: 42px; border: 1px solid var(--line); padding: 6px 9px; font-size: .9375rem; overflow-wrap: anywhere; }
.option i { color: var(--muted); font: .75rem/1 system-ui, sans-serif; }
.option:disabled { opacity: 1; }
.option.correct { background: #edf4ed; border-color: #b6c9b6; }
.option.incorrect { background: #faeeee; border-color: #d9b4b4; }
.result { margin-top: 7px; font-size: .875rem; }
.result > div { display: flex; gap: 4px; flex: none; }
.primary { background: #343239; color: white; }
.primary:hover { background: #4c4853; }
.retry, .muted { color: var(--muted); }
.records { height: 100%; overflow: auto; max-width: 860px; margin: 0 auto; padding: clamp(22px, 5vw, 58px); }
.records h2 { font-size: .875rem; color: var(--muted); margin: 22px 0 4px; }
.jump { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 0; }
.jump span { overflow-wrap: anywhere; }
.jump small { color: var(--muted); font-size: .8125rem; flex: none; }
.attempt { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.attempt strong, .attempt em { display: block; font-style: normal; }
.attempt em { margin-top: 2px; color: var(--muted); font-size: .875rem; }
.more { margin-top: 12px; }
dialog { width: min(94vw, 560px); max-height: 85dvh; padding: 0; border: 1px solid var(--line); border-radius: 9px; }
dialog::backdrop { background: #25242155; }
.modalhead { position: sticky; top: 0; background: white; border-bottom: 1px solid var(--line); padding: 10px 16px; }
.modalhead h2 { font-size: 1.0625rem; margin: 0; }
#close { font-size: 1.3rem; }
#modalBody { padding: 8px 16px 18px; }
#modalBody img { display: block; width: 100%; height: auto; }
@media (max-width: 760px) {
  .layout { display: block; }
  aside { display: none; }
  header { height: 46px; }
  .reading { padding: 9px 16px; }
  #answer { margin-inline: 16px; padding-top: 8px; }
  .context { margin-bottom: 1px; }
  article h1 { margin-bottom: 9px; }
  .article-meta { margin-top: 5px; }
  .option { gap: 6px; font-size: .875rem; min-height: 44px; }
  .reading.focused .article-meta, .reading.focused h1 { display: none; }
  .reading.focused #lines { margin-top: 8px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #practice { flex-direction: row; }
  .reading, #answer { flex: 1 1 50%; max-height: none; }
  #answer { margin: 0; padding: 10px 14px; border-top: 0; border-left: 1px solid var(--line); }
}
