:root {
  --text: #1f2933;
  --muted: #5f6b76;
  --bg: #ffffff;
  --bg-soft: #f4f7f9;
  --line: #d9e1e7;
  --accent: #0f5f78;
  --accent-soft: #e6f1f5;
  --cta: #d9480f;
  --cta-hover: #b83c0c;
  --radius: 8px;
  --max: 760px;
}

*, *::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, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

a { color: var(--accent); }
a:hover { text-decoration: none; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding-top: 12px; padding-bottom: 12px; }
.site-name { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.global-nav ul, .site-footer ul { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; }
.global-nav a { color: var(--text); text-decoration: none; font-size: .95rem; }
.global-nav a:hover { color: var(--accent); }
.site-footer { margin-top: 64px; padding: 24px 0 32px; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: .9rem; }
.site-footer a { color: var(--muted); }
.copyright { color: var(--muted); margin: 12px 0 0; }

/* Page chrome */
.breadcrumb ol { display: flex; flex-wrap: wrap; margin: 12px 0 0; padding: 0; list-style: none; font-size: .8rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin: 0 6px; }
.breadcrumb a { color: var(--muted); }
.pr-label { margin: 12px 0 0; font-size: .8rem; color: var(--muted); }
h1 { font-size: 1.6rem; line-height: 1.45; margin: 16px 0 8px; }
.meta { margin: 0 0 16px; font-size: .85rem; color: var(--muted); }

/* Content */
.content h2, .sources h2, .related h2, .children h2, .category h2 { font-size: 1.3rem; line-height: 1.5; margin: 48px 0 16px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.content h3 { font-size: 1.1rem; margin: 32px 0 12px; }
.content p, .content ul, .content ol { margin: 0 0 1.2em; }
.content li { margin-bottom: .3em; }
.content blockquote { margin: 0 0 1.2em; padding: 12px 16px; background: var(--bg-soft); border-left: 4px solid var(--line); }
.table-wrap { overflow-x: auto; margin: 0 0 1.5em; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; min-width: 100%; font-size: .92rem; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--bg-soft); white-space: nowrap; }

.summary { margin: 16px 0 24px; padding: 16px; background: var(--accent-soft); border-radius: var(--radius); }
.summary-title { margin: 0 0 8px; font-weight: 700; color: var(--accent); }
.summary ul { margin: 0; padding-left: 1.3em; }

.toc { margin: 0 0 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.toc-title { margin: 0 0 8px; font-weight: 700; }
.toc ol { margin: 0; padding-left: 1.4em; }

/* CTA */
.cta { margin: 32px 0; padding: 20px 16px; border: 2px solid var(--cta); border-radius: var(--radius); text-align: center; }
.cta-scope, .cta-note { margin: 0; font-size: .85rem; color: var(--muted); }
.cta-button { display: block; max-width: 420px; margin: 12px auto; padding: 14px 16px; background: var(--cta); color: #fff; border-radius: var(--radius); font-weight: 700; text-decoration: none; line-height: 1.5; }
.cta-button:hover { background: var(--cta-hover); }
.cta-fallback { border-color: var(--line); background: var(--bg-soft); text-align: left; }
.cta-fallback p { margin: 0; }

/* Lists of pages */
.page-list, .related ul, .sources ul { margin: 0; padding: 0; list-style: none; }
.page-list li, .related li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.page-list a, .related a { font-weight: 700; }
.page-list p, .related p { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.sources li { font-size: .88rem; margin-bottom: 6px; }
.category h2 a { color: var(--text); text-decoration: none; }
.empty { color: var(--muted); }

/* Tools */
.tool:empty { display: none; }
.tool { margin: 16px 0 32px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }

@media (min-width: 768px) {
  h1 { font-size: 1.9rem; }
}

/* Diagnosis tool */
.diag-title { margin: 0 0 8px; font-weight: 700; font-size: 1.1rem; }
.diag fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.diag legend { font-weight: 700; margin-bottom: 6px; }
.diag label { display: block; padding: 8px 12px; margin-bottom: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; line-height: 1.5; }
.diag label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.diag input { margin-right: 6px; }
.diag-result { margin-top: 8px; }
.diag-hint, .diag-note { font-size: .88rem; color: var(--muted); margin: 0; }
.diag-verdict { font-weight: 700; font-size: 1.15rem; padding: 12px 14px; border-radius: var(--radius); background: var(--bg); border-left: 5px solid var(--accent); margin: 0 0 12px; }
.diag-replace { border-left-color: var(--cta); }
.diag-result ul { padding-left: 1.3em; margin: 0 0 12px; }
.diag-next { margin: 0 0 8px; }
