/* 培玉 · 竞赛数学站。配色沿用培玉高中站（brand/peiyu）。 */
:root {
  --bg: #F7F4EE; --card: #FFFFFF; --fg: #1A2822; --muted: #5E6B64; --line: #E2DCD0;
  --a: #2F7A56; --b: #966524; --c: #3E5C76; --hl: #D9A441; --hl-soft: #F6E7C4;
  --no: #B5452F; --ok-soft: #DCEFE3; --no-soft: #F6DED8; --dim: #A39D90;
  --fig-blue-soft: #DDE6EF; --fig-gray-soft: #E9E6DF;
  --surface-hover: #EFF5EF; --button-bg: var(--a); --button-fg: #FFFFFF;
  --card-shadow: none;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141B18; --card: #1D2622; --fg: #E9E5DC; --muted: #B1BAB3; --line: #35443B;
    --a: #78C39B; --b: #D3A15C; --c: #91B2CF; --hl: #E2B65A; --hl-soft: #3A3220;
    --no: #E89782; --ok-soft: #243C2F; --no-soft: #3D2620; --dim: #8B968E;
    --fig-blue-soft: #22303C; --fig-gray-soft: #2A302D;
    --surface-hover: #26372E; --button-bg: #78C39B; --button-fg: #14271C;
    --card-shadow: 0 3px 12px #00000014;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141B18; --card: #1D2622; --fg: #E9E5DC; --muted: #B1BAB3; --line: #35443B;
  --a: #78C39B; --b: #D3A15C; --c: #91B2CF; --hl: #E2B65A; --hl-soft: #3A3220;
  --no: #E89782; --ok-soft: #243C2F; --no-soft: #3D2620; --dim: #8B968E;
  --fig-blue-soft: #22303C; --fig-gray-soft: #2A302D;
  --surface-hover: #26372E; --button-bg: #78C39B; --button-fg: #14271C;
  --card-shadow: 0 3px 12px #00000014;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.8 -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--a); }
/* 版心与小初高学习外壳 .lf-shell 同宽同内边距，四个学段切换时页面宽度不跳。 */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px 64px; }
button { font: inherit; color: inherit; }

/* 顶栏：与小初高学习外壳（highSchool/site/assets/learning-shell.css 的 .lf-top / .lf-nav / .lf-theme）同尺寸同样式 */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding: 20px 0 15px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.top .brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; color: var(--fg); text-decoration: none; min-height: 36px; white-space: nowrap; }
.top .brand img { display: block; width: auto; height: 48px; flex-shrink: 0; }
.pill { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--fg); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.pill:hover, .pill:focus-visible { border-color: var(--a); color: var(--a); }

.main-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.main-nav a.pill { min-height: 42px; padding: 8px 13px; border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 15px; font-weight: 400; }
.main-nav a.pill[aria-current="page"] { color: #286A49; background: var(--ok-soft); font-weight: 700; border: 0; }
.main-nav a.pill:hover { color: var(--fg); text-decoration: underline; border: 0; }
[aria-current="page"] { border-color: var(--a); color: #286A49; background: var(--ok-soft); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [aria-current="page"],
  :root:not([data-theme="light"]) .main-nav a.pill[aria-current="page"] { color: var(--a); }
  :root:not([data-theme="light"]) .main-nav a.pill[aria-current="page"]:hover { color: var(--fg); }
}
:root[data-theme="dark"] [aria-current="page"],
:root[data-theme="dark"] .main-nav a.pill[aria-current="page"] { color: var(--a); }
:root[data-theme="dark"] .main-nav a.pill[aria-current="page"]:hover { color: var(--fg); }
.practice-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }

/* 与高中站一致的太阳／月亮双态控件，状态不只依靠文字表达。 */
.theme-switch.pill { position: relative; isolation: isolate; display: inline-grid; grid-template-columns: 1fr 1fr;
  flex: 0 0 84px; width: 84px; height: 44px; padding: 3px; background: var(--bg); color: var(--muted);
  -webkit-tap-highlight-color: transparent; transition: border-color .18s ease, background-color .18s ease; }
