/* 物理资源库 · light theme tuned for projection and long reading */

:root {
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --sunken: #eff1ec;
  --ink: #1b2320;
  --ink-2: #414b47;
  --ink-3: #626c68;
  --line: #e1e4de;
  --line-strong: #cdd2ca;
  --accent: #1f6b57;
  --accent-ink: #17523f;
  --accent-soft: #e5f0eb;
  --blue: #245a91;
  --blue-soft: #e8eff8;
  --amber: #8a5a12;
  --amber-soft: #fbf3e4;
  --rose: #9b3b35;
  --rose-soft: #f9ecea;
  --slate-soft: #eef0f1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .04), 0 4px 16px rgba(20, 30, 25, .05);
  --shadow-lg: 0 12px 40px rgba(20, 30, 25, .16);
  --topbar-h: 3.75rem;
  --sidebar-w: 18.5rem;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", system-ui, sans-serif;
  --font-num: "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, var(--font);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 4.5rem); }
html[data-size="lg"] { font-size: 112.5%; }
html[data-size="xl"] { font-size: 125%; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.75;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: #cfe5da; }

.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; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 1rem; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.noscript { padding: 2rem; text-align: center; }

/* ---------- icons ---------- */
.icon { display: inline-block; width: 1.1em; height: 1.1em; flex: none; background: currentColor; vertical-align: -.18em;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon-search { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>"); }
.icon-basket { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 4h6'/><rect x='5' y='4' width='14' height='17' rx='2'/><path d='M9 10h6M9 14h6M9 18h3'/></svg>"); }
.icon-close { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><path d='M18 6 6 18M6 6l12 12'/></svg>"); }
.icon-external { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 4h6v6M10 14 20 4M19 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h5'/></svg>"); }
.icon-copy { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='8' y='8' width='13' height='13' rx='2'/><path d='M4 16V5a1 1 0 0 1 1-1h11'/></svg>"); }
.icon-lock { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4.5' y='10.5' width='15' height='10' rx='2'/><path d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/></svg>"); }
.icon-check { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"); }
.icon-shield { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3 5 6v5c0 4.5 3 8.3 7 10 4-1.7 7-5.5 7-10V6z'/><path d='m9 12 2 2 4-4'/></svg>"); }
.icon-chev-left { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m15 18-6-6 6-6'/></svg>"); }
.icon-chev-right { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m9 18 6-6-6-6'/></svg>"); }
.icon-chev-down { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); }
.icon-menu { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><path d='M4 6h16M4 12h16M4 18h10'/></svg>"); }
.icon-panel { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='2'/><path d='M9 4v16'/></svg>"); }
.icon-image { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='2'/><circle cx='9' cy='10' r='2'/><path d='m21 16-4.5-4.5L7 20'/></svg>"); }
.icon-play { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z'/></svg>"); }
.icon-type { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 19 8 6l5 13M4.8 14.5h6.4M15 12.5a3 3 0 1 1 0 4.2M18 11v8'/></svg>"); }
.icon-arrow-left { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M19 12H5M11 18l-6-6 6-6'/></svg>"); }
.icon-clock { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='12' cy='12' r='9'/><path d='M12 7v5l3 2'/></svg>"); }
.icon-alert { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.3 4.2 2.6 18a2 2 0 0 0 1.7 3h15.4a2 2 0 0 0 1.7-3L13.7 4.2a2 2 0 0 0-3.4 0z'/><path d='M12 9.5v4M12 17h.01'/></svg>"); }
.icon-refresh { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 11a8 8 0 0 0-14.3-4.9L4 8M4 4v4h4M4 13a8 8 0 0 0 14.3 4.9L20 16M20 20v-4h-4'/></svg>"); }
.icon-eye { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M2.5 12S6 5 12 5s9.5 7 9.5 7-3.5 7-9.5 7-9.5-7-9.5-7z'/><circle cx='12' cy='12' r='3'/></svg>"); }
.icon-user { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='12' cy='8' r='4'/><path d='M4 21a8 8 0 0 1 16 0'/></svg>"); }
.icon-inbox { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 13h5l1.5 3h5L16 13h5'/><path d='M5.5 5h13L21 13v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z'/></svg>"); }

/* ---------- buttons & controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 2.5rem; padding: .45rem 1rem;
  border: 1px solid transparent; border-radius: var(--radius-sm); font-size: .9375rem; font-weight: 600; line-height: 1.2;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-quiet { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-quiet:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-quiet[aria-pressed="true"] { background: var(--accent-soft); border-color: #b9d6c9; color: var(--accent-ink); }
.btn-sm { min-height: 2.125rem; padding: .3rem .75rem; font-size: .875rem; }
.icon-btn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); font-size: 1.05rem; flex: none; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn[aria-pressed="true"], .icon-btn[aria-expanded="true"] { background: var(--sunken); color: var(--ink); }
.icon-btn.on-dark { color: #e8ece9; }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.linklike { padding: 0; border: 0; background: none; color: var(--ink); text-align: left; font-weight: 600; line-height: 1.5; }
.linklike:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }

.search-wrap { position: relative; display: flex; align-items: center; flex: 1 1 16rem; min-width: 0; max-width: 26rem; }
.search-wrap > .icon { position: absolute; left: .75rem; color: var(--ink-3); pointer-events: none; }
.search { width: 100%; height: 2.5rem; padding: 0 .85rem 0 2.35rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .9375rem; transition: border-color .15s, box-shadow .15s; }
.search::placeholder { color: #8a938f; }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 107, 87, .15); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .35em; min-height: 2.125rem; padding: .2rem .8rem; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .875rem; font-weight: 500; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: #b9d6c9; color: var(--accent-ink); font-weight: 600; }
.chip-count { color: var(--ink-3); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-count { color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.toolbar-end { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.result-count { color: var(--ink-3); font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tag { display: inline-flex; align-items: center; min-height: 1.5rem; padding: 0 .55rem; border-radius: 6px; font-size: .8125rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.tag-type { background: var(--blue-soft); color: var(--blue); }
.tag-must { background: var(--accent-soft); color: var(--accent-ink); }
.tag-quiet { background: var(--slate-soft); color: var(--ink-2); font-weight: 500; }
.net-cn { background: var(--accent-soft); color: var(--accent-ink); }
.net-out { background: var(--amber-soft); color: var(--amber); }
.meta-inline { display: inline-flex; align-items: center; gap: .3em; color: var(--ink-3); font-size: .8125rem; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: .35em; padding: .1rem .6rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.pill-free { background: var(--accent-soft); color: var(--accent-ink); }
.pill-reviewed { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.pill-member { background: var(--slate-soft); color: var(--ink-3); font-weight: 500; }

.field-label { display: block; margin-bottom: .15rem; color: var(--ink-3); font-size: .8125rem; font-weight: 600; letter-spacing: .02em; }
.field-label.inline { display: inline; margin: 0 .5em 0 0; }
.field-label.ok { color: var(--accent); }
.field + .field { margin-top: .85rem; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--ink-3); }
.boot-mark, .brand-mark { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem; flex: none; }
.boot-mark { width: 3rem; height: 3rem; font-size: 1.4rem; border-radius: 12px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.topbar-inner { display: flex; align-items: center; gap: .75rem; height: 100%; padding: 0 1.25rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none !important; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { white-space: nowrap; font-size: 1.0625rem; font-weight: 700; letter-spacing: .02em; }
.brand-text span { color: var(--ink-3); font-size: .75rem; }
.drawer-btn { display: none; }

.book-switch { display: inline-flex; gap: 2px; margin-left: 1.25rem; padding: 3px; border-radius: 10px; background: var(--sunken); }
.book-tab { display: inline-flex; align-items: center; min-height: 2.125rem; padding: 0 .95rem; border-radius: 8px;
  color: var(--ink-2); font-size: .9375rem; font-weight: 600; text-decoration: none !important; }
.book-tab:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.book-tab[aria-current="page"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.book-switch.is-block { display: none; }

.topbar-end { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.back-link { display: inline-flex; align-items: center; gap: .4em; padding: .4rem .7rem; border-radius: var(--radius-sm); color: var(--ink-3); font-size: .875rem; font-weight: 500; white-space: nowrap; }
.back-link:hover { color: var(--ink); background: var(--sunken); text-decoration: none; }
.account { display: inline-flex; align-items: center; gap: .35em; padding: .3rem .7rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); background: var(--sunken); white-space: nowrap; }
a.account:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent-ink); }
.account-login { background: transparent; border: 1px solid var(--line-strong); }
.account-upgrade { background: var(--accent-soft); color: var(--accent-ink); }
.btn-basket { position: relative; background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-basket:hover { border-color: var(--ink-3); }
.badge-count { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 50; width: 15rem; padding: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-label { margin-bottom: .5rem; font-size: .8125rem; font-weight: 600; color: var(--ink-3); }
.menu-hint { margin-top: .6rem; font-size: .8125rem; color: var(--ink-3); line-height: 1.5; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 9px; background: var(--sunken); }
.seg-btn { min-height: 2.125rem; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-size: .875rem; font-weight: 600; }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
html[data-focus] .layout { grid-template-columns: minmax(0, 1fr); }
html[data-focus] .sidebar { display: none; }

.sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h));
  border-right: 1px solid var(--line); background: var(--surface-2); overflow: hidden; }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; }
.sidebar-mobile-head { display: none; }
.sidebar-head { padding: 1.25rem 1rem .75rem; border-bottom: 1px solid var(--line); }
.sidebar-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .75rem; font-size: 1rem; font-weight: 700; }
.sidebar-count { color: var(--ink-3); font-size: .8125rem; font-weight: 500; }
.sidebar-head .search-wrap { max-width: none; }
.toc { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .5rem .5rem 2rem; scrollbar-width: thin; }
.toc-group { margin-top: .75rem; }
.toc-chapter { position: sticky; top: -.5rem; z-index: 1; padding: .5rem .6rem .35rem; background: var(--surface-2); color: var(--ink-3); font-size: .8125rem; font-weight: 600; letter-spacing: .02em; }
.toc-link { position: relative; display: grid; grid-template-columns: 2.9rem minmax(0, 1fr) auto; align-items: center; gap: .15rem .35rem;
  padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--ink-2); font-size: .9375rem; line-height: 1.45; text-decoration: none !important; }
.toc-link:hover { background: var(--sunken); color: var(--ink); }
.toc-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.toc-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: .55rem; bottom: .55rem; width: 3px; border-radius: 3px; background: var(--accent); }
.toc-no { color: var(--ink-3); font-family: var(--font-num); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.toc-link[aria-current="page"] .toc-no { color: var(--accent); }
.toc-book { margin-right: .35em; color: var(--ink-3); font-size: .8125rem; font-weight: 600; }
.toc-link .pill { padding: 0 .45rem; font-size: .6875rem; }
.toc-lock { color: #9aa29e; font-size: .8rem; }
.toc-empty { padding: 1.5rem .75rem; color: var(--ink-3); font-size: .875rem; }
.toc-other { margin-top: 1.25rem; padding-top: .5rem; border-top: 1px dashed var(--line-strong); }
.scrim { display: none; }

.main { min-width: 0; padding: 2rem clamp(1.25rem, 3.2vw, 3rem) 3rem; outline: none; }
html[data-focus] .main { max-width: 80rem; margin: 0 auto; width: 100%; }
html[data-focus] .reading, html[data-focus] .diag-view { max-width: 62rem; }

/* ---------- lesson header & tabs ---------- */
.lesson-head { padding-bottom: 1.25rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; color: var(--ink-3); font-size: .875rem; }
.crumbs .sep { color: var(--line-strong); }
.lesson-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .35rem; }
.lesson-title { display: flex; align-items: baseline; gap: .6em; font-size: clamp(1.625rem, 2.4vw, 2.125rem); font-weight: 700; line-height: 1.3; letter-spacing: .01em; }
.lesson-no { color: var(--accent); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.lesson-no.is-text { align-self: center; padding: .1rem .55rem; border-radius: 6px; background: var(--accent-soft); font-family: var(--font); font-size: .8125rem; font-weight: 600; letter-spacing: .04em; }
.lesson-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.lesson-stats { margin-top: .4rem; color: var(--ink-3); font-size: .875rem; }

.tabbar-wrap { position: sticky; top: var(--topbar-h); z-index: 20; margin: 0 calc(-1 * clamp(1.25rem, 3.2vw, 3rem)); padding: 0 clamp(1.25rem, 3.2vw, 3rem);
  background: rgba(245, 246, 243, .95); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tabbar { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: .4em; padding: .85rem .8rem; color: var(--ink-3);
  font-size: .9375rem; font-weight: 600; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--accent-ink); }
.tab[aria-current="page"]::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab-count { color: #8c9591; font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.tab[aria-current="page"] .tab-count { color: var(--accent); }

.content-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; padding-top: 1.75rem; }
.content { min-width: 0; outline: none; }
.outline { display: none; }
@media (min-width: 1360px) {
  .content-wrap:has(.outline:not([hidden])) { grid-template-columns: minmax(0, 1fr) 12.5rem; }
  .outline:not([hidden]) { display: block; position: sticky; top: calc(var(--topbar-h) + 4.5rem); align-self: start; max-height: calc(100vh - var(--topbar-h) - 6rem); overflow: auto; }
}
.outline-title { margin-bottom: .5rem; color: var(--ink-3); font-size: .8125rem; font-weight: 600; }
.outline ul { border-left: 1px solid var(--line); }
.outline-link { display: block; margin-left: -1px; padding: .3rem 0 .3rem .9rem; border-left: 2px solid transparent; color: var(--ink-3); font-size: .875rem; line-height: 1.5; }
.outline-link:hover { color: var(--ink); text-decoration: none; }
.outline-link.is-active { border-left-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.pager-link { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none !important; }
.pager-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.pager-next { text-align: right; align-items: flex-end; grid-column: 2; }
.pager-dir { display: inline-flex; align-items: center; gap: .25em; color: var(--ink-3); font-size: .8125rem; }
.pager-title { font-weight: 600; }
.foot { margin-top: 2.5rem; color: var(--ink-3); font-size: .8125rem; line-height: 1.6; }

/* ---------- reading blocks ---------- */
.reading { max-width: 48rem; }
.block { padding-top: 2.25rem; }
.reading > .block:first-child, .reading > .toolbar + .block-lede + .block { padding-top: 0; }
.block-title { display: flex; align-items: baseline; gap: .5rem; margin-bottom: 1rem; font-size: 1.3125rem; font-weight: 700; line-height: 1.4; }
.block-title .count { color: var(--ink-3); font-size: .875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.block-lede { margin: -.5rem 0 1.25rem; color: var(--ink-3); font-size: .9375rem; line-height: 1.6; }
.media-view > .block-lede, .reading > .block-lede { margin-top: 0; }

.sub + .sub { margin-top: 1.5rem; }
.sub-title { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; color: var(--ink-2); font-size: .9375rem; font-weight: 700; }
.sub-title::before { content: ""; width: .55rem; height: .55rem; border-radius: 2px; background: var(--accent); opacity: .75; }

.bullets > li { position: relative; padding-left: 1.1rem; }
.bullets > li + li { margin-top: .45rem; }
.bullets > li::before { content: ""; position: absolute; left: .1rem; top: .72em; width: .36rem; height: .36rem; border-radius: 50%; background: var(--line-strong); }
.steps, .chain { counter-reset: step; }
.steps > li, .chain > li { position: relative; padding-left: 2.25rem; counter-increment: step; }
.steps > li + li, .chain > li + li { margin-top: .6rem; }
.steps > li::before, .chain > li::before { content: counter(step); position: absolute; left: 0; top: .2em; display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--sunken); color: var(--ink-2); font-family: var(--font-num); font-size: .8125rem; font-weight: 700; line-height: 1; }
.chain > li { padding: .8rem 1rem .8rem 3rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.chain > li::before { left: 1rem; top: 1.05rem; background: var(--accent-soft); color: var(--accent-ink); }

.note-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; }
.note { padding: 1.1rem 1.25rem; border-radius: var(--radius); }
.note-title { margin-bottom: .35rem; font-size: .9375rem; font-weight: 700; }
.note-difficulty { background: var(--amber-soft); }
.note-difficulty .note-title { color: var(--amber); }
.note-conflict { background: var(--blue-soft); }
.note-conflict .note-title { color: var(--blue); }

.boundary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.boundary-grid .sub { margin: 0; padding: 1rem 1.15rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line-strong); }
.boundary-grid .sub-title::before { display: none; }
.tone-must { border-top-color: var(--accent) !important; }
.tone-must .sub-title { color: var(--accent-ink); }
.tone-optional { border-top-color: #7ba3cc !important; }
.tone-optional .sub-title { color: var(--blue); }
.tone-out { border-top-color: #a3aaa6 !important; }
.tone-over { border-top-color: #d4a45a !important; }
.tone-over .sub-title { color: var(--amber); }
.boundary-grid .bullets { font-size: .9375rem; }

.levels { position: relative; }
.level { position: relative; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 1rem; padding-bottom: 1.25rem; }
.level:not(:last-child)::before { content: ""; position: absolute; left: 1.1rem; top: 2.3rem; bottom: .2rem; width: 2px; background: var(--line); }
.level-no { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-family: var(--font-num); font-weight: 700; }
.level:nth-child(2) .level-no { background: #d5e8de; }
.level:nth-child(3) .level-no { background: var(--accent); color: #fff; }
.level-name { display: flex; align-items: baseline; gap: .6rem; margin-top: .2rem; font-size: 1rem; font-weight: 700; }
.level-hint { color: var(--ink-3); font-size: .8125rem; font-weight: 500; }

.reps { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); overflow: hidden; }
.rep { padding: 1rem 1.15rem; background: var(--surface); }
.rep-label { margin-bottom: .25rem; color: var(--accent-ink); font-size: .875rem; font-weight: 700; }
.rep p { font-size: .9375rem; }
.topic-link { font-weight: 600; }

.fold { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.fold > summary { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; color: var(--ink-2); font-weight: 600; font-size: .9375rem; }
.fold > summary .icon-chev-down { margin-left: auto; transition: transform .2s var(--ease); }
.fold[open] > summary .icon-chev-down { transform: rotate(180deg); }
.fold > :not(summary) { padding: 0 1rem 1rem; }
.fold .bullets { padding: 0 1rem 1rem 1rem; font-size: .9375rem; }

/* ---------- misconceptions ---------- */
.misc-list { display: grid; gap: .5rem; }
.misc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.misc:hover { border-color: var(--line-strong); }
.misc[open] { box-shadow: var(--shadow); }
.misc-flat:hover { border-color: var(--line); }
.misc-flat .misc-summary { grid-template-columns: 2rem minmax(0, 1fr) auto; }
.misc-summary { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto auto; align-items: start; gap: .75rem; padding: .95rem 1.1rem; }
.misc-no { padding-top: .15rem; color: var(--ink-3); font-family: var(--font-num); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.misc-head { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.misc-quote { font-size: 1.0625rem; font-weight: 600; line-height: 1.6; quotes: "「" "」"; }
.misc-rule { color: var(--ink-3); font-size: .875rem; line-height: 1.6; }
.misc-summary > .icon-chev-down { margin-top: .3rem; color: var(--ink-3); transition: transform .2s var(--ease); }
.misc[open] > .misc-summary > .icon-chev-down { transform: rotate(180deg); }
.misc-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem 1.5rem; padding: .25rem 1.1rem 1.2rem 3.85rem; }
.misc-body .field + .field { margin-top: 0; }
.misc-body p { font-size: .9375rem; }
.no-match { padding: 2rem 0; text-align: center; }

/* ---------- basis ---------- */
.basis-head { display: grid; gap: .4rem; margin-bottom: 1.25rem; padding: 1rem 1.15rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.basis-codes { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.code { display: inline-block; padding: 0 .5rem; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); font-family: var(--font-num); font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.sources { display: grid; gap: .75rem; }
.source { padding: 1rem 1.15rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.source-quote { padding-left: .9rem; border-left: 3px solid #b9d6c9; color: var(--ink); font-size: 1rem; line-height: 1.75; }
.source-point, .source-note { margin-top: .5rem; color: var(--ink-2); font-size: .9375rem; }
.source-cite { margin-top: .5rem; color: var(--ink-3); font-size: .8125rem; }

/* ---------- experiments ---------- */
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1.25rem; align-items: start; }
.exp-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; scroll-margin-top: calc(var(--topbar-h) + 4.5rem); }
.exp-card:hover { border-color: var(--line-strong); }
.exp-thumb { display: block; padding: 0; border: 0; background: var(--sunken); aspect-ratio: 16 / 9; cursor: zoom-in; }
.exp-thumb:disabled { cursor: default; }
.exp-head { display: flex; flex-direction: column; gap: .45rem; padding: 1rem 1.15rem 1.1rem; flex: 1; }
.exp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.exp-no { color: var(--ink-3); font-family: var(--font-num); font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.exp-title { font-size: 1.0625rem; font-weight: 700; line-height: 1.5; }
.exp-goal { color: var(--ink-2); font-size: .9375rem; line-height: 1.65; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.exp-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .5rem; }
.exp-toggle .icon { transition: transform .2s var(--ease); }
.exp-card.is-open .exp-toggle .icon { transform: rotate(180deg); }

.exp-card.is-open { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(16rem, 26rem) minmax(0, 1fr); box-shadow: var(--shadow); }
.exp-card.is-open .exp-thumb { grid-column: 1; grid-row: 1; align-self: stretch; aspect-ratio: auto; min-height: 12rem; }
.exp-card.is-open .exp-thumb .media { height: 100%; }
.exp-card.is-open .exp-head { grid-column: 2; grid-row: 1; padding: 1.25rem 1.5rem; }
.exp-card.is-open .exp-title { font-size: 1.25rem; }
.exp-card.is-open .exp-goal { -webkit-line-clamp: unset; display: block; }
.exp-card.is-open .exp-detail { grid-column: 1 / -1; grid-row: 2; }
.exp-grid.is-reading { grid-template-columns: minmax(0, 1fr); max-width: 64rem; }
.exp-grid.is-reading .exp-card.is-open { grid-template-columns: minmax(12rem, 20rem) minmax(0, 1fr); }
.exp-grid.is-reading .exp-toggle { display: none; }

.exp-detail { padding: 1.5rem; border-top: 1px solid var(--line); }
.exp-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2rem 2.5rem; }
.exp-main > * + *, .exp-aside > * + * { margin-top: 1.35rem; }
.exp-sub-title { margin-bottom: .45rem; color: var(--ink-2); font-size: .9375rem; font-weight: 700; }
.exp-sub p, .exp-sub li { font-size: .9375rem; }
.exp-aside .exp-sub { padding-left: 1rem; border-left: 3px solid var(--line); }
.exp-aside .tone-boundary { border-left-color: #7ba3cc; }
.exp-aside .tone-avoid { border-left-color: #d4a45a; }
.equip { display: flex; flex-wrap: wrap; gap: .4rem; }
.equip > li { padding: .15rem .6rem !important; border-radius: 6px; background: var(--sunken); font-size: .875rem !important; line-height: 1.6; }
.equip > li::before { display: none; }
.equip > li + li { margin-top: 0 !important; }
.equip-list { display: grid; border-top: 1px solid var(--line); }
.equip-list > li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.equip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; }
.equip-name { font-weight: 600; font-size: .9375rem; }
.equip-qty { color: var(--ink-3); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.equip-spec { margin-top: .2rem; color: var(--ink-2); font-size: .875rem; line-height: 1.65; }
.vars { display: grid; gap: .35rem; }
.var-row { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: .75rem; font-size: .9375rem; }
.var-row dt { color: var(--ink-3); font-weight: 600; }
.flow > li { padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.flow > li:first-child { padding-top: 0; }
.flow-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.flow-meta { color: var(--ink-3); font-size: .8125rem; }
.flow-look { margin-top: .15rem; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th, .data-table td { padding: .5rem .65rem; border: 1px solid var(--line-strong); text-align: left; vertical-align: top; }
.data-table th { background: var(--sunken); font-weight: 600; }
.data-table td { height: 2.25rem; }
.callout { padding: .9rem 1rem; border-radius: var(--radius-sm); }
.callout-safety { background: var(--amber-soft); }
.callout-title { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; color: var(--amber); font-size: .9375rem; font-weight: 700; }
.level-pill { margin-left: auto; padding: 0 .5rem; border-radius: 999px; background: rgba(138, 90, 18, .12); font-size: .75rem; font-weight: 600; }
.callout p, .callout li { font-size: .9375rem; }
.callout .bullets > li::before { background: #d4a45a; }
.fold-trouble { margin-top: 1.75rem; }
.fold-trouble > summary > .icon-alert { color: var(--amber); }
.trouble { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: .75rem; padding: 0 1rem 1rem !important; }
.trouble > li { padding: .8rem .95rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; }
.trouble-symptom { margin-bottom: .3rem; font-weight: 600; }
.trouble p + p { margin-top: .2rem; color: var(--ink-2); }
.exp-source { margin-top: 1.25rem; color: var(--ink-3); font-size: .8125rem; }

/* ---------- media (video / sim / image) ---------- */
.media { position: relative; display: block; width: 100%; height: 100%; background: var(--sunken); overflow: hidden; }
.media img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.exp-thumb, .img-thumb, .media-cover, .row-thumb { overflow: hidden; }
.media.is-loaded img { opacity: 1; }
.media-ph { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .35rem; color: #98a19d; font-size: .8125rem; }
.media-ph .icon { font-size: 1.6rem; opacity: .7; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); gap: 1.25rem; align-items: start; }
.media-card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: box-shadow .2s, border-color .2s; scroll-margin-top: calc(var(--topbar-h) + 4.5rem); }
.media-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.media-cover { position: relative; display: block; aspect-ratio: 16 / 9; }
.cover-play { position: absolute; left: .7rem; bottom: .7rem; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: rgba(15, 20, 18, .62); color: #fff; font-size: .8rem; transition: transform .2s var(--ease), background .2s; }
.media-cover:hover .cover-play { transform: scale(1.08); background: var(--accent); }
.cover-time { position: absolute; right: .6rem; bottom: .6rem; padding: .05rem .45rem; border-radius: 5px; background: rgba(15, 20, 18, .72);
  color: #fff; font-family: var(--font-num); font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.media-body { display: flex; flex-direction: column; gap: .45rem; padding: .9rem 1rem .75rem; flex: 1; }
.media-source { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; color: var(--ink-3); font-size: .8125rem; line-height: 1.5; }
.platform { color: var(--ink-2); font-weight: 700; }
.media-title { font-size: 1rem; font-weight: 700; line-height: 1.5; }
.media-title a { color: var(--ink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.media-title a:hover { color: var(--accent); }
.media-use { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.media-desc { color: var(--ink-2); font-size: .875rem; line-height: 1.6; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card-tips { margin-top: auto; border-top: 1px dashed var(--line); }
.card-tips > summary { display: flex; align-items: center; gap: .4rem; padding-top: .55rem; color: var(--ink-3); font-size: .8125rem; font-weight: 600; }
.card-tips > summary:hover { color: var(--accent); }
.card-tips > summary .icon { margin-left: auto; transition: transform .2s var(--ease); }
.card-tips[open] > summary .icon { transform: rotate(180deg); }
.card-tips-body { padding-top: .6rem; }
.card-tips-body p { font-size: .875rem; line-height: 1.65; }
.card-tips-body .field + .field { margin-top: .6rem; }
.media-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .75rem .6rem 1rem; border-top: 1px solid var(--line); }
.link-out { display: inline-flex; align-items: center; gap: .3em; font-size: .875rem; font-weight: 600; min-width: 0; }
.link-out span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.basket-btn { display: inline-flex; align-items: center; gap: .35em; min-height: 2.125rem; padding: .25rem .7rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: .8125rem; font-weight: 600; white-space: nowrap; flex: none; }
.basket-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.basket-btn.is-on { background: var(--accent-soft); border-color: #b9d6c9; color: var(--accent-ink); }
.basket-btn.is-on .icon { --i: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"); }

.more { margin-top: 1.75rem; }
.more-toggle { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 3rem; padding: .6rem 1rem;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink-2); font-size: .9375rem; font-weight: 600; }
.more-toggle:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--surface); }
.more-toggle .icon { transition: transform .2s var(--ease); }
.more-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.more-panel { margin-top: 1.25rem; }
.rows { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: .75rem 1rem;
  content-visibility: auto; contain-intrinsic-size: auto 6rem; scroll-margin-top: calc(var(--topbar-h) + 4.5rem); }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: var(--surface-2); }
.row-thumb { display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; }
.row-main { min-width: 0; }
.row-title { color: var(--ink); font-weight: 600; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.row-title:hover { color: var(--accent); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin-top: .15rem; color: var(--ink-3); font-size: .8125rem; line-height: 1.5; }
.row-note { margin-top: .2rem; color: var(--ink-2); font-size: .8125rem; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 1.25rem; align-items: start; }
.img-card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; scroll-margin-top: calc(var(--topbar-h) + 4.5rem); }
.img-thumb { display: block; padding: 0; border: 0; aspect-ratio: 4 / 3; background: #f1f2ef; cursor: zoom-in; }
.img-thumb .media { background: #f1f2ef; }
.img-thumb .media img { object-fit: contain; padding: .5rem; }
.img-body { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .8rem .95rem .5rem; flex: 1; }
.img-title { font-size: .9375rem; font-weight: 700; line-height: 1.5; }
.img-desc { color: var(--ink-2); font-size: .8125rem; line-height: 1.6; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.credit { margin-top: auto; padding-top: .35rem; color: var(--ink-3); font-size: .75rem; line-height: 1.5; word-break: break-word; }
.credit-link { font-weight: 600; }
.img-foot { padding: 0 .95rem .85rem; }

/* ---------- diagnosis ---------- */
.diag-view { max-width: 52rem; }
.q-list { display: grid; gap: .75rem; }
.q { padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.q-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin-bottom: .5rem; }
.q-no { display: grid; place-items: center; min-width: 1.75rem; height: 1.75rem; padding: 0 .35rem; border-radius: 6px; background: var(--sunken); color: var(--ink-2); font-family: var(--font-num); font-size: .8125rem; font-weight: 700; }
.q-when { color: var(--ink-3); font-size: .8125rem; }
.q-prompt { font-size: 1.0625rem; font-weight: 600; line-height: 1.7; }
.options { display: grid; gap: .4rem; margin-top: .75rem; }
.option { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; align-items: start; gap: .6rem; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .9375rem; transition: background .2s, border-color .2s; }
.option-key { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--sunken); font-family: var(--font-num); font-size: .8125rem; font-weight: 700; }
.option-mark { color: var(--accent); padding-top: .15rem; }
.answer-only { display: none; }
.q.is-revealed .answer-only, .show-answers .answer-only { display: revert; }
.q.is-revealed .option.is-correct, .show-answers .option.is-correct { background: var(--accent-soft); border-color: #b9d6c9; }
.q.is-revealed .option.is-correct .option-key, .show-answers .option.is-correct .option-key { background: var(--accent); color: #fff; }
.q-extra { margin-top: .85rem; }
.q-reveal { margin-top: .85rem; }
.show-answers .q-reveal { display: none; }
.q-answer { margin-top: .85rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.q-answer p { font-size: .9375rem; }
.show-answers .q-answer.answer-only, .q.is-revealed .q-answer.answer-only { display: block; }
.distractors > li + li { margin-top: .5rem; }
.distractors > li { padding-left: .75rem; border-left: 2px solid #e2c8c5; }

/* ---------- locked / error panels ---------- */
.lock { max-width: 38rem; margin: 1rem auto 0; padding: 2.5rem clamp(1.25rem, 4vw, 2.75rem); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: center; box-shadow: var(--shadow); }
.lock-icon { display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; margin-bottom: 1rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 1.35rem; }
.lock h2 { font-size: 1.375rem; font-weight: 700; }
.lock-text { max-width: 30rem; margin: .6rem auto 0; color: var(--ink-2); line-height: 1.7; }
.lock-includes { margin-top: 1.4rem; }
.lock-includes-title, .lock-free-title { color: var(--ink-3); font-size: .8125rem; font-weight: 600; }
.lock-includes ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: .5rem; }
.lock-includes li { padding: .2rem .7rem; border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: .875rem; }
.lock-includes strong { margin-right: .15em; color: var(--ink); font-variant-numeric: tabular-nums; }
.lock-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.6rem; }
.lock-free { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); text-align: left; }
.lock-free ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .5rem; margin-top: .6rem; }
.lock-free a { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font-size: .9375rem; font-weight: 600; }
.lock-free a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.lock-free-book { flex: none; padding: 0 .4rem; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); font-size: .75rem; }
.lock-error .lock-icon { background: var(--slate-soft); color: var(--ink-3); }

.empty-state { display: grid; justify-items: center; gap: .5rem; max-width: 30rem; margin: 2rem auto; padding: 2.5rem 1.5rem; text-align: center; color: var(--ink-3); }
.empty-state > .icon { font-size: 2rem; color: #a7aeaa; }
.empty-title { color: var(--ink-2); font-weight: 700; }

.skeleton { display: grid; gap: 1rem; max-width: 48rem; padding-top: .5rem; }
.sk-line { height: 1.1rem; border-radius: 6px; background: linear-gradient(90deg, #eceee9 0%, #f6f7f4 50%, #eceee9 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.sk-line:first-child { height: 1.6rem; margin-bottom: .5rem; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.is-flash { animation: flash 1.8s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(31, 107, 87, .35); } 100% { box-shadow: 0 0 0 3px rgba(31, 107, 87, 0); } }

/* ---------- basket sheet ---------- */
.sheet { position: fixed; inset: 0 0 0 auto; width: min(28rem, 100vw); max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0;
  border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .28s var(--ease); }
.sheet::backdrop { background: rgba(18, 24, 21, .32); }
@keyframes sheet-in { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.25rem; font-weight: 700; }
.sheet-sub { margin-top: .15rem; color: var(--ink-3); font-size: .8125rem; }
.sheet-body { flex: 1; overflow-y: auto; padding: .5rem 1.25rem 1.5rem; }
.sheet-foot { display: flex; gap: .6rem; padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface-2); }
.sheet-foot .btn-primary { flex: 1; }
.basket-group { padding-top: 1.1rem; }
.basket-group h3 { margin-bottom: .4rem; color: var(--ink-2); font-size: .875rem; font-weight: 700; }
.basket-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: start; gap: .6rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.basket-item:first-child { border-top: 0; }
.basket-item .icon-btn { width: 2rem; height: 2rem; font-size: .9rem; }
.basket-item-main { min-width: 0; padding-top: .1rem; }
.basket-item-main .linklike { font-size: .9375rem; }
.basket-meta { display: block; color: var(--ink-3); font-size: .75rem; }
.kind-tag { margin-top: .2rem; padding: 0 .4rem; border-radius: 5px; font-size: .75rem; font-weight: 700; line-height: 1.6; background: var(--slate-soft); color: var(--ink-2); }
.kind-video { background: #fdeee8; color: #9a4526; }
.kind-sim { background: var(--blue-soft); color: var(--blue); }
.kind-exp { background: var(--accent-soft); color: var(--accent-ink); }
.kind-img { background: #f3edf8; color: #6a4388; }
.basket-export { width: 100%; margin-top: 1rem; padding: .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: .8125rem; line-height: 1.6; resize: vertical; }
.sheet .empty-state { margin-top: 3rem; }
.sheet .empty-state > .icon { font-size: 2.25rem; }

/* ---------- lightbox ---------- */
.lightbox { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: rgba(12, 15, 14, .94); color: #e8ece9; }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox::backdrop { background: rgba(12, 15, 14, .6); }
.lightbox-top { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; }
.lightbox-count { font-family: var(--font-num); font-size: .875rem; color: #b8c0bc; font-variant-numeric: tabular-nums; }
.lightbox-body { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem; align-items: center; min-height: 0; }
.lightbox-stage { display: grid; place-items: center; height: 100%; min-height: 0; padding: 0 .5rem; }
.lightbox-media { background: transparent; width: auto; height: auto; max-width: 100%; max-height: 100%; }
.lightbox-media img { position: static; max-width: 100%; max-height: calc(100vh - 11rem); width: auto; height: auto; object-fit: contain; border-radius: 6px; background: #fff; }
.lightbox-media .media-ph { position: static; color: #b8c0bc; padding: 3rem; }
.lightbox-nav { justify-self: center; font-size: 1.4rem; }
.lightbox-caption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .25rem 1rem; padding: 1rem 1.5rem calc(1.25rem + env(safe-area-inset-bottom)); text-align: center; font-size: .9375rem; }
.lightbox-caption .credit { margin: 0; padding: 0; color: #b8c0bc; font-size: .8125rem; }
.lightbox-caption a { color: #9fd6c0; }

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  :root { --sidebar-w: 16.5rem; }
  .back-link > span:not(.icon) { display: none; }
  .book-switch { margin-left: .5rem; }
  .exp-cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .drawer-btn { display: inline-grid; margin-left: -.35rem; }
  .focus-btn { display: none; }
  .topbar .book-switch { display: none; }
  .book-switch.is-block { display: flex; margin: .75rem 1rem 0; }
  .book-switch.is-block .book-tab { flex: 1; justify-content: center; }
  html[data-focus] .sidebar { display: block; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(21rem, 88vw); height: 100%; border-right: 0; box-shadow: var(--shadow-lg);
    transform: translateX(-102%); visibility: hidden; transition: transform .28s var(--ease), visibility 0s linear .28s; }
  .drawer-open .sidebar { transform: none; visibility: visible; transition: transform .28s var(--ease), visibility 0s; }
  .sidebar-mobile-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .6rem 0 1rem; }
  .sidebar-head { padding-top: .75rem; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(18, 24, 21, .35); opacity: 0; pointer-events: none; transition: opacity .28s; }
  .drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .drawer-open { overflow: hidden; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 3.5rem; }
  .topbar-inner { gap: .4rem; padding: 0 .75rem; }
  .brand-text span { display: none; }
  .brand-mark { width: 2rem; height: 2rem; font-size: .95rem; }
  .btn-basket { padding: .4rem .65rem; }
  .btn-basket-text { display: none; }
  .account { padding: .25rem .55rem; }
  .account .icon { display: none; }
  .main { padding: 1.25rem 1rem 2.5rem; }
  .tabbar-wrap { margin: 0 -1rem; padding: 0 .5rem; }
  .tab { padding: .8rem .6rem; }
  .tab[aria-current="page"]::after { left: .6rem; right: .6rem; }
  .content-wrap { padding-top: 1.25rem; }
  .block { padding-top: 1.75rem; }
  .block-title { font-size: 1.1875rem; }
  .toolbar { gap: .6rem; }
  .toolbar > .search-wrap { flex-basis: 100%; max-width: none; }
  .toolbar-end { margin-left: 0; width: 100%; justify-content: space-between; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .toolbar-end .chips { margin: 0; padding: 0; }
  .misc-summary { grid-template-columns: minmax(0, 1fr) auto; padding: .85rem .95rem; }
  .misc-no { display: none; }
  .misc-summary .tag { display: none; }
  .misc-body { padding: .25rem .95rem 1.1rem; }
  .exp-card.is-open, .exp-grid.is-reading .exp-card.is-open { display: flex; }
  .exp-card.is-open .exp-thumb { aspect-ratio: 16 / 9; min-height: 0; }
  .exp-card.is-open .exp-head { padding: 1rem 1.1rem; }
  .exp-detail { padding: 1.1rem; }
  .row { grid-template-columns: 6rem minmax(0, 1fr); gap: .75rem; padding: .7rem .8rem; }
  .row > .basket-btn { grid-column: 2; justify-self: start; }
  .card-grid { gap: 1rem; }
  .img-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .img-body { padding: .6rem .7rem .4rem; }
  .img-foot { padding: 0 .7rem .7rem; }
  .q { padding: 1rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
  .lock { padding: 2rem 1.1rem; }
  .lightbox-body { grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; }
  .sheet { width: 100vw; border-left: 0; }
}

@media (max-width: 380px) {
  .back-link { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .sidebar, .tabbar-wrap, .pager, .outline, .basket-btn, .more-toggle, .toolbar, .foot, .q-reveal { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .answer-only { display: block !important; }
}

@media (max-width: 420px) {
  .account-suffix { display: none; }
}
