/* ================= Tokens ================= */
:root {
  /* Anthropic-inspired warm palette */
  --bg: #F5F0E8;
  --bg-elevated: #FAF6EF;
  --paper: #FFFBF4;
  --ink: #1A1A1A;
  --ink-2: #2E2A26;
  --muted: #6B6156;
  --muted-2: #8A7F72;
  --rule: #E3D9C9;
  --rule-strong: #C9BCA6;
  --terracotta: #C85A3E;
  --terracotta-deep: #A8432B;
  --clay: #D97757;
  --cream: #F0E6D2;
  --ochre: #C89B3C;
  --forest: #3E5C3A;
  --code-bg: #2A2620;
  --code-ink: #EFE6D2;
  --highlight: #FBE9A7;

  --serif: "EB Garamond", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter Tight", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --jp-serif: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  --shadow-soft: 0 1px 2px rgba(42,30,10,.04), 0 8px 32px -16px rgba(42,30,10,.12);
  --shadow-card: 0 2px 4px rgba(42,30,10,.06), 0 20px 48px -24px rgba(42,30,10,.18);

  --max-w: 760px;
  --wide-w: 1180px;
}

[data-theme="dark"] {
  --bg: #17140F;
  --bg-elevated: #1E1A14;
  --paper: #221D16;
  --ink: #F3ECDE;
  --ink-2: #E6DDC9;
  --muted: #A89A85;
  --muted-2: #867967;
  --rule: #2E2820;
  --rule-strong: #423A2D;
  --terracotta: #E07A5F;
  --terracotta-deep: #C85A3E;
  --clay: #E89277;
  --cream: #2A241B;
  --ochre: #D4A544;
  --forest: #6B8C5E;
  --code-bg: #0F0D09;
  --code-ink: #E6DDC9;
  --highlight: #4A3E1A;
  --shadow-soft: 0 1px 2px rgba(0,0,0,.3), 0 8px 32px -16px rgba(0,0,0,.5);
  --shadow-card: 0 2px 4px rgba(0,0,0,.4), 0 20px 48px -24px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt" 1;
  transition: background .3s ease, color .3s ease;
}

::selection { background: var(--terracotta); color: #FFFBF4; }

a { color: var(--terracotta-deep); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s ease; }
a:hover { border-bottom-color: currentColor; }

/* ================= Typography ================= */
h1, h2, h3, h4 {
  font-family: var(--jp-serif);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-wrap: pretty;
  line-height: 1.25;
}
h1 { font-size: clamp(40px, 6vw, 72px); line-height: 1.05; letter-spacing: -0.025em; font-weight: 500; }
h2 { font-size: clamp(28px, 3.2vw, 38px); margin: 0 0 24px; letter-spacing: -0.015em; }
h3 { font-size: 22px; margin: 40px 0 12px; }
h4 { font-size: 17px; margin: 28px 0 8px; font-weight: 700; }

p { margin: 0 0 20px; color: var(--ink-2); }
p.lead { font-size: 21px; line-height: 1.55; color: var(--ink); font-family: var(--jp-serif); font-weight: 400; }

em { font-style: italic; color: var(--terracotta-deep); font-weight: 500; }
strong { color: var(--ink); font-weight: 700; background: linear-gradient(transparent 65%, var(--highlight) 65%); padding: 0 2px; }

code { font-family: var(--mono); font-size: .88em; background: var(--cream); color: var(--terracotta-deep); padding: 2px 6px; border-radius: var(--radius-sm); border: 1px solid var(--rule); }

blockquote {
  margin: 32px 0;
  padding: 4px 0 4px 28px;
  border-left: 3px solid var(--terracotta);
  font-family: var(--jp-serif);
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink);
  font-style: italic;
}
blockquote cite { display: block; margin-top: 12px; font-size: 14px; font-style: normal; color: var(--muted); font-family: var(--sans); }
blockquote cite::before { content: "— "; }

