:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #fffef9;
  --ground: #f2efe7;
  --ink: #182438;
  --link: #075b9a;
  --gold: #a76800;
  --green: #237858;
  --red: #b3332f;
  --line: #b8aa92;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.78 "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif; }
button, input, select { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
a { color: var(--link); text-underline-offset: 4px; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #c8943c; outline-offset: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 8px 14px; background: white; }
.skip:focus { top: 8px; }
.topline { max-width: 1480px; margin: auto; padding: 10px 100px 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topline a { font-size: .85rem; }
.languages { display: flex; gap: 8px; }
.languages button, .button { min-height: 42px; padding: 8px 15px; border: 1px solid #93846d; border-radius: 12px; background: var(--paper); color: var(--navy); font-size: .88rem; font-weight: 700; }
.languages button { min-height: 36px; border-radius: 28px; font-size: .77rem; }
.languages [aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: white; }
.hero { background: linear-gradient(118deg, var(--navy), var(--navy-light)); color: white; }
.hero-inner { max-width: 1480px; margin: auto; padding: 42px clamp(24px, 5.2vw, 80px) 36px; }
h1 { margin: 0; font-family: YuMincho, "Yu Mincho", serif; font-size: clamp(2rem,4.1vw,3.45rem); line-height: 1.24; letter-spacing: .015em; text-wrap: balance; }
html[lang="en"] h1 { font-size: clamp(1.8rem,3.7vw,3.25rem); }
.edition { display: block; margin-top: 14px; font-family: "Yu Gothic UI", Meiryo, sans-serif; font-size: .83rem; font-weight: 500; letter-spacing: .025em; }
.categories { background: #fffdf8; border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px #14233c12; overflow-x: auto; }
.categories-inner { display: flex; width: max-content; min-width: min(100%,1480px); margin: auto; padding: 10px clamp(24px,5.2vw,80px); gap: 26px; }
.categories a { display: flex; align-items: center; min-height: 34px; color: var(--link); font-size: .92rem; font-weight: 800; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.categories a[aria-current="page"] { color: var(--navy); border-color: var(--gold); }
.tools { max-width: 1440px; margin: auto; padding: 18px 32px 22px; border-bottom: 1px solid #c2b79f; display: grid; grid-template-columns: minmax(220px,1fr) auto; gap: 14px 24px; align-items: start; }
.search-label { display: block; font-size: .82rem; color: #415267; font-weight: 700; margin-bottom: 5px; }
.search-line { display: flex; gap: 8px; }
.search-line button { flex-shrink: 0; white-space: nowrap; }
#search { width: 100%; min-width: 0; height: 46px; border: 1px solid #8192aa; border-radius: 8px; padding: 10px 12px; background: white; color: var(--ink); }
.tool-buttons { display: flex; gap: 8px; padding-top: 28px; }
.search-results { margin-top: 12px; background: var(--paper); border: 1px solid #abb8c9; border-radius: 12px; padding: 14px; }
.search-results ol { margin: 8px 0 0; padding-left: 22px; }
.search-results li { margin-bottom: 12px; }
.search-results small { display: block; color: #4a586b; font-size: .82rem; }
.result-cat { display: inline-block; color: var(--gold); margin-right: 8px; font-size: .78rem; }
.layout { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 34px; max-width: 1440px; margin: auto; padding: 34px 84px 64px 40px; align-items: start; }
.toc { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 18px 17px; border: 1px solid #a89980; border-radius: 18px; background: var(--paper); box-shadow: 0 16px 35px #14233c13; }
.toc h2 { margin: 0 0 12px; font-size: .8rem; color: var(--gold); letter-spacing: .12em; }
.toc a { display: block; padding: 7px 8px; text-decoration: none; font-size: .86rem; line-height: 1.65; }
.toc a:hover { background: #e9edf1; border-radius: 6px; }
main { min-width: 0; }
.progress-card { display: flex; gap: 24px; align-items: center; justify-content: space-between; border: 1px solid #cabb9e; border-radius: 18px; padding: 22px 24px; background: linear-gradient(115deg,var(--paper),#f6f0e3); margin-bottom: 20px; }
.progress-main { flex: 1; min-width: 0; }
.progress-card h2 { font-size: 1rem; color: var(--navy); margin: 0 0 5px; }
.progress-card p { margin: 0 0 12px; font-size: .83rem; color: #435269; }
.track { height: 10px; border: 1px solid #ab9a7c; border-radius: 12px; background: #eee9dc; overflow: hidden; }
.fill { height: 100%; background: var(--green); width: 0; transition: width .35s ease; }
.progress-side { text-align: right; flex-shrink: 0; }
.progress-number { color: var(--gold); font-size: 1.25rem; font-weight: 700; margin-bottom: 10px; }
.progress-bubble { position: fixed; z-index: 50; right: 18px; top: 12px; width: 72px; height: 72px; border: 3px solid var(--navy-light); outline: 1px solid #ffffffcf; outline-offset: -8px; border-radius: 50%; background: #fffef9f7; color: #194a3c; display: grid; place-items: center; box-shadow: 0 8px 24px #09182c30; font-weight: 800; pointer-events: none; }
.notices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 24px; }
.notice { border: 1px solid #a79576; border-radius: 15px; padding: 18px; background: #f6efdf; font-size: .9rem; }
.notice:first-child { background: #f6e8e0; border-color: #a66753; }
.notice strong { display: block; color: var(--navy); margin-bottom: 6px; }
.notice p { margin: 0; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 28px 0 18px; }
.controls h2 { flex: 1 0 100%; margin: 0 0 2px; font-size: 1.4rem; color: var(--navy); }
.chapter { margin: 0 0 20px; border: 1px solid #a99b83; border-radius: 18px; background: var(--paper); overflow: clip; }
.chapter > summary { list-style: none; padding: 20px 24px; color: var(--navy); cursor: pointer; font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 18px; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { content: "+"; margin-left: auto; border: 1px solid #b4a27f; border-radius: 50%; font-size: 16px; width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; }
.chapter[open] > summary::after { content: "−"; }
.chapter-body { padding: 18px 20px 22px; background: #eae2d2; border-top: 1px solid #c0b397; }
.chapter-intro { margin: 0 0 16px; color: #4b4a43; font-size: .9rem; }
.route-card { position: relative; margin-bottom: 14px; padding: 18px 20px 20px 62px; border: 1px solid #c1b49e; border-radius: 15px; background: var(--paper); box-shadow: 0 5px 12px #3024100b; }
.route-card:last-child { margin-bottom: 0; }
.route-check { position: absolute; top: 23px; left: 21px; width: 24px; height: 24px; accent-color: #087653; margin: 0; cursor: pointer; }
.route-title { margin: 0 0 10px; font-size: 1rem; line-height: 1.65; }
.route-card ol, .route-card ul { margin: 8px 0 4px; padding-left: 22px; }
.route-card li { margin: 6px 0; }
.badge { display: inline-block; border: 1px solid #9a762a; border-radius: 20px; color: #805c13; font-size: .72rem; padding: 1px 8px; margin: 0 0 8px; }
.card-note { margin: 12px 0 0; padding: 12px 14px; border: 1px solid #c7bca2; border-radius: 8px; background: #f3ebd8; font-size: .86rem; }
.refs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.refs a { border: 1px solid #8295ad; border-radius: 6px; padding: 3px 9px; text-decoration: none; font-size: .8rem; }
.route-card.done { padding-bottom: 58px; border-color: var(--green); box-shadow: 0 7px 18px #18574219; }
.stamp { display: none; position: absolute; right: 15px; bottom: 12px; width: 62px; height: 31px; border: 2px solid #b3332feb; border-radius: 4px 6px 5px 3px; place-items: center; background: radial-gradient(circle at 16% 28%,#fffdf8eb 0 1px,transparent 1.35px) 0 0 / 9px 8px,#fffdf8db; color: var(--red); font-size: .92rem; font-weight: 900; letter-spacing: .08em; line-height: 1; transform: none; }
.done .stamp { display: grid; }
.bump { animation: card-bump .58s cubic-bezier(.22,1.3,.36,1); }
.bump .stamp { animation: stamp-pop .58s cubic-bezier(.22,1.3,.36,1); }
.progress-bubble.bump { animation: bubble-bump .64s cubic-bezier(.22,1.35,.36,1); }
@keyframes card-bump { 0%,100% { transform: scale(1); } 36% { transform: scale(1.018); } 68% { transform: scale(.995); } }
@keyframes stamp-pop { 0% { opacity: 0; transform: scale(1.42); } 58% { opacity: 1; transform: scale(.92); } 100% { opacity: 1; transform: scale(1); } }
@keyframes bubble-bump { 0%,100% { transform: scale(1); } 34% { transform: scale(1.22); } 62% { transform: scale(.91); } 82% { transform: scale(1.07); } }
.data-section { margin: 0 0 24px; padding: 22px; border: 1px solid #acb8c8; border-radius: 16px; background: var(--paper); }
.data-section h2 { margin: 0 0 10px; color: var(--navy); font-size: 1.4rem; }
.data-section > p { margin: 0 0 18px; font-size: .9rem; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid #b5c1d0; border-radius: 10px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; line-height: 1.7; min-width: 800px; }
th { background: #233d62; color: white; text-align: left; padding: 11px 12px; font-weight: 800; }
td { padding: 12px; vertical-align: top; border-top: 1px solid #c5cfdd; overflow-wrap: break-word; }
th + th, td + td { border-inline-start: 1px solid #d1d9e2; }
tbody tr:nth-child(even) { background: #eff3f6; }
td:first-child { min-width: 130px; font-weight: 700; color: var(--navy); }
td:last-child { min-width: 230px; }
td p { margin: 0; }
.table-wrap tr:target, .route-card:target { outline: 3px solid #bc8b37; outline-offset: -3px; }
.overview { margin-bottom: 22px; padding: 20px 24px; border: 1px solid #bdaf92; border-radius: 16px; background: var(--paper); }
.overview h2 { font-size: 1.2rem; margin: 0 0 10px; color: var(--navy); }
.overview ol { margin: 0; padding-left: 22px; }
.overview li { margin: 7px 0; }
.storage-warning { margin: 0 0 20px; border: 1px solid #ae644d; border-radius: 12px; padding: 16px; background: #fff0e6; }
.storage-warning p { margin-top: 0; }
.story { border: 1px solid #b9ad94; border-radius: 12px; padding: 16px 20px; background: var(--paper); margin-top: 24px; }
.story summary { cursor: pointer; font-weight: 700; }
.back-top { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 46px; height: 46px; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c26; font-size: 1.15rem; font-weight: 900; }
footer { padding: 24px 76px 34px; border-top: 1px solid #c3b89e; text-align: center; background: #eae4d7; font-size: .9rem; }
@media (max-width: 900px) { .layout { grid-template-columns: 205px minmax(0,1fr); gap: 22px; padding: 26px 76px 64px 24px; } }
@media (max-width: 760px) {
  .topline { padding: 8px 78px 8px 16px; gap: 8px; flex-wrap: wrap; }
  .topline a { font-size: .75rem; }
  .hero-inner { padding: 28px 20px; }
  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: .75rem; margin-top: 12px; }
  .categories-inner { padding: 9px 20px; gap: 21px; }
  .categories a { font-size: .84rem; }
  .tools { display: block; padding: 18px 76px 18px 16px; }
  .tool-buttons { justify-content: flex-end; padding-top: 13px; flex-wrap: wrap; }
  .layout { display: flex; flex-direction: column; padding: 22px 76px 76px 14px; gap: 20px; }
  .toc { position: static; width: 100%; max-height: none; padding: 14px; order: 1; }
  main { width: 100%; order: 0; }
  .toc-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px 10px; }
  .toc a { font-size: .8rem; }
  .progress-card { display: block; padding: 18px; }
  .progress-side { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; text-align: left; }
  .progress-number { font-size: 1rem; margin: 0; }
  .progress-bubble { right: 10px; top: 10px; width: 58px; height: 58px; font-size: .9rem; border-width: 2px; }
  .notices { grid-template-columns: 1fr; }
  .notice { padding: 16px; }
  .chapter > summary { padding: 17px 16px; font-size: 1.06rem; }
  .chapter-body { padding: 14px 10px; }
  .route-card { padding: 55px 15px 18px; }
  .route-check { top: 18px; left: 16px; }
  .route-title { font-size: 1rem; }
  .route-card ol { padding-left: 23px; }
  .route-card li { margin: 9px 0; }
  .data-section { padding: 18px 14px; }
  table { min-width: 800px; font-size: .88rem; }
  td { padding: 12px 14px; }
  .back-top { right: max(18px,env(safe-area-inset-right)); bottom: max(18px,env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topline, .categories, .tools, .toc, .controls, .progress-bubble, .back-top, .progress-side button, .route-check, .storage-warning, footer { display: none !important; }
  body { background: white; color: black; font-size: 11pt; }
  .hero { background: none; color: black; }
  .hero-inner { padding: 12px 0; }
  h1, html[lang="en"] h1 { font-size: 24pt; }
  .layout { display: block; max-width: none; padding: 0; }
  .chapter { break-inside: auto; }
  .route-card, tr { break-inside: avoid; }
  .table-wrap { overflow: visible; border: 0; }
  table { min-width: 0; font-size: 9pt; }
  td:first-child, td:last-child { min-width: 0; }
  .chapter-body { background: white; }
  .route-card { padding-left: 18px; }
  .chapter, .route-card, .data-section { box-shadow: none; }
}
