/* 情報工学徹底攻略 — 共通スタイル */

:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #ebeff3;
  --surface-3: #e0e6ed;
  --ink: #16202b;
  --ink-2: #344150;
  --muted: #5b6877;
  --rule: #d3dae2;
  --rule-strong: #a9b5c2;
  --accent: #274b8f;
  --accent-hover: #1b3870;
  --accent-soft: #e4eaf6;
  --on-accent: #ffffff;

  --env-ubuntu: #7b2d6f;
  --env-ssh: #5e3f9e;
  --env-win: #0f63b0;
  --env-proxmox: #a04f00;
  --env-browser: #2f6b55;
  --env-file: #4a5a68;
  --env-out: #4a5a68;
  --env-ubuntu-soft: #f5e9f2;
  --env-ssh-soft: #efeaf9;
  --env-win-soft: #e4effa;
  --env-proxmox-soft: #f9eee2;
  --env-browser-soft: #e4f1eb;
  --env-file-soft: #e9edf1;
  --env-out-soft: #e9edf1;

  --tip: #1f6a4a;
  --tip-soft: #e3f1ea;
  --warn: #a3301d;
  --warn-soft: #f8e8e4;
  --gap: #7d5a00;
  --gap-soft: #f6efd9;
  --note: #274b8f;
  --note-soft: #e4eaf6;

  --code-bg: #111821;
  --code-head: #19222d;
  --code-ink: #e2e8ef;
  --code-muted: #95a3b3;
  --code-rule: #2a3542;
  --envd-ubuntu: #eaa9dc;
  --envd-ssh: #c6b3f3;
  --envd-win: #82c0f6;
  --envd-proxmox: #f6b56f;
  --envd-browser: #92d5b6;
  --envd-file: #bac6d2;
  --envd-out: #bac6d2;

  --ph-bg: #fff1bf;
  --ph-ink: #4f3b00;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.05), 0 6px 18px rgba(22, 32, 43, 0.06);

  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-display: "IBM Plex Sans JP", "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "BIZ UDGothic", Consolas, Menlo, "Courier New", monospace;
  /* レポートの見本（明朝体）。BIZ UDPMincho は report.html だけが読み込む */
  --font-report: "BIZ UDPMincho", "Yu Mincho", "Hiragino Mincho ProN", "Times New Roman", serif;

  --radius: 10px;
  --topbar-h: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10151b;
    --surface: #171f28;
    --surface-2: #1e2732;
    --surface-3: #27323f;
    --ink: #e3e8ee;
    --ink-2: #c4cdd7;
    --muted: #97a4b2;
    --rule: #2b3643;
    --rule-strong: #465465;
    --accent: #9fb6ee;
    --accent-hover: #bfd0f6;
    --accent-soft: #1d2940;
    --on-accent: #0f1620;
    --env-ubuntu: #e3a0d4;
    --env-ssh: #c0aaf0;
    --env-win: #7cbaf2;
    --env-proxmox: #f0ac66;
    --env-browser: #8acfae;
    --env-file: #b3bfcb;
    --env-out: #b3bfcb;
    --env-ubuntu-soft: #2b1c29;
    --env-ssh-soft: #241f36;
    --env-win-soft: #152636;
    --env-proxmox-soft: #2e2217;
    --env-browser-soft: #16271f;
    --env-file-soft: #1e2732;
    --env-out-soft: #1e2732;
    --tip: #7fd0a8;
    --tip-soft: #15261e;
    --warn: #f09a88;
    --warn-soft: #2e1b17;
    --gap: #e4c46d;
    --gap-soft: #2a2414;
    --note: #9fb6ee;
    --note-soft: #1d2940;
    --code-bg: #0b1016;
    --code-head: #131b24;
    --code-rule: #232e3a;
    --ph-bg: #3a3012;
    --ph-ink: #ffe28a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #10151b;
  --surface: #171f28;
  --surface-2: #1e2732;
  --surface-3: #27323f;
  --ink: #e3e8ee;
  --ink-2: #c4cdd7;
  --muted: #97a4b2;
  --rule: #2b3643;
  --rule-strong: #465465;
  --accent: #9fb6ee;
  --accent-hover: #bfd0f6;
  --accent-soft: #1d2940;
  --on-accent: #0f1620;
  --env-ubuntu: #e3a0d4;
  --env-ssh: #c0aaf0;
  --env-win: #7cbaf2;
  --env-proxmox: #f0ac66;
  --env-browser: #8acfae;
  --env-file: #b3bfcb;
  --env-out: #b3bfcb;
  --env-ubuntu-soft: #2b1c29;
  --env-ssh-soft: #241f36;
  --env-win-soft: #152636;
  --env-proxmox-soft: #2e2217;
  --env-browser-soft: #16271f;
  --env-file-soft: #1e2732;
  --env-out-soft: #1e2732;
  --tip: #7fd0a8;
  --tip-soft: #15261e;
  --warn: #f09a88;
  --warn-soft: #2e1b17;
  --gap: #e4c46d;
  --gap-soft: #2a2414;
  --note: #9fb6ee;
  --note-soft: #1d2940;
  --code-bg: #0b1016;
  --code-head: #131b24;
  --code-rule: #232e3a;
  --ph-bg: #3a3012;
  --ph-ink: #ffe28a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  font-feature-settings: "palt" 0;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 6px;
}
.skip:focus { top: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding-inline: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark {
  align-self: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 13px; line-height: 1;
  color: var(--on-accent); background: var(--accent);
  padding: 6px 7px; border-radius: 6px;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: 0.04em; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.me-chip, .theme-btn, .menu-btn {
  font: inherit; font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.me-chip:hover, .theme-btn:hover, .menu-btn:hover { border-color: var(--rule-strong); background: var(--surface-2); }
.me-label { color: var(--muted); }
.me-value { font-family: var(--font-mono); font-size: 12.5px; }
.me-chip.is-set .me-value { color: var(--accent); font-weight: 600; }
.menu-btn { display: none; border-radius: 8px; padding: 0 10px; }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -5px; }
.menu-icon::after { top: 5px; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}
.sidenav {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  align-self: start;
  height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 24px 16px 32px 20px;
  border-right: 1px solid var(--rule);
  background: var(--bg);
}
.nav-group + .nav-group { margin-top: 20px; }
.nav-group-title {
  margin: 0 0 6px 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted);
}
.sidenav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidenav a {
  display: block; padding: 6px 10px; border-radius: 7px;
  color: var(--ink-2); text-decoration: none; font-size: 14.5px; line-height: 1.5;
}
.sidenav a:hover { background: var(--surface-2); color: var(--ink); }
.sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-foot { margin: 28px 8px 0; font-size: 12.5px; line-height: 1.9; color: var(--muted); }
.nav-foot a { color: var(--muted); }

.main { min-width: 0; padding-inline: 40px; padding-block: 40px 56px; }
.page { max-width: 47rem; margin-inline: auto; }

@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidenav {
    position: fixed; z-index: 60; left: 0;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    width: min(320px, 86vw);
    height: calc(100% - var(--topbar-h) - env(safe-area-inset-top, 0px));
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
  body.nav-open .sidenav { transform: none; }
  .nav-scrim {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(10, 15, 20, 0.35);
  }
  .main { padding-inline: 20px; padding-block: 28px 48px; }
}
@media (max-width: 640px) {
  .brand-sub { display: none; }
  .main { padding-inline: 16px; }
  .menu-label { display: none; }
  .me-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidenav { transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- page head ---------- */
.page-head { margin-bottom: 28px; }
.kicker {
  display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 12px;
  font-size: 13px; line-height: 1.5; color: var(--muted);
}
.kicker span {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--rule);
}
.kicker .kicker-file { font-family: var(--font-mono); font-size: 12px; }
h1, h2, h3, h4 { text-wrap: balance; }
.page-head h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(28px, 4.6vw, 40px); line-height: 1.35; letter-spacing: 0.03em;
}
.lead { margin: 16px 0 0; font-size: 17.5px; line-height: 1.9; color: var(--ink-2); }

/* ---------- toc ---------- */
.toc {
  margin: 0 0 36px; padding: 16px 20px 14px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.toc-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.4em; columns: 2 18rem; column-gap: 28px; font-size: 14.5px; line-height: 1.75; }
.toc li { break-inside: avoid; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- content typography ---------- */
.content > :first-child { margin-top: 0; }
.content h2 {
  margin: 56px 0 16px; padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display); font-weight: 700;
  font-size: 25px; line-height: 1.45; letter-spacing: 0.03em;
}
.content h3 { margin: 36px 0 10px; font-size: 19px; line-height: 1.5; font-weight: 700; }
.content h4 { margin: 24px 0 6px; font-size: 16.5px; line-height: 1.6; font-weight: 700; color: var(--ink-2); }
.content p { margin: 0 0 14px; }
.content ul, .content ol { margin: 0 0 16px; padding-left: 1.5em; }
.content li { margin: 3px 0; }
.content li > ul, .content li > ol { margin: 4px 0 6px; }
.content strong { font-weight: 700; }
.content hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--surface-2); color: var(--ink);
  padding: 0.12em 0.4em; border-radius: 5px; border: 1px solid var(--rule);
  overflow-wrap: anywhere;
}
kbd {
  font-family: var(--font-mono); font-size: 0.82em; white-space: nowrap;
  padding: 0.08em 0.45em; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-bottom-width: 2px;
}