ul, ol { margin: 0 0 24px; padding-left: 22px; color: var(--ink-2); }
li { margin-bottom: 8px; }
li::marker { color: var(--terracotta); }

hr { border: none; border-top: 1px solid var(--rule); margin: 56px 0; }
hr.ornament { display: flex; justify-content: center; align-items: center; border: none; margin: 64px 0; }
hr.ornament::before { content: "◆ ◆ ◆"; color: var(--rule-strong); letter-spacing: 16px; font-size: 12px; }

/* ================= Layout ================= */
.page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0 32px;
  gap: 64px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 48px 0;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  font-size: 14px;
}

.sidebar .brand { font-family: var(--jp-serif); font-weight: 500; font-size: 16px; color: var(--ink); margin-bottom: 4px; letter-spacing: -0.01em; }
.sidebar .brand-sub { font-size: 12px; color: var(--muted); margin-bottom: 32px; letter-spacing: 0.05em; text-transform: uppercase; }

.toc { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 7px 12px 7px 16px;
  color: var(--muted);
  border-left: 2px solid transparent;
  border-bottom: none;
  font-size: 13.5px;
  line-height: 1.4;
  transition: color .15s, border-color .15s, background .15s;
}
.toc a:hover { color: var(--ink); border-left-color: var(--rule-strong); }
.toc a.active { color: var(--terracotta-deep); border-left-color: var(--terracotta); font-weight: 600; background: var(--bg-elevated); }
.toc .toc-num { color: var(--muted-2); font-family: var(--mono); font-size: 11px; margin-right: 8px; }
.toc .toc-sub { padding-left: 32px; font-size: 12.5px; }

.content { padding: 48px 0 120px; min-width: 0; }
.prose { max-width: var(--max-w); }
.prose-wide { max-width: 100%; }

/* ================= Header ================= */
.doc-header {
  padding: 80px 0 56px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--terracotta-deep);
  font-weight: 600;
  margin-bottom: 28px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--terracotta);
}
.doc-header h1 { margin: 0 0 24px; }
.doc-header .subtitle { font-family: var(--jp-serif); font-size: 22px; color: var(--muted); max-width: 640px; line-height: 1.5; font-style: italic; }
.doc-meta {
  display: flex;
  gap: 32px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.doc-meta .meta-item { display: flex; flex-direction: column; gap: 2px; }
.doc-meta .meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted-2); }
.doc-meta .meta-value { color: var(--ink-2); font-weight: 500; }

/* ================= Sections ================= */
.chapter { padding: 72px 0 16px; scroll-margin-top: 24px; }
.chapter-header { margin-bottom: 40px; }
.chapter-num { font-family: var(--mono); font-size: 12px; color: var(--terracotta); letter-spacing: 0.15em; margin-bottom: 12px; display: block; }

/* ================= Components ================= */
.callout {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--terracotta);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 28px 0;
  font-size: 15.5px;
  line-height: 1.6;
}
.callout .callout-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--terracotta-deep);
  margin-bottom: 8px;
}
.callout p:last-child { margin-bottom: 0; }
.callout.tip { border-left-color: var(--forest); }
.callout.tip .callout-label { color: var(--forest); }
.callout.warn { border-left-color: var(--ochre); }
.callout.warn .callout-label { color: var(--ochre); }

/* Definition for beginners */
.def {
  display: inline-block;
  background: var(--cream);
  color: var(--terracotta-deep);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.92em;
  border-bottom: 1px dotted var(--terracotta);
  cursor: help;
}

