/* Local teaching assets. Layout and accessibility patterns adapted from the
   neighboring ComfyUI workspace; no runtime dependency on that workspace. */
:root {
  color-scheme: light;
  --paper: #faf9f5; --card: #fff; --ink: #213336; --muted: #526369;
  --line: #ced7d4; --accent: #186653; --soft: #eaf2ed;
  --gold: #f0d8a6; --danger: #963b28;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.8 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
main { width: min(1100px, 100%); margin: auto; padding: 32px 36px 72px; }
.narrow { max-width: 900px; }
a { color: var(--accent); text-underline-offset: 4px; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
p, li, td, dd { overflow-wrap: anywhere; }
p { margin: 12px 0; }
h1, h2, h3 { line-height: 1.35; }
h1 { font-size: clamp(30px, 4.7vw, 49px); letter-spacing: -.025em; margin: 22px 0 18px; }
h2 { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); font-size: clamp(23px, 3vw, 29px); }
h3 { margin-top: 25px; font-size: 20px; }
section, h2, tr[id] { scroll-margin-top: 24px; }
.topnav, .jumpnav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; font-size: 14px; padding: 12px 0 20px; border-bottom: 1px solid var(--line); }
.topnav { justify-content: space-between; }
.eyebrow { color: var(--accent); font: 700 12px/1.7 ui-monospace, monospace; letter-spacing: .15em; margin-top: 28px; }
.lead { font-size: 20px; max-width: 760px; color: var(--muted); }
.meta, .source { font-size: 14px; color: var(--muted); }
.objective, .note { padding: 18px 22px; border-left: 4px solid var(--accent); background: var(--soft); margin: 22px 0; }
.objective p { margin: 0; }
.route { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 25px 0; }
.route a { padding: 16px; background: var(--card); text-decoration: none; }
.route strong, .route span { display: block; }
.route span { font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; padding: 16px; background: var(--soft); }
.toolbar .feedback { width: 100%; margin: 0; }
#day-select { width: 100%; max-width: 100%; min-width: 0; flex: 1 1 280px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.phrase { padding: 18px; background: var(--card); border: 1px solid var(--line); margin: 12px 0; }
.phrase strong { display: block; font-size: 21px; line-height: 1.5; }
.phrase p { margin-bottom: 0; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
th { background: var(--soft); }
td { background: var(--card); }
caption { text-align: left; margin-bottom: 8px; color: var(--muted); }
.table-wrap { max-width: 100%; overflow-x: auto; }
.day-table td:first-child { font-size: 22px; font-weight: 700; color: var(--accent); width: 5%; }
.day-table td:nth-child(2) { width: 29%; }
.day-table td:nth-child(3) { width: 25%; }
.day-table td:nth-child(4) { width: 17%; }
tr:target td, .day-selected td { background: #fff3d9; }
button, select, textarea { font: inherit; color: var(--ink); }
button, select { min-height: 46px; padding: 9px 14px; border: 1px solid #899d96; border-radius: 4px; background: white; }
button { cursor: pointer; }
button:hover { border-color: var(--accent); background: var(--soft); }
button.primary { background: var(--accent); color: white; }
:focus-visible { outline: 3px solid #2369ac; outline-offset: 4px; }
.skip-link { position: absolute; top: -100px; left: 16px; padding: 10px; background: white; z-index: 2; }
.skip-link:focus { top: 8px; }
.quiz, .practice, .assessment { padding: 22px; margin: 24px 0; border: 1px solid var(--line); background: var(--card); }
.quiz h3, .practice h3 { margin-top: 0; }
.choices { display: grid; gap: 10px; margin: 14px 0; }
.choice { text-align: left; }
.is-correct { border-color: var(--accent); background: var(--soft); }
.is-wrong { border-color: var(--danger); background: #fff2ed; }
.feedback { min-height: 1.8em; font-size: 15px; margin-top: 14px; }
.feedback[data-state="success"] { color: var(--accent); }
.feedback[data-state="error"] { color: var(--danger); }
label { display: block; margin: 12px 0 6px; }
textarea { display: block; width: 100%; min-height: 100px; padding: 12px; border: 1px solid #899d96; background: #fffcf5; margin-bottom: 12px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; }
input[type="checkbox"] { width: 19px; height: 19px; margin: 6px 0 0; flex: 0 0 19px; accent-color: var(--accent); }
.assessment select { display: block; width: 100%; max-width: 540px; }
details { margin: 18px 0; padding: 14px 18px; border: 1px solid var(--line); background: var(--card); }
summary { cursor: pointer; font-weight: 650; }
pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; padding: 20px; border: 1px solid var(--line); background: #eef1eb; font: 14px/1.85 ui-monospace, monospace; }
code { font-family: ui-monospace, monospace; }
dl { margin: 18px 0; }
dt { font-weight: 650; }
dd { margin: 0 0 15px; }
footer { margin-top: 42px; border-top: 1px solid var(--line); padding-top: 20px; font-size: 14px; }
[hidden] { display: none !important; }
.no-js-only { display: block; }
.js .no-js-only { display: none; }
.js-only { display: none; }
.js .js-only { display: inline-block; }
.course-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.course-card { display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: white; text-decoration: none; }
.course-card:hover { background: var(--soft); }
.course-card strong { color: var(--ink); line-height: 1.5; margin: 8px 0; }
.course-card .meta { font-size: 13px; }
.course-card.practiced { border-color: var(--accent); }
.practice-mark { align-self: flex-start; font-size: 12px; padding: 2px 8px; margin-top: auto; background: var(--soft); border-radius: 20px; }
.vocab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.word-card { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 18px; background: white; }
.word-card h3 { margin: 0; color: var(--accent); }
.word-card p { margin: 8px 0; }
.term-status { width: 100%; max-width: 100%; font-size: 14px; }
.term-label { font-size: 13px; color: var(--muted); }
.js .term-label { display: block; margin-top: 12px; }
.audio-block { margin: 18px 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #f2f4f1; }
.audio-block > p:first-child { margin-top: 0; }
audio { display: block; width: 100%; max-width: 100%; min-width: 0; }
.audio-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.audio-tools label { margin: 0; font-size: 13px; }
.audio-tools select { min-height: 40px; padding: 4px 10px; font-size: 14px; }
.clip-button { font-size: 13px; min-height: 40px; padding: 6px 10px; margin: 6px 8px 6px 0; }
.clip-button[aria-pressed="true"] { background: var(--accent); color: white; }
.audio-error:empty { display: none; }
.audio-status { position: fixed; bottom: 10px; left: 10px; max-width: min(420px, calc(100vw - 20px)); padding: 6px 12px; font-size: 13px; color: white; background: #213336; border-radius: 4px; pointer-events: none; z-index: 3; }
.audio-status:empty { display: none; }
.transcript { list-style: none; padding: 0; }
.transcript li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.speaker { display: block; font-size: 12px; color: var(--muted); }
#practice-prompt { min-height: 220px; }
.lesson-entry { display: inline-block; font-weight: 700; margin: 8px 0; }
@media (max-width: 850px) { .course-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 500px) { .course-cards, .vocab-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  main { padding: 20px 18px 44px; }
  body { font-size: 16px; }
  .route, .grid { grid-template-columns: 1fr 1fr; }
  .day-table, .day-table tbody { display: block; }
  .day-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .day-table tr { display: block; margin: 18px 0; border: 1px solid var(--line); }
  .day-table td, .day-table td:nth-child(n) { display: block; width: 100%; border: 0; border-bottom: 1px dotted var(--line); padding: 10px 14px; }
  .day-table td::before { content: attr(data-label); display: block; font-weight: 650; color: var(--muted); font-size: 12px; }
  .day-table td:first-child::before { display: inline; content: "DAY "; }
  .quiz, .practice, .assessment { padding: 16px; }
  th, td { padding: 9px; }
}
@media (max-width: 440px) { .grid { grid-template-columns: 1fr; } .route a { padding: 12px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  @page { margin: 15mm; }
  body { background: white; color: #111; font-size: 10.5pt; line-height: 1.6; }
  main { width: 100%; max-width: none; padding: 0; }
  h1 { font-size: 25pt; }
  h2 { font-size: 17pt; break-after: avoid; margin-top: 24px; padding-top: 15px; }
  h3 { font-size: 13pt; break-after: avoid; }
  .topnav, .jumpnav, .route, .toolbar, .skip-link, button, textarea, .assessment select { display: none; }
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; }
  th, td { padding: 6px; }
  .day-table { display: table; }
  .day-table thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; display: table-header-group; }
  .day-table tbody { display: table-row-group; }
  .day-table tr { display: table-row; }
  .day-table td, .day-table td:nth-child(n) { display: table-cell; width: auto; border: 1px solid #aaa; }
  .day-table td::before { display: none !important; }
  a { color: #111; }
  tr, .phrase { break-inside: avoid; }
  .objective, .note, th, td { background: white; }
  details > :not(summary) { display: block; }
  .no-js-only, .js .no-js-only { display: block; }
  .choices button { display: block; width: 100%; text-align: left; padding: 4px; min-height: auto; border: 0; }
  input[type="checkbox"] { appearance: none; border: 1px solid #555; }
  audio, .audio-tools, .audio-status, .term-label, .term-status, .js .js-only, .progress-feedback, .local-state-note { display: none; }
  .vocab-grid { display: block; }
  .word-card { break-inside: avoid; margin-bottom: 8px; padding: 8px; }
  .course-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
