/* MySQL 视频课对照笔记 · 手机优先阅读版式
   无 CDN / 无框架 / 无动画；正文字号 18px、行高 1.8、窄列。 */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --paper: #ffffff;
  --text: #1e2126;
  --muted: #5d646d;
  --line: #ddd8ce;
  --accent: #8a5a12;
  --accent-strong: #6d470e;
  --accent-soft: #f7efe0;
  --code-bg: #f3f0e8;
  --danger: #8a3a2f;
  --mark: #ffe8a3;
  --fs: 18px;
  --lh: 1.8;
  --radius: 6px;
  --col: 42rem;
}

:root[data-font="lg"] { --fs: 20px; --lh: 1.78; }
:root[data-font="xl"] { --fs: 22px; --lh: 1.74; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181b;
    --paper: #1c2024;
    --text: #e7e5df;
    --muted: #a9b0b8;
    --line: #343a40;
    --accent: #dcb178;
    --accent-strong: #f0c98f;
    --accent-soft: #2a2419;
    --code-bg: #22262b;
    --danger: #e0a094;
    --mark: #6b571f;
  }
}

:root[data-theme="dark"] {
  --bg: #15181b;
  --paper: #1c2024;
  --text: #e7e5df;
  --muted: #a9b0b8;
  --line: #343a40;
  --accent: #dcb178;
  --accent-strong: #f0c98f;
  --accent-soft: #2a2419;
  --code-bg: #22262b;
  --danger: #e0a094;
  --mark: #6b571f;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--fs);
  line-height: var(--lh);
}

p, li, td, th, summary, dd, dt { overflow-wrap: anywhere; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 14px;
  background: var(--paper);
  z-index: 50;
}
.skip:focus { left: 8px; }

.wrap {
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 18px 56px;
}

/* ---------- top bar ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  max-width: var(--col);
  margin: 0 auto;
  padding: 10px 18px 6px;
}
.bar-nav a { font-weight: 600; text-decoration: none; }
.bar-tools { display: flex; gap: 6px; }

.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.78em;
  line-height: 1.2;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent-strong); }

.js-only { display: none !important; }
html.js .js-only { display: inline-block !important; }

/* ---------- headings ---------- */
h1 {
  font-size: 1.5rem;
  line-height: 1.32;
  margin: 0.35em 0 0.25em;
  letter-spacing: 0.01em;
}
h2 {
  font-size: 1.16rem;
  line-height: 1.4;
  margin: 2.1em 0 0.55em;
  padding-bottom: 0.28em;
  border-bottom: 1px solid var(--line);
}
h3 {
  font-size: 1.02rem;
  line-height: 1.45;
  margin: 1.7em 0 0.45em;
}

.sub, .mut { color: var(--muted); }
.sub { margin: 0 0 1.4rem; }
.eyebrow {
  margin: 1.1rem 0 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.crumbs {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.crumbs a { text-decoration: none; }

.pnum {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-right: 0.35em;
}

/* ---------- fixture banner ---------- */
.fixture {
  max-width: var(--col);
  margin: 10px auto 0;
  padding: 10px 14px;
  border: 1px dashed var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* ---------- index ---------- */
.howto {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 14px;
  margin: 1.2rem 0 1.6rem;
}
.howto p { margin: 0.4em 0; }

.searchbar { margin: 1.2rem 0 0.4rem; }
.searchbar label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.searchrow { display: flex; gap: 8px; }
.searchrow input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
}
.searchmeta { min-height: 1.6em; font-size: 0.82rem; color: var(--muted); margin: 0.3rem 0 0; }

.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0.8rem 0 1.4rem;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--muted);
}

.groupmap {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--muted);
}
.groupmap a { text-decoration: none; color: var(--accent); }
.groupmap a:hover { text-decoration: underline; }

.group { margin: 1.6rem 0 0; }
.group h2 { margin-top: 1.4em; }
.group h2 a { text-decoration: none; }
.group h2 a:hover { text-decoration: underline; }
.count { font-size: 0.72em; font-weight: 400; }