/* Pullquote */
.pullquote {
  margin: 48px 0;
  padding: 40px 48px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  font-family: var(--jp-serif);
  font-size: 26px;
  line-height: 1.5;
  color: var(--ink);
  position: relative;
  text-align: center;
  font-weight: 500;
}
.pullquote::before {
  content: "\201C";
  position: absolute;
  top: 8px;
  left: 20px;
  font-size: 80px;
  color: var(--terracotta);
  line-height: 1;
  font-family: Georgia, serif;
  opacity: .5;
}
.pullquote .pullquote-attr {
  display: block;
  margin-top: 20px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  font-style: normal;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Terminal */
.terminal {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  margin: 24px 0;
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
}
.terminal .term-header {
  display: flex;
  gap: 6px;
  margin: -4px -8px 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  align-items: center;
}
.terminal .term-dot { width: 10px; height: 10px; border-radius: 50%; background: #444039; }
.terminal .term-dot.red { background: #E07A5F; }
.terminal .term-dot.yellow { background: #E3B13C; }
.terminal .term-dot.green { background: #7FA968; }
.terminal .term-title { margin-left: 8px; font-size: 11px; color: rgba(239,230,210,.5); letter-spacing: 0.1em; }
.terminal .prompt { color: var(--clay); }
.terminal .comment { color: rgba(239,230,210,.45); font-style: italic; }
.terminal .output { color: rgba(239,230,210,.75); }
.terminal .hl { color: #E3B13C; }
.terminal .ok { color: #7FA968; }

/* Checklist */
.checklist {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin: 32px 0;
  box-shadow: var(--shadow-soft);
}
.checklist h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.checklist h3::before {
  content: "";
  width: 24px; height: 24px;
  background: var(--terracotta);
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'><path d='M9 12l2 2 4-4'/><path d='M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/></svg>") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'><path d='M9 12l2 2 4-4'/><path d='M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/></svg>") center/contain no-repeat;
}
.checklist-group { margin: 24px 0; }
.checklist-group:last-child { margin-bottom: 0; }
.checklist-group-title {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--terracotta-deep);
  font-weight: 700;
  margin-bottom: 12px;
}
.check-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
}
.check-item:last-child { border-bottom: none; }
.check-item .box {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 5px;
  margin-top: 2px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s ease;
}
.check-item input { display: none; }
.check-item input:checked + .box {
  background: var(--terracotta);
  border-color: var(--terracotta);
}
.check-item input:checked + .box::after {
  content: "";
  width: 11px; height: 11px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/contain no-repeat;
}
.check-item .text { font-size: 15px; color: var(--ink-2); line-height: 1.55; }
.check-item input:checked ~ .text { color: var(--muted); text-decoration: line-through; }
.check-item .text strong { background: transparent; color: var(--ink); }

/* Feature grid */
.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.feat-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform .2s, box-shadow .2s;
}
.feat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.feat-card .feat-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--terracotta);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}
.feat-card h4 { margin: 0 0 8px; font-family: var(--jp-serif); font-size: 18px; font-weight: 600; }
.feat-card p { font-size: 14px; line-height: 1.55; color: var(--muted); margin: 0; }

/* Diagram container */
.diagram {
  margin: 32px 0;
  padding: 32px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  position: relative;
}
.diagram .diagram-caption {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  margin-top: 16px;
  font-style: italic;
  font-family: var(--jp-serif);
}

/* Q&A */
.qa {
  margin: 16px 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.qa summary {
  padding: 18px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  list-style: none;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  color: var(--ink);
  transition: background .15s;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary:hover { background: var(--bg-elevated); }
.qa summary::before {
  content: "Q";
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--terracotta);
  color: #FFFBF4;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--jp-serif);
  font-size: 14px;
  font-weight: 700;
  margin-top: -1px;
}
.qa summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
  transition: transform .2s;
}
.qa[open] summary::after { transform: rotate(45deg); }
.qa .qa-body {
  padding: 0 24px 22px 64px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.7;
  border-top: 1px dashed var(--rule);
  padding-top: 18px;
  margin: 0 24px 0 24px;
}
.qa .qa-body p:first-child { margin-top: 6px; }
.qa .qa-body p:last-child { margin-bottom: 0; }

/* Step list for Use Cases */
.steps { counter-reset: step; margin: 32px 0; padding: 0; list-style: none; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 24px 0 24px 72px;
  border-bottom: 1px solid var(--rule);
}
.steps > li:last-child { border-bottom: none; }
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--terracotta);
  letter-spacing: 0.1em;
  font-weight: 600;
}
.steps > li::after {
  content: "";
  position: absolute;
  left: 40px; top: 32px;
  width: 20px; height: 1px;
  background: var(--terracotta);
  opacity: .4;
}
.steps li h4 { margin: 0 0 8px; font-size: 18px; }
.steps li p { font-size: 15px; color: var(--muted); margin: 0; }