a.term { color: inherit; text-decoration: underline dotted var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 0.25em; }
a.term:hover { color: var(--accent); }
a.xref { font-weight: 700; text-decoration: none; }

/* placeholders personalised by settings */
.ph { border-radius: 3px; }
.ph.is-set { background: var(--ph-bg); color: var(--ph-ink); padding: 0 2px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ph-ink) 25%, transparent); }
pre .ph.is-set { background: rgba(255, 214, 102, 0.18); color: #ffe08a; box-shadow: none; }

/* ---------- env badges ---------- */
.env-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 9px 1px 7px; border-radius: 6px;
  font-size: 12.5px; font-weight: 700; line-height: 1.7; white-space: nowrap;
  vertical-align: 0.08em;
  border: 1px solid currentColor;
}
.env-badge::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.env-badge.env-ubuntu { color: var(--env-ubuntu); background: var(--env-ubuntu-soft); }
.env-badge.env-ssh { color: var(--env-ssh); background: var(--env-ssh-soft); }
.env-badge.env-win { color: var(--env-win); background: var(--env-win-soft); }
.env-badge.env-proxmox { color: var(--env-proxmox); background: var(--env-proxmox-soft); }
.env-badge.env-browser { color: var(--env-browser); background: var(--env-browser-soft); }
.env-badge.env-file { color: var(--env-file); background: var(--env-file-soft); }
.env-badge.env-out { color: var(--env-out); background: var(--env-out-soft); }