.theme-switch.pill:hover { border-color: var(--line); color: var(--muted); }
.theme-switch::before { content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 2); border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); box-shadow: 0 1px 3px #00000016; transition: transform .2s ease; }
.theme-switch[aria-checked="true"]::before { transform: translateX(100%); }
.theme-icon { display: grid; place-items: center; }
.theme-icon svg { display: block; width: 18px; height: 18px; }
.theme-switch[aria-checked="false"] .theme-sun { color: var(--b); }
.theme-switch[aria-checked="true"] .theme-moon { color: var(--c); }
@media (hover: hover) { .theme-switch.pill:hover { border-color: var(--a); background: var(--ok-soft); } }
.theme-switch:active .theme-icon { transform: scale(.94); }
.theme-switch:focus-visible, .btn:focus-visible, .opt:focus-visible,
.top .brand:focus-visible, .main-nav a.pill:focus-visible { outline: 3px solid var(--hl); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .theme-switch, .theme-switch::before { transition: none; } }
@media (max-width: 760px) {
  .wrap { padding: 0 16px 40px; }
  .top { gap: 8px; padding: 14px 0 12px; margin-bottom: 18px; }
  .top .theme-switch { margin-left: auto; }
  .main-nav { width: 100%; margin: 0; justify-content: space-between; gap: 0; }
  .main-nav a.pill { padding: 8px 10px; font-size: 14px; }
}

/* 标题：首页大标题与小初高首页同款宋体，其他页与小初高课页同字号 */
.home-heading { font-family: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(32px, 3.8vw, 48px); line-height: 1.32; font-weight: 700; letter-spacing: .01em; margin: 0 0 18px; }
@media (max-width: 760px) { .home-heading { font-size: 30px; } }

.crumb { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.crumb a { color: var(--muted); }
h1 { font-size: 26px; line-height: 1.4; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 28px 0 10px; }
.lead { color: var(--muted); margin: 0 0 18px; }

/* 标签 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 14px; line-height: 24px; border: 1px solid var(--line); color: var(--muted); background: var(--card); }
.chip.lv { font-weight: 700; border-color: currentColor; }
.lv1 { color: var(--a); } .lv2 { color: var(--c); } .lv3 { color: var(--b); } .lv4, .lv5 { color: var(--no); }

/* 题目卡 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--card-shadow); }
.stem p, .layer p { margin: 0 0 10px; }
.stem p:last-child, .layer p:last-child { margin-bottom: 0; }
.blank { display: inline-block; min-width: 4.5em; border-bottom: 1.5px solid var(--fg); margin: 0 4px; vertical-align: -2px; }
ol.enum, ol.choices, ol.bullets { list-style: none; padding: 0; margin: 8px 0; }
ol.enum li, ol.choices li, ol.bullets li { display: flex; gap: 8px; margin: 4px 0; }
ol .lbl { flex: 0 0 auto; min-width: 2em; color: var(--muted); }
ol .li-body { flex: 1; min-width: 0; }
ol .li-body p { margin: 0; }
ol.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px 16px; }
.c-center { text-align: center; margin: 8px 0; }
.c-center ol, .c-center .katex-display { text-align: left; }
.c-mini { margin: 8px 0; }
h4.sub { font-size: 15px; margin: 14px 0 6px; color: var(--c); }
.tbl { overflow-x: auto; overflow-y: hidden; padding-block: 8px; margin: 8px 0; }
.tbl table { border-collapse: collapse; margin: 0 auto; }
.tbl td { border: 1px solid var(--line); padding: 4px 10px; text-align: center; }
.fig-missing { padding: 12px; border: 1px dashed var(--dim); border-radius: 8px; color: var(--muted); font-size: 14px; text-align: center; }

/* 公式：长公式局部横向滚动，不撑破页面 */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; margin: 10px 0; }
.katex { font-size: 1.08em; }
.math-error { color: var(--no); }

/* 图 */
figure.fig { margin: 12px 0; text-align: center; overflow-x: auto; overflow-y: hidden; }
svg.tikz { max-width: 100%; height: auto; color: var(--fg); }

