:root {
  color-scheme: light;
  font: 100%/1.52 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #f8f6ef;
  --panel: #fffcf5;
  --ink: #27342b;
  --muted: #555f51;
  --pine: #254538;
  --pine-dark: #18372c;
  --soft: #e6ece3;
  --line: #dcdcd0;
  --rust: #874a38;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --han: "Kaiti TC", "Songti TC", "Noto Serif CJK TC", "PMingLiU", serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
a { color: var(--pine-dark); }
:focus-visible { outline: 3px solid #5a7054; outline-offset: 3px; }
.site-header { border-bottom: 1px solid var(--line); background: #f8f6ef; }
.header-content, .workspace { width: min(100% - 64px, 1152px); margin-inline: auto; }
.header-content { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  border: 1px solid #693a2b; background: var(--rust); color: #fff9ee; border-radius: 5px;
  width: 38px; height: 38px; display: grid; place-items: center; font: 1.38rem/1 var(--han);
  box-shadow: inset 0 0 0 2px var(--rust), inset 0 0 0 3px #b57b61;
}
.brand strong { display: block; font: 600 1.16rem/1.15 var(--serif); }
.brand div span { display: block; margin-top: 5px; font: .875rem/1.2 var(--han); color: var(--muted); letter-spacing: .14em; }
.workspace { padding-block: 44px 52px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 28px; }
.eyebrow { color: var(--rust); margin: 0 0 7px; font: 600 .98rem var(--han); letter-spacing: .23em; }
h1 { margin: 0; font: 500 clamp(2.3rem, 5vw, 4rem)/1.04 var(--serif); letter-spacing: -.035em; }
.coverage { margin: 0 0 4px; color: var(--muted); font-size: .92rem; }
.coverage span { padding-left: 4px; font-variant-numeric: tabular-nums; }
.layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 28px; align-items: start; }
.side {
  background: #f3f1e7; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.side-header { padding: 20px 19px 17px; }
h2 { margin: 0; font: 600 1.25rem/1.2 var(--serif); }
.progress-count { display: block; margin: 8px 0 7px; color: var(--muted); font-size: .875rem; }
progress { appearance: none; display: block; border: 0; width: 100%; height: 5px; border-radius: 20px; overflow: hidden; background: #dedfd3; }
progress::-webkit-progress-bar { background: #dedfd3; }
progress::-webkit-progress-value { background: var(--pine); }
progress::-moz-progress-bar { background: var(--pine); }
.passage-list { padding: 0 9px; }
.passage {
  display: block; width: 100%; text-align: left; border: 1px solid transparent; color: var(--ink);
  background: transparent; border-radius: 8px; padding: 9px 10px; margin: 3px 0;
}
.passage:hover { background: #eaeae1; }
.passage[aria-current="true"] { color: var(--pine-dark); background: #e1e9dd; border-color: #d1ddce; }
.passage span { display: block; }
.passage-range { font-size: .875rem; font-weight: 650; }
.passage-text { font: 1rem/1.6 var(--han); letter-spacing: .04em; margin-top: 1px; }
.side-note { margin: 14px 19px 17px; color: var(--muted); font-size: .875rem; }
.practice { min-width: 0; }
.toolbar { display: flex; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.segmented { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #eeede4; }
.segmented button {
  border: 0; background: transparent; min-height: 38px; min-width: 75px; padding: 0 15px; color: var(--muted);
  border-radius: 6px; font-size: .92rem; font-weight: 600;
}
.segmented button[aria-pressed="true"] { background: var(--panel); color: var(--pine-dark); box-shadow: 0 1px 3px #1f342319; }
.segmented button:hover { color: var(--pine-dark); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 620; color: inherit; text-decoration: none; padding: 8px 14px; font-size: .9rem; text-align: center;
}
.quiet { background: var(--panel); border-color: var(--line); }
.quiet:hover:not(:disabled) { border-color: #a5b29f; background: #f3f4eb; }
.primary { background: var(--pine); color: #fffdf4; }
.primary:hover:not(:disabled) { background: var(--pine-dark); }
.text-button { background: transparent; color: #d9e3cf; padding-inline: 10px; }
.text-button:hover { background: #ffffff14; }
.voice-panel {
  border: 1px solid #cfdbce; background: #e8eee4; border-radius: 9px; padding: 8px 10px 8px 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 11px; margin-bottom: 12px;
}
.voice-info { display: flex; align-items: center; gap: 10px; }
.voice-info p { margin: 0; font-size: .9rem; }
.microphone-help {
  color: var(--pine-dark); background: transparent; border: 0; padding: 4px 0;
  text-decoration: underline; text-underline-offset: 2px; font-size: .875rem;
}
.voice-dot { display: block; flex: 0 0 9px; height: 9px; border-radius: 50%; background: #778375; }
.voice-panel[data-listening="true"] .voice-dot { background: #397450; outline: 3px solid #b8d2b8; }
.phrase-card {
  position: relative; border-radius: 14px; min-height: 330px; display: flex; flex-direction: column;
  border: 1px solid #18392c; color: #fffaf0; overflow: hidden;
  background: radial-gradient(ellipse at 75% 12%, #335346, var(--pine-dark) 85%);
  box-shadow: 0 5px 13px #20352913;
}
.phrase-card::before { content: ""; position: absolute; inset: 8px; border: 1px solid #d3dfc72b; border-radius: 8px; pointer-events: none; }
.card-top, .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 23px; }
.card-position { margin: 0; color: #dbe5d2; font-size: .92rem; font-weight: 600; }
.card-middle { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px 22px; min-height: 185px; }
.characters { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 10px; max-width: 100%; }
.glyph { display: flex; flex-direction: column; align-items: center; min-width: 1.07em; font: 500 clamp(2rem, 5.8vw, 4.35rem)/1.25 var(--han); }
.glyph small { font: 500 .86rem/1.35 -apple-system, BlinkMacSystemFont, "Noto Sans Bopomofo", sans-serif; color: #d4dfca; margin-top: 4px; white-space: nowrap; }
.recall-prompt { font: 1.25rem/1.4 var(--serif); text-align: center; margin: 9px 0; color: #edf1e3; }
.reveal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 9px; }
.reveal-actions .button { color: var(--pine-dark); background: #edf0e3; border-color: #edf0e3; }
.reveal-actions .button:hover { background: white; }
.reveal-actions .quiet { color: #f8f9ef; background: transparent; border-color: #aabdad; }
.reveal-actions .quiet:hover { background: #ffffff14; }
.check-label, .card-range { font-size: .875rem; color: #e7eddf; }
.check-label { display: flex; align-items: center; gap: 8px; min-height: 39px; }
.check-label span { color: #c6d4bf; }
.check-label:has(input:disabled) { opacity: .62; }
.check-label input { accent-color: #b8ccaa; width: 17px; height: 17px; margin: 0; }
.phrase-card :focus-visible { outline-color: #d0e2be; }
.navigation, .navigation-right { display: flex; align-items: center; gap: 9px; }
.navigation { justify-content: space-between; margin-top: 13px; }
.notes { margin-top: 17px; }
.practice-help { margin: 0; color: var(--muted); font-size: .92rem; }
.review {
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 11px 13px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.review h2 { font-size: 1.12rem; }
.review p { margin: 3px 0 0; color: var(--muted); font-size: .875rem; }
.rating-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.rating-buttons [aria-pressed="true"] { background: var(--soft); border-color: #9eb49c; }
.phrase-index { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 17px; }
.phrase-index h2 { font-size: 1.15rem; margin-bottom: 10px; }
.number-list { display: flex; flex-wrap: wrap; gap: 6px; }
.number {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: .875rem; min-width: 40px; min-height: 40px; padding: 0 5px; font-variant-numeric: tabular-nums;
}
.number:hover { border-color: #9fb39c; }
.number[data-rating="memory"] { background: var(--soft); color: var(--pine-dark); }
.number[data-rating="again"], .number[data-rating="hint"] { box-shadow: inset 0 -3px #bc8d62; }
.number[aria-current="true"] { border-color: var(--pine); background: var(--pine); color: white; }
dialog { width: min(94%, 560px); max-height: 90dvh; color: var(--ink); border-radius: 14px; border: 1px solid var(--line); background: var(--panel); padding: 20px; }
dialog::backdrop { background: #17282099; }
.dialog-title, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-actions { justify-content: flex-end; flex-wrap: wrap; }
.source-pages { margin-top: 12px; display: grid; justify-items: center; gap: 14px; }
.source-pages figure { margin: 0; }
.source-pages img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 5px; }
.source-pages figcaption { color: var(--muted); text-align: center; margin-top: 5px; }
.reference-list { padding-left: 18px; }
.reference-list li + li { margin-top: 8px; }
@media (max-width: 800px) {
  .header-content, .workspace { width: calc(100% - 36px); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .workspace { padding-top: 26px; }
  .page-heading { margin-bottom: 18px; }
  .side-header { padding: 11px 12px 9px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; }
  .progress-count { margin: 0; }
  progress { grid-column: 1 / -1; }
  .passage-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 7px 7px; }
  .passage { min-height: 43px; text-align: center; margin: 0; padding: 6px 3px; }
  .passage .passage-text, .side-note { display: none; }
}
@media (max-width: 420px) {
  .header-content, .workspace { width: calc(100% - 24px); }
  .header-content { min-height: 64px; }
  .page-heading { display: block; }
  .coverage { margin-top: 5px; }
  .segmented button { min-width: 64px; padding-inline: 8px; }
  .card-top, .card-bottom { padding-inline: 14px; }
  .card-middle { padding-inline: 16px; }
  .glyph { font-size: clamp(1.9rem, 7vw, 2.3rem); }
  .glyph small { font-size: .75rem; }
  .characters { gap: 6px; }
  .navigation .button { padding-inline: 8px; }
}