/* Theme toggle (Tweaks) */
.tweaks-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 6px;
  display: none;
  gap: 4px;
  box-shadow: var(--shadow-card);
  z-index: 100;
  font-size: 12px;
}
.tweaks-panel.active { display: inline-flex; }
.tweaks-panel button {
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.tweaks-panel button:hover { color: var(--ink); }
.tweaks-panel button.active {
  background: var(--terracotta);
  color: #FFFBF4;
}

/* Final credit */
.doc-footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.doc-footer .mark {
  font-family: var(--jp-serif);
  color: var(--terracotta);
  font-size: 20px;
  margin-bottom: 12px;
}

/* Visually show progress on top */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--terracotta);
  width: 0;
  z-index: 1000;
  transition: width .1s linear;
}

/* ================= Responsive ================= */

/* ensure code blocks never overflow on narrow screens */
pre { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

/* 860px — tablet landscape, laptop narrow */
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; padding: 0 20px; gap: 0; }
  .sidebar { display: none; }
  .content { padding: 24px 0 80px; }
  .doc-header { padding: 48px 0 32px; margin-bottom: 40px; }
  .doc-header .subtitle { font-size: 19px; }
  .doc-meta { gap: 20px 28px; }
  .chapter { padding: 56px 0 12px; }
  .chapter-header { margin-bottom: 28px; }
  h3 { font-size: 20px; margin: 32px 0 10px; }
  p.lead { font-size: 19px; }
  blockquote { font-size: 20px; padding-left: 22px; margin: 28px 0; }
  .pullquote { padding: 28px 24px; font-size: 20px; margin: 32px 0; }
  .pullquote::before { font-size: 60px; top: 6px; left: 14px; }
  .callout { padding: 18px 20px; font-size: 15px; }
  .terminal { padding: 16px 18px; font-size: 13px; }
  .checklist { padding: 24px 22px; }
  .feat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .steps > li { padding: 20px 0 20px 58px; }
  .qa .qa-body { padding-left: 46px; margin-left: 16px; margin-right: 16px; }
  .qa summary { padding: 16px 18px; font-size: 15.5px; gap: 12px; }
}

