:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #f2efe7;
  --panel: #fffef9;
  --ink: #152137;
  --muted: #46536a;
  --line: #c4b8a4;
  --gold: #a76800;
  --link: #075b9a;
  --green: #237858;
  --red: #b3332f;
  --shadow: 0 14px 36px rgba(46, 38, 25, .1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #e6e0d2, var(--paper) 40rem);
  font: 16px/1.78 "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}
button, input { font: inherit; color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--link); text-underline-offset: .22em; }
a:hover { color: #073d67; }
:focus-visible { outline: 3px solid #b77719; outline-offset: 3px; }
button, input[type="search"] { border: 1px solid #8e887a; border-radius: 8px; background: var(--panel); }
button { min-height: 42px; padding: 7px 15px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 7px max(110px, calc((100vw - 1480px) / 2 + 110px)) 7px max(24px, calc((100vw - 1480px) / 2 + 24px));
  border-bottom: 1px solid var(--line);
  background: #eee8dc;
  font-size: .84rem;
}
.languages { display: flex; gap: 8px; flex: 0 0 auto; }
.languages button { min-height: 34px; padding: 4px 14px; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.languages button[aria-pressed="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }
.hero { color: #fff; background: linear-gradient(118deg, var(--navy), var(--navy-light)); }
.hero-inner { max-width: 1480px; margin: auto; padding: 26px clamp(24px, 5.2vw, 80px) 34px; }
.edition { margin: 0 0 8px; font-size: .84rem; letter-spacing: .04em; }
h1 { margin: 0; font: 700 clamp(2rem, 4.1vw, 3.45rem)/1.24 YuMincho, "Yu Mincho", serif; letter-spacing: .015em; text-wrap: balance; }
html[lang="en"] h1 { font-size: clamp(1.8rem, 3.7vw, 3.25rem); }
.category-nav { overflow-x: auto; background: var(--panel); border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px #14233c12; }
.category-inner { display: flex; gap: 24px; width: max-content; min-width: min(100%, 1480px); margin: auto; padding: 11px clamp(24px, 5.2vw, 80px); }
.category-nav a { padding: 4px 0; border-bottom: 2px solid transparent; font-size: .92rem; font-weight: 850; line-height: 1.4; text-decoration: none; white-space: nowrap; }
.category-nav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); }
.category-nav a:hover { border-bottom-color: #d09a45; }
.floating-progress {
  position: fixed; top: 13px; right: max(16px, calc((100vw - 1480px) / 2 + 16px));
  z-index: 100; display: grid; place-items: center; width: 72px; height: 72px;
  border: 3px solid #1d3f6bf0; border-radius: 50%; background: #fffdf8fa;
  box-shadow: 0 8px 24px #09182c40, inset 0 0 0 3px #ffffffeb;
  color: #194a3c; font-weight: 900; line-height: 1; pointer-events: none;
}
.floating-progress::before { content: ""; position: absolute; inset: 5px; border: 1px solid #1d3f6b3b; border-radius: inherit; }
.floating-progress.bump { animation: progress-bump .64s ease; }
.tools { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; max-width: 1440px; margin: auto; padding: 13px clamp(20px, 4vw, 56px); }
.search-area { max-width: 1440px; margin: auto; padding: 0 clamp(20px, 4vw, 56px); }
.search-box { display: flex; gap: 8px; align-items: center; }
.search-box button { flex: 0 0 auto; white-space: nowrap; }
.search-box input { width: 100%; min-width: 0; min-height: 46px; padding: 9px 13px; background: #fff; }
.search-label { display: block; margin-bottom: 5px; font-size: .84rem; font-weight: 800; color: var(--navy); }
.search-results { max-height: 450px; overflow: auto; margin: 10px 0; padding: 14px 18px; border: 1px solid #a9b4c3; border-radius: 10px; background: var(--panel); }
.search-results ol { margin: 7px 0 0; padding-left: 22px; }
.search-results li { padding: 7px 0; }
.search-results small { display: block; color: var(--muted); }
.critical { max-width: 1440px; margin: 22px auto 0; padding: 0 clamp(20px, 4vw, 56px); }
.critical-inner { border: 1px solid #a66f43; border-radius: 14px; padding: 16px 20px; background: #f7eae2; }
.critical h2 { margin: 0 0 6px; font-size: 1rem; }
.critical ul { margin: 0; padding-left: 1.3em; font-size: .9rem; }
.critical li + li { margin-top: 4px; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: auto; padding: 28px clamp(20px, 4vw, 56px) 84px; }
.toc { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow: auto; padding: 16px; border: 1px solid #968873; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.toc h2 { margin: 0 0 10px; color: var(--gold); font-size: .8rem; letter-spacing: .12em; }
.toc a { display: block; padding: 7px 9px; color: var(--muted); font-size: .87rem; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--navy); background: #f4ecdc; border-radius: 7px; }
main { min-width: 0; }
.progress-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 24px; align-items: center; margin-bottom: 22px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.progress-panel h2 { margin: 0 0 5px; color: var(--link); font-size: 1rem; }
.progress-panel p { margin: 0 0 10px; color: var(--muted); font-size: .85rem; }
.progress-number { display: block; color: #9a6500; font-size: 1.22rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.progress-actions { display: grid; gap: 9px; justify-items: end; }
.progress-track { height: 10px; overflow: hidden; border: 1px solid #aa9b81; border-radius: 10px; background: #e9e1d2; }
.progress-fill { height: 100%; background: var(--green); transition: width .35s ease; }
.save-status { display: flex; gap: 12px; align-items: center; justify-content: space-between; max-width: 1440px; margin: 10px auto; padding: 0 clamp(20px, 4vw, 56px); color: #7b3517; font-size: .9rem; }
.section-heading { margin: 0 0 8px; color: var(--navy); font: 700 1.45rem/1.4 YuMincho, "Yu Mincho", serif; }
.section-lead { margin: 0 0 18px; color: var(--muted); }
.chart-controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.chapter { margin-bottom: 20px; overflow: clip; border: 1px solid #a99b84; border-radius: 16px; background: #e9e1d2; box-shadow: var(--shadow); }
.chapter > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 15px; align-items: center; padding: 20px 22px; list-style: none; cursor: pointer; background: var(--panel); }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { content: "+"; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #968873; border-radius: 50%; color: var(--gold); font-weight: 900; }
.chapter[open] > summary::after { content: "−"; }
.chapter h3 { margin: 0; font: 700 1.22rem/1.5 YuMincho, "Yu Mincho", serif; }
.chapter-summary { margin-top: 4px; color: var(--link); font-size: .85rem; }
.chapter-body { padding: 0 20px 22px; }
.route-card { position: relative; margin-top: 12px; padding: 18px 18px 18px 62px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 4px 12px #2e261908; }
.route-card h4 { margin: 0; font-size: 1.05rem; line-height: 1.45; }
.route-card .check { position: absolute; top: 20px; left: 18px; width: 24px; height: 24px; accent-color: var(--green); cursor: pointer; }
.route-card ol { margin: 8px 0 0; padding-left: 1.35em; }
.route-card li + li { margin-top: 5px; }
.route-card .tip { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f4ecdc; font-size: .86rem; }
.route-card.is-checked { padding-bottom: 58px; border-color: var(--green); opacity: 1; box-shadow: 0 7px 18px #1857421a; }
.route-card.is-checked::after {
  content: attr(data-stamp); position: absolute; right: 15px; bottom: 12px;
  display: grid; place-items: center; width: 62px; height: 31px;
  border: 2px solid #b3332feb; border-radius: 4px 6px 5px 3px;
  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; text-shadow: .5px 0 #78191770; transform: none;
}
.route-card.bump { animation: card-bump .58s ease; }
.route-card.is-checked.bump::after { animation: stamp-pop .58s ease; }
.references { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.references a { padding: 3px 8px; border: 1px solid #8a9cac; border-radius: 5px; font-size: .82rem; text-decoration: none; }
.data-panel { margin: 0 0 24px; padding: 20px; border: 1px solid #a9b4c3; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.data-panel h3 { margin: 0 0 8px; color: var(--navy); font-size: 1.2rem; }
.data-panel > p { font-size: .9rem; color: var(--muted); }
.table-wrap { overflow: auto; max-width: 100%; border: 0; border-radius: 9px; background: #fff; }
table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: .9rem; line-height: 1.65; }
th { text-align: left; color: #fff; background: #233e65; white-space: nowrap; }
th, td { padding: 10px 12px; border-right: 1px solid #d5dbe3; border-bottom: 1px solid #c8d0da; vertical-align: top; }
td:first-child { min-width: 150px; font-weight: 750; }
td { min-width: 110px; }
td:last-child { min-width: 180px; }
tr:nth-child(even) td { background: #f0f3f7; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
.row-check { width: 20px; height: 20px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--green); }
.row-stamp { display: block; width: fit-content; margin-top: 7px; border: 1px solid var(--red); border-radius: 3px; padding: 0 7px; color: var(--red); font-size: .75rem; font-weight: 900; background: #fffdf8; }
.data-detail { align-self: start; margin-top: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.data-detail h4 { margin: 0 0 7px; color: var(--navy); }
.data-detail p { margin: 7px 0; }
.data-detail .return-chart { display: inline-block; margin-top: 7px; }
.back-top { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 120; display: grid; place-items: center; width: 46px; min-height: 46px; padding: 0; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c38; font-weight: 900; font-size: 1.15rem; }
footer { padding: 24px 80px 90px; text-align: center; border-top: 1px solid var(--line); background: #e9e3d7; }
.skip { position: fixed; top: -100px; left: 10px; z-index: 200; padding: 8px; background: #fff; }
.skip:focus { top: 10px; }
[hidden] { display: none !important; }
@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 progress-bump { 0%,100% { transform: scale(1); } 34% { transform: scale(1.22); } 62% { transform: scale(.91); } 82% { transform: scale(1.07); } }
@media(max-width: 760px) {
  .topbar { min-height: 54px; padding: 8px 78px 8px 16px; flex-wrap: wrap; gap: 5px; }
  .topbar > a { font-size: .75rem; }
  .languages { margin-left: auto; }
  .languages button { padding: 4px 11px; }
  .hero-inner { padding: 24px 20px 25px; }
  h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); text-wrap: wrap; }
  html[lang="en"] h1 { font-size: clamp(1.8rem, 7.4vw, 2.2rem); }
  .edition { font-size: .75rem; line-height: 1.5; }
  .category-inner { gap: 18px; padding: 9px 20px; }
  .category-nav a { font-size: .84rem; }
  .floating-progress { top: 10px; right: 10px; width: 58px; height: 58px; border-width: 2px; font-size: .9rem; }
  .tools { padding: 12px 16px; }
  .search-area { padding: 0 16px; }
  .search-box { gap: 6px; }
  .search-box button { padding: 7px 11px; font-size: .85rem; }
  .critical { margin-top: 18px; padding: 0 14px; }
  .critical-inner { padding: 14px; }
  .critical ul { font-size: .86rem; }
  .layout { display: block; padding: 20px 14px 90px; }
  .toc { position: static; max-height: none; margin-bottom: 20px; padding: 15px; }
  .toc-links { display: flex; flex-wrap: wrap; gap: 4px 9px; }
  .toc a { padding: 5px; font-size: .82rem; }
  .progress-panel { grid-template-columns: 1fr; padding: 18px; }
  .progress-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
  .progress-number { font-size: 1.1rem; }
  .chapter > summary { padding: 17px 15px; }
  .chapter-body { padding: 0 10px 12px; }
  .chapter h3 { font-size: 1.12rem; }
  .route-card { padding: 16px 14px; }
  .route-card .check { position: static; display: block; margin: 0 0 10px; }
  .route-card h4 { font-size: 1rem; }
  .route-card ol { padding-left: 1.3em; }
  .data-panel { padding: 14px; }
  .save-status { padding: 0 16px; flex-wrap: wrap; }
  footer { padding: 22px 68px 90px 20px; }
}
@media(prefers-reduced-motion: reduce) {
  html, *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
@media print {
  .topbar, .category-nav, .tools, .search-area, .floating-progress, .back-top, .toc, .chart-controls, .save-status, .progress-actions, .row-check, .check, footer, .skip { display: none !important; }
  body, .hero, .chapter, .route-card, .critical-inner { color: #000; background: #fff; }
  .hero-inner { padding: 12px 0; }
  h1 { font-size: 25px !important; }
  .layout { display: block; padding: 10px 0; }
  .critical { padding: 0; }
  .critical-inner { border-color: #777; }
  .chapter, .route-card, .data-panel { box-shadow: none; }
  .chapter > summary { padding: 12px; }
  .route-card { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 9px; }
  td, td:first-child, td:last-child { min-width: 0; padding: 5px; }
  th { color: #000; background: #eee; white-space: normal; }
  a { color: #000; }
}