.eplist { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.epitem {
  display: grid;
  grid-template-columns: 3.1rem 1fr auto;
  align-items: baseline;
  gap: 2px 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.epitem .pnum { margin: 0; }
.epitem a { color: var(--text); text-decoration: none; font-weight: 600; }
.epitem a:hover { color: var(--accent-strong); text-decoration: underline; }
.epsum {
  grid-column: 2 / -1;
  font-size: 0.8rem;
  line-height: 1.6;
  font-weight: 400;
}
.read {
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.epitem.is-read a { color: var(--muted); }
.empty {
  margin: 1.4rem 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- group page ---------- */
.grouptoc {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px 12px 30px;
  margin: 0 0 1.8rem;
  background: var(--paper);
  font-size: 0.86rem;
}
.grouptoc li { margin: 0.25em 0; }

.ep {
  padding-top: 0.4rem;
  margin-top: 2.2rem;
  border-top: 3px solid var(--accent-soft);
}
.ep h2 { border-bottom: 0; }
.videolink { font-size: 0.82rem; color: var(--muted); margin: 0.2rem 0 1.2rem; }

/* ---------- watch / reading ---------- */
.watch {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 1.4rem 0 0.6rem;
}
.watch h2 { margin: 0 0 0.4em; border: 0; font-size: 1.02rem; }
.watch p { margin: 0.45em 0; font-size: 0.9rem; }
.videobtn {
  display: inline-block;
  min-height: 40px;
  padding: 9px 12px;
  margin: 4px 0;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.intro { font-size: 0.92rem; color: var(--muted); margin: 1rem 0 0; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px 16px;
  margin: 1.4rem 0;
}
.panel > summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 32px;
  padding: 4px 0;
}
.panel > summary::marker { color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0.9rem 0 0.2rem; }
.chips a {
  display: inline-block;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  background: var(--bg);
}
.chips a:hover { border-color: var(--accent); }

.sec { scroll-margin-top: 12px; }
.sec h3 { color: var(--accent-strong); }
.sec p { margin: 0.5em 0; }

.big { font-size: 1.04em; font-weight: 600; line-height: 1.65; }

.steps { margin: 0.4rem 0 0; padding-left: 1.4em; }
.steps li { margin: 0.45em 0; }

.pitfalls { margin: 0.4rem 0 0; padding-left: 1.25em; }
.pitfalls li { margin: 0.4em 0; }
.pitfalls li::marker { color: var(--danger); }

.recap {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.94rem;
}

/* ---------- code ---------- */
.codeblock {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
  margin: 0.7rem 0 0.6rem;
}
.codebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
}
pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  tab-size: 2;
}
pre code { white-space: pre; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.06em 0.3em;
}
pre code { background: none; border: 0; padding: 0; }
.expl { font-size: 0.88rem; color: var(--muted); }
.prep { font-size: 0.86rem; color: var(--muted); margin: 0 0 0.55em; padding: 6px 9px; border-left: 2px solid var(--accent-soft); background: var(--accent-soft); border-radius: 0 4px 4px 0; }
.prep a { font-weight: 600; }
.prep.warn { border-left-color: var(--danger); }

/* ---------- quiz / sources ---------- */
.quiz {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}
.quiz > summary { cursor: pointer; min-height: 32px; }
.quiz > summary::marker { color: var(--accent); }
.quiz-a { padding: 6px 0 2px 1.1em; border-left: 2px solid var(--accent-soft); }
.quiz-a p { margin: 0.3em 0; }

.tablewrap { overflow-x: auto; max-width: 100%; margin: 0.6rem 0; }
table.src { border-collapse: collapse; width: 100%; font-size: 0.78rem; line-height: 1.55; }
table.src th, table.src td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.src th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.evidence-note { font-size: 0.84rem; color: var(--muted); }
.warn { color: var(--danger); }

/* ---------- footer / pager ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 2rem 0 0; }
.pager {
  margin: 2.2rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  line-height: 2;
}
.pager a { text-decoration: none; }
.pager a:hover { text-decoration: underline; }

.foot {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--muted);
}
.foot a { color: var(--muted); }
.foot p { margin: 0.45em 0; }

/* ---------- print ---------- */
@media print {
  :root { --bg: #fff; --paper: #fff; --text: #000; --muted: #333; --line: #999; --accent: #000; --accent-soft: #eee; --code-bg: #f4f4f4; }
  body { font-size: 11.5pt; line-height: 1.6; }
  .bar, .skip, .searchbar, .progress, .actions, .pager, .fixture, .js-only, .chips { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
  h1, h2, h3 { break-after: avoid; }
  section, details, .quiz, .codeblock { break-inside: avoid; }
  pre {
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #999;
    background: #f4f4f4;
    font-size: 9.5pt;
  }
  .panel { border: 1px solid #999; }
  details > summary { list-style: none; }
}

/* ---------- provenance / sampling / practice ---------- */
.attr {
  font-size: 0.84rem;
  line-height: 1.7;
  margin: 0.6em 0;
  padding-left: 0.7em;
  border-left: 3px solid var(--accent);
  color: var(--text);
}
.samplenote {
  margin: 1rem 0 0.4rem;
  padding: 0.6em 0.8em;
  border: 1px solid var(--line);
  border-left: 3px solid #b8860b;
  background: var(--accent-soft);
  font-size: 0.86rem;
  line-height: 1.7;
  border-radius: 4px;
}
.facts { margin-top: 0.8rem; font-size: 0.85rem; line-height: 1.75; }
.facts .factlist, .facts .lims { margin: 0.3em 0 0.6em; padding-left: 1.2em; }
.facts .factlist li, .facts .lims li { margin: 0.2em 0; }
.noexample {
  padding: 0.7em 0.9em;
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: var(--accent-soft);
  font-size: 0.9rem;
  line-height: 1.75;
}
.noexample p { margin: 0.25em 0; }
pre.lang-text, pre.lang-bash { font-family: inherit; }

/* ---------- 讲义锚点 / 跟播层 / 分题练习（handout-upgrade） ---------- */
.srcbar {
  margin: 0.5rem 0 0.2rem;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 4px 4px 0;
}
.srcbar .srcline { margin: 0; font-size: 0.9rem; line-height: 1.6; }
.srcbar .srcsub { margin: 0.15em 0 0; font-size: 0.78rem; }
.srcbar .srcdetail { margin-top: 0.45rem; font-size: 0.85rem; }
.srcbar .srcdetail p { margin: 0.35em 0; }

.watchline {
  margin: 0.8rem 0 0.2rem;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.watchline .videobtn { flex: 0 0 auto; }

.follow {
  margin: 1.6rem 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.follow h3 { margin: 0 0 0.3em; color: var(--accent-strong); }
.follow p { margin: 0.4em 0; }
.follow .follow-scene { font-weight: 600; }
.follow .follow-goal { font-size: 0.9rem; }
.follow .rule { font-size: 0.8rem; border-top: 1px dashed var(--line); padding-top: 0.5em; }
table.map { border-collapse: collapse; width: 100%; font-size: 0.8rem; line-height: 1.55; }
table.map th, table.map td {
  border: 1px solid var(--line);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}
table.map th { color: var(--muted); font-weight: 600; }

.points { margin: 0.4rem 0 0; padding-left: 1.3em; }
.points li { margin: 0.5em 0; }
.points li::marker { color: var(--accent); font-weight: 700; }

.related {
  margin: 1.2rem 0 0;
  font-size: 0.88rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.exercise {
  margin: 1.1rem 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.exercise .ex-goal { margin: 0 0 0.2em; font-weight: 600; }
.exercise .exnum {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
}
.exercise .ex-hint { margin: 0 0 0.3em; font-size: 0.82rem; }
.exercise .codeblock { margin: 0.5rem 0 0.2rem; }
.exercise-answer { margin: 0.5rem 0 0; font-size: 0.9rem; }
.exercise-answer > summary { cursor: pointer; min-height: 32px; color: var(--accent-strong); }
.exercise-answer p { margin: 0.3em 0; }

.extras { margin-top: 1rem; }
.extras .codeblock { margin-top: 0.6rem; }
.expected { font-size: 0.86rem; color: var(--muted); }
.quickref { margin-top: 0.8rem; font-size: 0.86rem; }