/* ---------- code blocks ---------- */
.code {
  margin: 12px 0 18px;
  background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--code-rule);
  border-left: 4px solid var(--envd-out);
}
.code.env-ubuntu { border-left-color: var(--envd-ubuntu); }
.code.env-ssh { border-left-color: var(--envd-ssh); }
.code.env-win { border-left-color: var(--envd-win); }
.code.env-proxmox { border-left-color: var(--envd-proxmox); }
.code.env-browser { border-left-color: var(--envd-browser); }
.code.env-file { border-left-color: var(--envd-file); background: color-mix(in srgb, var(--code-bg) 88%, #3a4a5a); }
.code-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  padding: 7px 10px 7px 14px;
  background: var(--code-head); border-bottom: 1px solid var(--code-rule);
  font-size: 12.5px; line-height: 1.5;
}
.env-tag { font-weight: 700; color: var(--envd-out); }
.env-ubuntu .env-tag { color: var(--envd-ubuntu); }
.env-ssh .env-tag { color: var(--envd-ssh); }
.env-win .env-tag { color: var(--envd-win); }
.env-proxmox .env-tag { color: var(--envd-proxmox); }
.env-browser .env-tag { color: var(--envd-browser); }
.env-file .env-tag { color: var(--envd-file); }
.code-file { font-family: var(--font-mono); color: var(--code-ink); font-size: 12.5px; overflow-wrap: anywhere; }
.code-title { color: var(--code-ink); }
.code-lang { font-family: var(--font-mono); color: var(--code-muted); font-size: 11.5px; }
.code-hint { color: var(--code-muted); font-size: 12px; }
.copy {
  margin-left: auto;
  font: inherit; font-size: 12px; line-height: 1;
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
  color: var(--code-ink); background: transparent; border: 1px solid var(--code-rule);
}
.copy:hover { background: rgba(255, 255, 255, 0.07); border-color: #3c4a5a; }
.copy.done { color: #9fe0bd; border-color: #2f6b55; }
.code pre {
  margin: 0; padding: 14px 16px 16px;
  overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.8px; line-height: 1.65;
  tab-size: 4;
}
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; white-space: pre; }

/* ---------- command anatomy ---------- */
.anatomy {
  display: flex; flex-wrap: wrap; gap: 8px 6px;
  margin: 10px 0 18px; padding: 14px;
  background: var(--surface); border: 1px dashed var(--rule-strong); border-radius: var(--radius);
}
.anatomy .tok { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 100%; }
.anatomy .tok code {
  font-size: 14px; padding: 5px 9px; text-align: center;
  background: var(--code-bg); color: var(--code-ink); border-color: var(--code-rule);
}
.anatomy .tok span { font-size: 12.5px; line-height: 1.5; color: var(--muted); padding-inline: 2px; max-width: 13em; }

/* ---------- callouts ---------- */
.callout {
  margin: 18px 0; padding: 14px 18px 12px;
  border-radius: var(--radius);
  background: var(--note-soft);
  border: 1px solid color-mix(in srgb, var(--note) 30%, transparent);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px !important;
  font-size: 14px; font-weight: 700; letter-spacing: 0.04em; color: var(--note);
}
.callout-title::before {
  content: attr(data-mark);
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px;
  font-size: 12px; font-family: var(--font-mono);
  color: var(--surface); background: var(--note);
}
.callout.tip { background: var(--tip-soft); border-color: color-mix(in srgb, var(--tip) 30%, transparent); }
.callout.tip .callout-title { color: var(--tip); }
.callout.tip .callout-title::before { background: var(--tip); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.warn .callout-title { color: var(--warn); }
.callout.warn .callout-title::before { background: var(--warn); }
.callout.gap { background: var(--gap-soft); border-color: color-mix(in srgb, var(--gap) 35%, transparent); }
.callout.gap .callout-title { color: var(--gap); }
.callout.gap .callout-title::before { background: var(--gap); }
.callout .code { margin-bottom: 12px; }

/* ---------- steps (指導書の手順) ---------- */
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 18px 0 8px; }
.step {
  position: relative;
  padding: 18px 20px 6px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 8px; }
.step-no {
  font-family: var(--font-mono); font-weight: 600; font-size: 12.5px;
  padding: 2px 8px; border-radius: 6px;
  background: var(--ink); color: var(--surface);
}
.content .step h3 { margin: 0; width: 100%; font-size: 18.5px; }
.step-body > :last-child { margin-bottom: 14px; }
.step .label {
  display: inline-block; margin-right: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted);
}
.step p.what { font-size: 16.5px; }
.ok {
  margin: 10px 0 14px; padding: 10px 14px;
  border-left: 3px solid var(--tip); background: var(--tip-soft); border-radius: 0 8px 8px 0;
}
.ok > :last-child { margin-bottom: 0; }
.ok-title { font-size: 13px; font-weight: 700; color: var(--tip); margin: 0 0 2px !important; }

/* ---------- tables (三線表スタイル) ---------- */
.table-wrap { margin: 16px 0 22px; overflow-x: auto; }
.content table {
  width: 100%; border-collapse: collapse;
  font-size: 14.5px; line-height: 1.65;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  font-variant-numeric: tabular-nums;
}
.content caption {
  caption-side: top; text-align: left;
  padding: 0 0 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6;
}
.content thead th { border-bottom: 1px solid var(--ink); }
.content th, .content td { padding: 8px 12px; text-align: left; vertical-align: top; }
.content th { font-weight: 700; white-space: nowrap; }
.content tbody th { white-space: normal; }
.content tbody tr + tr > * { border-top: 1px solid var(--rule); }
.content td code, .content th code { font-size: 0.9em; }
.cap-no { font-weight: 700; margin-right: 0.6em; }
table.plain-rows tbody tr + tr > * { border-top: 0; }

/* ---------- figures ---------- */
.fig { margin: 22px 0 26px; }
.fig-scroll { overflow-x: auto; padding: 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.fig svg { display: block; width: 100%; height: auto; min-width: 560px; color: var(--ink); font-family: var(--font-body); }
.fig.narrow svg { min-width: 0; max-width: 520px; margin-inline: auto; }
.fig figcaption { margin-top: 10px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }

/* diagram primitives */
.dg-box { fill: var(--surface); stroke: var(--rule-strong); stroke-width: 1.2; }
.dg-fill { fill: var(--surface-2); stroke: var(--rule-strong); stroke-width: 1.2; }
.dg-fill2 { fill: var(--surface-3); stroke: var(--rule-strong); stroke-width: 1.2; }
.dg-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.dg-tip { fill: var(--tip-soft); stroke: var(--tip); stroke-width: 1.4; }
.dg-warn { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1.4; }
.dg-gap { fill: var(--gap-soft); stroke: var(--gap); stroke-width: 1.4; }
.dg-win { fill: var(--env-win-soft); stroke: var(--env-win); stroke-width: 1.5; }
.dg-ubuntu { fill: var(--env-ubuntu-soft); stroke: var(--env-ubuntu); stroke-width: 1.5; }
.dg-ssh { fill: var(--env-ssh-soft); stroke: var(--env-ssh); stroke-width: 1.5; }
.dg-proxmox { fill: var(--env-proxmox-soft); stroke: var(--env-proxmox); stroke-width: 1.5; }
.dg-dash { fill: none; stroke: var(--rule-strong); stroke-width: 1.2; stroke-dasharray: 5 4; }
.dg-line { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.dg-line-accent { fill: none; stroke: var(--accent); stroke-width: 2; }
.dg-line-tip { fill: none; stroke: var(--tip); stroke-width: 2; }
.dg-line-warn { fill: none; stroke: var(--warn); stroke-width: 2; stroke-dasharray: 6 4; }
.dg-head { fill: var(--ink-2); }
.dg-head-accent { fill: var(--accent); }
.dg-head-tip { fill: var(--tip); }
.dg-head-warn { fill: var(--warn); }
.dg-t { fill: var(--ink); font-size: 13px; }
.dg-tb { fill: var(--ink); font-size: 13.5px; font-weight: 700; }
.dg-ts { fill: var(--muted); font-size: 11.5px; }
.dg-tm { fill: var(--ink); font-size: 12px; font-family: var(--font-mono); }
.dg-ta { fill: var(--accent); font-size: 12px; font-weight: 700; }
.dg-ttip { fill: var(--tip); font-size: 12px; font-weight: 700; }
.dg-twarn { fill: var(--warn); font-size: 12px; font-weight: 700; }
.dg-twin { fill: var(--env-win); font-size: 12.5px; font-weight: 700; }
.dg-tubuntu { fill: var(--env-ubuntu); font-size: 12.5px; font-weight: 700; }
.dg-tproxmox { fill: var(--env-proxmox); font-size: 12.5px; font-weight: 700; }
.dg-tssh { fill: var(--env-ssh); font-size: 12.5px; font-weight: 700; }

/* ---------- cards / grids ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 14px; margin: 16px 0 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 14px; margin: 16px 0 22px; }
.card {
  padding: 16px 18px 14px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.card > :last-child { margin-bottom: 0; }
.card h3, .card h4 { margin-top: 0 !important; }
.card-title { margin: 0 0 6px !important; font-weight: 700; font-size: 16px; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
a.card:hover { border-color: var(--accent); color: inherit; }
a.card .card-title { color: var(--accent); }
.card .meta { font-size: 13px; color: var(--muted); margin: 0 0 6px; }

/* key-value explanation lists */
.kv { display: grid; grid-template-columns: fit-content(15rem) minmax(0, 1fr); gap: 6px 16px; margin: 10px 0 18px; }
.kv dt { font-weight: 700; }
.kv dt code { font-weight: 400; }
.kv dd { margin: 0; }
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 10px; }
}

/* ---------- checklists ---------- */
.checklist { list-style: none; padding: 0 !important; margin: 12px 0 8px; display: grid; gap: 8px; }
.checklist li { margin: 0; }
.checklist label {
  display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start;
  padding: 10px 14px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
  cursor: pointer; line-height: 1.7;
}
.checklist input { width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--tip); }
.checklist label:has(input:checked) { background: var(--tip-soft); border-color: color-mix(in srgb, var(--tip) 40%, transparent); }
.checklist label:has(input:checked) .ck-text { color: var(--ink-2); }
.check-progress { font-size: 13.5px; color: var(--muted); margin: 0 0 18px; }
.check-progress strong { color: var(--tip); }
.check-reset { font: inherit; font-size: 12.5px; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0 4px; }

