:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #fffef9;
  --page: #f2efe7;
  --ink: #172132;
  --muted: #4c5768;
  --link: #075b9a;
  --gold: #a76800;
  --line: #c8baa4;
  --green: #237858;
  --red: #b3332f;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.78 "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}
a { color: var(--link); text-underline-offset: 4px; }
button, input { font: inherit; }
button { cursor: pointer; }
button, .button {
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid #95856e;
  border-radius: 10px;
  background: var(--paper);
  color: var(--navy);
  font-size: .9rem;
  font-weight: 700;
}
button:hover, .button:hover { background: #f5eddf; }
:focus-visible { outline: 3px solid #b77719; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 1000; }
.skip:focus { top: 8px; padding: 10px; background: white; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 6px max(24px, calc((100% - 1328px) / 2));
  background: #eee8dc;
  font-size: .8rem;
}
.language { display: flex; gap: 8px; }
.language button { min-height: 34px; padding: 4px 14px; border-radius: 999px; font-size: .8rem; }
.language button[aria-pressed="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.hero { background: linear-gradient(118deg, var(--navy), var(--navy-light)); color: white; }
.hero-inner { max-width: 1440px; margin: auto; padding: 39px 56px 33px; }
h1 {
  margin: 0;
  font: 700 clamp(2rem, 3.83vw, 3.45rem)/1.3 YuMincho, "Yu Mincho", serif;
  letter-spacing: .015em;
  overflow-wrap: anywhere;
}
html[lang="en"] h1 { font-size: clamp(1.9rem, 3.61vw, 3.25rem); }
.edition { display: block; margin-top: 13px; color: #eee4d2; font-size: .86rem; letter-spacing: .05em; }
.category-nav { background: var(--paper); box-shadow: 0 3px 12px #14233c12; }
.category-inner { max-width: 1440px; margin: auto; display: flex; gap: 25px; overflow-x: auto; padding: 11px 56px 8px; }
.category-inner a { flex: none; padding: 5px 0; white-space: nowrap; text-decoration: none; font-size: .92rem; font-weight: 800; border-bottom: 2px solid transparent; }
.category-inner a[aria-current="page"] { color: var(--navy); border-color: var(--gold); }
.tools { max-width: 1440px; margin: auto; padding: 16px 56px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.progress-mini { margin-right: auto; font-size: .9rem; font-weight: 800; color: var(--green); }
.search-area { max-width: 1328px; margin: 8px auto 25px; padding: 17px 20px; background: #f8f5ee; border: 1px solid var(--line); border-radius: 13px; }
.search-area label { font-weight: 800; color: var(--navy); font-size: .91rem; }
.search-controls { display: flex; gap: 10px; margin-top: 7px; }
.search-controls input { min-width: 0; flex: 1; min-height: 44px; padding: 9px 12px; border: 1px solid #8394b0; border-radius: 6px; color: var(--ink); background: white; }
.search-count { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.search-results { margin: 12px 0 0; padding: 0; list-style: none; max-height: 340px; overflow-y: auto; }
.search-results li { padding: 12px 0; border-top: 1px solid #d6d0c4; }
.search-results a { display: block; font-weight: 800; }
.result-context { display: block; margin-top: 4px; font-size: .86rem; }
.result-category { font-size: .75rem; color: var(--gold); font-weight: 800; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: 0 auto; padding: 0 56px 40px; align-items: start; }
.prelude { max-width: 1280px; margin: 0 auto; }
.toc { position: sticky; top: 18px; padding: 20px 17px; border: 1px solid #b3a187; border-radius: 18px; background: var(--paper); box-shadow: 0 15px 35px #2632440d; }
.toc h2 { margin: 0 0 12px; color: var(--gold); font-size: .86rem; letter-spacing: .08em; }
.toc a { display: block; padding: 6px 8px; color: var(--muted); text-decoration: none; font-size: .87rem; }
.toc a:hover { background: #f2eadc; border-radius: 5px; }
main { min-width: 0; }
h2 { color: var(--navy); font-size: 1.4rem; line-height: 1.5; }
h3 { margin: 0 0 10px; font-size: 1.06rem; line-height: 1.6; }
p { margin: 9px 0; }
.notice { padding: 18px 21px; border: 1px solid #a26a5d; border-radius: 14px; background: #f6e8df; margin-bottom: 24px; }
.notice h2 { font-size: 1rem; margin: 0 0 8px; }
.notice ul { margin: 0; padding-left: 21px; }
.notice li + li { margin-top: 7px; }
.progress-panel { padding: 23px 25px; margin-bottom: 25px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px #2632440b; }
.progress-panel h2 { margin: 0 0 5px; font-size: 1rem; }
.progress-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.progress-number { font-size: 1.35rem; color: var(--gold); font-weight: 800; white-space: nowrap; }
.progress-track { height: 11px; border: 1px solid #b2a188; border-radius: 99px; background: #ede6d8; overflow: hidden; margin: 14px 0; }
.progress-fill { height: 100%; width: 0; background: var(--green); transition: width .5s ease; }
.save-note { color: var(--muted); font-size: .82rem; }
.storage-warning { margin: 10px 0; padding: 12px; border: 1px solid #ae6a4a; border-radius: 8px; background: #fff0df; }
.chapter-tools { display: flex; gap: 9px; flex-wrap: wrap; margin: 25px 0 18px; }
details.chapter { margin: 0 0 24px; padding: 0; }
.chapter > summary { cursor: pointer; padding: 17px 0 15px; color: var(--navy); font-size: 1.2rem; font-weight: 800; list-style: none; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.chapter > summary::after { content: "+"; float: right; color: var(--gold); margin-left: 12px; }
.chapter[open] > summary::after { content: "−"; }
.chapter-lead { margin: 0 0 17px; color: var(--muted); font-size: .9rem; }
.route-card, .section-card { position: relative; background: var(--paper); padding: 22px; border: 1px solid var(--line); border-radius: 15px; margin: 0 0 15px; box-shadow: 0 5px 15px #2632440b; }
.route-title { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 11px; font-weight: 800; }
.route-title input { width: 23px; height: 23px; margin: 4px 0 0; accent-color: var(--green); cursor: pointer; }
.route-body { padding-left: 39px; }
.route-body ol { margin: 6px 0; padding-left: 22px; }
.route-body li + li { margin-top: 8px; }
.badge { display: inline-block; font-size: .73rem; color: #805100; border: 1px solid #b8975f; border-radius: 99px; padding: 1px 9px; margin-top: 7px; }
.route-warning { background: #f4ead6; border: 1px solid #cabc9e; border-radius: 8px; padding: 10px 13px; font-size: .87rem; margin-top: 13px; }
.route-links { display: flex; gap: 7px 15px; flex-wrap: wrap; margin-top: 12px; font-size: .85rem; }
.route-card.is-done { border-color: var(--green); padding-bottom: 59px; opacity: 1; }
.stamp { position: absolute; bottom: 13px; right: 15px; display: grid; place-items: center; width: 64px; height: 32px; border: 2px solid #b3332feb; color: var(--red); background: radial-gradient(circle at 20% 30%, #fffef9 0 1px, transparent 1.4px) 0 0/9px 8px, #fffdf8db; border-radius: 4px 6px 5px 3px; font-size: .9rem; font-weight: 900; letter-spacing: .1em; transform: none; box-shadow: inset 0 0 0 1px #b3332f26; pointer-events: none; }
.is-bumping { animation: card-bump .58s ease; }
.is-bumping .stamp { animation: stamp-pop .58s ease; }
@keyframes card-bump { 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% { transform: scale(1); } }
.table-section { margin: 0 0 28px; }
.table-section h2 { margin: 0 0 13px; }
.table-wrap { overflow-x: auto; border: 1px solid #b0bccb; border-radius: 11px; background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; line-height: 1.7; }
thead th { background: #213e64; color: white; text-align: left; padding: 12px; font-weight: 800; }
td, tbody th { border: 1px solid #cdd5df; padding: 12px; vertical-align: top; min-width: 120px; }
tbody th { text-align: left; font-weight: 700; }
td:first-child { min-width: 150px; font-weight: 700; }
tbody tr:nth-child(even) { background: #eff3f7; }
tbody tr:target, .route-card:target, .section-card:target { outline: 3px solid #b7771970; outline-offset: 3px; }
.page-lead { margin: 0 0 22px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.quick-grid .section-card { margin: 0; }
.quick-grid p { font-size: .9rem; }
footer { max-width: 1328px; margin: 0 auto; padding: 20px 24px 85px; text-align: center; }
.back-top { position: fixed; z-index: 520; width: 46px; height: 46px; min-height: 46px; padding: 0; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c25; font-size: 1.15rem; }
.empty { padding: 15px 0; }
@media (max-width: 900px) {
  .hero-inner { padding: 31px 30px; }
  .layout { padding: 0 25px 35px; grid-template-columns: 205px minmax(0, 1fr); gap: 23px; }
  .search-area { margin: 8px 25px 25px; }
  .prelude { margin: 0 25px; }
  .category-inner { padding-left: 30px; padding-right: 30px; }
  .tools { padding-left: 30px; padding-right: 30px; }
}
@media (max-width: 700px) {
  body { line-height: 1.78; }
  .topbar { padding: 8px 15px; align-items: center; }
  .topbar > a { max-width: 43%; line-height: 1.5; }
  .language { gap: 5px; }
  .language button { padding-left: 11px; padding-right: 11px; }
  .hero-inner { padding: 29px 20px 25px; }
  h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); line-height: 1.42; }
  html[lang="en"] h1 { font-size: 1.8rem; }
  .edition { font-size: .78rem; }
  .category-inner { gap: 21px; padding: 10px 20px 8px; }
  .category-inner a { font-size: .84rem; }
  .tools { padding: 15px; gap: 7px; }
  .tools button { padding: 8px 10px; font-size: .8rem; }
  .progress-mini { width: 100%; }
  .search-area { margin: 5px 15px 22px; padding: 15px; }
  .search-controls { gap: 7px; }
  .search-controls button { padding: 7px 10px; font-size: .8rem; }
  .layout { display: flex; flex-direction: column; gap: 22px; padding: 0 15px 35px; }
  .prelude { margin: 0 15px; }
  .toc { position: static; width: 100%; padding: 16px; }
  .toc a { display: inline-block; margin-right: 8px; padding: 6px 4px; font-size: .8rem; }
  main { width: 100%; }
  .notice { padding: 16px 18px; margin-bottom: 20px; }
  .notice li { font-size: .9rem; }
  .progress-panel { padding: 18px; }
  .progress-row { flex-wrap: wrap; gap: 8px; }
  .progress-number { font-size: 1.18rem; }
  .route-card, .section-card { padding: 18px 15px; }
  .route-title { gap: 11px; margin-bottom: 12px; }
  .route-body { padding-left: 0; }
  .route-body ol { padding-left: 22px; }
  .quick-grid { grid-template-columns: 1fr; }
  td, th { padding: 10px; }
  .table-section { padding-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (min-width: 701px) {
  .layout { padding-right: 82px; }
  .tools { padding-right: 82px; }
  .search-area { max-width: 1280px; }
}
@media (min-width: 901px) and (max-width: 1440px) {
  .search-area { margin: 8px 82px 25px 56px; }
  .prelude { margin: 0 82px 0 56px; }
}
@media (min-width: 701px) and (max-width: 900px) {
  .search-area { margin: 8px 82px 25px 25px; }
  .prelude { margin: 0 82px 0 25px; }
}
@media (max-width: 700px) {
  .layout { padding-right: 78px; }
  .prelude, .search-area { margin-right: 78px; }
  .tools, footer { padding-right: 78px; }
}
@media print {
  .topbar, .category-nav, .tools, .toc, .search-area, .chapter-tools, .back-top, .route-title input, .storage-warning, footer { display: none !important; }
  body { background: white; color: black; font-size: 11pt; }
  .hero { background: white; color: black; }
  .hero-inner { padding: 12px 0; }
  .edition { color: black; }
  h1, html[lang="en"] h1 { font-size: 24pt; }
  .layout { display: block; padding: 0; }
  .route-card, .section-card, .notice, .progress-panel { box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; }
  thead th { background: #eee; color: black; }
  td, td:first-child { min-width: 0; }
}