/* 640px — tablet portrait / large phone */
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.72; }
  .page { padding: 0 16px; }
  .content { padding: 16px 0 72px; }
  .doc-header { padding: 32px 0 24px; margin-bottom: 32px; }
  .doc-header .subtitle { font-size: 17px; line-height: 1.55; }
  .doc-meta { gap: 14px 24px; margin-top: 28px; padding-top: 18px; }
  .doc-meta .meta-item { flex: 1 1 130px; }
  .eyebrow { font-size: 11px; margin-bottom: 20px; letter-spacing: 0.12em; }
  .eyebrow::before { width: 20px; }
  .chapter { padding: 48px 0 8px; }
  .chapter-header { margin-bottom: 24px; }
  .chapter-num { font-size: 11px; margin-bottom: 8px; }
  h2 { margin-bottom: 18px; }
  h3 { font-size: 19px; margin: 28px 0 10px; }
  h4 { font-size: 16px; margin: 22px 0 6px; }
  p { margin: 0 0 16px; }
  p.lead { font-size: 17.5px; }
  blockquote { font-size: 18px; padding: 2px 0 2px 18px; border-left-width: 3px; margin: 24px 0; }
  blockquote cite { font-size: 13px; margin-top: 8px; }
  .pullquote { padding: 30px 22px 24px; font-size: 18px; margin: 28px 0; border-radius: var(--radius); }
  .pullquote::before { font-size: 52px; top: 0; left: 10px; }
  .pullquote .pullquote-attr { font-size: 11.5px; margin-top: 14px; }
  .callout { padding: 16px 18px; font-size: 14.5px; margin: 22px 0; }
  .callout .callout-label { font-size: 10.5px; }
  .terminal { padding: 14px 16px; font-size: 12.5px; line-height: 1.65; border-radius: var(--radius-sm); }
  .terminal .term-title { display: none; }
  .feat-grid { grid-template-columns: 1fr; gap: 12px; margin: 24px 0; }
  .feat-card { padding: 20px 18px; }
  .feat-card h4 { font-size: 17px; }
  .feat-card p { font-size: 13.5px; }
  .diagram { padding: 18px 12px; margin: 24px 0; }
  .diagram .diagram-caption { font-size: 12px; margin-top: 12px; }
  /* チェックリスト：タップしやすく、縦ゆったり */
  .checklist { padding: 20px 18px; margin: 24px 0; border-radius: var(--radius); }
  .checklist h3 { font-size: 17px; }
  .checklist h3::before { width: 20px; height: 20px; }
  .checklist-group { margin: 20px 0; }
  .checklist-group-title { font-size: 10.5px; margin-bottom: 10px; }
  .check-item { padding: 14px 0; gap: 10px; min-height: 48px; }
  .check-item .box { width: 22px; height: 22px; margin-top: 3px; }
  .check-item .text { font-size: 14.5px; line-height: 1.55; }
  /* 箇条書き：左インデント削減 */
  ul, ol { padding-left: 20px; }
  .steps > li { padding: 18px 0 18px 42px; }
  .steps > li::before { font-size: 12px; top: 20px; }
  .steps > li::after { left: 22px; top: 28px; width: 12px; }
  .steps li h4 { font-size: 16.5px; }
  .steps li p { font-size: 14px; }
  /* Q&A: Q アイコン小さく、左余白削減 */
  .qa summary { padding: 14px 16px; font-size: 15px; gap: 10px; }
  .qa summary::before { width: 22px; height: 22px; font-size: 12px; }
  .qa summary::after { font-size: 20px; }
  .qa .qa-body { padding: 14px 16px 18px; margin: 0; font-size: 14.5px; border-top: 1px dashed var(--rule); }
  /* 図表内のSVGは幅いっぱいに */
  .diagram svg { max-width: 100%; height: auto; }
  /* 区切り線・飾り */
  hr { margin: 40px 0; }
  hr.ornament { margin: 40px 0; }
  hr.ornament::before { letter-spacing: 10px; }
  /* フッター */
  .doc-footer { margin-top: 56px; padding: 28px 0; font-size: 12.5px; }
  /* テーマトグルはジャマなので少し引っ込める */
  .tweaks-panel { bottom: 16px; right: 16px; padding: 4px; }
  .tweaks-panel button { padding: 6px 10px; font-size: 11px; }
}

/* 480px — small phone */
@media (max-width: 480px) {
  body { font-size: 15.5px; }
  .page { padding: 0 14px; }
  .doc-header { padding: 24px 0 18px; margin-bottom: 24px; }
  .doc-header .subtitle { font-size: 16px; }
  .doc-meta { font-size: 12px; gap: 12px 20px; }
  h3 { font-size: 18px; }
  h4 { font-size: 15.5px; }
  p.lead { font-size: 16.5px; }
  blockquote { font-size: 17px; padding-left: 14px; }
  .pullquote { padding: 26px 16px 20px; font-size: 16.5px; }
  .pullquote::before { font-size: 44px; }
  .callout { padding: 14px 16px; font-size: 14px; }
  .terminal { padding: 12px 14px; font-size: 12px; }
  .feat-card { padding: 18px 16px; }
  .checklist { padding: 18px 14px; }
  .check-item .text { font-size: 14px; }
  .steps > li { padding: 16px 0 16px 36px; }
  .qa summary { padding: 12px 14px; font-size: 14.5px; }
  .qa .qa-body { padding: 12px 14px 16px; font-size: 14px; }
}
