:root {
  color-scheme: light dark;
  --paper: #f7f4ed;
  --paper-raised: #fffdf8;
  --ink: #18211d;
  --muted: #5b6861;
  --line: #d8d7cd;
  --brand: #164f43;
  --brand-strong: #0d3b32;
  --brand-soft: #dceae5;
  --accent: #b36a35;
  --fact: #e9f3ef;
  --claim: #edf0f5;
  --commentary: #f7eee3;
  --limitation: #f8e8e3;
  --max: 1120px;
  --reading: 760px;
  font-family: Inter, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
a { color: var(--brand); text-underline-offset: .18em; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #e69a59;
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 100;
  transform: translateY(-180%);
  padding: .7rem 1rem;
  border-radius: .4rem;
  color: #fff;
  background: var(--brand-strong);
}
.skip-link:focus { transform: none; }
.content-width { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.notes-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  background: color-mix(in srgb, var(--paper-raised), transparent 6%);
  backdrop-filter: blur(12px);
}
.notes-header-inner {
  width: min(calc(100% - 40px), var(--max));
  min-height: 76px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.notes-brand { color: var(--ink); text-decoration: none; line-height: 1.25; }
.notes-brand strong { display: block; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 1.2rem; letter-spacing: .06em; }
.notes-brand span { display: block; margin-top: .2rem; color: var(--muted); font-size: .68rem; letter-spacing: .04em; }
.notes-header nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.notes-header nav a { color: var(--ink); font-size: .88rem; font-weight: 700; text-decoration: none; }
.page-hero {
  padding: clamp(4rem, 9vw, 7.5rem) 0 clamp(3rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-soft), transparent 28%), transparent 54%),
    var(--paper-raised);
}
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 2.7rem; color: var(--muted); font-size: .78rem; }
.breadcrumbs a { color: var(--muted); }
.eyebrow { margin: 0 0 .8rem; color: var(--accent); font-size: .73rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3 { line-height: 1.35; text-wrap: balance; }
h1, .page-hero h1 {
  max-width: 900px;
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2.25rem, 6vw, 4.75rem);
  font-weight: 600;
  letter-spacing: -.025em;
}
.page-hero .lead { max-width: 760px; margin: 1.5rem 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.23rem); }
.section { padding: clamp(3.5rem, 8vw, 7rem) 0; }
.section-tint { background: var(--paper-raised); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-heading h2, .section h2 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(1.75rem, 4vw, 2.65rem); font-weight: 600; }
.split-intro { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(250px, .75fr); gap: clamp(2rem, 7vw, 6rem); }
.split-intro > div > p { max-width: 720px; font-size: 1.08rem; }
.principles { padding: 1.6rem; border: 1px solid var(--line); border-top: 4px solid var(--brand); background: var(--paper-raised); }
.principles h2 { font-size: 1.2rem; }
.principles ol { margin-bottom: 0; padding-left: 1.3rem; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.paper-card {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--paper-raised);
  box-shadow: 0 12px 38px rgba(24, 33, 29, .04);
}
.paper-card h2 { margin: 1.05rem 0 .7rem; font-size: clamp(1.25rem, 2vw, 1.65rem); }
.paper-card h2 a { color: var(--ink); text-decoration: none; }
.paper-card p { color: var(--muted); }
.paper-card-meta { display: flex; align-items: center; justify-content: space-between; gap: .8rem; color: var(--muted); font-size: .75rem; }
.taxonomy { display: inline-flex; padding: .2rem .65rem; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-weight: 800; text-decoration: none; }
.taxonomy-static { cursor: default; }
.tag-list { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.2rem 0; padding: 0; list-style: none; }
.tag-list a, .tag-list span, .article-tags a, .article-tags span { color: var(--muted); font-size: .78rem; text-decoration: none; }
.text-link { font-weight: 800; }
.taxonomy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: 1.8rem; }
.taxonomy-grid > a {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--ink);
  text-decoration: none;
}
.taxonomy-grid > a:hover { border-color: var(--brand); }
.taxonomy-grid span { color: var(--muted); font-size: .82rem; }
.feature-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1.8rem; }
.feature-nav a { min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; padding: 1.3rem; border: 1px solid var(--line); color: var(--ink); background: var(--paper-raised); text-decoration: none; }
.feature-nav a:hover { border-color: var(--brand); }
.feature-nav span { color: var(--accent); font-size: .73rem; font-weight: 800; letter-spacing: .08em; }
.editorial-link { margin-top: 1.4rem; color: var(--muted); font-size: .86rem; }
.action-section { padding-top: 0; }
.action-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  background: var(--paper-raised);
}
.action-banner h2 { margin: 0; }
.action-banner p:not(.eyebrow) { max-width: 720px; margin-bottom: 0; color: var(--muted); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .7rem; }
.tag-cloud a { padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-raised); text-decoration: none; }
.tag-cloud span { color: var(--muted); }
.newsletter-section { color: #f7faf8; background: var(--brand-strong); }
.newsletter-section .content-width { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 3rem; }
.newsletter-section h2 { color: #fff; }
.newsletter-section .eyebrow { color: #efb682; }
.newsletter-section input { width: 100%; min-height: 48px; padding: .7rem; border: 1px solid #bdd0c9; background: #fff; color: #17201c; }
.newsletter-section button, .button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem 1rem;
  border: 1px solid var(--brand);
  border-radius: .25rem;
  color: #fff;
  background: var(--brand);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}
.newsletter-disabled { display: grid; grid-template-columns: 1fr auto; }
.newsletter-disabled button { border-color: #72847d; background: #72847d; }
.newsletter-disabled input:disabled { opacity: .82; }
.article-layout { display: grid; grid-template-columns: minmax(0, var(--reading)) minmax(240px, 1fr); gap: clamp(2rem, 6vw, 5rem); padding-top: clamp(2.5rem, 6vw, 5rem); padding-bottom: clamp(4rem, 8vw, 7rem); }
.article-content { min-width: 0; }
.article-content > h2 { margin: 4rem 0 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(1.65rem, 3vw, 2.25rem); }
.article-content > h3 { margin-top: 2.4rem; font-size: 1.3rem; }
.article-content > p, .article-content > ul, .article-content > ol { font-size: 1.02rem; }
.article-content li + li { margin-top: .55rem; }
.article-content pre { max-width: 100%; padding: 1rem; overflow-x: auto; border: 1px solid var(--line); background: var(--paper-raised); }
.article-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; white-space: nowrap; }
.article-content th, .article-content td { padding: .65rem .8rem; border: 1px solid var(--line); text-align: left; }
.article-content .math { max-width: 100%; overflow-x: auto; }
.article-content blockquote { margin: 0 0 2rem; padding: 1.2rem 1.4rem; border-left: 4px solid var(--brand); background: var(--brand-soft); font-weight: 600; }
.byline { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin-bottom: 1.5rem; color: var(--muted); font-size: .8rem; }
.paper-metadata { margin: 0 0 2rem; border-top: 1px solid var(--line); }
.paper-metadata > div { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.paper-metadata dt { color: var(--muted); font-size: .78rem; font-weight: 800; }
.paper-metadata dd { margin: 0; font-size: .86rem; }
.article-action {
  margin: 2rem 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  background: var(--paper-raised);
}
.article-action h2 { margin: 0 0 .7rem; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 1.45rem; }
.article-action p:not(.eyebrow) { color: var(--muted); }
.article-action .button { width: 100%; }
.toc { margin: 2rem 0 3rem; padding: 1.35rem 1.55rem; border: 1px solid var(--line); background: var(--paper-raised); }
.toc h2 { margin: 0 0 .7rem; font-size: 1rem; font-family: inherit; }
.toc ol { columns: 2; margin: 0; padding-left: 1.3rem; font-size: .82rem; }
.toc li { break-inside: avoid; margin-bottom: .25rem; }
.content-box { margin: 2rem 0; padding: 1.3rem 1.45rem; border: 1px solid var(--line); border-left-width: 5px; border-radius: .2rem; }
.content-box h3 { margin: 0 0 .6rem; font-family: inherit; font-size: .92rem; letter-spacing: .03em; }
.content-box p { margin: .35rem 0 0; }
.FactBox { border-left-color: #28735f; background: var(--fact); }
.AuthorClaim { border-left-color: #526788; background: var(--claim); }
.CommentaryBox { border-left-color: var(--accent); background: var(--commentary); }
.LimitationBox { border-left-color: #a34b3d; background: var(--limitation); }
.SourceCard, .CitationBlock, .LicenseBadge, .DisclosureBox, .CorrectionNotice, .AffiliateDisclosure { border-left-color: var(--muted); background: var(--paper-raised); }
.CitationBlock p:not(.box-source) { font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; }
.box-source { font-size: .78rem; }
.ad-slot { min-height: 100px; margin: 2.5rem 0; padding: 1rem; border: 1px dashed var(--line); text-align: center; }
.ad-slot > span { display: block; color: var(--muted); font-size: .68rem; letter-spacing: .12em; }
.ad-slot-disabled p { margin: .2rem 0 0; color: var(--muted); font-size: .75rem; }
.article-tags { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.related-reading {
  margin: 3rem 0 1rem;
  padding: clamp(1.4rem, 3vw, 2rem);
  border: 1px solid var(--line);
  background: var(--paper-raised);
}
.related-reading h2 { margin: 0 0 .5rem; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 1.55rem; }
.related-reading > p:not(.eyebrow) { color: var(--muted); }
.related-grid { display: grid; gap: .75rem; margin-top: 1.25rem; }
.related-grid a { display: grid; gap: .25rem; padding: 1rem; border-left: 4px solid var(--brand); color: var(--ink); background: var(--paper); text-decoration: none; }
.related-grid a:hover { border-left-color: var(--accent); }
.related-grid span { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .05em; }
.related-grid strong { line-height: 1.55; }
.article-rail { min-width: 0; }
.rail-card { position: sticky; top: 110px; padding: 1.3rem; border-top: 4px solid var(--brand); background: var(--paper-raised); }
.rail-card h2 { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 1.35rem; }
.rail-card p { color: var(--muted); font-size: .85rem; }
.rail-card .button { width: 100%; font-size: .84rem; }
.decision-intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); gap: 2rem; align-items: start; }
.learning-route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.book-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.learning-route {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: var(--paper-raised);
}
.learning-route.recommended { border-top: 5px solid var(--brand); }
.learning-route h2 { margin: .8rem 0; font-size: 1.35rem; }
.learning-route p, .learning-route li { color: var(--muted); font-size: .9rem; }
.learning-route ul { margin: 0 0 1.3rem; padding-left: 1.2rem; }
.learning-route .button { width: 100%; margin-top: auto; text-align: center; }
.route-label { color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.route-note { margin-bottom: 0; font-size: .75rem !important; }
.not-for { padding-top: .8rem; border-top: 1px solid var(--line); }
.source-link { display: inline-block; margin: 0 0 1rem; font-size: .82rem; font-weight: 700; }
.affiliate-notice { padding: .75rem; border-left: 3px solid var(--accent); background: var(--commentary); color: var(--ink) !important; font-size: .78rem !important; }
.secondary-button { color: var(--brand); background: transparent; }
.secondary-button:hover { color: #fff; background: var(--brand); }
.example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; }
.example-grid article { padding: 1.35rem; border-top: 4px solid var(--brand); background: var(--paper); }
.example-grid h3 { margin-top: 0; }
.example-grid p { color: var(--muted); font-size: .9rem; }
.example-grid a { font-weight: 800; }
.faq-section { max-width: var(--reading); }
.faq-section details { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.faq-section summary { cursor: pointer; font-weight: 800; }
.faq-section details p { margin-bottom: 0; color: var(--muted); }
.measurement-note { max-width: var(--reading); }
.analytics-consent {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  width: min(calc(100% - 2rem), 680px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  background: var(--paper-raised);
  box-shadow: 0 18px 60px rgba(10, 20, 15, .22);
}
.analytics-consent p { margin: .25rem 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.analytics-consent a { font-size: .75rem; }
.analytics-consent-actions { display: flex; gap: .5rem; }
.analytics-consent button { min-height: 42px; padding: .5rem .8rem; border: 1px solid var(--brand); color: var(--ink); background: transparent; font: inherit; font-size: .78rem; font-weight: 700; }
.analytics-consent button[data-analytics-consent="granted"] { color: #fff; background: var(--brand); }
.policy-content { max-width: var(--reading); }
.policy-content h2 { margin-top: 3rem; font-size: 1.6rem; }
.policy-list { border-top: 1px solid var(--line); }
.policy-list > div { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.policy-list dd { margin: 0; }
.notice { padding: 1rem; border-left: 4px solid var(--accent); background: var(--commentary); }
.policy-updated { margin-top: 4rem; color: var(--muted); font-size: .78rem; }
.disabled-form { display: grid; gap: 1rem; max-width: 580px; padding: 1.3rem; border: 1px solid var(--line); opacity: .72; }
.disabled-form label { display: grid; gap: .4rem; }
.disabled-form input, .disabled-form textarea { min-height: 44px; }
.disabled-form textarea { min-height: 120px; }
.disabled-form button { min-height: 44px; }
.empty-state { grid-column: 1 / -1; padding: 3rem; border: 1px solid var(--line); text-align: center; }
.error-page { min-height: 66vh; display: grid; align-items: center; text-align: center; }
.error-code { margin: 0; color: var(--accent); font: 700 clamp(5rem, 20vw, 12rem)/1 Georgia, serif; }
.error-page h1 { margin: 0 auto 1rem; font-size: clamp(2rem, 5vw, 3.6rem); }
.error-actions { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin-top: 2rem; }
.notes-footer { padding: 3rem 0 1.5rem; border-top: 1px solid var(--line); background: var(--paper-raised); }
.notes-footer-inner { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; }
.notes-footer-inner > div p { margin: .2rem 0; color: var(--muted); font-size: .82rem; }
.notes-footer nav { display: flex; flex-wrap: wrap; align-content: start; gap: .65rem 1rem; }
.notes-footer nav a { color: var(--muted); font-size: .78rem; }
.copyright { width: min(calc(100% - 40px), var(--max)); margin: 2rem auto 0; color: var(--muted); font-size: .72rem; }
code { padding: .12rem .35rem; border-radius: .2rem; background: color-mix(in srgb, var(--line), transparent 48%); font-size: .9em; }

@media (max-width: 900px) {
  .notes-header { position: static; }
  .notes-header-inner { align-items: flex-start; flex-direction: column; gap: .7rem; padding: 1rem 0; }
  .notes-header nav { gap: .55rem 1rem; }
  .split-intro, .article-layout, .notes-footer-inner, .decision-intro, .learning-route-grid, .book-grid, .example-grid { grid-template-columns: 1fr; }
  .article-rail { order: -1; }
  .rail-card { position: static; }
  .taxonomy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .content-width, .notes-header-inner, .notes-footer-inner, .copyright { width: min(calc(100% - 28px), var(--max)); }
  body { line-height: 1.75; }
  .page-hero { padding-top: 3rem; }
  .breadcrumbs { margin-bottom: 1.8rem; }
  .card-grid, .taxonomy-grid, .feature-nav, .newsletter-section .content-width, .action-banner, .analytics-consent { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .toc ol { columns: 1; }
  .paper-metadata > div, .policy-list > div { grid-template-columns: 1fr; gap: .2rem; }
  .article-layout { padding-top: 2rem; }
  .article-content > h2 { margin-top: 3rem; }
  .error-actions { flex-direction: column; }
  .analytics-consent-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .analytics-consent button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111713;
    --paper-raised: #17201b;
    --ink: #edf2ee;
    --muted: #acb9b1;
    --line: #34423a;
    --brand: #83c6b3;
    --brand-strong: #0b2d26;
    --brand-soft: #203b33;
    --accent: #e5a26e;
    --fact: #193a31;
    --claim: #242f40;
    --commentary: #3b2b20;
    --limitation: #402521;
  }
  .newsletter-section { background: #092820; }
  .paper-card { box-shadow: none; }
}
