:root {
  color-scheme: light;
  --paper: #f2efe7;
  --panel: #fffef9;
  --ink: #17233a;
  --muted: #46536a;
  --line: #b8ac97;
  --navy: #17375f;
  --blue: #075b9a;
  --gold: #9a6500;
  --green: #237858;
  --red: #b3332f;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.78;
}
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: .22em; }
a:hover { color: #073d67; }
button { cursor: pointer; }
button, input[type="search"] {
  min-height: 42px;
  border: 1px solid #7e8998;
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 7px 14px;
}
button:hover { border-color: var(--navy); background: #f6f0e3; }
:focus-visible { outline: 3px solid #c18d36; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 1000; background: white; padding: 10px; }
.skip:focus { top: 10px; }
.utility {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px max(24px, calc((100vw - 1440px) / 2 + 24px));
  padding-right: max(112px, calc((100vw - 1440px) / 2 + 112px));
  background: #eee8dc;
  border-bottom: 1px solid var(--line);
  min-height: 54px;
}
.utility > a { font-size: .84rem; font-weight: 700; }
.languages { display: flex; gap: 8px; flex-shrink: 0; }
.languages button { min-height: 34px; border-radius: 999px; font-size: .8rem; padding: 4px 13px; }
.languages button[aria-pressed="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.hero { background: linear-gradient(118deg, #17375f, #1d3f6b); color: white; }
.hero-inner { max-width: 1480px; margin: auto; padding: 44px clamp(24px, 5.2vw, 80px) 36px; }
h1 {
  margin: 0;
  max-width: 1250px;
  font: 700 clamp(2rem, 3.85vw, 3.45rem)/1.27 YuMincho, "Yu Mincho", serif;
  letter-spacing: .015em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
html[lang="en"] h1 { font-size: clamp(1.8rem, 3.6vw, 3.25rem); }
.category-nav { background: var(--panel); border-bottom: 1px solid #aeb8c7; overflow-x: auto; }
.category-inner { display: flex; gap: 26px; max-width: 1440px; margin: auto; padding: 11px clamp(24px, 4vw, 56px); width: max-content; min-width: min(100%, 1440px); }
.category-nav a { white-space: nowrap; text-decoration: none; font-weight: 850; border-bottom: 2px solid transparent; padding: 3px 0; }
.category-nav a[aria-current="page"] { border-bottom-color: var(--gold); color: var(--navy); }
.controls { max-width: 1440px; margin: 0 auto; padding: 14px 76px 0 clamp(20px, 4vw, 56px); }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }
.search-form { display: flex; gap: 10px; align-items: center; }
.search-form input { flex: 1; min-width: 0; background: white; }
.search-label { display: block; font-size: .87rem; font-weight: 750; margin-bottom: 5px; }
.search-results { margin: 12px 0 0; padding: 15px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.search-results ul { list-style: none; margin: 8px 0 0; padding: 0; }
.search-results li + li { margin-top: 12px; padding-top: 12px; border-top: 1px solid #d8d0c0; }
.search-results a { font-weight: 750; }
.search-results small { display: block; color: var(--muted); line-height: 1.65; margin-top: 3px; }
.intro { max-width: 1440px; margin: auto; padding: 22px 76px 0 clamp(20px, 4vw, 56px); }
.edition { margin: 0 0 12px; color: var(--muted); font-weight: 700; }
.notices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.notice { padding: 14px 17px; margin: 0; border: 1px solid #ad7468; border-radius: 12px; background: #f6e9e2; font-size: .94rem; font-weight: 600; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: auto; padding: 26px 76px 70px clamp(20px, 4vw, 56px); align-items: start; }
.toc { position: sticky; top: 22px; max-height: calc(100vh - 44px); overflow: auto; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 10px 28px #17233a0d; }
.toc summary { font-weight: 850; color: var(--gold); cursor: pointer; }
.toc a { display: block; text-decoration: none; font-size: .87rem; line-height: 1.5; padding: 8px 5px; }
.toc a:hover { background: #f2ebde; border-radius: 5px; }
main { min-width: 0; }
.progress-panel { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 20px 24px; box-shadow: 0 10px 28px #17233a0d; margin-bottom: 22px; }
.progress-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.progress-top h2 { font-size: 1.05rem; margin: 0; color: var(--blue); }
.progress-number { color: var(--gold); font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.progress-note { margin: 8px 0 12px; font-size: .87rem; color: var(--muted); }
.progress-track { height: 10px; overflow: hidden; border: 1px solid #9d927d; border-radius: 99px; background: #e8e1d5; }
.progress-fill { height: 100%; width: 0; background: var(--green); transition: width .25s ease; }
.progress-bottom { display: flex; justify-content: flex-end; margin-top: 14px; }
.storage-notice { margin-top: 12px; color: #842b25; font-size: .9rem; }
.chapter-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.chapter { margin-bottom: 30px; }
.chapter > summary { cursor: pointer; padding: 15px 2px; border-bottom: 1px solid var(--line); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { content: "+"; display: grid; place-items: center; border: 1px solid var(--line); width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; color: var(--gold); }
.chapter[open] > summary::after { content: "−"; }
.chapter h2 { margin: 0; font-size: 1.3rem; color: var(--navy); }
.chapter-summary { margin: 12px 0 18px; color: var(--muted); }
.route-card { position: relative; padding: 19px 22px 20px; margin: 14px 0; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: 0 6px 18px #17233a0b; overflow-wrap: anywhere; }
.route-card.is-done { border-color: var(--green); padding-bottom: 58px; }
.route-heading { display: flex; gap: 13px; align-items: flex-start; }
.route-heading input { width: 23px; height: 23px; accent-color: #087653; flex-shrink: 0; margin: 4px 0 0; cursor: pointer; }
.route-heading label { cursor: pointer; font-weight: 800; line-height: 1.65; }
.route-meta { color: var(--gold); font-size: .83rem; margin: 7px 0 9px 36px; }
.route-card ol { padding-left: 1.45em; margin: 12px 0 12px 36px; }
.route-card li + li { margin-top: 5px; }
.route-card .warning { margin: 12px 0 12px 36px; padding: 10px 13px; background: #f3ead6; border: 1px solid #c9b999; border-radius: 8px; font-weight: 650; font-size: .88rem; }
.next { margin: 10px 0 0 36px; color: var(--muted); font-size: .9rem; }
.references { display: flex; flex-wrap: wrap; gap: 10px; margin: 9px 0 0 36px; font-size: .85rem; }
.stamp { position: absolute; right: 15px; bottom: 12px; display: grid; place-items: center; width: 62px; height: 31px; color: var(--red); border: 2px solid var(--red); border-radius: 4px 6px 5px 3px; font-size: .92rem; line-height: 1; font-weight: 900; letter-spacing: .08em; background: radial-gradient(circle at 16% 28%, #fffef9eb 0 1px, transparent 1.35px) 0 0 / 9px 8px, #fffef9dc; transform: none; }
.route-card.bump { animation: card-bump .58s cubic-bezier(.22,1.3,.36,1); }
.route-card.bump .stamp { animation: stamp-pop .58s cubic-bezier(.22,1.3,.36,1); }
.floating-progress { position: fixed; right: 16px; top: 12px; z-index: 80; width: 72px; height: 72px; display: grid; place-items: center; border: 3px solid var(--navy); border-radius: 50%; box-shadow: 0 6px 20px #17233a30, inset 0 0 0 4px white; background: #fffdf8f7; color: #194a3c; font-weight: 900; font-size: 1rem; pointer-events: none; }
.floating-progress.bump { animation: progress-bump .64s cubic-bezier(.22,1.35,.36,1); }
.reference-section { margin-bottom: 32px; }
.reference-section > h2 { margin-top: 0; font-size: 1.35rem; color: var(--navy); }
.table-scroll { overflow-x: auto; border: 1px solid #a9b4c3; border-radius: 10px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.65; }
th, td { text-align: left; padding: 11px 13px; vertical-align: top; border-right: 1px solid #d5dbe3; border-bottom: 1px solid #c8d0da; min-width: 140px; }
th:last-child, td:last-child { border-right: 0; }
tr:last-child td { border-bottom: 0; }
th { background: #233e65; color: white; font-weight: 800; }
tbody tr:nth-child(even) { background: #f0f3f7; }
tbody tr:target { background: #fff1ca; }
td:first-child { min-width: 170px; font-weight: 700; }
.back-top { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 90; width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c38; font-size: 1.15rem; font-weight: 900; }
footer { border-top: 1px solid var(--line); padding: 25px 80px 32px 24px; text-align: center; background: #eee8dc; }
@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) {
  body { line-height: 1.78; }
  .utility { padding: 8px 79px 8px 15px; gap: 8px; flex-wrap: wrap; }
  .utility > a { font-size: .75rem; }
  .languages { margin-left: auto; gap: 6px; }
  .languages button { padding: 4px 10px; font-size: .75rem; }
  .hero-inner { padding: 29px 20px 27px; }
  h1, html[lang="en"] h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); line-height: 1.3; text-wrap: wrap; }
  .category-inner { gap: 22px; padding: 10px 20px; font-size: .85rem; }
  .controls { padding: 13px 76px 0 15px; }
  .actions button { font-size: .84rem; }
  .search-form { flex-wrap: wrap; }
  .search-form input { flex-basis: calc(100% - 80px); }
  .search-label { font-size: .85rem; }
  .intro { padding: 20px 76px 0 15px; }
  .edition { font-size: .86rem; }
  .notices { grid-template-columns: 1fr; }
  .notice { padding: 13px 15px; font-size: .88rem; }
  .layout { display: block; padding: 22px 76px 65px 15px; }
  .toc { position: static; max-height: none; margin-bottom: 22px; padding: 14px 17px; }
  .progress-panel { padding: 17px; }
  .progress-note { font-size: .83rem; }
  .progress-number { font-size: 1rem; }
  .chapter h2 { font-size: 1.14rem; }
  .chapter-controls button { font-size: .83rem; padding: 7px 12px; }
  .route-card { padding: 17px 15px 19px; }
  .route-heading { gap: 10px; }
  .route-heading label { font-size: 1rem; }
  .route-meta { margin-left: 0; }
  .route-card ol { margin-left: 0; padding-left: 1.35em; }
  .route-card .warning, .next, .references { margin-left: 0; }
  .floating-progress { width: 58px; height: 58px; right: 10px; top: 10px; border-width: 2px; font-size: .88rem; }
  th, td { padding: 10px 12px; font-size: .87rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: white; color: black; font-size: 11pt; }
  .utility, .category-nav, .controls, .toc, .floating-progress, .chapter-controls, .progress-bottom, .back-top, footer, .references { display: none !important; }
  .hero { background: none; color: black; }
  .hero-inner { padding: 0 0 15px; }
  h1, html[lang="en"] h1 { font-size: 22pt; }
  .intro, .layout { display: block; padding: 0; }
  .route-card { break-inside: avoid; box-shadow: none; }
  .table-scroll { overflow: visible; }
  table { width: 100%; table-layout: fixed; }
  th, td, td:first-child { min-width: 0; overflow-wrap: anywhere; }
}

/* Date overview: keep the date and objective readable in a narrow table. */
#story-dates table { table-layout: fixed; min-width: 468px; }
#story-dates th, #story-dates td { min-width: 0; overflow-wrap: anywhere; }
#story-dates th:first-child, #story-dates td:first-child { width: 88px; }
#story-dates th:nth-child(3), #story-dates td:nth-child(3) { width: 170px; }

.category-inner { width: auto; min-width: 0; flex-wrap: wrap; row-gap: 6px; }
.map-section { margin-bottom: 32px; }
.map-section > h2 { color: var(--navy); font-size: 1.35rem; }
.map-figure { margin: 20px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.map-stage { position: relative; max-width: 640px; margin: auto; }
.map-image { display: block; width: 100%; height: auto; }
.map-hotspot { position: absolute; width: 44px; height: 44px; transform: translate(-50%, -50%); color: transparent; font-size: 0; border-radius: 50%; }
.map-hotspot:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; background: #fff7dc66; }
.map-figure figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 12px; font-size: .9rem; }
.map-point { margin: 14px 0; padding: 14px 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.map-point > summary { cursor: pointer; font-weight: 800; color: var(--blue); }
.map-point .references { margin-left: 0; }
@media (max-width: 760px) {
  .maps-content .map-figure { padding: 6px; }
  .maps-content .map-figure figcaption { padding: 10px 5px 5px; }
}
@media print {
  .map-figure { padding: 0; border: 0; break-inside: avoid; }
  .map-hotspot, .map-image-open { display: none !important; }
}
