:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: #fff;
  --soft: #fcfbf8;
  --line: #dedbd6;
  --strong-line: #918b83;
  --ink: #292624;
  --muted: #635d56;
  --accent: #b11f4b;
  --accent-hover: #941a3e;
  --accent-soft: #f9edf0;
  --accent-ink: #fff;
  --success: #236d40;
  --danger: #ae292d;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #33302e;
    --surface: #292726;
    --soft: #302d2b;
    --line: #514c48;
    --strong-line: #a59a93;
    --ink: #f2eae4;
    --muted: #c0b6ae;
    --accent: #fd8ea1;
    --accent-hover: #ffb0be;
    --accent-soft: #442c32;
    --accent-ink: #24191c;
    --success: #86d6a0;
    --danger: #ff9fa4;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Aptos, Calibri, sans-serif; line-height: 1.6; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button, input, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: 3px; }
button:disabled { cursor: default; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
main:focus, h1[tabindex="-1"]:focus-visible, h2[tabindex="-1"]:focus-visible { outline: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { line-height: 1.23; letter-spacing: -.025em; }
h1 { font-size: clamp(26px, 5vw, 36px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: 20px; }
p { margin-bottom: 18px; }
.app { width: min(800px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 32px; }
.app-header, .brand, .top-actions, .account-bar, .app-footer, .progress-meta, .breadcrumb, .actions, .next-row { display: flex; align-items: center; gap: 12px; }
.app-header { justify-content: space-between; margin-bottom: 20px; }
.brand { color: var(--ink); text-decoration: none; min-width: 0; line-height: 1.35; }
.brand-title { display: block; font-weight: 750; font-size: clamp(20px, 4vw, 27px); letter-spacing: -.03em; }
.brand-subtitle { display: block; margin-top: 3px; font-size: 13px; }
.logo { display: grid; flex-shrink: 0; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 24px; }
.account-bar { justify-content: space-between; border-top: 1px solid var(--line); padding: 10px 0 18px; font-size: 13px; color: var(--muted); }
#accountLabel { overflow-wrap: anywhere; }
.card { padding: clamp(22px, 5vw, 38px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px #00000006; }
.hero { text-align: center; }
.hero p { max-width: 590px; margin-left: auto; margin-right: auto; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 750; margin-bottom: 13px; }
.intro { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spaced { margin-top: 24px; }
.primary, .secondary, .ghost, .answer, .file-label {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 17px; border: 1px solid var(--strong-line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; line-height: 1.45;
}
.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary:hover:not(:disabled), .ghost:hover:not(:disabled), .file-label:hover { border-color: var(--accent); }
.ghost { background: var(--soft); border-color: var(--line); }
.text-button { min-height: 44px; padding: 4px 7px; color: var(--accent); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.actions { flex-wrap: wrap; }
.center-actions { justify-content: center; }
.breadcrumb { flex-wrap: wrap; font-size: 13px; margin: 0 0 18px; color: var(--muted); }
.breadcrumb a { min-height: 36px; display: inline-flex; align-items: center; }
.theme-list, .chapter-list, .word-list { list-style: none; padding: 0; margin: 26px 0 0; }
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-link, .chapter-link { display: flex; gap: 16px; align-items: center; text-decoration: none; color: var(--ink); padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.theme-link:hover, .chapter-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-number { color: var(--accent); font-family: Georgia, "Times New Roman", serif; font-size: 29px; line-height: 1; min-width: 30px; }
.link-title { display: block; font-weight: 700; font-size: 18px; }
.link-meta { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.chapter-list { display: grid; gap: 10px; }
.chapter-link { justify-content: space-between; }
.chapter-arrow { color: var(--accent); font-size: 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.stat { padding: 15px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); text-align: center; }
.stat strong { display: block; font-size: 25px; line-height: 1.4; }
.stat span { color: var(--muted); font-size: 13px; }
.word-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.word-list li { border-top: 1px solid var(--line); padding: 11px 0; font-size: 15px; }
.word-list .learned { color: var(--success); }
.progress-meta { justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
progress { display: block; appearance: none; border: 0; width: 100%; height: 7px; border-radius: 10px; background: var(--line); margin-bottom: 22px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--accent); }
.quiz-card { min-height: 450px; }
.quiz-type { display: inline-block; background: var(--accent-soft); color: var(--accent); padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 700; margin-bottom: 19px; }
.prompt { font-size: 16px; color: var(--muted); margin-bottom: 10px; }
.question { margin-bottom: 24px; overflow-wrap: anywhere; }
.english { border-left: 3px solid var(--accent); padding: 12px 15px; background: var(--accent-soft); color: var(--muted); }
.answers { display: grid; gap: 10px; }
.answer { width: 100%; text-align: left; justify-content: flex-start; padding: 15px 17px; font-weight: 500; background: var(--soft); border-color: var(--line); }
.answer:hover:not(:disabled) { border-color: var(--accent); }
.answer.correct { border-color: var(--success); color: var(--success); opacity: 1; }
.answer.wrong { border-color: var(--danger); color: var(--danger); opacity: 1; }
.typing-label { display: block; margin-bottom: 6px; font-weight: 650; }
.typing-row { display: flex; gap: 10px; }
.typing-row input { min-width: 0; flex: 1; padding: 13px 14px; border: 1px solid var(--strong-line); border-radius: 10px; background: var(--soft); color: var(--ink); }
.hint { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
summary { color: var(--accent); min-height: 44px; padding: 8px 0; font-weight: 650; }
.hint p { margin: 7px 0; }
.notice, .feedback, .record-panel { margin: 0 0 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: 15px; overflow-wrap: anywhere; }
.notice p:last-child, .feedback p:last-child { margin-bottom: 0; }
.notice.error { border-left: 4px solid var(--danger); }
.notice.info { border-left: 4px solid var(--accent); }
.feedback { margin-top: 22px; margin-bottom: 0; }
.feedback.good { border-left: 4px solid var(--success); }
.feedback.retry { border-left: 4px solid var(--accent); }
.feedback strong { display: block; margin-bottom: 6px; }
.next-row { justify-content: flex-end; margin-top: 18px; }
.listen-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.audio-note { flex-basis: 100%; margin: 4px 0 0; }
.record-panel { margin-top: 22px; }
.record-panel h3 { font-size: 17px; margin-bottom: 8px; }
.record-status { margin: 12px 0; }
.recording { color: var(--danger); font-weight: 700; }
.self-check { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.self-check h3 { font-size: 17px; margin-bottom: 7px; }
.score-grid { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.score-grid .stat { min-width: 110px; flex: 1; }
.assessment-words { padding-left: 20px; font-size: 14px; }
.result-icon { font-size: 45px; margin-bottom: 10px; }
.data-tools { margin: 22px 0; border-top: 1px solid var(--line); padding-top: 8px; }
.file-label { position: relative; overflow: hidden; cursor: pointer; }
.file-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-label:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.app-footer { justify-content: space-between; flex-wrap: wrap; margin-top: 25px; font-size: 12px; color: var(--muted); }
.skip-link { position: fixed; left: 15px; top: -100px; background: var(--surface); padding: 10px 18px; z-index: 10; border: 2px solid var(--accent); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.privacy-copy h2 { font-size: 21px; margin-top: 28px; margin-bottom: 9px; }
.privacy-copy li { margin-bottom: 9px; }
@media (max-width: 560px) {
  .app { width: calc(100% - 24px); padding-top: 18px; }
  .brand-subtitle { display: none; }
  .logo { width: 38px; height: 42px; }
  .app-header { gap: 7px; }
  .top-actions .ghost { font-size: 12px; padding: 8px 10px; min-width: 85px; }
  .brand { gap: 8px; }
  .theme-list, .word-list { grid-template-columns: 1fr; }
  .stats { gap: 7px; }
  .stat span { font-size: 12px; }
  .typing-row { flex-direction: column; }
  .actions > button { flex: 1 1 160px; }
  .progress-meta { flex-wrap: wrap; gap: 2px 10px; }
  .chapter-link { padding: 15px; }
}
@media (prefers-reduced-motion: no-preference) {
  .card { animation: settle 180ms ease-out; }
  @keyframes settle { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
