:root {
  --navy: #17375f; --navy-light: #1d3f6b; --paper: #fffef9;
  --ink: #172331; --blue: #075b9a; --gold: #a76800; --green: #237858;
  --red: #b3332f; --line: #b9ad98; --muted: #526173;
  --back-slot: max(78px,calc(env(safe-area-inset-bottom) + 64px));
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink); background: #f2efe7; font-size: 16px; line-height: 1.78;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
.document-scroll { height: calc(100dvh - var(--back-slot)); overflow: auto; overscroll-behavior: contain; }
body::after { content: ""; position: fixed; inset: auto 0 0; height: var(--back-slot); border-top: 1px solid var(--line); background: #eee9df; pointer-events: none; z-index: 20; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 1px solid #8b816e; background: var(--paper); color: var(--navy); border-radius: 9px; padding: 9px 15px; cursor: pointer; line-height: 1.45; min-height: 42px; }
button:hover { background: #f0e9dc; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #c99032; outline-offset: 3px; }
a { color: var(--blue); text-underline-offset: 3px; }
p { margin: .65em 0; }
h1, h2, h3, h4 { line-height: 1.45; }
h2 { color: var(--navy); font-size: 1.55rem; margin: 0 0 22px; }
h3 { color: var(--navy); font-size: 1.18rem; margin: 0 0 14px; }
h4 { font-size: 1.04rem; margin: 0 0 12px; }
.skip { position: absolute; top: -90px; left: 12px; z-index: 100; background: white; padding: 12px; }
.skip:focus { top: 8px; }
.language-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; max-width: 1360px; margin: auto; padding: 9px 28px; }
.all-guides { font-size: .86rem; font-weight: 700; }
.language-buttons { display: flex; gap: 8px; }
.language-buttons button { border-radius: 999px; min-height: 36px; padding: 7px 15px; font-size: .8rem; }
.language-buttons button[aria-pressed="true"] { color: white; background: var(--navy); border-color: var(--navy); }
.hero { color: white; background: radial-gradient(circle at 83% -55%, #ffffff1e, transparent 31rem),linear-gradient(118deg,var(--navy),var(--navy-light)); }
.hero-inner { max-width: 1480px; margin: auto; padding: 34px clamp(24px,5.2vw,80px) 36px; }
.edition { font-size: .87rem; font-weight: 700; margin-bottom: 10px; letter-spacing: .04em; }
.hero h1 { font-family: YuMincho, "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(2rem,4.1vw,3.45rem); line-height: 1.24; margin: 0; text-wrap: balance; letter-spacing: .015em; }
html[lang="en"] .hero h1 { font-size: clamp(1.8rem,3.7vw,3.25rem); }
.category-nav { background: #fffdf8; border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px #14233c12; overflow-x: auto; }
.category-nav > div { display: flex; gap: 6px 28px; width: max-content; min-width: min(100%,1480px); margin: auto; padding: 10px clamp(24px,5.2vw,80px); }
.category-nav a { display: inline-flex; align-items: center; min-height: 34px; font-weight: 850; font-size: .92rem; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none; }
.category-nav a[aria-current="page"] { border-color: var(--gold); color: var(--navy); }
.utility { border-bottom: 1px solid var(--line); background: #eae4d8; }
.utility-inner { max-width: 1360px; display: flex; gap: 18px; justify-content: flex-end; align-items: center; margin: auto; padding: 12px 28px; }
#progress-circle { border: 2px solid var(--navy); width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: var(--green); background: var(--paper); flex-shrink: 0; box-shadow: inset 0 0 0 4px #eee8dd; }
.utility-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
.search-panel { max-width: 1288px; margin: 28px auto 20px; border: 1px solid #b2bccb; border-radius: 14px; padding: 18px 22px; background: #fffef9; }
.search-panel h2 { font-size: 1rem; margin: 0 0 7px; }
.search-panel label { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 8px; }
.search-controls { display: flex; gap: 10px; }
.search-controls button { flex-shrink: 0; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.search-controls input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #8798b3; border-radius: 6px; color: var(--ink); background: white; }
#search-status { font-size: .86rem; color: var(--muted); margin-top: 4px; }
#search-results { padding: 0 0 0 24px; max-height: 400px; overflow-y: auto; }
#search-results li { margin: 12px 0; padding-right: 12px; }
.result-context { display: block; font-size: .86rem; color: var(--muted); }
.notices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; max-width: 1288px; margin: 20px auto 30px; }
.notice { border: 1px solid #aa7865; background: #f6e8df; border-radius: 14px; padding: 16px 20px; }
.notice:nth-child(2) { background: #e5eee9; border-color: #6d8b79; }
.notice h2 { font-size: .98rem; margin: 0 0 8px; }
.notice p { margin: 0; font-size: .92rem; line-height: 1.85; }
.layout { display: grid; grid-template-columns: 244px minmax(0,1fr); gap: 34px; max-width: 1360px; margin: 0 auto; padding: 0 28px 50px; }
.toc { align-self: start; position: sticky; top: 20px; border: 1px solid var(--line); background: var(--paper); border-radius: 17px; padding: 19px 22px; box-shadow: 0 14px 35px #29200c10; }
.toc summary { font-size: .92rem; font-weight: 800; color: var(--gold); cursor: pointer; }
#toc-links { display: grid; gap: 5px; margin-top: 14px; }
#toc-links a { font-size: .87rem; color: #46566c; padding: 5px 0; text-decoration: none; }
main { min-width: 0; }
.view { scroll-margin-top: 20px; }
.progress-panel, .data-section { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); padding: 24px; box-shadow: 0 8px 24px #22200d0a; margin: 0 0 24px; }
.progress-line { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
#progress-text { color: var(--gold); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 12px; margin-top: 16px; accent-color: var(--green); }
.muted { color: var(--muted); font-size: .84rem; }
.chart-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 16px; }
.chapter { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); margin-bottom: 22px; overflow: clip; }
.chapter > summary { font-size: 1.18rem; font-weight: 800; color: var(--navy); padding: 22px; cursor: pointer; }
.chapter[open] > summary { border-bottom: 1px solid #cec4b3; }
.chapter-body { background: #ebe4d6; padding: 20px; }
.chapter-body > p { margin: 0 0 20px; }
.route-card { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 14px; background: var(--paper); box-shadow: 0 5px 15px #28200c0a; scroll-margin-top: 24px; }
.route-card:last-child { margin-bottom: 0; }
.route-heading { display: flex; align-items: flex-start; gap: 16px; }
.route-heading h4 { margin: 0; padding-top: 2px; }
.route-check { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--green); margin: 2px 0 0; cursor: pointer; }
.route-card ol { margin: 13px 0 0 35px; padding-left: 22px; }
.route-card li { padding-left: 2px; margin: 7px 0; }
.route-card:has(.route-check:checked) { padding-bottom: 60px; border-color: var(--green); box-shadow: 0 7px 18px #1857421a; }
.stamp { display: none; position: absolute; right: 15px; bottom: 12px; width: 64px; height: 32px; place-items: center; border: 2px solid var(--red); color: var(--red); border-radius: 4px 6px 5px 3px; font-size: .89rem; font-weight: 900; line-height: 1; letter-spacing: .08em; background: radial-gradient(circle at 16% 28%,#fffef9 0 1px,transparent 1.35px) 0 0/9px 8px,#fffdf8; transform: none; }
.route-card:has(.route-check:checked) .stamp { display: grid; }
.route-card.bump { animation: card-bump .58s ease; }
.route-card.bump .stamp { animation: stamp-pop .58s ease; }
#progress-circle.bump { animation: progress-bump .64s ease; }
.note { border: 1px solid #c6b99e; border-radius: 8px; background: #f3ecd9; padding: 12px 14px; margin: 14px 0 0 40px; font-size: .9rem; }
.references { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.references a { font-size: .85rem; padding: 5px 10px; background: white; border: 1px solid #899ab2; border-radius: 5px; text-decoration: none; }
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid #b7c3d3; border-radius: 11px; }
table { width: 100%; border-collapse: collapse; font-size: .91rem; line-height: 1.75; }
caption { text-align: left; padding: 10px 13px; font-weight: 700; background: #ece8dc; }
thead th { color: white; background: #223f66; white-space: nowrap; }
th, td { text-align: left; vertical-align: top; padding: 12px 13px; border: 1px solid #d0d8e2; min-width: 140px; }
tbody th { font-weight: 750; min-width: 155px; }
tbody tr:nth-child(even) { background: #eff3f6; }
tbody tr:target { background: #fff1c9; }
.text-card { padding: 20px 0; border-top: 1px solid #cec4b3; scroll-margin-top: 24px; }
.text-card h4 { color: var(--navy); }
footer { text-align: center; padding: 28px 72px 40px; border-top: 1px solid var(--line); background: #ebe5d9; }
footer a { font-weight: 700; }
.back-top { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border-radius: 50%; border: 1px solid #7e8998; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c38; font-size: 1.15rem; font-weight: 900; }
#storage-status { max-width: 1288px; margin: 16px auto; border: 1px solid #af7061; padding: 16px 20px; border-radius: 12px; background: #f9e9df; }
#storage-status button { margin: 12px 0 0 12px; }
@keyframes card-bump { 0% { transform: scale(1); } 36% { transform: scale(1.012); } 68% { transform: scale(.997); } 100% { transform: scale(1); } }
@keyframes stamp-pop { 0% { opacity: 0; transform: scale(1.4); } 58% { opacity: 1; transform: scale(.92); } 100% { opacity: 1; transform: scale(1); } }
@keyframes progress-bump { 0%,100% { transform: scale(1); } 34% { transform: scale(1.18); } 62% { transform: scale(.94); } }
@media (max-width: 760px) {
  .language-bar { padding: 9px 16px; gap: 8px; flex-wrap: wrap; }
  .all-guides { font-size: .79rem; }
  .language-buttons button { padding: 7px 11px; }
  .hero-inner { padding: 26px 20px 28px; }
  .hero h1 { font-size: clamp(1.55rem,7vw,2.15rem); }
  html[lang="en"] .hero h1 { font-size: clamp(1.55rem,7.3vw,2.2rem); }
  .edition { font-size: .79rem; }
  .category-nav > div { padding: 8px 20px; gap: 20px; }
  .category-nav a { font-size: .84rem; }
  .utility-inner { padding: 10px 18px; }
  #progress-circle { width: 54px; height: 54px; }
  .utility-buttons button { font-size: .84rem; }
  .search-panel { margin: 20px 15px 16px; padding: 16px; }
  .notices { grid-template-columns: 1fr; margin: 16px 15px 22px; }
  .notice { padding: 16px; }
  .layout { grid-template-columns: 1fr; gap: 22px; padding: 0 15px 78px; }
  .toc { position: static; padding: 14px 18px; }
  #toc-links { gap: 3px; }
  .progress-panel, .data-section { padding: 18px 16px; }
  .chapter > summary { padding: 18px 16px; font-size: 1.07rem; }
  .chapter-body { padding: 12px 10px; }
  .route-card { padding: 17px 14px; }
  .route-heading { gap: 12px; }
  .route-card ol { margin-left: 0; padding-left: 23px; }
  .note { margin-left: 0; }
  .table-wrap { margin-top: 15px; }
  th, td { min-width: 160px; }
  tbody th { min-width: 165px; }
  #storage-status { margin: 16px 15px; }
  .back-top { right: max(18px,env(safe-area-inset-right)); bottom: max(18px,env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { overflow: visible; }
  body::after { display: none; }
  .document-scroll { height: auto; overflow: visible; }
  .language-bar,.category-nav,.utility,.search-panel,.toc,.chart-controls,.back-top,button,#storage-status,.references,footer { display: none !important; }
  .layout { display: block; padding: 0; }
  body { background: white; }
  .hero { color: black; background: white; }
  .hero h1 { font-size: 25pt; }
  .hero-inner { padding: 12px 0; }
  .notices { display: block; }
  .notice,.route-card,.chapter,.data-section { box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; }
  th,td { min-width: 0; padding: 5px; }
  .route-card ol { margin-left: 0; }
}
