:root {
  color: #3d3929;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --background: #faf9f5;
  --foreground: #3d3929;
  --card: #ffffff;
  --primary: #c96442;
  --primary-deep: #a34a2a;
  --primary-soft: #f6ded6;
  --secondary: #e9e6dc;
  --muted: #83827d;
  --border: #dedbd3;
  --mint: #3da982;
  --mint-soft: #dff2e9;
  --yellow: #d8a63f;
  --yellow-soft: #fff2cc;
  --danger: #d44f43;
  --danger-soft: #f9dedb;
  --blue: #4b7fa7;
  --blue-soft: #e6f0f7;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; letter-spacing: 0; }
html, body, #app { width: 100%; min-width: 320px; height: 100%; margin: 0; }
body { background: var(--background); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgb(201 100 66 / 24%);
  outline-offset: 3px;
}

.app-shell {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgb(201 100 66 / 4%), transparent 22%), var(--background);
  overflow: hidden;
}

.app-header {
  z-index: 20;
  flex: 0 0 76px;
  height: 76px;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid rgb(222 219 211 / 80%);
  background: rgb(250 249 245 / 94%);
  box-shadow: 0 8px 24px rgb(36 32 23 / 4%);
}

.module-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.home-link {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px;
  color: var(--foreground); text-decoration: none; border-radius: 6px; font-size: 25px;
}
.brand-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-copy small { color: var(--primary); font-size: 9px; font-weight: 900; }
.brand-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.demo-tabs { width: 100%; min-width: 0; display: flex; justify-content: safe center; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.demo-tabs::-webkit-scrollbar { display: none; }
.demo-tabs button, .demo-tabs a {
  min-width: 86px; height: 48px; display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  padding: 0 11px; border: 0; border-radius: 24px; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 900; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: transform .16s, background .16s, color .16s, box-shadow .16s;
}
.demo-tabs button:hover, .demo-tabs a:hover { color: var(--foreground); background: var(--secondary); }
.demo-tabs button.active { color: white; background: var(--primary); box-shadow: 0 8px 18px rgb(201 100 66 / 22%); }
.nav-number { opacity: .66; font-size: 10px; font-variant-numeric: tabular-nums; }
.lab-status { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 900; }
.lab-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgb(61 169 130 / 12%); }