/* ---------- details (課題のヒント・クイズ) ---------- */
details.hint {
  margin: 12px 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
}
details.hint > summary {
  cursor: pointer; list-style: none;
  padding: 12px 16px; font-weight: 700; line-height: 1.6;
  display: flex; gap: 10px; align-items: baseline;
}
details.hint > summary::-webkit-details-marker { display: none; }
details.hint > summary::before {
  content: "+"; font-family: var(--font-mono); color: var(--accent);
  display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none;
  border: 1px solid var(--accent); border-radius: 5px; font-size: 14px; line-height: 1;
}
details.hint[open] > summary::before { content: "−"; }
details.hint > .hint-body { padding: 0 18px 8px; border-top: 1px solid var(--rule); padding-top: 14px; }
.task-q {
  margin: 0 0 6px !important; padding: 12px 16px;
  background: var(--surface-2); border-radius: 8px; font-weight: 700;
}
.task-no { font-family: var(--font-mono); color: var(--accent); margin-right: 6px; }

/* quiz */
.quiz { display: grid; gap: 10px; margin: 14px 0 20px; }
.quiz details { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.quiz summary { cursor: pointer; padding: 10px 14px; line-height: 1.7; }
.quiz summary .q-hint { color: var(--muted); font-size: 13px; margin-left: 6px; white-space: nowrap; }
.quiz .ans { padding: 0 14px 10px 14px; }
.verdict { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: 5px; margin-right: 6px; }
.verdict.res { background: var(--note-soft); color: var(--note); }
.verdict.dis { background: var(--tip-soft); color: var(--tip); }
.verdict.ng { background: var(--warn-soft); color: var(--warn); }

/* ---------- tools (interactive widgets) ---------- */
.tool {
  margin: 18px 0 24px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.tool-title { margin: 0 0 12px !important; font-weight: 700; font-size: 15.5px; display: flex; gap: 8px; align-items: center; }
.tool-title::before { content: "操作できます"; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 700; }
input[type="text"], input[type="search"], input:not([type]), input[inputmode], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink);
  padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--rule-strong); background: var(--bg);
  min-width: 0; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.tool-out {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px;
  background: var(--surface-2); font-family: var(--font-mono); font-size: 15px; line-height: 1.6;
  overflow-wrap: anywhere;
}
.tool-out .lbl { font-family: var(--font-body); font-size: 12.5px; color: var(--muted); display: block; }
.tool-note { font-size: 13px; color: var(--muted); margin: 8px 0 0 !important; }

