:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #fffef9;
  --canvas: #f2efe7;
  --ink: #111827;
  --muted: #374151;
  --blue: #075b9a;
  --gold: #a76800;
  --green: #237858;
  --red: #b3332f;
  --line: #c6b9a2;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 16px/1.78 'Yu Gothic UI','Yu Gothic',Meiryo,sans-serif; }
button,input { font: inherit; }
button,a,input { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: 3px; }
button { cursor: pointer; }
button,.button { min-height: 42px; padding: 8px 15px; border: 1px solid #9c8c73; border-radius: 10px; color: var(--navy); background: var(--paper); font-weight: 700; }
button:hover { background: #f6eddc; }
:focus-visible { outline: 3px solid #b77919; outline-offset: 3px; }
.skip { position: absolute; left: 15px; top: -100px; z-index: 1000; padding: 8px; background: white; }
.skip:focus { top: 8px; }
.top-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; max-width: 1480px; margin: auto; padding: 8px 110px 8px 24px; }
.top-tools button { min-height: 36px; padding: 5px 13px; border-radius: 22px; font-size: 13px; font-weight: 700; }
.top-tools button[aria-pressed='true'] { background: var(--navy); border-color: var(--navy); color: white; }
.title-band { background: linear-gradient(118deg,var(--navy),var(--navy-light)); color: #fff; }
.title-inner { max-width: 1480px; margin: auto; padding: 42px clamp(24px,5.2vw,80px) 32px; }
h1 { font-family: YuMincho,'Yu Mincho',serif; font-size: clamp(2rem,4.1vw,3.45rem); line-height: 1.24; letter-spacing: .015em; margin: 0; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
html[lang='en'] h1 { font-size: clamp(1.8rem,3.7vw,3.25rem); }
.edition { display: block; margin-top: 12px; font-size: 14px; color: #eef3fa; letter-spacing: .03em; }
.category-nav { background: var(--paper); border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px #14233c12; overflow-x: auto; scrollbar-width: thin; }
.nav-inner { display: flex; gap: 24px; width: max-content; min-width: min(100%,1440px); margin: auto; padding: 10px clamp(24px,5.2vw,80px); }
.nav-inner a { white-space: nowrap; font-size: 14px; font-weight: 800; text-decoration: none; border-bottom: 2px solid transparent; min-height: 32px; display: inline-flex; align-items: center; }
.nav-inner a[aria-current='page'] { color: var(--navy); border-color: var(--gold); }
.guide-list { display: inline-block; color: inherit; font-size: 13px; margin-top: 16px; }
.floating-progress { position: fixed; z-index: 50; top: 12px; right: 16px; width: 72px; height: 72px; display: grid; place-items: center; border: 3px solid #1d3f6bf0; border-radius: 50%; background: #fffdf8fa; box-shadow: 0 8px 24px #09182c30,inset 0 0 0 4px white; color: #194a3c; font-weight: 900; font-variant-numeric: tabular-nums; pointer-events: none; }
.floating-progress::before { content: ''; position: absolute; inset: 6px; border: 1px solid #1d3f6b35; border-radius: inherit; }
.floating-progress.bump { animation: progress-bump .64s ease; }
.search-area { max-width: 1440px; margin: 24px auto 0; padding: 0 56px; }
.search-box { display: flex; gap: 12px; align-items: flex-end; padding: 15px 18px; border: 1px solid #b7bdc8; border-radius: 13px; background: #fbf8f1; }
.search-field { flex: 1; min-width: 0; }
.search-field label { display: block; color: var(--navy); font-size: 13px; font-weight: 800; margin-bottom: 4px; }
#search { width: 100%; min-height: 44px; border: 1px solid #8797af; border-radius: 6px; padding: 9px 12px; color: var(--ink); background: white; }
.search-results { margin-top: 10px; border: 1px solid #b7bdc8; border-radius: 12px; background: var(--paper); padding: 14px 18px; }
.search-results[hidden] { display: none; }
.search-results ol { margin: 10px 0; padding-left: 24px; }
.search-results li { margin-bottom: 14px; }
.result-category { color: var(--gold); font-size: 12px; font-weight: 800; margin-right: 8px; }
.result-context { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.layout { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 34px; max-width: 1440px; margin: 28px auto 0; padding: 0 56px 50px; align-items: start; }
.toc { position: sticky; top: 20px; background: var(--paper); border: 1px solid #a99980; border-radius: 18px; box-shadow: 0 14px 30px #241b1020; padding: 16px; max-height: calc(100vh - 40px); overflow-y: auto; }
.toc summary { font-weight: 800; color: var(--gold); font-size: 14px; cursor: pointer; }
.toc a { display: block; padding: 6px 8px; color: var(--muted); font-size: 14px; line-height: 1.55; text-decoration: none; }
.toc a:hover { color: var(--blue); background: #f2eee3; border-radius: 5px; }
main { min-width: 0; }
.page-title { font-family: YuMincho,'Yu Mincho',serif; color: var(--navy); font-size: 28px; margin: 0 0 10px; line-height: 1.45; }
.intro { color: var(--muted); margin: 0 0 20px; }
.progress-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px 20px; background: #faf5ea; border: 1px solid var(--line); border-radius: 18px; padding: 20px 24px; margin-bottom: 24px; box-shadow: 0 9px 22px #33271510; }
.progress-card h2 { color: var(--blue); font-size: 16px; margin: 0; }
.progress-card p { margin: 5px 0 12px; color: var(--muted); font-size: 13px; }
.progress-total { font-size: 21px; color: #946100; font-weight: 800; white-space: nowrap; }
.progress-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bar { height: 10px; width: 100%; border: 1px solid #ab9c82; background: #e6dfd0; border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--green); transition: width .35s ease; }
.warnings { max-width: 1440px; margin: 22px auto 0; padding: 0 56px; }
.warning-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 12px; }
.warning { border: 1px solid #a75a46; background: #f7e9e1; border-radius: 14px; padding: 14px 18px; font-weight: 650; font-size: 14px; }
.warnings h2 { color: var(--navy); margin: 0 0 10px; font-size: 18px; }
.chapter-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 12px; }
.chapter { border: 1px solid var(--line); background: var(--paper); border-radius: 16px; margin-bottom: 18px; overflow: clip; box-shadow: 0 6px 18px #3025160b; }
.chapter > summary { padding: 18px 22px; cursor: pointer; color: var(--navy); line-height: 1.5; font-family: YuMincho,'Yu Mincho',serif; font-weight: 700; font-size: 21px; }
.chapter[open] > summary { border-bottom: 1px solid #dfd4c0; background: #faf7ef; }
.chapter:has(input[data-progress]:checked) { border-color: var(--green); }
.route-card { position: relative; padding: 18px 22px 24px; min-width: 0; }
.route-card:has(input[data-progress]:checked) { padding-bottom: 62px; }
.route-card ol { margin: 12px 0 0; padding-left: 24px; }
.route-card li { padding-left: 2px; margin: 9px 0; }
.check-control { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; color: var(--navy); min-height: 36px; }
input[data-progress] { width: 23px; height: 23px; flex: 0 0 23px; accent-color: #087653; cursor: pointer; }
.stamp { display: none; }
.route-card:has(input[data-progress]:checked) .stamp { position: absolute; display: grid; place-items: center; right: 15px; bottom: 12px; width: 64px; height: 32px; border: 2px solid #b3332feb; border-radius: 4px 6px 5px 3px; color: var(--red); font-weight: 900; letter-spacing: .1em; line-height: 1; background: radial-gradient(circle at 18% 30%,#fffdf8eb 0 1px,transparent 1.4px) 0 0/9px 8px,#fffdf8dc; transform: none; box-shadow: inset 0 0 0 1px #b3332f24; }
.route-card.bump { animation: card-bump .58s ease; }
.route-card.bump .stamp { animation: stamp-pop .58s ease; }
.entry-warning { margin-top: 12px; padding: 11px 14px; border: 1px solid #b38c64; border-radius: 8px; background: #f4ead6; font-size: 14px; font-weight: 650; }
.entry-links { display: flex; flex-wrap: wrap; gap: 10px 16px; padding-top: 12px; font-size: 14px; }
.data-section { background: var(--paper); border: 1px solid #aeb8c7; border-radius: 16px; padding: 22px; margin: 24px 0; }
.data-section h2 { font-family: YuMincho,'Yu Mincho',serif; color: var(--navy); font-size: 25px; margin: 0 0 18px; }
.table-wrap { width: 100%; overflow-x: auto; border-radius: 10px; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.65; }
th { background: #203f66; color: white; text-align: left; padding: 11px 12px; white-space: nowrap; }
td { border: 1px solid #cbd5e1; padding: 11px 12px; vertical-align: top; min-width: 120px; }
td:first-child { min-width: 150px; font-weight: 750; }
tr:nth-child(even) td { background: #eff3f7; }
tr:target td { background: #fff0c9; }
.row-links { display: block; font-size: 12px; padding-top: 7px; }
.storage-status { border: 1px solid #b38c64; background: #fff1d9; border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; }
.storage-status[hidden] { display: none; }
.storage-status button { margin: 8px 0 0; }
footer { border-top: 1px solid #c6b9a2; padding: 24px 80px 72px; text-align: center; background: #e9e2d4; }
.back-top { position: fixed; z-index: 60; right: 18px; bottom: 18px; display: grid; place-items: center; width: 46px; height: 46px; min-height: 46px; padding: 0; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c30; font-size: 20px; }
.empty { margin: 8px 0; color: var(--muted); }
@keyframes card-bump { 0%,100% { transform: scale(1); } 35% { transform: scale(1.012); } 70% { transform: scale(.997); } }
@keyframes stamp-pop { 0% { opacity: 0; transform: scale(1.4); } 60% { opacity: 1; transform: scale(.93); } 100% { opacity: 1; transform: none; } }
@keyframes progress-bump { 0%,100% { transform: scale(1); } 35% { transform: scale(1.17); } 65% { transform: scale(.94); } }
@media (max-width:1100px) {
  .layout { grid-template-columns: 210px minmax(0,1fr); gap: 22px; padding-inline: 28px; }
  .search-area,.warnings { padding-inline: 28px; }
  .warning-grid { grid-template-columns: 1fr; }
}
@media (max-width:760px) {
  .top-tools { padding: 8px 78px 8px 14px; justify-content: flex-start; gap: 6px; }
  .top-tools button { min-height: 36px; padding: 5px 10px; font-size: 12px; }
  .title-inner { padding: 27px 20px 25px; }
  h1 { font-size: clamp(1.55rem,7vw,2.15rem); text-wrap: wrap; }
  html[lang='en'] h1 { font-size: clamp(1.6rem,7.4vw,2.2rem); }
  .edition { font-size: 12px; line-height: 1.5; margin-top: 10px; }
  .nav-inner { gap: 20px; padding: 9px 20px; }
  .nav-inner a { font-size: 13px; }
  .floating-progress { top: 10px; right: 10px; width: 58px; height: 58px; border-width: 2px; font-size: 14px; }
  .warnings,.search-area { padding-inline: 14px; margin-top: 18px; }
  .warning { padding: 12px 14px; font-size: 13px; }
  .search-box { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; padding: 13px; gap: 8px; }
  .search-box button { align-self: flex-end; min-height: 36px; padding: 4px 14px; font-size: 13px; }
  .layout { display: flex; flex-direction: column; gap: 22px; padding: 0 14px 40px; margin-top: 20px; }
  .layout > aside { width: 100%; min-width: 0; }
  .toc { position: static; width: 100%; max-height: none; box-shadow: none; border-radius: 14px; }
  main { width: 100%; }
  .page-title { font-size: 24px; }
  .intro { font-size: 14px; }
  .progress-card { grid-template-columns: 1fr; padding: 17px; gap: 10px; }
  .progress-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .progress-actions button { font-size: 13px; }
  .chapter > summary { padding: 16px; font-size: 20px; }
  .route-card { padding: 14px 15px 20px; }
  .route-card li { font-size: 15px; line-height: 1.85; }
  .data-section { padding: 16px; }
  .data-section h2 { font-size: 23px; }
  table { min-width: 760px; }
  table:has(th:nth-child(2):last-child) { min-width: 0; table-layout: fixed; }
  table:has(th:nth-child(2):last-child) td { min-width: 0; overflow-wrap: break-word; }
  table:has(th:nth-child(2):last-child) th:first-child,
  table:has(th:nth-child(2):last-child) td:first-child { min-width: 0; width: 84px; }
  td { padding: 10px; }
  footer { padding-inline: 20px; }
  .back-top { right: max(18px,env(safe-area-inset-right)); bottom: max(18px,env(safe-area-inset-bottom)); }
}
/* Keep the fixed progress circle and top button outside readable content. */
.layout,.search-area,.warnings { padding-right: 104px; }
.title-inner { padding-right: 104px; }
footer { padding-right: 104px; }
@media (max-width:1100px) { .category-nav { margin-right: 104px; } }
@media (max-width:760px) {
  .layout,.search-area,.warnings,.title-inner,footer { padding-right: 78px; }
  .category-nav { margin-right: 78px; }
}
@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto !important; }
  *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .top-tools,.category-nav,.search-area,.toc,.floating-progress,.chapter-tools,.back-top,.progress-actions,.check-control,.guide-list,footer,.storage-status { display: none !important; }
  body { background: white; color: black; }
  .title-band { color: black; background: white; }
  .edition { color: black; }
  .title-inner { padding: 12px 0; }
  h1,html[lang='en'] h1 { font-size: 26px; }
  .warnings,.layout { display: block; max-width: none; padding: 0; margin: 12px 0; }
  .warning-grid { display: block; }
  .warning { margin: 8px 0; }
  .chapter,.data-section { box-shadow: none; break-inside: auto; }
  .chapter > summary { font-size: 19px; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 10px; }
  th,td { min-width: 0 !important; padding: 5px; }
  .route-card li { font-size: 12px; }
  .route-card:has(input[data-progress]:checked) { padding-bottom: 50px; }
}

.table-hint { display:none; }
@media(max-width:1100px) { .table-hint { display:block; color:var(--muted); font-size:13px; margin:0 0 10px; } }
@media print { .table-hint { display:none; } }
html { scroll-padding-top:76px; }
.top-tools { position:sticky; top:0; z-index:40; background:var(--canvas); }
@media(max-width:760px) { html { scroll-padding-top:118px; } }
