/* 羽毛球技术与战术精讲 · 独立出版阅读版 */
:root {
  color-scheme: light;
  --blue: #0047ba;
  --green: #00864a;
  --navy: #102d55;
  --ink: #182b42;
  --muted: #5c6d82;
  --line: #d9e2ec;
  --paper: #fff;
  --canvas: #f3f6fa;
  --blue-tint: #eaf1fc;
  --green-tint: #edf6f1;
  --sidebar-width: 284px;
  --topbar-height: 64px;
  --book-width: 940px;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Songti SC", STSong, "Noto Serif CJK SC", serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; padding-left: var(--sidebar-width); color: var(--ink); background: var(--canvas); font: 17px/1.85 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--blue); text-underline-offset: 4px; text-decoration-thickness: 1px; }
button, input, select { font: inherit; }
button, .button, input, select { min-height: 44px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 5px; padding: 9px 15px; background: white; color: var(--navy); font-size: 13px; line-height: 1.45; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
button:hover, .button:hover { border-color: #b0c3df; background: var(--blue-tint); }
button:disabled { color: #8491a3; cursor: default; background: #f5f7fa; opacity: .65; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
button svg, .button svg { width: 18px; height: 18px; flex: 0 0 auto; }
img, video, svg { max-width: 100%; }
img { display: block; height: auto; }
figure { margin: 0; }
input, select { min-width: 0; padding: 10px 13px; border: 1px solid #becbda; border-radius: 5px; color: var(--ink); background: white; font-size: 14px; line-height: 1.5; }
input::placeholder { color: #6b7b8f; opacity: 1; }
input[type="range"] { padding: 0; border: 0; accent-color: var(--blue); }
mark { color: inherit; background: #e3efb9; padding: 0 2px; }
summary { cursor: pointer; }
.print-only { display: none; }
.skip-link { position: fixed; z-index: 300; left: 16px; top: -100px; padding: 10px 20px; background: white; border: 2px solid var(--blue); font-size: 14px; }
.skip-link:focus { top: 10px; }

/* 阅读工具与目录 */
.topbar { position: fixed; inset: 0 0 auto; height: var(--topbar-height); z-index: 70; display: flex; align-items: center; gap: 16px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; align-items: center; gap: 12px; flex: 0 0 260px; min-width: 0; color: var(--navy); text-decoration: none; font-size: 15px; line-height: 1.5; font-weight: 750; letter-spacing: .03em; }
.wordmark::before { content: ""; width: 5px; height: 25px; background: var(--blue); box-shadow: 5px 0 0 var(--green); margin-right: 4px; flex: 0 0 auto; }
.wordmark small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tools button, .tools .button { border-color: transparent; min-width: 44px; background: transparent; }
.tools button:hover, .tools .button:hover { background: var(--blue-tint); }
.topbar .menu-toggle { display: none; width: 44px; padding: 10px; flex: 0 0 auto; }
.current-reading { overflow: hidden; min-width: 0; flex: 1; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 1.5; }
#reading-progress { position: absolute; top: auto; bottom: -1px; left: 0; height: 3px; width: 0; max-width: 100%; background: var(--green); border: 0; pointer-events: none; }
.sidebar { position: fixed; z-index: 60; top: var(--topbar-height); bottom: 0; left: 0; width: var(--sidebar-width); padding: 24px 14px 16px; display: flex; flex-direction: column; background: #f8fafd; border-right: 1px solid var(--line); }
.side-head { padding: 0 13px 19px; color: var(--navy); font-size: 12px; font-weight: 650; letter-spacing: .12em; }
.side-head strong { display: block; font-size: 15px; letter-spacing: .03em; }
.side-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.7; font-weight: 400; letter-spacing: 0; }
.side-head button { float: right; min-width: 44px; padding: 8px; margin-top: -8px; }
.nav-tabs { display: flex; gap: 0; padding: 0 5px 12px; border-bottom: 1px solid var(--line); }
.nav-tabs [role="tab"] { flex: 1; border: 0; background: transparent; border-radius: 4px; color: var(--muted); font-size: 12px; padding: 9px 6px; }
.nav-tabs [aria-selected="true"] { background: var(--blue); color: #fff; }
.nav-tabs [aria-selected="true"]:hover { background: #003c9e; }
.nav-panel { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; padding: 12px 3px 32px; scrollbar-width: thin; scrollbar-color: #b8c5d5 transparent; }
.nav-group { margin: 5px 0 9px; border: 0; }
.nav-group > summary { list-style: none; display: flex; align-items: flex-start; gap: 8px; padding: 12px 9px; color: var(--navy); font-size: 12px; line-height: 1.6; font-weight: 650; min-height: 44px; }
.nav-group > summary::-webkit-details-marker, .lesson > summary::-webkit-details-marker { display: none; }
.nav-group > summary::before { content: "›"; width: 12px; flex: 0 0 auto; color: var(--muted); font-size: 18px; line-height: 1; transform: translateY(2px); }
.nav-group[open] > summary::before { transform: translateY(2px) rotate(90deg); }
.nav-group > summary small { margin-left: auto; color: var(--muted); font: 10px/2 var(--mono); font-weight: 400; }
.nav-links > a { display: flex; align-items: flex-start; gap: 11px; padding: 10px 12px; min-height: 44px; margin: 2px 0; border-left: 3px solid transparent; color: #43546b; text-decoration: none; font-size: 12px; line-height: 1.7; border-radius: 0 4px 4px 0; overflow-wrap: anywhere; }
.nav-links > a:hover { background: #edf2f8; color: var(--blue); }
.nav-links > a[aria-current="location"], .nav-links > a[aria-current="true"], .nav-links > a.active { color: var(--blue); background: var(--blue-tint); border-left-color: var(--blue); font-weight: 650; }
.nav-links .num { min-width: 24px; flex: 0 0 auto; padding-top: 3px; font: 11px/1.65 var(--mono); color: #7b8b9f; font-weight: 400; }
.nav-links > a[aria-current] .num { color: var(--blue); }
.sidebar .current-reading { flex: 0 0 auto; margin: 10px 12px 0; padding-top: 13px; border-top: 1px solid var(--line); font-size: 11px; white-space: normal; }
.scrim { display: none; }

/* 封面与书页 */
.book { width: min(var(--book-width), calc(100% - 80px)); margin: calc(var(--topbar-height) + 40px) auto 80px; background: var(--paper); box-shadow: 0 8px 32px #16325008; }
.cover { position: relative; isolation: isolate; overflow: hidden; padding: 44px 56px 36px; background: #fff; }
.cover::before { content: ""; position: absolute; z-index: -2; inset: 0; background: var(--blue); }
.cover::after { content: ""; position: absolute; z-index: -1; inset: auto 0 0; height: 6px; background: var(--green); }
.cover h1 { position: relative; margin: 0 0 14px; max-width: 590px; color: white; font-size: clamp(34px, 3.2vw, 48px); font-weight: 750; line-height: 1.3; letter-spacing: -.02em; }
.cover h1 span { display: block; }
.cover-subtitle { position: relative; max-width: 520px; margin: 0; color: #e3eeff; font-size: 17px; line-height: 1.85; letter-spacing: .08em; }
.cover-credit { position: relative; margin: 16px 0 0; color: #e3eeff; font-size: 12px; line-height: 1.9; }
.cover-credit strong { display: block; margin-bottom: 5px; font-size: 15px; font-weight: 650; }
.cover-credit p { margin: 3px 0; }
.court-art { position: absolute; z-index: -1; top: 76px; right: -104px; width: 390px; height: 365px; color: #fff; opacity: .2; transform: rotate(-16deg); pointer-events: none; }
.frontmatter, .chapter, .course-library, .source-index, .colophon { padding: 60px 56px; }
.frontmatter { border-bottom: 1px solid var(--line); }
.frontmatter h2, .source-index h2, .colophon h2, .library-head h2 { margin: 0 0 24px; font-size: 28px; line-height: 1.45; color: var(--navy); font-weight: 700; }
.frontmatter p { max-width: 760px; }
.part-label { margin: 0 0 18px; color: var(--green); font-size: 12px; line-height: 1.6; letter-spacing: .12em; font-weight: 650; }
.chapter { border-bottom: 1px solid var(--line); }
.chapter-heading { margin-bottom: 37px; padding-bottom: 27px; border-bottom: 1px solid var(--line); position: relative; }
.chapter-heading::after { content: ""; position: absolute; bottom: -1px; left: 0; width: 46px; height: 3px; background: var(--green); }
.chapter-num { display: block; color: var(--blue); font: 500 13px/1.5 var(--mono); margin-bottom: 14px; letter-spacing: .05em; }
.chapter-heading h2 { margin: 0; color: var(--navy); font-size: 30px; font-weight: 720; letter-spacing: -.02em; line-height: 1.45; }
.prose { overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .frontmatter p, .colophon p { margin: 18px 0; }
.prose h3 { margin: 40px 0 16px; color: var(--navy); font-size: 22px; font-weight: 700; line-height: 1.55; }
.prose h4 { margin: 29px 0 12px; color: var(--navy); font-size: 18px; line-height: 1.6; font-weight: 650; }
.prose h5 { margin: 24px 0 10px; color: var(--navy); font-size: 16px; }
.prose strong { font-weight: 650; color: #143d67; }
.prose ul, .prose ol { margin: 16px 0 23px; padding-left: 1.45em; }
.prose li { margin: 8px 0; padding-left: .15em; }
.prose li::marker { color: var(--green); }
.prose li > p { margin: 6px 0; }
.prose blockquote { margin: 26px 0; padding: 17px 22px; border-left: 3px solid var(--green); background: var(--green-tint); color: #204d40; font-size: 15px; line-height: 1.85; }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { margin: 34px 0; border: 0; border-top: 1px solid var(--line); }
.prose code { font-size: .85em; font-family: var(--mono); }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 26px 0; border-block: 1px solid #c5d2e3; }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.8; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
th { background: #edf2f9; color: var(--navy); font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
th + th, td + td { border-left: 1px solid #e5ebf2; }
.table-wrap > table { margin: 0; }
.prose > table { margin: 24px 0; }

/* 可核对的示范，保留动作本身 */
.demonstration { margin: 36px 0; padding: 22px 0 26px; border-block: 1px solid var(--line); }
.demo-heading { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; color: var(--navy); }
.demo-heading h3, .demo-heading h4 { margin: 0; font-size: 17px; line-height: 1.65; }
.demo-heading > span, .demo-heading > small { color: var(--green); font-size: 11px; line-height: 1.6; letter-spacing: .08em; font-weight: 650; flex: 0 0 auto; }
.demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.demo-grid figure { min-width: 0; }
.demo-grid figure a { display: block; text-decoration: none; }
.demo-grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #11253b; border: 1px solid #d2dce8; }
.demo-grid figcaption { margin-top: 9px; font-size: 11px; line-height: 1.75; color: #53657a; }
.demo-grid figcaption strong, .demo-grid figcaption b { font-weight: 650; color: var(--navy); }
.demo-note { margin: 17px 0 0; padding-left: 12px; border-left: 2px solid var(--green); color: #385b4c; font-size: 13px; line-height: 1.85; }
.demo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 18px; }
.demo-actions .button, .demo-actions button { font-size: 12px; }
.source-note { margin-top: 14px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.source-note > summary { width: fit-content; padding: 10px 0; min-height: 44px; }
.source-note > p { margin: 4px 0; }
.source-note a { color: #526986; }
.demo-actions + .source-note { margin-top: 9px; }
.clip { margin: 18px 0; }
.clip summary { min-height: 44px; padding: 10px 0; color: var(--blue); font-size: 13px; }
.clip video, .demonstration video { display: block; width: 100%; margin-top: 12px; background: #101a29; aspect-ratio: 16 / 9; }
.clip label { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 12px; }
.clip select { min-height: 40px; font-size: 12px; }

/* 课程研习 */
.course-library { border-bottom: 1px solid var(--line); }
.library-head p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.library-filter { display: flex; flex-wrap: wrap; gap: 10px; margin: 25px 0 32px; padding: 18px 0; border-block: 1px solid var(--line); }
.library-filter input { flex: 1 1 240px; }
.library-filter select { flex: 0 1 205px; max-width: 100%; }
.library-filter label { font-size: 12px; color: var(--muted); }
.library-count { font-size: 12px; color: var(--muted); }
.course-group { margin-top: 42px; }
.course-group > h3 { display: flex; align-items: center; gap: 15px; margin: 0 0 21px; color: var(--navy); font-size: 22px; line-height: 1.5; font-weight: 700; }
.course-group > h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lesson { margin: 0; border-top: 1px solid var(--line); }
.lesson:last-child { border-bottom: 1px solid var(--line); }
.lesson > summary { display: flex; align-items: flex-start; gap: 14px; min-height: 72px; padding: 22px 9px; list-style: none; font-size: 15px; line-height: 1.8; color: var(--navy); }
.lesson > summary:hover { background: #f6f9fd; }
.lesson-code { flex: 0 0 50px; padding-top: 3px; color: var(--blue); font: 11px/2 var(--mono); }
.lesson-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: break-word; }
.lesson-chevron { display: flex; align-items: center; justify-content: center; width: 24px; flex: 0 0 24px; height: 26px; color: var(--blue); font: 22px/1 var(--sans); }
.lesson-chevron::after { content: "+"; }
.lesson[open] .lesson-chevron::after { content: "−"; }
.lesson[open] > summary { background: #f2f6fc; }
.lesson-body { padding: 8px 22px 31px; font-size: 15px; line-height: 1.85; }
.lesson-intro { margin: 15px 0 25px; font-size: 15px; color: #314a65; }
.lesson-body h4 { margin: 26px 0 11px; color: var(--navy); font-size: 15px; line-height: 1.7; font-weight: 700; }
.lesson-body p { margin: 12px 0; }
.lesson-body ul, .lesson-body ol { padding-left: 1.4em; margin: 12px 0 20px; }
.lesson-body li { margin: 9px 0; }
.lesson-body li::marker { color: var(--green); }
.lesson-body .points { list-style: disc; }
.lesson-body .practice { margin: 22px 0; border-left: 3px solid var(--green); padding: 4px 0 4px 20px; }
.lesson-body .practice > h4 { color: #006d3d; margin-top: 6px; }
.lesson-body .caution { margin: 22px 0 8px; padding-top: 14px; border-top: 1px dashed #c6d1df; font-size: 13px; line-height: 1.9; color: #59667a; }
.lesson-body .caution > h4 { color: #59667a; margin-top: 0; font-size: 13px; }
.lesson-body .demonstration { margin-bottom: 5px; }
.source-index, .colophon { color: #516379; font-size: 13px; line-height: 1.9; }
.source-index { background: #fbfcfe; border-bottom: 1px solid var(--line); }
.source-index li { margin: 10px 0; }
.colophon { padding-top: 42px; padding-bottom: 48px; }
.colophon h2 { font-size: 20px; }
.colophon strong { color: var(--navy); }
.colophon small { display: block; color: #6c7a8d; font-size: 11px; line-height: 1.8; }

/* 检索与连续画面 */
dialog { width: min(1080px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0; overflow: hidden; border: 1px solid #cbd7e7; border-radius: 8px; color: var(--ink); background: white; box-shadow: 0 28px 100px #0f294e55; }
dialog::backdrop { background: #112d50bd; }
.dialog-head { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2, .dialog-head h3 { flex: 1; min-width: 0; margin: 0; font-size: 17px; line-height: 1.65; color: var(--navy); }
.dialog-head button { margin-left: auto; min-width: 44px; flex: 0 0 auto; }
.dialog-body { padding: 22px 24px 26px; max-height: calc(100dvh - 144px); overflow: auto; overscroll-behavior: contain; }
.viewer-image { width: 100%; height: auto; max-height: 59dvh; object-fit: contain; aspect-ratio: 16 / 9; background: #101c2c; }
.viewer-controls { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.viewer-controls input[type="range"] { flex: 1 1 220px; min-width: 140px; }
.viewer-controls output, .viewer-controls .time, #frame-time { font: 12px/1.7 var(--mono); color: var(--muted); }
.viewer-caption { font-size: 13px; line-height: 1.85; color: var(--muted); margin: 14px 0 0; }
#search-dialog { width: min(720px, calc(100vw - 48px)); }
#search-dialog input[type="search"], #search-dialog input[type="text"] { display: block; width: 100%; min-height: 48px; font-size: 16px; }
.search-results { margin-top: 20px; }
.search-results a { display: block; padding: 15px 10px; border-top: 1px solid var(--line); color: var(--navy); font-size: 15px; line-height: 1.75; text-decoration: none; }
.search-results a:hover { background: #f1f6fd; }
.search-results a strong { color: var(--blue); }
.search-results small, .search-results p { display: block; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.search-results > p { padding: 14px 0; }

/* 目录在窄屏时转为抽屉，正文始终保留可读宽度。 */
@media screen and (min-width: 1700px) {
  .book { margin-top: 112px; }
}
@media screen and (max-width: 1180px) {
  .book { width: calc(100% - 48px); margin-top: 88px; }
  .cover { padding-inline: 40px; }
  .frontmatter, .chapter, .course-library, .source-index, .colophon { padding-inline: 36px; }
  .cover h1 { font-size: 42px; max-width: 470px; }
  .court-art { right: -145px; opacity: .14; }
  .chapter-heading h2 { font-size: 27px; }
  .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .current-reading { display: none; }
}
@media screen and (max-width: 900px) {
  body { padding-left: 0; }
  .topbar { padding: 0 18px; gap: 12px; }
  .topbar .menu-toggle { display: inline-flex; }
  .wordmark { flex: 1 1 auto; }
  .tools { flex: 0 0 auto; gap: 3px; }
  .sidebar { z-index: 100; top: 0; width: min(320px, calc(100vw - 56px)); padding-top: 27px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 14px 0 60px #0f294e26; }
  body.nav-open .scrim { display: block; position: fixed; z-index: 90; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: #102b4cad; }
  .book { width: calc(100% - 48px); max-width: 780px; margin-top: 88px; }
  .cover { padding: 40px 44px 32px; }
  .cover h1 { font-size: 42px; max-width: 530px; }
  .court-art { width: 400px; right: -125px; opacity: .19; }
  .frontmatter, .chapter, .course-library, .source-index, .colophon { padding-inline: 44px; }
  .chapter-heading h2 { font-size: 29px; }
  .demo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-head { padding-bottom: 22px; }
}
@media screen and (max-width: 640px) {
  body { font-size: 16px; line-height: 1.85; }
  .topbar { padding: 0 12px; gap: 8px; }
  .wordmark { font-size: 13px; gap: 9px; letter-spacing: 0; }
  .wordmark::before { width: 3px; height: 22px; box-shadow: 4px 0 0 var(--green); margin-right: 2px; }
  .wordmark small { display: none; }
  .tools button, .tools .button { padding: 9px; font-size: 12px; }
  .tools .optional-tool { display: none; }
  .book { width: 100%; margin-top: 64px; margin-bottom: 0; box-shadow: none; }
  .cover { padding: 32px 24px 30px; }
  .cover::after { height: 5px; }
  .cover h1 { max-width: 450px; font-size: clamp(30px, 9vw, 38px); line-height: 1.3; letter-spacing: 0; }
  .cover-subtitle { max-width: 340px; font-size: 14px; letter-spacing: .05em; }
  .cover-credit { font-size: 11px; }
  .cover-credit strong { font-size: 13px; }
  .court-art { width: 350px; top: 145px; right: -165px; opacity: .15; }
  .frontmatter, .chapter, .course-library, .source-index, .colophon { padding: 43px 24px; }
  .frontmatter h2, .source-index h2, .library-head h2 { font-size: 25px; }
  .chapter-heading { padding-bottom: 23px; margin-bottom: 29px; }
  .chapter-heading h2 { font-size: 26px; line-height: 1.5; }
  .chapter-num { font-size: 12px; margin-bottom: 12px; }
  .part-label { font-size: 11px; margin-bottom: 15px; }
  .prose h3 { font-size: 20px; margin-top: 34px; }
  .prose h4 { font-size: 17px; margin-top: 25px; }
  .prose blockquote { padding: 15px 17px; font-size: 14px; }
  .prose ul, .prose ol { padding-left: 1.3em; }
  .table-wrap { margin-inline: 0; }
  table { min-width: 470px; font-size: 12px; }
  th, td { padding: 10px 11px; }
  .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 10px; }
  .demo-grid figcaption { font-size: 11px; line-height: 1.8; }
  .demo-heading { display: block; }
  .demo-heading > span, .demo-heading > small { display: block; margin-bottom: 6px; }
  .demo-heading h3, .demo-heading h4 { font-size: 16px; }
  .demo-note { font-size: 12px; }
  .library-filter { gap: 9px; }
  .library-filter input { flex-basis: 100%; width: 100%; }
  .library-filter select { flex: 1; width: 100%; }
  .course-group > h3 { font-size: 20px; }
  .lesson > summary { padding: 19px 0; gap: 9px; font-size: 14px; }
  .lesson-code { flex-basis: 41px; font-size: 10px; padding-top: 4px; }
  .lesson-chevron { flex-basis: 18px; width: 18px; font-size: 20px; }
  .lesson-body { padding: 5px 2px 25px; font-size: 14px; }
  .lesson-intro { font-size: 14px; }
  .lesson-body .practice { padding-left: 15px; }
  .lesson-body .demonstration { margin-top: 25px; }
  dialog, #search-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); border-radius: 6px; }
  .dialog-head { padding: 12px 15px; gap: 10px; }
  .dialog-head h2, .dialog-head h3 { font-size: 15px; }
  .dialog-head button { padding-inline: 10px; font-size: 12px; }
  .dialog-body { padding: 16px 15px 20px; max-height: calc(100dvh - 107px); }
  .viewer-controls { gap: 8px; }
  .viewer-controls button { font-size: 12px; padding-inline: 12px; }
  .viewer-controls input[type="range"] { flex-basis: 100%; order: 5; }
  .viewer-image { max-height: 52dvh; }
  .colophon h2 { font-size: 19px; }
}
@media screen and (max-width: 380px) {
  .wordmark { font-size: 12px; }
  .topbar { gap: 5px; padding-inline: 8px; }
  .topbar .menu-toggle { width: 40px; min-width: 44px; }
  .tools { gap: 0; }
  .cover { padding-inline: 24px; }
  .cover h1 { font-size: 30px; }
  .frontmatter, .chapter, .course-library, .source-index, .colophon { padding-inline: 21px; }
  .chapter-heading h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* B5 正式阅读稿：页边距与页眉页码由导出器提供。 */
@page { size: 176mm 250mm; }
@media print {
  :root { --paper: #fff; }
  html { scroll-behavior: auto; scroll-padding-top: 0; }
  body { margin: 0; padding: 0; background: white; color: #172d44; font: 10.5pt/1.65 var(--serif); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .topbar, .scrim, .skip-link, dialog, .screen-only, .demo-actions, .library-filter, .library-count, .clip, .source-note, #reading-progress { display: none !important; }
  .print-only { display: block; }
  .book { width: 100%; max-width: none; margin: 0; background: white; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
  p, li { orphans: 3; widows: 3; }
  h1, h2, h3, h4, h5, .chapter-heading, .demo-heading { break-after: avoid-page; page-break-after: avoid; }
  h1, h2, h3, h4, h5 { font-family: var(--sans); }
  .cover { min-height: 211mm; height: 211mm; padding: 19mm 15mm 11mm; break-after: page; page-break-after: always; overflow: hidden; }
  .cover::before { inset: 0 0 36mm; }
  .cover::after { bottom: 36mm; height: 2.5mm; }
  .cover h1 { margin: 16mm 0 7mm; max-width: 120mm; font: 800 31pt/1.4 var(--sans); letter-spacing: .02em; }
  .cover-subtitle { max-width: 115mm; font: 11pt/1.85 var(--sans); letter-spacing: .05em; }
  .cover-credit { position: absolute; left: 15mm; right: 15mm; bottom: 10mm; margin: 0; font: 8pt/1.85 var(--sans); }
  .cover-credit strong { font-size: 10pt; margin-bottom: 2mm; }
  .court-art { width: 110mm; height: 110mm; right: -33mm; top: 43mm; opacity: .19; }
  .frontmatter, .chapter, .course-library, .source-index, .colophon { padding: 0; border: 0; background: white; }
  .frontmatter, .print-toc { break-before: page; page-break-before: always; }
  .frontmatter { break-after: page; page-break-after: always; }
  .frontmatter h2, .source-index h2, .colophon h2, .library-head h2 { margin: 6mm 0 7mm; font-size: 20pt; line-height: 1.5; }
  .frontmatter p, .prose p, .colophon p { margin: 3.1mm 0; }
  .print-toc { padding-top: 6mm; font-family: var(--sans); }
  .print-toc h2 { margin: 0 0 8mm; color: var(--navy); font-size: 22pt; }
  .toc-part { margin: 6mm 0 2.5mm; color: var(--green); font-size: 10pt; font-weight: 650; break-after: avoid-page; }
  .toc-row { display: flex; align-items: baseline; gap: 2mm; margin: 2mm 0; font-size: 9pt; line-height: 1.65; break-inside: avoid-page; }
  .toc-row > a { display: contents; }
  .toc-row .toc-title { max-width: calc(100% - 14mm); }
  .toc-rule { flex: 1; min-width: 3mm; border-bottom: .3pt dotted #9dabbc; transform: translateY(-1mm); }
  .toc-page { width: 8mm; flex: 0 0 8mm; text-align: right; font: 8.5pt/1.6 var(--mono); }
  .chapter { break-before: page; page-break-before: always; scroll-margin: 0; }
  .part-label { margin: 6mm 0 5mm; font: 650 8.5pt/1.6 var(--sans); letter-spacing: .08em; }
  .chapter-heading { margin: 0 0 8mm; padding-bottom: 5.5mm; border-bottom: .5pt solid var(--line); break-inside: avoid; }
  .chapter-heading::after { width: 13mm; height: 1mm; }
  .chapter-num { margin-bottom: 3.5mm; font: 9pt/1.5 var(--mono); }
  .chapter-heading h2 { margin: 0; font-size: 23pt; line-height: 1.48; letter-spacing: 0; }
  .prose h3 { margin: 8mm 0 3.5mm; font-size: 14pt; line-height: 1.5; }
  .prose h4 { margin: 6mm 0 3mm; font-size: 11.5pt; line-height: 1.6; }
  .prose h5 { margin: 5mm 0 2mm; font-size: 10.5pt; }
  .prose strong { color: var(--navy); font-weight: 700; }
  .prose ul, .prose ol { margin: 3mm 0 5mm; padding-left: 1.3em; }
  .prose li { margin: 1.5mm 0; }
  .prose blockquote { margin: 5mm 0; padding: 3mm 4mm; border-left: 1.8pt solid var(--green); font-size: 9.5pt; line-height: 1.7; break-inside: avoid; }
  .prose hr { margin: 6mm 0; }
  .table-wrap { overflow: visible; margin: 5mm 0; border-block: .5pt solid #becddd; }
  table { min-width: 0; font: 8.5pt/1.65 var(--sans); table-layout: auto; }
  th, td { padding: 2.5mm 2.8mm; border-bottom: .4pt solid var(--line); }
  th + th, td + td { border-left: .35pt solid #e1e7ef; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  thead { display: table-header-group; }
  .demonstration { margin: 6mm 0; padding: 4mm 0; border-block: .5pt solid var(--line); break-inside: avoid; page-break-inside: avoid; }
  .demo-heading { display: block; margin: 0 0 3mm; }
  .demo-heading h3, .demo-heading h4 { margin: 0; font: 650 10pt/1.65 var(--sans); }
  .demo-heading > span, .demo-heading > small { display: inline; margin-right: 3mm; font: 650 7.5pt/1.6 var(--sans); }
  .demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3mm; }
  .demo-grid figure { break-inside: avoid; page-break-inside: avoid; }
  .demo-grid img { border: .4pt solid #ccd7e5; aspect-ratio: 16 / 9; }
  .demo-grid figcaption { margin-top: 2mm; font: 8pt/1.65 var(--sans); color: #40546d; }
  .demo-note { margin-top: 3.5mm; padding-left: 3mm; border-left: 1.2pt solid var(--green); font: 8.5pt/1.7 var(--sans); }
  .course-library { break-before: page; }
  .library-head p { font-size: 10pt; color: #40546d; }
  .course-group { margin: 0; break-before: page; page-break-before: always; }
  .course-group > h3 { margin: 5mm 0 6mm; font-size: 19pt; line-height: 1.5; }
  .course-group > h3::after { display: none; }
  .lesson, .lesson:last-child { margin: 0; border-bottom: 0; border-top: .5pt solid var(--line); break-before: auto; break-inside: auto; }
  .lesson > summary { display: flex; gap: 3mm; min-height: 0; padding: 5mm 0 2mm; background: white !important; font: 650 11.5pt/1.65 var(--sans); break-after: avoid; page-break-after: avoid; }
  .lesson-code { flex-basis: 13mm; padding-top: .5mm; font: 8pt/1.9 var(--mono); }
  .lesson-title { font-weight: 650; }
  .lesson-chevron { display: none; }
  .lesson-body { padding: 0 0 5mm; font: 10pt/1.65 var(--serif); break-inside: auto; }
  .lesson-intro { margin: 2mm 0 4mm; font: 10pt/1.7 var(--serif); }
  .lesson-body h4 { margin: 4mm 0 2mm; font: 650 10pt/1.6 var(--sans); }
  .lesson-body p { margin: 2.5mm 0; }
  .lesson-body ul, .lesson-body ol { margin: 2mm 0 3.5mm; padding-left: 1.3em; }
  .lesson-body li { margin: 1.4mm 0; }
  .lesson-body .practice { margin: 4mm 0; border-left: 1.5pt solid var(--green); padding: 1mm 0 1mm 4mm; }
  .lesson-body .practice > h4 { margin-top: 1mm; }
  .lesson-body .caution { margin: 4mm 0 2mm; padding-top: 3mm; font: 8.5pt/1.7 var(--sans); }
  .lesson-body .caution > h4 { font-size: 8.5pt; }
  .lesson-body .demonstration { margin-bottom: 3mm; }
  .source-index, .colophon { break-before: page; page-break-before: always; font: 9pt/1.8 var(--sans); }
  .colophon h2 { font-size: 18pt; }
  .colophon small { font-size: 8pt; line-height: 1.8; }
}

/* 实际出版 DOM 补充 */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.wordmark { position: relative; display: block; padding-left: 19px; }
.wordmark::before { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
.wordmark > span { display: block; color: var(--muted); font-size: 11px; line-height: 1.65; font-weight: 500; letter-spacing: .08em; }
.side-footer { flex: 0 0 auto; padding: 15px 12px 2px; margin-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.7; }
.nav-description { margin: 3px 12px 15px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.reading-route { margin-top: 35px; padding-top: 24px; border-top: 1px solid var(--line); }
.demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.demo-grid figcaption > span { display: inline-block; margin-right: 5px; color: var(--blue); font: 10px/1.6 var(--mono); }
.lesson-chevron { font-size: 0; }
.lesson-chevron::after { font-size: 22px; }
.video-disclosure, .more-examples, .source-disclosure { margin-top: 18px; }
.video-disclosure > summary, .more-examples > summary, .source-disclosure > summary { min-height: 44px; padding: 10px 0; color: var(--blue); font-size: 12px; line-height: 1.8; }
.video-disclosure video { display: block; width: 100%; margin-top: 10px; aspect-ratio: 16 / 9; background: #101c2c; }
.video-disclosure label { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.video-disclosure select { font-size: 12px; }
.source-disclosure { color: var(--muted); font-size: 12px; line-height: 1.85; }
.source-disclosure time { font-family: var(--mono); color: var(--blue); }
#frame-range { width: 100%; margin-top: 12px; }
.viewer-controls > span { color: var(--muted); font-size: 11px; }
#global-query { margin-top: 9px; }
#search-status { margin: 15px 0 0; color: var(--muted); font-size: 12px; }
#lesson-count { width: 100%; color: var(--muted); font-size: 11px; }
.library-filter > label:not(.sr-only) { flex-basis: 100%; line-height: 1.5; }
.tools kbd { font: 11px/1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 4px; }
#font-toggle[aria-pressed="true"] { color: var(--blue); background: var(--blue-tint); }
@media screen and (min-width: 901px) { #nav-close { display: none; } }
@media screen { .large-type .prose { font-size: 19px; } .large-type .lesson-body, .large-type .lesson-intro { font-size: 17px; } }
@media screen and (max-width: 1180px) { .cover-bottom { left: 40px; right: 40px; } }
@media screen and (max-width: 900px) { .cover-bottom { left: 48px; right: 48px; } }
@media screen and (max-width: 640px) {
  .wordmark { padding-left: 14px; }
  .wordmark > span { font-size: 11px; line-height: 1.65; letter-spacing: .01em; }
  .tools kbd { display: none; }
  #font-toggle { font-size: 0; width: 44px; padding: 9px 5px; }
  #font-toggle::after { content: "A+"; font-size: 12px; font-weight: 650; }
  .reading-route { margin-top: 28px; }
  .viewer-controls > span { width: 100%; text-align: center; }
}
@media screen and (max-width: 380px) { .cover-bottom { left: 24px; right: 24px; } }
@media print {
  .reading-route { margin-top: 7mm; padding-top: 5mm; }
  .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3mm; }
  .demo-grid figcaption > span { font-size: 7pt; }
  .toc-part { margin-top: 5mm; }
  .toc-part h3 { margin: 0 0 2.5mm; color: var(--green); font-size: 10pt; }
  .toc-row { font-weight: 400; color: var(--ink); letter-spacing: 0; }
  .toc-dots { flex: 1; min-width: 3mm; border-bottom: .3pt dotted #9dabbc; transform: translateY(-1mm); }
  .toc-row > span:first-child { max-width: calc(100% - 14mm); }
}
/* 短列仍保留至少三个汉字的宽度，避免表头被挤成竖排。 */
th:first-child, td:first-child { min-width: 6.5em; }

/* Online edition: media loads only on demand. */
.jiaverse-home{font-size:12px;text-decoration:none;font-weight:650;padding:10px;color:var(--blue)}
#viewer-video{display:block;width:100%;max-height:58vh;aspect-ratio:16/9;object-fit:contain;background:#0b1830;border-radius:4px}
.viewer-options{display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-top:14px;font-size:13px}.viewer-options label{display:flex;align-items:center;gap:7px}.viewer-options input[type=checkbox]{min-height:20px;width:18px;height:18px;accent-color:var(--green)}
.play-demo{background:var(--blue);border-color:var(--blue);color:#fff}.play-demo:hover{background:#003c9e;color:#fff}
#motion-loading,#motion-error{font-size:13px;margin:8px 0}#motion-error{color:#9f301d}img[data-src]{background:#edf2f7;object-fit:contain}
@media(max-width:560px){.jiaverse-home{display:none}.viewer-controls{gap:6px}.viewer-controls button{padding:8px 10px;font-size:12px}.viewer-options{gap:10px}#frame-dialog{width:calc(100vw - 24px);padding:0}}
@media print{.jiaverse-home{display:none}}

/* 阅读优先：层级、定位与必要操作。 */
::selection { color: var(--navy); background: #cfe2ff; }
input { caret-color: var(--blue); }
input::placeholder { color: var(--muted); }
.topbar button svg, .dialog-head button svg, .side-head button svg { width: 19px; height: 19px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; }
.side-head button { float: none; margin: 0; }
.nav-group > summary > span:first-child { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav-links > a { border-left-width: 1px; border-radius: 4px; }
.nav-links .num { color: var(--muted); }
.cover-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.cover-actions .button { border-color: white; background: white; color: var(--blue); padding-inline: 20px; }
.cover-actions .button + .button { border-color: #7ca4e4; color: white; background: transparent; }
.cover-actions #resume-reading { border-color: white; color: var(--blue); background: white; }
.cover-actions .button:hover { background: #e3eeff; color: #003c9e; }
.cover-meta { position: relative; margin: 24px 0 0; color: #e3eeff; font-size: 11px; letter-spacing: .04em; }
.cover a:focus-visible { outline-color: white; }
.cover .court-art { top: 36px; opacity: .12; }
.reading-route { display: block; margin-top: 24px; padding: 0; border-top: 1px solid var(--line); }
.reading-route > a { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.reading-route > a > span { color: var(--muted); font-size: 12px; }
.reading-route > a:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.reading-notes { color: var(--muted); margin-top: 20px; font-size: 13px; }
.reading-notes summary { min-height: 44px; padding-block: 10px; }
.reading-notes p { margin: 10px 0; }
.source-disclosure li { margin-block: 7px; }
.source-disclosure time { margin-right: 8px; font-variant-numeric: tabular-nums; }
.source-disclosure a { color: var(--blue); }
#frame-position { font-variant-numeric: tabular-nums; }
#motion-error { padding: 10px 0; }
.lesson-chevron::after { content: ""; display: block; width: 9px; height: 9px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.lesson[open] .lesson-chevron::after { content: ""; transform: translateY(4px) rotate(225deg); }
@media screen {
  .lesson-code, #nav-lessons .num { display: none; }
  .chapter [id], .lesson [id] { scroll-margin-top: 0; }
  .book { box-shadow: none; }
  .chapter:focus, .frontmatter:focus, .course-group:focus, .lesson:focus, .prose h3:focus, .points li:focus { outline: none; }
}
@media screen and (min-width: 901px) { #nav-close { display: none; } }
@media screen and (max-width: 640px) {
  .reading-route > a { align-items: flex-start; flex-direction: column; gap: 2px; }
  .cover-actions { margin-top: 20px; }
  .cover-meta { margin-top: 20px; }
  .cover-credit { left: auto; right: auto; bottom: auto; }
  .lesson > summary { min-height: 64px; padding: 17px 0; }
}
@media print { .cover-meta { color: var(--navy); font-size: 8pt; } }

.frame-tools { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.frame-tools > summary { min-height: 44px; padding: 10px 0; color: var(--navy); font-size: 13px; }
.frame-tools .viewer-controls { margin-top: 10px; }
.nav-links > a, .nav-group > summary, .nav-tabs [role="tab"] { font-size: 13px; }
.nav-group > summary::before { content: ""; width: 7px; height: 7px; margin: 6px 3px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.nav-group[open] > summary::before { transform: rotate(45deg); }
dialog { border: 0; }
@media screen {
  .course-group > h3 > span { display: none; }
  .prose blockquote, .lesson-body .practice, .demo-note { border-left-width: 1px; }
}