.perm-grid { display: grid; grid-template-columns: auto repeat(3, minmax(3.2rem, auto)); gap: 6px 10px; align-items: center; justify-content: start; }
.perm-grid .h { font-size: 12.5px; color: var(--muted); font-weight: 700; text-align: center; }
.perm-grid .r { font-size: 14px; font-weight: 700; }
.perm-grid label { display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--font-mono); font-size: 14px; padding: 4px 8px; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; background: var(--bg); }
.perm-grid label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.perm-grid input { accent-color: var(--accent); margin: 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.btn-primary, .btn-ghost, .chip {
  font: inherit; font-size: 14px; line-height: 1; cursor: pointer;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--rule-strong);
  background: var(--surface); color: var(--ink);
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost:hover, .chip:hover { background: var(--surface-2); }
.chip { padding: 6px 11px; border-radius: 999px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* my values table on home / settings */
.me-card {
  margin: 18px 0 26px; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.me-card h3 { margin: 0 0 6px !important; }
.me-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 10px; margin: 14px 0 6px; }
.me-values div { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.me-values .k { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.me-values .v { font-family: var(--font-mono); font-size: 15.5px; overflow-wrap: anywhere; }

/* ---------- settings dialog ---------- */
dialog.settings {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog.settings::backdrop { background: rgba(10, 15, 20, 0.45); }
.settings-form { padding: 22px 22px 18px; display: grid; gap: 8px; }
.settings-form h2 { margin: 0; font-family: var(--font-display); font-size: 21px; }
.settings-form p { margin: 0 0 6px; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.settings-form label { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.settings-error { color: var(--warn) !important; font-weight: 700; }
.settings-preview { font-family: var(--font-mono); font-size: 13px; line-height: 1.8; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.settings-preview:empty { display: none; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.settings-actions .btn-ghost:first-child { margin-right: auto; }

/* ---------- glossary ---------- */
.gloss-tools {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); z-index: 5;
  margin: 0 -8px 12px; padding: 12px 8px;
  background: var(--bg); border-bottom: 1px solid var(--rule);
  display: grid; gap: 8px;
}
.gloss-search-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.gloss-search { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gloss-count { margin: 0; font-size: 13px; color: var(--muted); }
.gloss-cat h2 { margin-top: 36px !important; }
.gloss-list { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.gloss-item { padding: 14px 18px 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); scroll-margin-top: calc(var(--topbar-h) + 150px); }
.gloss-item:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gloss-item dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.gloss-term { font-weight: 700; font-size: 17px; }
.gloss-yomi { font-size: 12.5px; color: var(--muted); }
.gloss-item dd { margin: 0; }
.gloss-item dd p { margin: 0 0 8px; }
.gloss-short { font-weight: 700; color: var(--ink-2); }
.gloss-see { font-size: 13px; color: var(--muted); }
.gloss-empty { padding: 20px; text-align: center; color: var(--muted); }

/* ---------- report page: A4 mock ---------- */
.paper-wrap { overflow-x: auto; margin: 18px 0 24px; padding: 20px; background: var(--surface-3); border-radius: var(--radius); }
.paper {
  width: 520px; margin-inline: auto; aspect-ratio: 210 / 297;
  background: #fff; color: #111; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  padding: 49.5px; /* 20mm / 210mm × 520px */
  font-family: var(--font-report); font-size: 9.3px; line-height: 1.55;
  position: relative;
}
.paper .p-title { font-size: 12.4px; font-weight: 700; text-align: center; margin: 0; }
.paper .p-etitle { font-size: 10.6px; text-align: center; margin: 2px 0 0; font-family: "Times New Roman", "BIZ UDPMincho", serif; }
.paper .p-name { font-size: 10.6px; text-align: center; margin: 6px 0 10px; }
.paper .p-h { font-size: 9.3px; font-weight: 700; margin: 8px 0 2px; font-family: var(--font-body); }
.paper p { margin: 0 0 3px; text-indent: 1em; }
.paper .p-fig { margin: 8px auto 2px; width: 60%; height: 58px; border: 1px solid #999; display: grid; place-items: center; color: #777; font-size: 8px; font-family: var(--font-body); }
.paper .p-cap { font-size: 8px; text-align: center; margin: 0 0 8px; text-indent: 0; }
.paper table { width: 70%; margin: 2px auto 8px; border-collapse: collapse; font-size: 8px; border-top: 1.2px solid #111; border-bottom: 1.2px solid #111; }
.paper thead th { border-bottom: 0.8px solid #111; }
.paper th, .paper td { padding: 1px 6px; text-align: center; font-weight: 400; }
.paper .p-eq { display: flex; justify-content: center; position: relative; margin: 6px 0; text-indent: 0; font-family: "Times New Roman", serif; }
.paper .p-eq .no { position: absolute; right: 0; }
.paper .note { position: absolute; font-family: var(--font-body); font-size: 10px; color: #a3301d; background: #fff4f1; border: 1px solid #e3b6ab; border-radius: 4px; padding: 1px 5px; line-height: 1.4; white-space: nowrap; }
.paper .margin-guide { position: absolute; inset: 49.5px; border: 1px dashed #b7c6db; pointer-events: none; }

/* font samples */
.font-samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 12px; margin: 14px 0 20px; }
.font-sample { padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.font-sample .fs-name { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 0 0 4px !important; }
.font-sample .fs-demo { font-size: 22px; line-height: 1.5; margin: 0 !important; }
.fs-mincho { font-family: var(--font-report); }
.fs-gothic { font-family: var(--font-body); }
.fs-serif { font-family: "Century", "Century Schoolbook", "Times New Roman", "BIZ UDPMincho", serif; }
.fs-sans { font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; }
.fs-mono { font-family: Consolas, "JetBrains Mono", monospace; }
.fs-prop { font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; }

.math { font-family: "Times New Roman", "Cambria Math", serif; font-size: 1.08em; }
.math i { font-style: italic; }
.eq-demo { display: flex; align-items: center; justify-content: center; position: relative; padding: 14px 3.5em; margin: 12px 0 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); font-size: 19px; }
.eq-demo .eq-no { position: absolute; right: 16px; font-family: "Times New Roman", serif; font-size: 17px; }

/* compare (NG/OK) */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 12px; margin: 14px 0 20px; }
.compare > div { padding: 14px 16px 10px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); }
.compare .ng { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.compare .good { border-color: color-mix(in srgb, var(--tip) 45%, transparent); }
.compare .tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 5px; margin-bottom: 8px; }
.compare .ng .tag { background: var(--warn-soft); color: var(--warn); }
.compare .good .tag { background: var(--tip-soft); color: var(--tip); }
.compare p:last-child { margin-bottom: 4px; }
.compare .table-wrap { margin: 0 0 8px; }

/* table variants for the 3-line demo */
.content table.bad-table { border: 2px solid var(--ink); }
.content table.bad-table th, .content table.bad-table td { border: 1px solid var(--ink) !important; text-align: center; }
.content table.good-table th, .content table.good-table td { text-align: center; }
.content table.good-table tbody tr + tr > * { border-top: 0; }
.content table.num td { text-align: right; }

/* terms chip row */
.term-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 18px; padding: 0; list-style: none; }
.term-row li { margin: 0; }
.term-row a {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface);
  font-size: 13.5px; text-decoration: none; color: var(--ink-2);
}
.term-row a:hover { border-color: var(--accent); color: var(--accent); }

/* route (roadmap) list */
.route { list-style: none; padding: 0 !important; margin: 16px 0 24px; display: grid; gap: 0; }
.route li {
  display: grid; grid-template-columns: 6.2rem 1fr; gap: 14px; margin: 0; padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.route li:last-child { border-bottom: 1px solid var(--rule); }
.route .when { font-weight: 700; font-size: 14px; color: var(--accent); }
.route .what { margin: 0; }
.route .what strong { display: block; font-size: 16.5px; }
.route .what span { color: var(--ink-2); font-size: 15px; }
@media (max-width: 520px) {
  .route li { grid-template-columns: 1fr; gap: 2px; }
}

/* pager & footer */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 56px 0 0; }
.pager a {
  display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--ink); line-height: 1.5; font-weight: 700;
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager a span { font-size: 12px; color: var(--muted); font-weight: 400; }
.pager-next { text-align: right; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager-next { text-align: left; } }
.site-foot {
  max-width: 47rem; margin: 48px auto 0; padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px; line-height: 1.8; color: var(--muted);
}
.site-foot p { margin: 0 0 8px; }
.site-foot a { color: var(--muted); }

/* ---------- IP address visual ---------- */
.ipviz { padding: 22px 16px 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; }
.ip-row { display: flex; align-items: baseline; justify-content: center; gap: 4px; font-family: var(--font-mono); font-size: clamp(22px, 5vw, 34px); font-weight: 600; }
.oct { padding: 4px 10px; border-radius: 8px; min-width: 2.4em; text-align: center; }
.oct.net { background: var(--accent-soft); color: var(--accent); }
.oct.host { background: var(--ph-bg); color: var(--ph-ink); }
.oct.host .ph.is-set { background: none; box-shadow: none; padding: 0; }
.ip-dot { color: var(--muted); }
.ip-prefix { margin-left: 10px; font-size: 0.6em; color: var(--muted); }
.ip-labels { display: grid; grid-template-columns: 3fr 1fr; gap: 8px; max-width: 30rem; margin: 10px auto 0; font-size: 12.5px; line-height: 1.5; text-align: center; }
.lab-net { color: var(--accent); border-top: 2px solid var(--accent); padding-top: 4px; }
.lab-host { color: var(--ph-ink); border-top: 2px solid var(--ph-ink); padding-top: 4px; }

/* ---------- directory tree ---------- */
pre.tree {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7; color: var(--ink);
}
.tree-note { color: var(--muted); font-family: var(--font-body); font-size: 12.5px; }
pre.tree .ph.is-set { padding: 0; box-shadow: none; }
.dg-x { fill: none; stroke: var(--warn); stroke-width: 2.5; stroke-linecap: round; }
.dg-frame { fill: none; stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 4 3; }
.dg-mark { fill: var(--surface); stroke: currentColor; stroke-width: 1.6; }

/* grid children must be allowed to shrink below their content width */
.step, .grid-2 > *, .grid-3 > *, .compare > *, .kv > *, .font-samples > *, .me-values > * { min-width: 0; }
.kv dt { overflow-wrap: anywhere; }

.me-chip, .theme-btn { white-space: nowrap; }
@media (max-width: 640px) {
  .me-ip, .tl-pre { display: none; }
  .topbar { gap: 8px; padding-inline: 12px; }
  .brand-name { font-size: 17px; }
}

/* ---------- 撮影ポイント（カメラ）と考察のヒント（電球） ---------- */
:root {
  --shot: #b3275a;
  --shot-soft: #fbe5ee;
  --on-shot: #ffffff;
  --idea: #8f5f00;
  --idea-soft: #fff1c4;
  --pintip-bg: #18212b;
  --pintip-ink: #eef2f6;
  --pintip-muted: #a9b4c0;
  --pintip-shot: #ff9fc0;
  --pintip-idea: #ffd66e;
  --pintip-code: rgba(255, 255, 255, 0.13);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --shot: #f58cb0;
    --shot-soft: #3b1a29;
    --on-shot: #1c0e15;
    --idea: #f2cd66;
    --idea-soft: #352c12;
    --pintip-bg: #eef2f6;
    --pintip-ink: #16202b;
    --pintip-muted: #56626e;
    --pintip-shot: #a8224f;
    --pintip-idea: #7a5100;
    --pintip-code: rgba(0, 0, 0, 0.07);
  }
}
:root[data-theme="dark"] {
  --shot: #f58cb0;
  --shot-soft: #3b1a29;
  --on-shot: #1c0e15;
  --idea: #f2cd66;
  --idea-soft: #352c12;
  --pintip-bg: #eef2f6;
  --pintip-ink: #16202b;
  --pintip-muted: #56626e;
  --pintip-shot: #a8224f;
  --pintip-idea: #7a5100;
  --pintip-code: rgba(0, 0, 0, 0.07);
}

.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pin-wrap { position: relative; display: inline-block; vertical-align: middle; margin: -4px 3px 0; line-height: 1; }
.pin {
  position: relative; display: inline-grid; place-items: center;
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  font: inherit; text-decoration: none; cursor: pointer;
  border: 1.5px solid currentColor;
  transition: background-color 0.12s, color 0.12s, transform 0.12s;
}
.pin .pin-ico, .pin-demo .pin-ico {
  width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.pin:hover { transform: translateY(-1px); }
.pin.shot { color: var(--shot); background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.pin.shot:hover, .pin.shot:focus-visible { background: var(--shot); color: var(--on-shot); }
.pin.idea { color: var(--idea); background: var(--idea-soft); }
.pin.idea:hover, .pin.idea:focus-visible, .pin.idea.is-open { background: var(--idea); color: var(--surface); }
.pin-no {
  position: absolute; top: -6px; right: -7px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--shot); color: var(--on-shot);
  font: 700 10.5px/17px var(--font-mono); text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.pin.shot:hover .pin-no, .pin.shot:focus-visible .pin-no { background: var(--on-shot); color: var(--shot); }
.pin:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ツールチップ（JavaScriptなしでは .pin-tip を直接表示、ありでは .pin-float に複製して表示） */
.pin-tip, .pin-float {
  padding: 11px 14px 12px; border-radius: 10px;
  background: var(--pintip-bg); color: var(--pintip-ink);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 400; line-height: 1.75;
  letter-spacing: 0.01em; text-align: left; white-space: normal;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.pin-tip { display: none; position: absolute; left: -8px; top: calc(100% + 8px); z-index: 30; width: max-content; max-width: min(320px, 80vw); }
.pin-wrap:hover .pin-tip, .pin-wrap:focus-within .pin-tip { display: block; }
.js-pins .pin-tip { display: none !important; }
.pin-float { position: fixed; z-index: 90; max-width: min(340px, calc(100vw - 24px)); }
.tip-head { display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; }
.tip-head.shot { color: var(--pintip-shot); }
.tip-head.idea { color: var(--pintip-idea); }
.tip-body { display: block; }
.tip-go { display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--pintip-shot); }
.tip-go:hover { color: var(--pintip-shot); }
.pin-tip code, .pin-float code { background: var(--pintip-code); border-color: transparent; color: inherit; }
.pin-tip a.term, .pin-float a.term { color: inherit; text-decoration-color: currentColor; }
.pin-float .ph.is-set { background: rgba(255, 214, 102, 0.25); color: inherit; box-shadow: none; }

/* 凡例 */
.pin-legend {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center;
  margin: 8px 0 18px !important; padding: 12px 16px;
  background: var(--surface); border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.6; color: var(--ink-2);
}
.pin-demo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid currentColor; }
.pin-demo.shot { color: var(--shot); background: var(--surface); }
.pin-demo.idea { color: var(--idea); background: var(--idea-soft); }

/* エビデンス一覧の該当項目の強調 */
.checklist li.shot-item { scroll-margin-top: calc(var(--topbar-h) + 32px); }
.checklist li:target > label, .checklist li.is-flash > label {
  border-color: var(--shot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--shot) 35%, transparent);
}
.checklist li.is-flash > label { animation: shot-flash 2.4s ease-out 1; }
@keyframes shot-flash {
  0%, 30% { background-color: var(--shot-soft); }
  100% { background-color: var(--surface); }
}
.back-to-pin { display: inline-block; margin: 4px 0 0 46px; font-size: 12.5px; color: var(--muted); }
.back-to-pin:hover { color: var(--shot); }
.pin.is-flash { animation: pin-pulse 1.2s ease-out 2; }
@keyframes pin-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--shot) 55%, transparent); }
  100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--shot) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .checklist li.is-flash > label, .pin.is-flash { animation: none; }
  .pin { transition: none; }
  .pin:hover { transform: none; }
}

/* ---------- エラーを特定 ---------- */
.finder {
  margin: 12px 0 18px; padding: 18px 20px 14px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.finder-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
textarea.finder-input {
  display: block; width: 100%; min-height: 12rem; resize: vertical;
  font-family: var(--font-mono); font-size: 14px; line-height: 1.6;
  padding: 12px 14px; border-radius: 8px;
  background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--code-rule);
}
textarea.finder-input::placeholder { color: var(--code-muted); }
textarea.finder-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.finder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 12px; }
.finder-actions .btn-primary { padding: 11px 22px; font-size: 15px; }
.finder-hint { font-size: 12.5px; color: var(--muted); }
.finder-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.finder-samples-label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-right: 4px; }

.err-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 0 8px; }
.err-results:empty { display: none; }
.err-summary { padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); scroll-margin-top: calc(var(--topbar-h) + 16px); }
.err-summary:focus { outline: none; }
.err-summary p { margin: 0; }
.err-summary p + p { margin-top: 6px; }
.err-summary.none { background: var(--gap-soft); }
.err-secondary-title { margin: 10px 0 0 !important; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.err-hit { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.err-hit-title { margin: 0 0 6px !important; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.err-hit p:last-child { margin-bottom: 0; }
pre.err-hit-lines {
  margin: 0; padding: 8px 10px; overflow-x: auto; border-radius: 6px;
  background: var(--code-bg); color: var(--code-ink);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; white-space: pre;
}
pre.err-hit-lines mark { background: rgba(255, 214, 102, 0.3); color: #ffe08a; border-radius: 3px; padding: 0 2px; }
.err-to-catalog { margin: 4px 0 0 !important; font-size: 13px; }

/* 一覧と結果の項目 */
.err-cat-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px !important; }
.err-cat-jump .chip { text-decoration: none; color: var(--ink-2); }
.content h3.err-cat { display: flex; align-items: baseline; gap: 10px; margin-top: 30px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.err-cat-count { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.err-entry { margin: 0 0 8px; scroll-margin-top: calc(var(--topbar-h) + 16px); border-radius: var(--radius); }
.err-entry.is-flash { animation: err-flash 2s ease-out 1; }
@keyframes err-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.err-details { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.err-result .err-details { border-color: var(--rule-strong); }
.err-details > summary {
  cursor: pointer; list-style: none;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline;
  padding: 11px 16px; line-height: 1.55;
}
.err-details > summary::-webkit-details-marker { display: none; }
.err-details[open] > summary { border-bottom: 1px solid var(--rule); }
.err-title { font-weight: 700; overflow-wrap: anywhere; }
.err-where { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.err-kind {
  grid-row: 1 / span 2; align-self: start;
  display: inline-block; margin-top: 2px; padding: 1px 8px; border-radius: 5px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.err-kind.k-error { background: var(--warn-soft); color: var(--warn); }
.err-kind.k-warn { background: var(--gap-soft); color: var(--gap); }
.err-kind.k-info { background: var(--tip-soft); color: var(--tip); }
.err-body { padding: 12px 18px 6px; }
.err-body h4 { margin: 14px 0 4px; font-size: 14px; color: var(--ink-2); }
.err-body ul { margin: 0 0 10px; }
.err-body .code { margin: 6px 0 10px; }
.err-pats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: 13px; }
.err-pats code { font-size: 12.5px; }
.err-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.err-meaning { font-weight: 700; }
.err-links { font-size: 13.5px; }
@media (prefers-reduced-motion: reduce) { .err-entry.is-flash { animation: none; box-shadow: 0 0 0 3px var(--accent); } }

/* サイト名が長くても、スマホの上部バーからはみ出さないようにする */
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) {
  .brand { gap: 8px; }
  .brand-name { font-size: 15.5px; letter-spacing: 0.02em; }
  .me-chip, .theme-btn { padding: 0 10px; }
}
@media (max-width: 380px) {
  .brand-mark { display: none; }
}
@media (max-width: 340px) {
  .topbar { gap: 6px; padding-inline: 10px; }
  .brand-name { font-size: 14px; letter-spacing: 0; }
  .me-chip, .theme-btn { padding: 0 8px; }
}

/* ---------- サイトを制作（builder.html） ---------- */
.page-builder .page { max-width: 100rem; }
.page-builder .page-head,
.page-builder .content > :not(.builder),
.page-builder .pager { max-width: 47rem; }
.page-builder .site-foot { max-width: 100rem; }
.page-builder .site-foot p { max-width: 47rem; }
.content .step-head h4 { margin: 0; width: 100%; font-size: 17px; line-height: 1.55; }

.builder {
  --pv-h: clamp(260px, 46vh, 460px);
  --pv-sm: calc(var(--pv-h) + 16px);
  margin: 4px 0 40px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: clip;
  overflow-anchor: none;
  font-size: 14.5px; line-height: 1.6;
}
.builder p { margin: 0; }
.builder.pv-collapsed { --pv-sm: 110px; }
.bd-noscript { padding: 18px 20px; }

.bd-i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bd-btn {
  font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
}
.bd-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: var(--rule-strong); }
.bd-btn:disabled { opacity: 0.4; cursor: default; }
.bd-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.bd-btn[aria-pressed="true"]:hover { background: var(--ink-2); color: var(--surface); }
.bd-icon-btn { padding: 0 7px; }
.bd-link { font: inherit; padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* 上の帯 */
.bd-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--rule); background: var(--surface);
}
.bd-bar-group { display: flex; gap: 6px; }
.bd-status { flex: 1 1 14rem; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.bd-status.is-warn { color: var(--warn); font-weight: 700; }

/* 編集とプレビューの並べ方：狭いときはプレビューが上（上に貼り付いて、常に見える） */
.bd-main { display: grid; grid-template-columns: minmax(0, 1fr); }
.bd-editor { min-width: 0; }
.bd-preview {
  order: -1; position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); z-index: 6;
  display: flex; flex-direction: column; min-width: 0; height: var(--pv-h);
  background: var(--surface-2); border-bottom: 1px solid var(--rule);
}
.pv-collapsed .bd-preview { height: auto; }
.pv-collapsed .bd-pv-stage { display: none; }
.pv-collapsed .bd-collapse-btn .bd-i { transform: rotate(180deg); }

/* タブ */
.bd-tabs { display: flex; border-bottom: 1px solid var(--rule); padding-inline: 6px; }
.bd-tab {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap;
  padding: 12px 8px 10px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer;
}
.bd-tab:hover { color: var(--ink); }
.bd-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.bd-tab-no {
  display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%;
  font-family: var(--font-mono); font-size: 11px; background: var(--surface-2); color: var(--muted);
}
.bd-tab[aria-selected="true"] .bd-tab-no { background: var(--accent); color: var(--on-accent); }
.bd-panel { padding: 14px 14px 22px; display: grid; gap: 22px; }
.bd-panel[hidden] { display: none; }
.bd-sec { display: grid; gap: 10px; min-width: 0; }
.bd-sec-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.bd-sec-note { font-weight: 400; letter-spacing: 0; color: var(--muted); font-size: 12px; }
.bd-templates, .bd-snippets { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-help { font-size: 13px; line-height: 1.7; color: var(--muted); }
.bd-help code, .bd-hint code { font-size: 12px; }
.bd-empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--rule-strong); border-radius: 10px; }

/* 部品を足す */
.bd-palette { display: grid; gap: 6px; }
.builder .bd-pal-group { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.bd-pal-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.bd-part {
  display: grid; justify-items: center; gap: 4px; min-width: 0;
  padding: 8px 4px 7px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; line-height: 1.3; cursor: pointer; text-align: center;
}
.bd-part:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.bd-part-ico { color: var(--ink-2); }
.bd-part:hover .bd-part-ico { color: var(--accent); }
.bd-mini { display: block; width: 40px; height: 28px; overflow: visible; }
.bd-mini .i-s { fill: currentColor; }
.bd-mini .i-f { fill: currentColor; opacity: 0.38; }
.bd-mini .i-b { fill: currentColor; opacity: 0.13; }
.bd-mini .i-o { fill: none; stroke: currentColor; stroke-width: 1.3; }
.bd-mini .i-k { fill: var(--surface); }
.bd-mini .i-l { stroke: currentColor; stroke-width: 1.2; opacity: 0.55; }

/* ページの組み立て（部品の一覧） */
.content .bd-blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.content .bd-block { margin: 0; }
.bd-block { border: 1px solid var(--rule); border-radius: 10px; background: var(--bg); scroll-margin-top: calc(var(--topbar-h) + var(--pv-sm)); }
.bd-block.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bd-block.is-dragging { position: relative; z-index: 2; border-color: var(--accent); box-shadow: var(--shadow), inset 0 0 0 1px var(--accent); background: var(--surface); }
.is-sorting, .is-sorting * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.bd-block-head { display: flex; align-items: center; gap: 2px; padding: 3px 4px 3px 2px; }
.bd-grip {
  flex: none; display: grid; place-items: center; width: 24px; height: 36px; border-radius: 6px;
  color: var(--muted); cursor: grab; touch-action: none;
}
.bd-grip:hover { background: var(--surface-2); color: var(--ink); }
.bd-grip svg { width: 8px; height: 14px; fill: currentColor; }
.bd-block-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 4px 6px; border: 0; border-radius: 6px; background: none;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.bd-block-toggle:hover { background: var(--surface-2); }
.bd-ico { flex: none; color: var(--ink-2); }
.bd-ico .bd-mini { width: 34px; height: 24px; }
.bd-block.is-selected .bd-ico { color: var(--accent); }
.bd-block-text { display: grid; min-width: 0; line-height: 1.35; }
.bd-block-name { font-size: 13.5px; font-weight: 700; }
.bd-block-sum { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-block-sum:empty { display: none; }
.bd-block-tools, .bd-item-tools { display: flex; flex: none; }
.bd-tool {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.bd-tool:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.bd-tool.is-del:hover:not(:disabled) { background: var(--warn-soft); color: var(--warn); }
.bd-tool:disabled { opacity: 0.28; cursor: default; }
.bd-block-body { display: none; }
.bd-block.is-open .bd-block-body { display: grid; gap: 12px; padding: 12px 14px 14px; border-top: 1px solid var(--rule); }
.bd-desc { font-size: 12.5px; color: var(--muted); }
.bd-note { font-size: 12.5px; line-height: 1.65; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--ink-2); }

/* 入力欄 */
.bd-field, .bd-ctl { display: grid; gap: 5px; min-width: 0; }
.bd-field > label, .bd-label, .bd-ctl > label, .bd-ctl-label {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.bd-tag, .bd-prop { font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; background: none; border: 0; padding: 0; }
.bd-tag { color: var(--env-ubuntu); }
.bd-prop { color: var(--accent); }
.builder input[type="text"], .builder textarea, .builder select { width: 100%; font-size: 15px; padding: 7px 10px; }
.builder textarea { resize: vertical; line-height: 1.6; }
.builder textarea.is-mono { font-family: var(--font-mono); font-size: 13.5px; }
@media (pointer: coarse) { .builder input[type="text"], .builder textarea, .builder select { font-size: 16px; } }
.bd-hint { font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.bd-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 10px; }
.bd-common { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--rule-strong); }
.bd-common-title { font-size: 12px; font-weight: 700; color: var(--muted); }
.bd-check label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer; }
.bd-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.bd-range { display: flex; align-items: center; gap: 10px; }
.bd-range input { flex: 1; min-width: 0; accent-color: var(--accent); }
.bd-out { min-width: 4.6em; text-align: right; font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.bd-image { border-radius: 8px; }
.bd-image.is-drop { outline: 2px dashed var(--accent); outline-offset: 4px; }
.bd-img-row { display: flex; align-items: flex-start; gap: 12px; }
.bd-thumb { flex: none; width: 96px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface-2); }
.bd-img-tools { display: grid; gap: 6px; min-width: 0; }
.bd-img-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-sublabel { font-size: 12.5px; color: var(--muted); }
.bd-items { display: grid; gap: 8px; }
.bd-item { display: grid; gap: 8px; padding: 8px 10px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.bd-item-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.bd-add-item { justify-self: start; }

/* デザイン */
.bd-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.bd-preset {
  display: grid; gap: 4px; padding: 5px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; cursor: pointer;
}
.bd-preset:hover { border-color: var(--rule-strong); }
.bd-preset[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bd-swatch { position: relative; display: grid; place-items: center; height: 42px; border: 1px solid; border-radius: 6px; }
.bd-swatch-aa { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.bd-swatch-dot { position: absolute; right: 6px; bottom: 6px; width: 11px; height: 11px; border-radius: 50%; }
.bd-preset-name { font-size: 12.5px; text-align: center; }
.bd-color { display: flex; align-items: center; gap: 8px; }
.bd-color input[type="color"] { flex: none; width: 46px; height: 36px; padding: 2px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--bg); cursor: pointer; }
.builder .bd-hex { width: 8.5em; font-family: var(--font-mono); font-size: 14px; }
.bd-contrast { font-size: 12px; line-height: 1.5; color: var(--tip); }
.bd-contrast.is-bad { color: var(--warn); font-weight: 700; }
.bd-seg { display: inline-flex; justify-self: start; max-width: 100%; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.bd-seg button {
  font: inherit; font-size: 13px; line-height: 1; white-space: nowrap;
  padding: 7px 11px; border: 0; background: none; color: var(--ink-2); cursor: pointer;
}
.bd-seg button + button { border-left: 1px solid var(--rule-strong); }
.bd-seg button:hover { background: var(--surface-2); }
.bd-seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.builder textarea.bd-css { min-height: 10rem; background: var(--code-bg); color: var(--code-ink); border-color: var(--code-rule); }
.builder textarea.bd-css::placeholder { color: var(--code-muted); }
.bd-snippets { align-items: center; }
.bd-snippets-label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-right: 2px; }

/* 書き出す */
.bd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.builder .is-done { background: var(--tip); border-color: var(--tip); color: var(--surface); }
.content .bd-warn { margin: 0; padding: 8px 12px 8px 28px; border-radius: 8px; background: var(--gap-soft); color: var(--ink-2); font-size: 13px; line-height: 1.6; }
.content .bd-warn li { margin: 2px 0; }
.bd-code {
  margin: 0; max-height: 28rem; overflow: auto; padding: 12px 14px; border-radius: 8px;
  background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--code-rule);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; white-space: pre; tab-size: 2;
}
.bd-code code { font: inherit; background: none; border: 0; padding: 0; color: inherit; }
.bd-code .hl-t { color: #82c0f6; }
.bd-code .hl-a { color: #eaa9dc; }
.bd-code .hl-v { color: #9fe0bd; }
.bd-code .hl-s { color: #f6c177; }
.bd-code .hl-c { color: #8d9bab; }
.bd-offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* プレビュー */
.bd-pv-head { flex: none; background: var(--surface-2); border-bottom: 1px solid var(--rule); }
.bd-pv-chrome { display: flex; align-items: flex-end; gap: 10px; padding: 7px 12px 0; }
.bd-pv-dots { display: flex; gap: 5px; padding-bottom: 10px; }
.bd-pv-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--rule-strong); }
.bd-pv-tab {
  min-width: 0; max-width: 18rem; padding: 6px 14px 7px; border-radius: 8px 8px 0 0;
  background: var(--surface); font-size: 12.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bd-pv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 10px; background: var(--surface); }
.bd-pv-url {
  flex: 1 1 9rem; min-width: 0; padding: 4px 12px; border-radius: 999px; background: var(--surface-2);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bd-pv-scheme { color: var(--muted); }
.bd-pv-bar .bd-seg button { padding: 6px 9px; font-size: 12.5px; }
.bd-scale { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.bd-pv-stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  background-color: var(--surface-3);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 14%, transparent) 1px, transparent 1px);
  background-size: 14px 14px;
}
.bd-frame { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; background: #fff; transform-origin: 0 0; }
.bd-frame.is-device { box-shadow: 0 0 0 1px var(--rule-strong), 0 8px 24px rgba(0, 0, 0, 0.12); }

/* 横に並べられる幅：左に編集、右にプレビュー（プレビューは画面の上に貼り付く） */
@media (min-width: 860px) and (max-width: 1023px), (min-width: 1180px) {
  .builder { --pv-sm: 16px; }
  .bd-main { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); }
  .bd-editor { border-right: 1px solid var(--rule); }
  .bd-preview {
    order: 0; align-self: start; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    height: max(460px, calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px)));
    border-bottom: 0;
  }
  .bd-collapse-btn { display: none; }
}

/* 広い画面で作業（ページ全体を覆う） */
body.bd-full { overflow: hidden; }
.builder.is-full {
  position: fixed; z-index: 45; inset: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)) 0 0;
  margin: 0; border: 0; border-radius: 0; box-shadow: none;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.builder.is-full .bd-main { flex: 1; min-height: 0; grid-template-rows: minmax(0, 45%) minmax(0, 1fr); }
.builder.is-full.pv-collapsed .bd-main { grid-template-rows: auto minmax(0, 1fr); }
.builder.is-full .bd-editor { overflow-y: auto; overscroll-behavior: contain; }
/* 横並びのときの「上に貼り付く・高さを画面に合わせる」指定を外し、行の高さいっぱいに広げる */
.builder.is-full .bd-preview { position: relative; top: auto; height: auto; align-self: stretch; min-height: 0; }
.builder.is-full .bd-block { scroll-margin-top: 8px; }
@media (min-width: 860px) {
  .builder.is-full .bd-main { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .builder.is-full .bd-editor { border-right: 1px solid var(--rule); }
  .builder.is-full .bd-preview { order: 0; border-bottom: 0; }
  .builder.is-full .bd-collapse-btn { display: none; }
}

@media (max-width: 520px) {
  .bd-bar .bd-btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bd-bar .bd-btn { padding: 0 9px; }
  .bd-panel { padding-inline: 10px; }
  .bd-pv-chrome { display: none; }
  .bd-block.is-open .bd-block-body { padding-inline: 10px; }
}
@media (max-width: 400px) {
  .bd-tab-sub { display: none; }
  .bd-tab { font-size: 13.5px; }
  .bd-pal-row { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}