/* 作答 */
.answer h2, .ladder h2 { margin-top: 0; font-size: 17px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.opt { min-width: 52px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 700; cursor: pointer; }
.opt[aria-pressed="true"] { border-color: var(--a); background: var(--ok-soft); }
.opt.right { border-color: var(--a); background: var(--ok-soft); }
.opt.wrong { border-color: var(--no); background: var(--no-soft); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input.ans { flex: 1 1 200px; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); font: inherit; }
input.ans:focus { outline: none; border-color: var(--a); }
.btn { min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--a); border-radius: 10px; background: var(--button-bg); color: var(--button-fg); font-weight: 700; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--a); }
.btn:disabled { opacity: .5; cursor: default; }
.hint-text { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.verdict { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; }
.verdict.ok { background: var(--ok-soft); }
.verdict.no { background: var(--no-soft); }
.verdict.info { background: var(--hl-soft); }

/* 解析逐层展开 */
.layer { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.layer > h3 { margin: 0 0 8px; font-size: 16px; color: var(--a); }
.layer.check > h3 { color: var(--c); }
.layer.sum > h3 { color: var(--b); }
.layer.hint { border-left: 3px solid var(--hl); border-top: 0; padding: 10px 14px; background: var(--hl-soft); border-radius: 0 8px 8px 0; margin-bottom: 8px; }
.next { margin: 12px 0 4px; display: flex; flex-wrap: wrap; gap: 8px; }
details.why { margin-top: 14px; font-size: 15px; color: var(--muted); }
details.why summary { cursor: pointer; }

/* 列表页 */
.blocks { display: grid; gap: 16px; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.topic { display: block; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--fg); text-decoration: none; }
a.topic:hover, a.topic:focus-visible { border-color: var(--a); background: var(--surface-hover); }
.topic .t { font-weight: 700; }
.topic .n { font-size: 14px; color: var(--muted); }
.topic.off { opacity: .55; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.plist li a:hover, .plist li a:focus-visible { background: var(--card); }
.plist .name { flex: 1; min-width: 0; }
.plist .meta { font-size: 14px; color: var(--muted); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--dim); flex: 0 0 auto; }
.dot.ok { background: var(--a); border-color: var(--a); }
.dot.no { background: var(--no); border-color: var(--no); }
.dot.part { background: var(--hl); border-color: var(--hl); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.filters button[aria-pressed="true"] { border-color: var(--a); color: var(--a); background: var(--ok-soft); }

.pager { display: flex; justify-content: space-between; gap: 8px; margin: 24px 0 0; }
footer.note { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

@media (max-width: 520px) {
  .card { padding: 14px 14px; }
  h1 { font-size: 21px; }
  .katex { font-size: 1.02em; }
}

/* 专题内容：导语、先修、知识要点、方法卡 */
.muted { color: var(--muted); }
.lead-block { color: var(--fg); margin: 0 0 12px; }
.lead-block p { margin: 0 0 8px; }
.prereq { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; font-size: 14px; }
.chip.link { color: var(--a); text-decoration: none; }
.chip.link:hover, .chip.link:focus-visible { border-color: var(--a); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.toc .pill { font-weight: 500; }
.kcards { display: grid; gap: 8px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0 16px; }
.kcard > summary { cursor: pointer; padding: 12px 0; font-weight: 700; list-style-position: outside; }
.kcard[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.kbody { padding-bottom: 12px; }
.kbody p, .mrow p { margin: 0 0 8px; }
.kbody p:last-child, .mrow p:last-child { margin-bottom: 0; }
.kbody ul, .kbody ol, .mrow ul:not(.plist), .mrow ol { padding-left: 1.2em; margin: 6px 0; }
.lesson { max-width: 46em; }
.lesson-advanced { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.lesson-advanced > summary { cursor: pointer; font-weight: 600; }
.lesson-back { margin: 12px 0 0; font-size: 14px; }
.lesson-core { margin: 0 0 8px; font-weight: 600; }
.lesson { padding-top: 6px; line-height: 1.75; }
.lesson-head { margin: 22px 0 8px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 16px; }
.lesson h4 { margin: 14px 0 4px; font-size: 15px; }
.lesson ol, .lesson ul { padding-left: 1.4em; }
.lesson-table { overflow-x: auto; }
.lesson-table table { width: 100%; border-collapse: collapse; }
.lesson-table th, .lesson-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.lesson-example { margin: 12px 0; padding: 4px 14px 12px; border: 1px solid var(--line); border-radius: 8px; }
.lesson-spot { margin: 10px 0 2px; }
.mcards { display: grid; gap: 12px; }
.mcard { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--a); border-radius: 10px; padding: 14px 16px; scroll-margin-top: 16px; }
.mcard:target { box-shadow: 0 0 0 2px var(--hl); }
.mcard h3 { margin: 0 0 10px; font-size: 17px; }
.mrow { display: grid; grid-template-columns: 7.5em 1fr; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.mrow > div, .mrow > ul { min-width: 0; }
.mtag { font-size: 14px; font-weight: 700; padding-top: 2px; }
.mtag.when { color: var(--c); } .mtag.how { color: var(--a); } .mtag.trap { color: var(--no); } .mtag.ex { color: var(--b); }
.plist.mini li a { padding: 6px 4px; border-bottom: 0; }
@media (max-width: 520px) {
  .mrow { grid-template-columns: 1fr; gap: 2px; }
}

/* 反馈与我的学习 */
.feedback { margin: 16px 0 0; }
.feedback form { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.feedback fieldset { border: 0; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.feedback legend { font-weight: 700; margin-bottom: 4px; }
.feedback label { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.feedback textarea, #summary-text { width: 100%; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); font: inherit; margin: 0 0 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0 6px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat span { font-size: 14px; color: var(--muted); }
.stat.ok b { color: var(--a); } .stat.no b { color: var(--no); }
.name-row label { font-size: 14px; color: var(--muted); }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 4px 10px; }
.tbl th { background: var(--card); font-size: 14px; }
ol.steps, .card > ul { padding-left: 1.4em; margin: 6px 0; }
ol.steps li, .card > ul li { margin: 6px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
/* 网格里的卡片允许比内容更窄，长公式在卡片内横向滚动，不撑宽页面 */
.kcards > *, .mcards > *, .blocks > *, .topics > *, .stats > * { min-width: 0; }

/* 联系：先回想相关题，作答或看过解答后再比较深层结构。 */
.related-stem { border-top: 1px dashed var(--line); padding: 10px 0; }
.related-stem summary, .connections > details > summary, .practice > summary { cursor: pointer; font-weight: 600; }
.connection { padding: 12px 0; border-top: 1px solid var(--line); }
.connection p { margin: 6px 0 10px; }
.link-reason { margin-top: 12px; padding: 8px 12px; border-left: 3px solid var(--a); background: var(--ok-soft); overflow-wrap: anywhere; }
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.compare-grid > * { min-width: 0; }
.compare-grid h2 { margin-top: 0; font-size: 17px; }
@media (max-width: 680px) { .compare-grid { grid-template-columns: 1fr; } }

/* 交错练习在学生作答前不提示专题、方法和关联题。 */
html.practice-blind .crumb, html.practice-blind .chips, html.practice-blind .wrap > .lead, html.practice-blind .pmain > .lead, html.practice-blind .prail,
html.practice-blind .pager, html.practice-blind .why, html.practice-blind .layer.link,
html.practice-blind .connections { display: none; }
#teacher-files { display: block; max-width: 100%; margin-top: 10px; font: inherit; }
#teacher-output { overflow-wrap: anywhere; }
.rubric-step { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.rubric-step input { margin-top: 8px; flex: 0 0 auto; }
.rubric-description { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; padding-block: 8px; }
.rubric-description p { margin: 0; }
.rubric-step > .chip { flex: 0 0 auto; white-space: nowrap; }

/* Only measured oversized inline math gets a local scroll box. */
.katex.inline-math-scroll {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: middle;
  padding: .2em .1em;
}

/* 学习入口与不等式样板：同一条路线，既能从头学，也能随时查阅。 */
[hidden] { display: none !important; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.study-home { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px;
  border-block: 1px solid var(--line); padding: 24px 0; margin: 22px 0 14px; }
.study-home h2 { margin: 0 0 8px; }
.study-home p { margin: 0 0 16px; }
.study-start { border-left: 4px solid var(--a); padding-left: 18px; }
.study-start .btn { margin-right: 12px; }
.study-secondary { display: inline-block; font-size: 14px; padding-top: 10px; }
.study-return { display: grid; gap: 22px; padding-left: 24px; border-left: 1px solid var(--line); }
.study-return h2 { font-size: 16px; }
.study-return p { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.study-howto { margin: 0 0 28px; }
.study-howto > summary { cursor: pointer; color: var(--a); font-weight: 600; padding: 8px 0; }
.study-howto ol { padding-left: 1.4em; }
.study-route { margin: 24px 0 40px; }
.study-route > h2 { font-size: 23px; }
.study-route-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-left: 1.3em; margin-bottom: 8px; }
.study-route-nav a { padding: 6px 0; display: inline-block; }
.study-route-nav [aria-current="step"] { font-weight: 700; text-decoration-thickness: 2px; }
.study-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 26px; scroll-margin-top: 18px; }
.study-section > h3 { margin: 0 0 14px; font-size: 19px; }
.study-disclosure { margin: 10px 0; border-left: 3px solid var(--line); padding: 0 14px; }
.study-disclosure > summary { cursor: pointer; padding: 10px 0; color: var(--a); font-weight: 600; }
.study-disclosure[open] { border-left-color: var(--a); }
.study-disclosure p { margin: 0 0 10px; }
.study-quiz { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.study-quiz fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.study-quiz legend { padding: 0; margin-bottom: 12px; width: 100%; }
.study-quiz label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px; cursor: pointer; }
.study-quiz label:has(input:checked) { background: var(--ok-soft); border-radius: 6px; }
.study-quiz input { flex: 0 0 auto; margin-top: 7px; accent-color: var(--a); }
.study-quiz label span { min-width: 0; }
.study-feedback { padding: 12px 0 0; }
.study-feedback p { margin: 0; }
.topic-misconception { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; overflow: hidden; }
.topic-misconception > div { padding: 12px 16px; overflow-wrap: anywhere; }
.topic-misconception p { margin: 6px 0 0; }
.topic-wrong { background: var(--no-soft); }
.topic-right { background: var(--ok-soft); }
.topic-quiz { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.topic-quiz fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.topic-quiz legend { width: 100%; padding: 0; margin-bottom: 12px; }
.topic-quiz label { display: flex; align-items: flex-start; gap: 10px; padding: 12px 8px; min-height: 44px; cursor: pointer; }
.topic-quiz label:has(input:checked) { background: var(--ok-soft); border-radius: 6px; }
.topic-quiz input { flex: 0 0 auto; margin-top: 7px; accent-color: var(--a); }
.topic-quiz label span { min-width: 0; overflow-wrap: anywhere; }
.topic-quiz-result { margin-top: 12px; padding: 12px; background: var(--ok-soft); border-radius: 6px; }
.topic-quiz-result[data-correct="false"] { background: var(--no-soft); }
.topic-quiz-result p { margin: 6px 0 0; }
.study-result[data-correct="false"] { color: var(--no); }
.study-lab { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 20px 0; }
.study-lab h4, .study-transfer h4 { font-size: 17px; margin: 0 0 8px; }
.study-lab label { display: block; margin-top: 14px; }
#study-bound { display: block; width: 100%; min-height: 44px; accent-color: var(--a); }
.study-numberline { --bound: 10%; position: relative; height: 48px; margin: 12px 0 30px;
  border-bottom: 2px solid var(--muted); }
.study-allowed { position: absolute; left: var(--bound); right: 0; bottom: 0; height: 18px; background: var(--ok-soft); border-left: 3px solid var(--a); }
.study-equality { position: absolute; left: 40%; bottom: -15px; padding: 0 4px; background: var(--card); color: var(--a); font-weight: 700; }
.study-equality > span { display: block; position: absolute; white-space: nowrap; left: -20px; font-size: 14px; font-weight: 400; }
.study-numberline[data-excluded="true"] .study-equality { color: var(--no); }
.study-transfer { border-left: 3px solid var(--line); padding-left: 16px; margin: 24px 0; }
.study-takeaway { color: var(--b); }
.study-next { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-top: 20px; font-size: 14px; }
.study-route :focus-visible, .study-home :focus-visible, .study-howto :focus-visible { outline: 3px solid var(--hl); outline-offset: 3px; }
@media (max-width: 600px) {
  .study-home { grid-template-columns: 1fr; gap: 20px; }
  .study-return { padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .study-route > h2 { font-size: 21px; }
}

/* 首页把开始与回访放在同一位置，四块入门入口与专题地图对应。 */
#home-state h2 { margin: 0 0 12px; font-size: 20px; }
.home-starters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.home-starters article { border-left: 2px solid var(--line); padding-left: 12px; }
.home-starters h3 { font-size: 16px; margin: 4px 0 12px; }
.home-starters .muted { font-size: 14px; }
#home-state .study-start { margin-bottom: 0; }
.home-followup { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }
.home-followup p { font-size: 14px; color: var(--muted); }
.topic-guided { color: var(--a); font-size: 14px; margin: 6px 0; }
.home-guide { font-size: 14px; margin: 0 0 24px; }
@media (max-width: 600px) {
  .home-starters { grid-template-columns: 1fr 1fr; gap: 18px 10px; }
  .home-followup { grid-template-columns: 1fr; }
}

/* ---------- 题目页工作台（PY-179，problem-ui.js） ---------- */
.ans-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.ans-preview-math { min-height: 32px; display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--bg); color: var(--fg); font-size: 17px; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.sym-keys { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.sym-keys .sym { min-width: 40px; min-height: 36px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg);
  font: 15px/1 "Times New Roman", "STIX Two Math", serif; cursor: pointer; }
.sym-keys .sym:hover, .sym-keys .sym:focus-visible { border-color: var(--a); color: var(--a); }
.sym-keys .sym:focus-visible, .text-btn:focus-visible, .hint-step button:focus-visible, .kbd-tip:focus-visible, .drawer-handle:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; }
.text-btn { min-height: 36px; padding: 4px 6px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-btn:hover { color: var(--fg); }
.reveal-nudge { font-size: 14px; color: var(--muted); margin-right: 2px; }
.answer .row .reveal-nudge, .answer .row .reveal-nudge[hidden] + .text-btn { margin-left: auto; }

/* 解析分级步骤条 */
.hint-steps { list-style: none; display: flex; gap: 6px; margin: 0 0 6px; padding: 0; counter-reset: none; }
.hint-step { display: flex; flex: 1 1 0; min-width: 0; margin: 0; }
.hint-step button { width: 100%; min-height: 40px; padding: 6px 8px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; color: var(--dim);
  font: inherit; font-size: 14px; line-height: 1.4; text-align: left; white-space: normal; overflow-wrap: anywhere; cursor: default; }
.hint-step.open button { border: 1px solid var(--hl); background: var(--hl-soft); color: var(--fg); cursor: pointer; }
.hint-step.next button { border: 1.5px solid var(--a); color: var(--a); font-weight: 700; cursor: pointer; }
.hint-cost { margin: 0 0 8px; font-size: 14px; }
@media (max-width: 640px) {
  .hint-steps { overflow-x: auto; }
  .hint-step { flex: 0 0 auto; }
  .hint-step button { width: auto; }
}

/* 答完反馈卡 */
.result-card { margin: 14px 0 0; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.result-card.ok { background: var(--ok-soft); border-color: transparent; }
.result-card.part { background: var(--hl-soft); border-color: transparent; }
.result-card.no { background: var(--no-soft); border-color: transparent; }
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0; }
.result-card.ok .result-head strong { color: var(--a); }
.result-card.no .result-head strong { color: var(--no); }
.result-meta { font-size: 14px; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.result-card.pop { animation: result-pop .22s ease-out; }
@keyframes result-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.answer.shake { animation: answer-shake .3s ease-in-out; }
@keyframes answer-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* 快捷键与专注模式 */
.kbd-tip { display: block; margin: 14px 0 0 auto; padding: 2px 8px; border: 0; background: transparent; color: var(--dim); font: inherit; font-size: 14px; cursor: pointer; }
.kbd-help { position: fixed; right: 20px; bottom: 20px; z-index: 30; max-width: 320px; padding: 12px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--fg); box-shadow: 0 8px 28px #0002; font-size: 14px; }
.kbd-help p { margin: 0 0 6px; }
.kbd-help ul { margin: 0; padding-left: 18px; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg);
  font: 14px/18px ui-monospace, Menlo, monospace; text-align: center; }
html.focus-mode .top, html.focus-mode .site-credit, html.focus-mode .feedback, html.focus-mode .connections, html.focus-mode .crumb { display: none; }
@media (hover: none) { .kbd-tip { display: none; } }

/* 手机作答抽屉：作答卡贴在屏幕底部，题面始终可见 */
.drawer-handle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 32px; margin: -8px 0 6px; padding: 0;
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.drawer-handle .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
@media (max-width: 640px) {
  .answer.drawer { position: sticky; bottom: 0; z-index: 20; margin-left: -16px; margin-right: -16px; border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 20px #0000001f; max-height: 50vh; overflow-y: auto; }
  .answer.drawer.collapsed > :not(.drawer-handle):not(h2) { display: none; }
  .answer.drawer.collapsed { padding-bottom: 6px; }
  .answer.drawer.collapsed h2 { margin: 0; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .result-card.pop, .answer.shake { animation: none; }
}

/* 专题进度格（progress-grid.js）：题目页左栏 / 窄屏折叠条；专题页标题下 */
.pwork { display: block; }
.pmain { min-width: 0; }
.prail details { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 8px 14px; }
.prail summary { cursor: pointer; font-size: 14px; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.prail summary::-webkit-details-marker { margin-right: 6px; }
.prail .pg-body { padding: 4px 0 6px; }
@media (min-width: 1100px) {
  .pwork { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 28px; align-items: start; }
  html.practice-blind .pwork,
  .pwork:has(> .prail[hidden]) { display: block; }
  .prail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .prail details { margin: 0; }
  .prail summary { pointer-events: none; list-style: none; color: var(--fg); font-weight: 700; }
  .prail summary::-webkit-details-marker { display: none; }
}
.pg-head { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.pg-head strong { color: var(--fg); }
.pg-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin: 0 0 10px; }
.pg-bar i { display: block; height: 100%; }
.pg-bar .pg-ok { background: var(--a); } .pg-bar .pg-part { background: var(--hl); } .pg-bar .pg-no { background: var(--no); }
.pg-row { margin: 0 0 10px; }
.pg-lab { display: flex; justify-content: space-between; margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16px, 1fr)); gap: 4px; }
.pg-cell { display: block; aspect-ratio: 1; min-width: 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--card); }
a.pg-cell:hover, a.pg-cell:focus-visible { border-color: var(--fg); outline: none; }
a.pg-cell:focus-visible { outline: 2px solid var(--hl); outline-offset: 1px; }
.pg-cell.pg-ok { background: var(--a); border-color: var(--a); }
.pg-cell.pg-part, .pg-cell.pg-unsure { background: var(--hl); border-color: var(--hl); }
.pg-cell.pg-no { background: var(--no); border-color: var(--no); }
.pg-cell.pg-cur { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }
.pg-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.pg-legend .pg-cell { display: inline-block; width: 10px; min-width: 10px; height: 10px; margin-left: 4px; }
.topic-progress { padding: 14px 18px; }
.topic-progress .pg-body { display: flex; flex-wrap: wrap; gap: 0 24px; }
.topic-progress .pg-head, .topic-progress .pg-bar, .topic-progress .pg-legend { flex: 1 1 100%; }
.topic-progress .pg-row { flex: 1 1 240px; min-width: 0; }

/* 专题页：固定目录 + 方法卡折叠（topic-ui.js） */
.topic-toc.is-sticky { position: sticky; top: 0; z-index: 15; margin-left: -8px; margin-right: -8px; padding: 8px; background: var(--bg);
  border-bottom: 1px solid transparent; }
.topic-toc .pill[aria-current="location"] { border-color: var(--a); color: var(--a); background: var(--ok-soft); font-weight: 700; }
@media (max-width: 760px) {
  .topic-toc.is-sticky { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 8px 16px; scrollbar-width: none; }
  .topic-toc.is-sticky .pill { flex: 0 0 auto; }
}
h2[id], .mcard, .lvgroup { scroll-margin-top: 64px; }
details.mfold { border-top: 1px dashed var(--line); padding-top: 6px; }
details.mfold > summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--a); font-weight: 600; }
details.mfold > summary .muted { font-weight: 400; color: var(--muted); }
details.mfold[open] > summary { margin-bottom: 2px; }

.kbd-off { display: block; margin-top: 8px; font-size: 14px; color: var(--muted); }

.search-page label { font-size: 15px; }
.search-page input, .search-page select { font: inherit; font-size: 16px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.search-page input { display: block; width: 100%; margin: 8px 0 16px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 12px; }
.search-filters label { display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
.search-filters select { max-width: 220px; min-width: 0; }
.search-result { display: block; padding: 12px; color: var(--fg); border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; text-decoration: none; }
.search-result span { display: block; }
.search-result strong span { display: inline; }
.search-result[aria-selected="true"] { outline: 3px solid var(--a); }
.search-result mark { background: #ffe58a; color: #222; }

/* PY-401 textbook parallel relation; color and MathML remain inherited. */
.py-par{display:inline-block;transform:skewX(-20deg)}
svg tspan.py-par{font-style:oblique 20deg;transform:none}

/* 模考倒计时：只在计时中有文字，做后面的题时也看得到。 */
#exam-timer:not(:empty) { position: fixed; right: 16px; bottom: 16px; z-index: 20; margin: 0; padding: 8px 14px; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; font-size: 15px; font-variant-numeric: tabular-nums; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
@media print { #exam-timer { display: none; } }