.feature-page { width: min(100%, 1440px); height: 100%; min-height: 0; margin: 0 auto; padding: 16px 24px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.feature-heading { flex: none; min-height: 70px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.heading-copy { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 7px; color: var(--primary); font-size: 11px; font-weight: 900; }
.feature-heading h1 { margin: 4px 0 2px; font-size: 26px; line-height: 1.15; }
.feature-heading p { max-width: 850px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.55; }
.feature-actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; flex: none; }
.tool-button {
  width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 22px; font-weight: 700; cursor: pointer;
}
.tool-button:hover { color: var(--primary); background: white; }
.view-button {
  min-height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px; border: 1px solid var(--border);
  border-radius: 7px; background: white; font-size: 12px; font-weight: 900; cursor: pointer;
}

.guided-layout { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; }
.guided-layout.complete { grid-template-columns: minmax(0, 1fr); }
.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.panel { border: 1px solid var(--border); border-radius: 8px; background: var(--card); box-shadow: 0 8px 22px rgb(36 32 23 / 5%); }
.action-button {
  min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  padding: 9px 18px; border: 1px solid transparent; border-bottom-width: 5px; border-radius: 10px;
  font-size: 13px; font-weight: 900; cursor: pointer; transition: transform .12s, filter .12s;
}
.action-button.primary { color: white; background: var(--primary); border-color: var(--primary-deep); box-shadow: 0 9px 18px rgb(201 100 66 / 18%); }
.action-button.secondary { background: white; border-color: #c7c2b8; }
.action-button.success { color: white; background: var(--mint); border-color: #26795d; }
.action-button:disabled { opacity: .42; cursor: default; }
.action-button:active:not(:disabled) { border-bottom-width: 2px; transform: translateY(3px); }
.text-button { border: 0; background: transparent; color: var(--primary-deep); font-size: 12px; font-weight: 900; cursor: pointer; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 4px; background: var(--primary-soft); color: var(--primary-deep); font-size: 10px; font-weight: 900; }
.status-chip.mint { background: var(--mint-soft); color: #246d54; }
.status-chip.blue { background: var(--blue-soft); color: #345f80; }
.muted { color: var(--muted); }

.search-strip { min-height: 66px; display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: center; gap: 10px; padding: 11px 14px; }
.input-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 7px; background: #fcfbf8; }
.input-wrap span { color: var(--primary); font-size: 16px; }
.input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 800; }
.suggestions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.suggestions button { min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 5px; background: white; color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; }
.suggestions button:hover { border-color: var(--primary); color: var(--primary-deep); }

.pronunciation-grid { flex: 1; min-height: 430px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; }
.question-panel { min-width: 0; padding: 24px 28px; display: flex; flex-direction: column; justify-content: center; }
.question-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.word-focus { margin: 20px 0 4px; text-align: center; font-family: Georgia, "Kaiti SC", serif; font-size: clamp(42px, 6vw, 72px); font-weight: 800; }
.context-line { margin: 0 auto 20px; max-width: 680px; text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.6; }
.masked-reading { display: flex; justify-content: center; gap: 9px; margin-bottom: 18px; }
.masked-reading span { min-width: 74px; height: 42px; display: grid; place-items: center; border-bottom: 3px solid var(--primary); color: var(--primary-deep); font-family: ui-monospace, monospace; font-size: 15px; font-weight: 900; }
.choice-grid { width: min(620px, 100%); margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.choice-button { min-height: 54px; border: 2px solid var(--border); border-radius: 8px; background: white; font-size: 16px; font-weight: 900; cursor: pointer; }
.choice-button:hover { border-color: #e4aa96; background: #fffaf8; }
.choice-button.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
.choice-button.correct { border-color: var(--mint); background: var(--mint-soft); color: #246d54; }
.choice-button.wrong { border-color: var(--danger); background: var(--danger-soft); color: #9f3932; }
.question-actions { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; }
.need-panel { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.need-panel h2 { margin: 4px 0 0; font-size: 18px; }
.need-panel p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.55; }
.mastery-ring { width: 112px; height: 112px; margin: 6px auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) var(--value), var(--secondary) 0); position: relative; }
.mastery-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: white; }
.mastery-ring div { z-index: 1; text-align: center; }
.mastery-ring strong { display: block; font-size: 25px; }
.mastery-ring span { color: var(--muted); font-size: 9px; font-weight: 800; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list span { padding: 5px 7px; border-radius: 4px; background: var(--secondary); color: var(--muted); font-size: 9px; font-weight: 850; }

.analysis-panel { padding: 20px 22px; display: grid; grid-template-columns: minmax(190px, .7fr) minmax(0, 1.3fr); gap: 18px; }
.result-mark { border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: 7px; padding-right: 18px; }
.result-mark strong { font-size: 23px; }
.result-mark p, .analysis-copy p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.6; }
.syllable-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.syllable-card { display: grid; grid-template-columns: 32px 1fr; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.syllable-card b { font-size: 20px; }
.syllable-card span { color: var(--muted); font-size: 9px; font-weight: 800; }
.analysis-copy { display: grid; gap: 10px; }
.analysis-layer { padding-left: 12px; border-left: 3px solid var(--primary); }
.analysis-layer.secondary { border-color: var(--yellow); }
.analysis-layer b { display: block; margin-bottom: 4px; font-size: 12px; }
.analysis-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.report-box { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.report-box textarea { min-height: 64px; resize: none; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: #fcfbf8; font-size: 12px; }

.notebook-panel { flex: 1; min-height: 430px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.notebook-header { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.notebook-header h2 { margin: 0; font-size: 21px; }
.notebook-header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.notebook-grid { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-height: 0; }
.notebook-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 7px; background: #fffdfa; }
.notebook-card strong { font-family: Georgia, "Kaiti SC", serif; font-size: 22px; }
.notebook-card b { display: block; margin: 7px 0; color: var(--primary-deep); }
.notebook-card p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.55; }

.classical-grid { flex: 1; min-height: 440px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; }
.material-panel { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.material-panel h2 { margin: 4px 0 0; font-family: Georgia, "Kaiti SC", serif; font-size: 21px; }
.material-panel p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.55; }
.material-panel select { width: 100%; min-height: 40px; padding: 0 9px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 12px; font-weight: 800; }
.integrity-list { display: grid; gap: 7px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.integrity-list span { display: flex; align-items: center; gap: 7px; color: #367a61; font-size: 10px; font-weight: 850; }
.ability-map { margin-top: auto; }
.ability-map > div { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.workbench-panel { min-width: 0; padding: 22px 26px; display: flex; flex-direction: column; }
.segmented { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 7px; background: var(--secondary); width: fit-content; }
.segmented button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 900; cursor: pointer; }
.segmented button.active { color: var(--foreground); background: white; box-shadow: 0 2px 7px rgb(36 32 23 / 10%); }
.workbench-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workbench-question { margin: 22px 0 10px; font-size: 17px; font-weight: 900; }
.punctuation-board { flex: 1; min-height: 180px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; align-content: center; padding: 24px; border: 1px solid #e8e4da; border-radius: 8px; background: #fcfaf5; font-family: Georgia, "Kaiti SC", serif; font-size: clamp(22px, 3vw, 34px); font-weight: 750; line-height: 1.9; }
.punctuation-board .token { white-space: nowrap; }
.gap-button { width: 16px; height: 42px; margin: 0 1px; padding: 0; border: 0; background: transparent; color: transparent; cursor: pointer; position: relative; }
.gap-button::after { content: ""; width: 2px; height: 24px; background: transparent; position: absolute; top: 9px; left: 7px; }
.gap-button:hover::after { background: #e7b39f; }
.gap-button.active::after { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gap-button.active { color: var(--primary); }
.classic-options { flex: 1; display: grid; align-content: center; gap: 9px; width: min(680px, 100%); margin: 0 auto; }
.classic-options button { min-height: 52px; padding: 10px 14px; border: 2px solid var(--border); border-radius: 7px; background: white; text-align: left; font-size: 13px; font-weight: 850; cursor: pointer; }
.classic-options button.selected { border-color: var(--primary); background: var(--primary-soft); }
.translation-input { width: 100%; min-height: 130px; resize: none; padding: 15px; border: 1px solid var(--border); border-radius: 7px; background: #fcfbf8; font-size: 14px; font-weight: 700; line-height: 1.7; }
.hint-line { min-height: 38px; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: var(--yellow-soft); color: #7d621f; font-size: 11px; font-weight: 750; }
.workbench-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.evidence-sheet { margin-top: 14px; padding: 14px 16px; border-left: 4px solid var(--mint); border-radius: 6px; background: #f1faf6; }
.evidence-sheet strong { font-size: 13px; }
.evidence-sheet p { margin: 5px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.6; }
.evidence-sheet details { margin-top: 8px; color: var(--foreground); font-size: 11px; font-weight: 750; }

.turtle-status { min-height: 58px; padding: 10px 14px; display: grid; grid-template-columns: repeat(3, auto) 1fr auto; align-items: center; gap: 14px; }
.metric { min-width: 100px; padding-right: 14px; border-right: 1px solid var(--border); }
.metric span { display: block; color: var(--muted); font-size: 9px; font-weight: 850; }
.metric strong { font-size: 18px; }
.turtle-main { flex: 1; min-height: 440px; display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 12px; }
.reading-panel { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.reading-panel h2 { margin: 2px 0 0; font-size: 22px; }
.reading-panel .book-name { color: var(--primary); font-size: 11px; font-weight: 900; }
.reading-copy { margin: 0; padding: 16px 18px; border-left: 4px solid var(--primary); background: #fcfaf5; font-family: Georgia, "Kaiti SC", serif; font-size: 16px; font-weight: 700; line-height: 1.9; }
.statement-card { margin-top: auto; padding: 14px 0 0; border-top: 1px solid var(--border); }
.statement-card span { color: var(--muted); font-size: 9px; font-weight: 800; }
.statement-card p { margin: 7px 0 0; font-size: 14px; font-weight: 850; line-height: 1.55; }
.judgement-panel { min-width: 0; padding: 22px 26px; display: flex; flex-direction: column; }
.judgement-panel h2 { margin: 18px 0 12px; font-size: 20px; }
.verdict-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.verdict-grid button { min-height: 58px; border: 2px solid var(--border); border-radius: 8px; background: white; font-size: 14px; font-weight: 900; cursor: pointer; }
.verdict-grid button.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
.reason-label { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 7px; font-size: 11px; font-weight: 900; }
.reason-label span { color: var(--muted); font-weight: 700; }
.reason-input { width: 100%; flex: 1; min-height: 110px; resize: none; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: #fcfbf8; font-size: 13px; font-weight: 700; line-height: 1.65; }
.judge-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.score-result { flex: 1; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; align-items: center; }
.score-seal { width: 110px; height: 110px; display: grid; place-items: center; border: 5px double var(--mint); border-radius: 50%; color: var(--mint); font-family: Georgia, serif; font-size: 42px; font-weight: 900; transform: rotate(-4deg); }
.score-copy h2 { margin: 0 0 7px; }
.score-copy p { margin: 0 0 9px; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.6; }
.score-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.score-breakdown div { padding: 9px; border: 1px solid var(--border); border-radius: 6px; }
.score-breakdown span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; }
.score-breakdown b { font-size: 14px; }
.compose-panel { flex: 1; min-height: 440px; padding: 24px 28px; display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 22px; }
.compose-panel h2 { margin: 5px 0 10px; font-size: 22px; }
.compose-panel p { color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.6; }
.compose-form { display: flex; flex-direction: column; gap: 10px; }
.compose-form textarea { flex: 1; min-height: 160px; resize: none; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: #fcfbf8; font-size: 13px; font-weight: 700; line-height: 1.65; }

.guide-sidebar { z-index: 60; min-width: 0; min-height: 0; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; background: white; box-shadow: 0 10px 26px rgb(36 32 23 / 8%); position: relative; }
.guide-head { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 900; }
.guide-head b { margin-left: auto; color: var(--primary); }
.guide-head button { min-height: 30px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: white; color: var(--muted); font-size: 10px; font-weight: 800; cursor: pointer; }
.guide-current { margin-top: 16px; padding: 16px 0; border-top: 4px solid var(--primary); border-bottom: 1px solid var(--border); }
.guide-current span { color: var(--primary); font-size: 10px; font-weight: 900; }
.guide-current h2 { margin: 7px 0 12px; font-size: 23px; line-height: 1.18; }
.guide-current p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 750; line-height: 1.6; }
.guide-steps { display: grid; gap: 7px; margin-top: auto; }
.guide-step { min-height: 38px; display: grid; grid-template-columns: 25px 1fr; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 6px; color: #aaa69d; }
.guide-step b { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; font-size: 9px; }
.guide-step span { font-size: 11px; font-weight: 800; }
.guide-step.active { color: var(--primary-deep); background: var(--primary-soft); }
.guide-step.active b { color: white; border-color: var(--primary); background: var(--primary); }
.guide-step.done { color: #367a61; }
.guide-followup { display: flex; align-items: center; gap: 7px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; font-weight: 800; line-height: 1.45; }
.guide-followup i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--mint); }
.guide-overlay { z-index: 45; pointer-events: none; position: fixed; inset: 0; }
.guide-shade { position: fixed; background: rgb(31 29 24 / 58%); transition: all .2s; }
.guide-frame { position: fixed; border: 3px solid var(--primary); border-radius: 10px; box-shadow: 0 0 0 4px rgb(201 100 66 / 18%); transition: all .2s; }

.toast { z-index: 100; position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(90vw, 560px); padding: 10px 14px; border: 1px solid var(--border); border-radius: 7px; background: #292824; color: white; box-shadow: 0 12px 32px rgb(0 0 0 / 20%); font-size: 12px; font-weight: 800; }
.empty-state { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px; }
.empty-state h2 { margin: 0 0 6px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 12px; font-weight: 700; }

@media (max-width: 1120px) {
  .app-header { grid-template-columns: 148px minmax(0, 1fr) 64px; padding: 0 13px; }
  .brand-copy strong { font-size: 13px; }
  .demo-tabs button, .demo-tabs a { min-width: 76px; padding: 0 8px; font-size: 12px; }
  .feature-page { padding: 14px 16px 16px; }
  .pronunciation-grid { grid-template-columns: minmax(0, 1fr) 240px; }
  .classical-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .turtle-main { grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr); }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .app-shell { min-height: 100dvh; height: auto; overflow: visible; }
  .app-header { height: auto; min-height: 70px; grid-template-columns: 132px minmax(0, 1fr); padding: 8px 12px; }
  .lab-status { display: none; }
  .demo-tabs { justify-content: flex-start; }
  .feature-page { min-height: calc(100dvh - 70px); height: auto; overflow: visible; }
  .feature-heading { gap: 10px; }
  .feature-heading h1 { font-size: 23px; }
  .feature-heading p { font-size: 12px; }
  .view-button span { display: none; }
  .guided-layout { display: block; }
  .guide-sidebar { position: fixed; right: 10px; bottom: 10px; left: 10px; min-height: 0; max-height: 42vh; }
  .guide-current { padding: 10px 0; }
  .guide-current h2 { margin: 4px 0 6px; font-size: 18px; }
  .guide-steps { display: none; }
  .guide-followup { margin-top: 6px; padding-top: 6px; }
  .search-strip { grid-template-columns: 1fr auto; }
  .suggestions { grid-column: 1 / -1; }
  .pronunciation-grid, .classical-grid, .turtle-main, .compose-panel { min-height: 0; grid-template-columns: 1fr; }
  .need-panel { order: -1; display: grid; grid-template-columns: auto 1fr; align-items: center; }
  .mastery-ring { width: 82px; height: 82px; grid-row: 1 / 4; margin: 0; }
  .need-panel .tag-list { grid-column: 2; }
  .analysis-panel { grid-template-columns: 1fr; }
  .result-mark { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 14px; }
  .notebook-grid { grid-template-columns: 1fr 1fr; }
  .material-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .material-panel .ability-map { grid-column: 1 / -1; }
  .turtle-status { grid-template-columns: repeat(3, 1fr); }
  .turtle-status .segmented { grid-column: 1 / -1; justify-self: stretch; width: 100%; }
  .turtle-status .segmented button { flex: 1; }
  .score-result { grid-template-columns: 90px 1fr; }
  .score-seal { width: 82px; height: 82px; font-size: 32px; }
}

@media (max-width: 560px) {
  .app-header { grid-template-columns: 104px minmax(0, 1fr); }
  .brand-copy small { display: none; }
  .demo-tabs { gap: 3px; }
  .demo-tabs button, .demo-tabs a { min-width: 62px; height: 42px; padding: 0 7px; font-size: 11px; }
  .feature-page { padding: 12px; }
  .feature-heading { min-height: 0; }
  .feature-heading p { max-width: 250px; }
  .search-strip { padding: 9px; }
  .choice-grid, .verdict-grid { grid-template-columns: 1fr; }
  .question-panel, .workbench-panel, .judgement-panel, .reading-panel { padding: 18px; }
  .word-focus { font-size: 44px; }
  .notebook-grid { grid-template-columns: 1fr; }
  .material-panel { grid-template-columns: 1fr; }
  .material-panel .ability-map { grid-column: auto; }
  .workbench-head { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; padding: 0 8px; }
  .punctuation-board { padding: 16px 8px; font-size: 22px; }
  .score-result { grid-template-columns: 1fr; }
  .score-breakdown { grid-template-columns: 1fr; }
  .turtle-status { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .metric { min-width: 0; padding-right: 6px; }
  .metric strong { font-size: 14px; }
}
