:root {
  --grammatical: #2f5d8a; --lexical: #3d7a4a; --topic: #6f8f3a; --phonological: #8a4f9e; --orthographic: #a0627a;
  --functional: #c0662b; --discourse: #b08a1e; --sociolinguistic: #357f86; --strategic: #6c6c6c; --activity: #8b3a3a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
h2, h3.section-title, .lesson-head h2, h3.phase { font-family: var(--font-display); }
button, select, input { font: inherit; color: inherit; }
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; margin-right: 8px; }
.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.top nav { display: flex; gap: 4px; }
.top nav button { border: 1px solid transparent; background: transparent; padding: 5px 13px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.top nav button:hover { background: var(--soft); color: var(--ink); }
.top nav button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
#q { flex: 1; min-width: 160px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
#lang { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
main { padding: 16px; max-width: 1180px; margin: 0 auto; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.stat b { font-size: 20px; display: block; }
.stat span { color: var(--muted); font-size: 13px; }
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.toc { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.toc h4 { margin: 10px 6px 4px; font-size: 13px; color: var(--muted); }
.toc a { display: block; padding: 3px 6px; border-radius: 4px; color: inherit; text-decoration: none; font-size: 14px; }
.toc a:hover { background: var(--bg); }
.section-title { margin: 24px 0 8px; font-size: 20px; }
.unit { scroll-margin-top: 64px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.unit h3 { margin: 0 0 4px; font-size: 17px; }
.unit .uid { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; margin-right: 6px; }
.unit .goal { margin: 4px 0; }
.unit .why { margin: 4px 0 10px; color: var(--muted); font-size: 14px; }
.kc-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kc { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); background: var(--bg); padding: 4px 9px; border-radius: 6px; cursor: pointer; text-align: left; }
.kc:hover { border-color: var(--c, var(--accent)); }
.kc small { color: var(--muted); }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; color: #fff; background: var(--c, var(--accent)); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab { border: 1px solid var(--line); background: var(--panel); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg); font-weight: 600; position: sticky; top: 56px; }
td code, .mono { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.link { color: var(--accent); cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.warn { color: #b3261e; font-weight: 600; }
#detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); overflow: auto; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12); padding: 18px 20px 40px; z-index: 10; }
#detail h2 { margin: 6px 0 2px; font-size: 21px; }
#detail h5 { margin: 18px 0 6px; font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: .02em; }
#detail ul { margin: 0; padding-left: 20px; }
#detail .close { float: right; border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: 2px 10px; cursor: pointer; }
.ex { margin: 6px 0; }
.ex .en { font-weight: 500; }
.ex .zh { color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 12px; padding: 1px 8px; font-size: 13px; background: var(--bg); }
.note { background: var(--bg); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.cite { font-size: 13px; margin-bottom: 6px; }
.cite .meta { color: var(--muted); }
.prim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.prim-card { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.prim-card.spec { border-left-color: #b3261e; }
.prim-card.partial { border-left-color: #b08a1e; }
.prim-card span { font-size: 14px; }
.prim-card small { color: var(--muted); }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--accent); color: #fff; }
.pill.spec { background: #b3261e; }
.pill.partial { background: #b08a1e; }
.kc.prim { border-left-color: var(--accent); }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
  th { position: static; }
}

/* ---- navigation ---- */
a.brand { color: inherit; text-decoration: none; }
.top nav.minor button { border-color: transparent; color: var(--muted); font-size: 14px; }
.top nav.minor { border-left: 1px solid var(--line); padding-left: 10px; }
.top nav button.hl:not(.on) { border-color: var(--accent); color: var(--accent); }
.top .ext { font-size: 14px; color: var(--accent); }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 14px; cursor: pointer; color: inherit; text-decoration: none; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill { color: var(--accent-ink); }
.pill.spec, .pill.partial { color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- coverage bar ---- */
i.cv { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--cv-spec); vertical-align: -1px; margin-right: 3px; }
i.cv.block { background: var(--cv-block); } i.cv.impl { background: var(--cv-impl); } i.cv.borrow { background: var(--cv-borrow); }
.covbar { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 8px 0 4px; }
.covbar .cells { display: flex; flex-wrap: wrap; gap: 2px; }
.covbar .covtext { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.lg { white-space: nowrap; margin-right: 8px; }
.pill.cov.block { background: var(--cv-block); } .pill.cov.impl { background: var(--cv-impl); } .pill.cov.borrow { background: var(--cv-borrow); } .pill.cov.spec { background: var(--cv-spec); color: var(--ink); }
.pill.impl { background: var(--cv-impl); }
.unit-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 6px; }
.unit-foot .prims { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; min-width: 200px; }
.pchip { cursor: pointer; font-size: 12px; }
.pchip.spec { border-style: dashed; }

/* ---- 备课 ---- */
.intro { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.intro h2 { margin: 0 0 6px; }
h4.sec { margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.pick:hover { border-color: var(--accent); }
.pick small { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crumbs { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.lesson-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.lesson-head h2 { margin: 2px 0 6px; font-size: 24px; }
.lesson-head .actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 200px; }
.anchor { margin: 12px 0; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; }
.anchor h4 { margin: 0 0 4px; }
.anchor textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); font: inherit; resize: vertical; }
h3.phase { margin: 22px 0 8px; font-size: 18px; }
h3.phase small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
.step { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.step.off { opacity: .45; }
.step header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.step header label { font-size: 13px; color: var(--muted); }
.step .title { font-size: 16px; font-weight: 600; color: var(--ink); }
.step p { margin: 6px 0; }
.step .bind { font-size: 14px; }
.how { background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 14px; }
.how.script { border: 1px dashed var(--line); }
.how .tab { margin-left: 6px; font-size: 13px; padding: 2px 10px; }
.try iframe { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; background: #fff; }
.warnline { color: var(--muted); font-size: 13.5px; }

/* ---- 课堂模式 ---- */
#present-ov { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
#present-ov .slide { flex: 1; min-height: 0; padding: clamp(16px, 4vw, 48px); overflow: auto; }
#present-ov .cover { display: flex; flex-direction: column; justify-content: center; max-width: 960px; margin: 0 auto; }
#present-ov .cover h1 { font-size: clamp(32px, 5vw, 56px); margin: 6px 0; }
#present-ov .cover .goal { font-size: clamp(18px, 2.2vw, 26px); }
#present-ov .anchor-line { font-size: 18px; border-left: 4px solid var(--accent); padding-left: 12px; }
#present-ov .exit { font-size: 20px; line-height: 1.8; }
#present-ov .step-slide { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.5fr); gap: 24px; }
#present-ov .step-slide h2 { font-size: clamp(26px, 3.4vw, 40px); margin: 6px 0 12px; }
#present-ov .step-slide .ex .en { font-size: 22px; }
#present-ov .step-slide .ex .zh { font-size: 16px; }
#present-ov .right iframe { width: 100%; height: 100%; min-height: 60vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
#present-ov .script { background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: 16px 20px; font-size: 17px; }
#present-ov .pnav { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 8px; border-top: 1px solid var(--line); background: var(--panel); }
#present-ov .pnav button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 4px 14px; cursor: pointer; }
@media (max-width: 760px) { #present-ov .step-slide { grid-template-columns: 1fr; } .lesson-head .actions { min-width: 0; width: 100%; } }

/* ---- shared look ---- */
.top { padding: 8px 18px; gap: 8px 12px; }
#q, #lang { border-radius: 999px; padding: 6px 12px; }
.unit, .stat, .toc, .intro, .pick, .step, .lesson-head, .anchor { border-radius: var(--radius); }
.lesson-head > div:first-child { flex: 1 1 480px; min-width: 0; }

/* ---- depth (see design/atlas.css) ---- */
.unit, .intro, .lesson-head, .toc, .stat, .step, .anchor, .prim-card, .pick { border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; box-shadow: 0 4px 0 var(--edge); }
.unit, .intro, .lesson-head, .toc, .stat, .pick { border-left-width: 2px; }
.btn, .tab, .pick { border-width: 2px; box-shadow: 0 3px 0 var(--edge); }
.btn:active, .tab:active, .pick:active, .prim-card:active { transform: translateY(3px); box-shadow: none; }
.btn.primary { box-shadow: 0 3px 0 var(--edge-accent); } .tab.on { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-dark); }
.btn:disabled { box-shadow: none; transform: none; }
.kc { box-shadow: 0 2px 0 var(--edge); } .kc:active { transform: translateY(2px); box-shadow: none; }
.top { border-bottom-width: 2px; }
