/* スマホ優先・1ファイル・システムフォント・外部リソースなし */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --border: #d9dee6;
  --accent: #c2410c;
  --accent-bg: #fff4ec;
  --accent-border: #f3b48c;
  --link: #0b5cad;
  --head-bg: #1f2937;
  --head-text: #ffffff;
  --th-bg: #eef1f5;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b212a;
    --text: #e6e9ee;
    --muted: #a0aab8;
    --border: #323b48;
    --accent: #ffa366;
    --accent-bg: #2a2018;
    --accent-border: #6b4527;
    --link: #7fb8ff;
    --head-bg: #0c0f13;
    --head-text: #f2f4f7;
    --th-bg: #232b36;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  word-break: normal;
  overflow-wrap: anywhere;
}

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

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ヘッダー */
.site-header { background: var(--head-bg); color: var(--head-text); }
.header-inner { padding-top: 10px; padding-bottom: 6px; }
.site-name {
  color: var(--head-text); font-weight: 700; font-size: 1.2rem; text-decoration: none;
  display: inline-block; padding: 4px 0;
}
.global-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.global-nav a {
  display: block; padding: 6px 12px; color: var(--head-text); text-decoration: none;
  border-radius: 999px; font-size: 0.95rem; background: rgba(255, 255, 255, 0.12);
}
.global-nav a:hover { background: rgba(255, 255, 255, 0.24); }
.header-inner { padding-bottom: 12px; }

main { padding-top: 12px; padding-bottom: 32px; }

/* パンくず */
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin: 4px 0 8px; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.breadcrumb li + li::before { content: "›"; margin: 0 6px; color: var(--muted); }

/* 見出し */
h1 { font-size: 1.4rem; line-height: 1.4; margin: 12px 0 8px; }
h2 {
  font-size: 1.2rem; line-height: 1.4; margin: 32px 0 12px; padding: 6px 0 6px 12px;
  border-left: 5px solid var(--accent); background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}
h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.lead { color: var(--muted); margin: 4px 0 16px; }

/* メタ情報 */
.meta { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 0.9rem; color: var(--muted); }

/* 早見表 */
.quick { margin-top: 16px; }
.quick h2 { margin-top: 0; }
.quick-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.quick-card {
  background: var(--accent-bg); border: 2px solid var(--accent-border);
  border-radius: var(--radius); padding: 10px 14px 8px;
}
.quick-label { font-size: 0.85rem; font-weight: 700; color: var(--accent); letter-spacing: 0.05em; }
.quick-value p { margin: 2px 0; font-size: 1.1rem; font-weight: 700; line-height: 1.5; }
.quick-more { font-size: 0.8rem; }

@media (min-width: 640px) {
  .quick-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.7rem; }
}

/* 本文 */
.prose p { margin: 0 0 1em; }
.pre p { white-space: pre-line; }
.summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 2px; margin: 16px 0; }

.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin: 16px 0; }
.toc-title { margin: 0; font-weight: 700; }
.toc ul { margin: 6px 0 0; padding-left: 1.2em; }

/* 表 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
caption { text-align: left; font-weight: 700; padding: 8px 12px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; line-height: 1.55; }
thead th { background: var(--th-bg); white-space: nowrap; }
tbody th { background: var(--th-bg); font-weight: 700; min-width: 7em; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.list-table td { min-width: 9em; }
table .plain { list-style: none; margin: 0; padding: 0; }
table .plain li + li { margin-top: 4px; }

/* 項目: 値 */
.kv { margin: 8px 0 16px; display: grid; gap: 8px; }
.kv > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; }
.kv dt { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.kv dd { margin: 2px 0 0; font-weight: 600; }

.check-list { padding-left: 1.3em; }
.check-list li { margin-bottom: 6px; }

/* リンク一覧 */
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.link-list .sub { margin-left: 10px; font-size: 0.8rem; color: var(--muted); }
.link-list.inline { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.link-list.inline li { border: 0; padding: 0; }
@media (min-width: 640px) {
  .link-list.columns { columns: 2; column-gap: 24px; }
  .link-list.columns li { break-inside: avoid; }
}
.card-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-links a {
  display: block; padding: 14px 10px; text-align: center; font-weight: 700; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.card-links a:hover { border-color: var(--accent); }
@media (min-width: 640px) { .card-links { grid-template-columns: repeat(3, 1fr); } }

.more { margin: 12px 0; text-align: right; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; }

/* 検索 */
.search { margin: 16px 0; }
.search-label { display: block; font-weight: 700; margin-bottom: 6px; }
.search input {
  width: 100%; font: inherit; padding: 12px 14px; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: var(--radius);
}
.search input:focus { border-color: var(--accent); }
.search[hidden], [data-sort-controls][hidden] { display: none; }

/* 並べ替え */
.sort-controls { margin: 8px 0; font-size: 0.9rem; }
.sort-controls button {
  font: inherit; padding: 6px 12px; margin-left: 6px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.sort-controls button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .sort-controls button[aria-pressed="true"] { color: #12161c; } }

/* 出典・免責 */
.sources { padding-left: 1.4em; font-size: 0.9rem; }
.disclaimer-line { font-size: 0.85rem; color: var(--muted); }

/* 広告 */
.ad-slot { margin: 20px 0; min-height: 0; text-align: center; overflow: hidden; }

/* フッター */
.site-footer { background: var(--head-bg); color: var(--head-text); padding: 20px 0 28px; font-size: 0.85rem; }
.site-footer a { color: var(--head-text); }
.footer-links { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer p { margin: 6px 0; opacity: 0.9; }
.fixed-page h2 { font-size: 1.1rem; }
.fixed-page ul, .fixed-page ol { padding-left: 1.4em; }

@media print { .site-header, .site-footer, .ad-slot, .toc { display: none; } }

/* v2: 出典・更新日 / 用語リンク / FAQ / 用語ガイド / 五十音 */
.quick-meta { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.term-link { margin: -4px 0 10px; font-size: 0.8rem; }
.faq h3 { font-size: 1rem; margin: 16px 0 4px; }
.faq h3::before { content: "Q. "; color: var(--accent); font-weight: 700; }
.faq p { margin: 0 0 8px; padding-left: 1.6em; position: relative; }
.faq p::before { content: "A."; position: absolute; left: 0; font-weight: 700; color: var(--muted); }
.glossary-index ul, .row-nav ul { list-style: none; margin: 8px 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.glossary-index a, .row-nav a {
  display: block; padding: 4px 12px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; font-size: 0.9rem;
}
.glossary dt { font-weight: 700; font-size: 1.05rem; margin-top: 20px; padding-left: 10px; border-left: 4px solid var(--accent); scroll-margin-top: 12px; }
.glossary dd { margin: 4px 0 0; }
.row-nav + section h2, section[id^="row-"] h2 { margin-top: 24px; }
