:root {
  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --surface-2: #ECEEEA;
  --ink: #1C2420;
  --ink-soft: #4B5850;
  --ink-faint: #7C8981;
  --accent: #2B6E63;
  --accent-strong: #1F5349;
  --accent-soft: #DEEAE6;
  --line: #D8DED9;
  --warn: #9C5A1F;
  --warn-bg: #FBEEE0;
  --warn-line: #E3B686;
  --danger: #A23B33;
  --danger-bg: #FBEAE7;
  --danger-line: #E3AEA7;
  --link: #1F5349;
  --shadow: 0 1px 2px rgba(28,36,32,0.06), 0 8px 24px rgba(28,36,32,0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121815;
    --surface: #182019;
    --surface-2: #1E2721;
    --ink: #E8ECE7;
    --ink-soft: #B7C2BB;
    --ink-faint: #8B978F;
    --accent: #5FB3A0;
    --accent-strong: #7FC9B7;
    --accent-soft: #23342E;
    --line: #2B3630;
    --warn: #D99B5C;
    --warn-bg: #2E2419;
    --warn-line: #6B4A28;
    --danger: #E08277;
    --danger-bg: #331F1C;
    --danger-line: #6B3630;
    --link: #7FC9B7;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic Medium", "Noto Sans JP", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
.app {
  display: grid;
  grid-template-columns: 264px minmax(0,1fr);
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 34' preserveAspectRatio='none'%3E%3Cpolyline points='0,17 60,17 76,17 84,3 92,31 100,17 140,17 220,17 236,17 244,3 252,31 260,17 400,17' fill='none' stroke='%232B6E63' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' opacity='0.16'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 400px 34px;
  pointer-events: none;
}
.brand { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.brand-name {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.brand-tag {
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}
.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.scrim { display: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  padding: 24px 18px 40px;
}
.sidebar-group { margin-bottom: 22px; }
.sidebar-group h3 {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 8px 6px;
  font-weight: 600;
}
.sidebar-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-group a {
  display: block;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.5;
}
.sidebar-group a:hover { background: var(--surface); color: var(--ink); }
.sidebar-group a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

/* ---------- Content ---------- */
.content-wrap { padding: 40px 40px 80px; min-width: 0; }
article { max-width: 700px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}
h1.page-title {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.5;
  margin: 0 0 10px;
  text-wrap: balance;
  font-weight: 600;
}
.updated {
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 28px;
}
article h2 {
  font-size: 20px;
  margin: 40px 0 14px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-weight: 700;
}
article > div > h2:first-child { border-top: none; padding-top: 0; margin-top: 8px; }
article h3 {
  font-size: 16px;
  margin: 24px 0 10px;
  color: var(--accent-strong);
  font-weight: 700;
}
article p { margin: 0 0 16px; color: var(--ink-soft); }
article strong { color: var(--ink); font-weight: 700; }
article ul, article ol { margin: 0 0 16px; padding-left: 22px; color: var(--ink-soft); }
article li { margin-bottom: 8px; }
article li strong { color: var(--ink); }
.checklist { list-style: none; padding-left: 0; }
.checklist li {
  position: relative;
  padding-left: 30px;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0; top: 3px;
  width: 18px; height: 18px;
  border: 1.6px solid var(--danger);
  border-radius: 5px;
  background: var(--surface);
}

.callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-faint);
  background: var(--surface);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 20px;
  font-size: 14.5px;
  box-shadow: var(--shadow);
}
.callout p { margin: 0; color: var(--ink-soft); }
.callout-label { font-weight: 700; display: block; margin-bottom: 4px; font-size: 13px; letter-spacing: 0.02em; }
.callout-info { border-left-color: var(--accent); }
.callout-info .callout-label { color: var(--accent-strong); }
.callout-caution { border-left-color: var(--warn); background: var(--warn-bg); }
.callout-caution .callout-label { color: var(--warn); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-bg); }
.callout-danger .callout-label { color: var(--danger); }
.callout-danger ul { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 480px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); color: var(--ink-soft); font-weight: 600; font-size: 12.5px; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: none; }
td, th { font-variant-numeric: tabular-nums; }

.related {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.related h2 { border-top: none; padding-top: 0; margin-top: 0; }
.related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.related a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14.5px;
  background: var(--surface);
}
.related a:hover { border-color: var(--accent); color: var(--accent-strong); }

.footer {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding: 28px 40px 40px;
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.9;
}
.footer strong { color: var(--ink-soft); }
.footer-links { margin: 12px 0 0; }
.footer-links a { color: var(--ink-faint); text-decoration: underline; }
.footer-links a:hover { color: var(--ink-soft); }

.home-links { display: flex; flex-direction: column; gap: 4px; margin: 0 0 22px; }
.home-cat { margin: 34px 0 12px; }
.home-cat h2 { border-top: none; padding-top: 0; margin: 0 0 6px; font-size: 18px; }
.home-cat > p { margin: 0 0 12px; font-size: 14px; }
.home-cat .related { margin-top: 0; padding-top: 0; border-top: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 78vw;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 40;
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 30;
  }
  .scrim.open { display: block; }
  .content-wrap { padding: 28px 20px 60px; }
  .footer { padding: 24px 20px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
