:root {
  color-scheme: light;
  --paper: #fffef9;
  --page: #f2efe7;
  --navy: #17375f;
  --blue: #075b9a;
  --gold: #9a6500;
  --green: #087653;
  --red: #b3332f;
  --line: #b9ac96;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: #111827;
  background: var(--page);
  font: 16px/1.78 "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  letter-spacing: .012em;
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: #06385f; }
:focus-visible { outline: 3px solid #ad771f; outline-offset: 3px; }
.page-scroll { height: calc(100dvh - 68px); overflow: auto; scroll-behavior: auto; }
.skip { position: absolute; top: -100px; left: 16px; z-index: 50; background: white; padding: 10px; }
.skip:focus { top: 10px; }
.action-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  min-height: 90px;
  padding: 8px max(24px, calc((100% - 1328px) / 2));
  padding-right: max(108px, calc((100% - 1328px) / 2));
  background: #eee8dc;
  border-bottom: 1px solid var(--line);
}
.bar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, .button {
  min-height: 42px;
  padding: 7px 14px;
  border: 1px solid #968873;
  border-radius: 10px;
  background: var(--paper);
  color: #17375f;
  line-height: 1.4;
  text-decoration: none;
}
button[aria-pressed="true"] { color: white; background: var(--navy); border-color: var(--navy); }
.language button { border-radius: 30px; font-size: .85rem; min-height: 34px; }
.hero { background: linear-gradient(118deg, #17375f, #1d3f6b); color: white; }
.hero-inner { max-width: 1440px; margin: auto; padding: 34px clamp(20px, 5.2vw, 76px) 38px; }
.edition { margin: 0 0 7px; color: #f2e8d2; font-size: .83rem; letter-spacing: .05em; }
h1 {
  margin: 0;
  font: 700 clamp(2rem, 4.1vw, 3.45rem)/1.24 YuMincho, "Yu Mincho", serif;
  letter-spacing: .015em;
  overflow-wrap: break-word;
  text-wrap: balance;
}
html[lang="en"] h1 { font-size: clamp(1.8rem, 3.7vw, 3.25rem); }
.category-nav { background: var(--paper); border-bottom: 1px solid #aeb8c7; overflow-x: auto; }
.nav-inner { display: flex; gap: 24px; min-width: max-content; max-width: 1440px; margin: auto; padding: 10px clamp(20px, 5.2vw, 76px); }
.category-nav a { font-size: .92rem; font-weight: 800; text-decoration: none; white-space: nowrap; padding: 3px 0; border-bottom: 2px solid transparent; }
.category-nav a[aria-current="page"] { color: var(--navy); border-color: var(--gold); }
.shell { max-width: 1440px; padding: 24px clamp(14px, 4vw, 56px) 38px; margin: auto; }
.notice {
  border: 1px solid #ae6e54;
  border-radius: 14px;
  background: #f6e8df;
  padding: 17px 22px;
  margin-bottom: 20px;
}
.notice h2 { font-size: 1rem; margin: 0 0 7px; color: #6e2e20; }
.notice ul { margin: 0; padding-left: 1.3em; font-size: .9rem; }
.notice li + li { margin-top: 4px; }
.search-panel { border: 1px solid #adb8ca; border-radius: 14px; padding: 16px; background: #faf7ef; margin-bottom: 24px; }
.search-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.search-controls label { font-weight: 700; color: var(--navy); }
input[type="search"] { min-height: 44px; width: 100%; min-width: 0; border: 1px solid #8294b1; border-radius: 7px; padding: 8px 12px; background: white; }
#search-status { margin: 6px 0 0; font-size: .84rem; color: #374151; }
#search-results { margin-top: 12px; max-height: 350px; overflow: auto; }
.search-result { padding: 10px 3px; border-top: 1px solid #d5ccbd; }
.search-result small { display: block; color: #66543b; }
.search-result p { font-size: .88rem; margin: 3px 0; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; align-items: start; }
.toc { position: sticky; top: 16px; max-height: calc(100dvh - 110px); overflow: auto; padding: 18px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 16px 35px #30261518; }
.toc h2 { font-size: .8rem; color: var(--gold); margin: 0 0 10px; letter-spacing: .12em; }
.toc a { display: block; font-size: .87rem; line-height: 1.5; padding: 8px; border-radius: 7px; color: #374151; text-decoration: none; }
.toc a:hover { background: #f0e9da; color: var(--navy); }
main { min-width: 0; }
.panel { padding: 22px 24px; margin-bottom: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 20px #3026150e; }
.panel h2 { margin: 0 0 12px; font-size: 1.25rem; }
.panel p { margin: 8px 0; }
.progress-panel h2 { font-size: 1rem; color: var(--navy); }
.progress-summary { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.progress-number { font-size: 1.3rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.mode-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0; }
.mode-controls label { font-size: .9rem; font-weight: 700; color: var(--navy); }
.mode-controls select { max-width: 100%; min-width: 0; min-height: 42px; padding: 5px 30px 5px 10px; border: 1px solid #8294b1; border-radius: 7px; background: white; color: #17375f; }
.collection-mode-note { font-size: .8rem; }
.mp-cost { min-width: 115px; }
.track { height: 10px; border: 1px solid #ad9d83; border-radius: 20px; overflow: hidden; background: #e8e0d1; margin: 12px 0; }
.fill { height: 100%; width: 0; background: #237858; transition: width .3s ease; }
.save-text { color: #374151; font-size: .86rem; }
#storage-status { color: #7c371c; }
#retry-save { margin-top: 8px; }
.overview { margin: 0; padding-left: 1.35em; }
.overview li + li { margin-top: 7px; }
.chapter-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
details.chapter { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 18px; overflow: clip; background: #e9e1d2; box-shadow: 0 10px 26px #30261512; }
details.chapter > summary { padding: 20px 22px; background: var(--paper); cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 14px; list-style: none; }
summary::-webkit-details-marker { display: none; }
details.chapter > summary::after { content: "+"; border: 1px solid var(--line); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; color: var(--gold); }
details.chapter[open] > summary::after { content: "−"; }
summary h2 { font-size: 1.22rem; margin: 0; }
.chapter-body { padding: 0 20px 22px; }
.route-card { position: relative; margin-top: 14px; padding: 20px; border: 1px solid #c4b8a4; border-radius: 14px; background: var(--paper); scroll-margin-top: 22px; }
.route-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.route-head input { width: 24px; height: 24px; margin: 3px 0 0; accent-color: var(--green); cursor: pointer; }
.route-head h3 { margin: 0; font-size: 1.05rem; line-height: 1.5; }
.badge { border: 1px solid #9d8148; border-radius: 25px; padding: 2px 8px; font-size: .68rem; color: #735413; white-space: nowrap; }
.badge.optional { border-color: #4c8a6d; color: #146342; }
.route-card ol { margin: 12px 0 0 38px; padding-left: 1.3em; }
.route-card li + li { margin-top: 10px; }
.reference-link { margin: 12px 0 0 38px; font-size: .88rem; }
.route-card.is-done { border-color: var(--green); padding-bottom: 62px; box-shadow: 0 7px 18px #18574214; }
.route-card.is-done::after {
  content: "完了";
  position: absolute;
  display: grid;
  place-items: center;
  right: 15px;
  bottom: 12px;
  width: 62px;
  height: 31px;
  border: 2px solid #b3332fed;
  border-radius: 4px 6px 5px 3px;
  color: var(--red);
  background: radial-gradient(circle at 16% 28%, #fffef9 0 1px, transparent 1.35px) 0 0 / 9px 8px, #fffdf8;
  font-size: .92rem;
  font-weight: 900;
  letter-spacing: .1em;
  line-height: 1;
  transform: none;
}
html[lang="en"] .route-card.is-done::after { content: "DONE"; letter-spacing: .06em; }
.route-card.bump { animation: card-bump .58s ease; }
.route-card.bump::after { animation: stamp-pop .58s ease; }
@keyframes card-bump { 0%, 100% { transform: scale(1); } 36% { transform: scale(1.012); } 68% { transform: scale(.996); } }
@keyframes stamp-pop { 0% { opacity: 0; transform: scale(1.4); } 58% { opacity: 1; transform: scale(.93); } 100% { opacity: 1; transform: scale(1); } }
.floating-progress { position: absolute; z-index: 20; top: 10px; right: 18px; width: 72px; height: 72px; border: 3px solid #1d3f6b; border-radius: 50%; background: #fffdf8f7; color: #194a3c; display: grid; place-items: center; box-shadow: 0 6px 20px #09182c25, inset 0 0 0 4px #eee8dc; font-weight: 900; pointer-events: none; }
.floating-progress.bump { animation: progress-bump .64s ease; }
@keyframes progress-bump { 0%,100% { transform: scale(1); } 34% { transform: scale(1.15); } 62% { transform: scale(.94); } }
.utility-rail { position: fixed; bottom: 0; right: 0; left: 0; height: 68px; background: var(--page); border-top: 1px solid #c4b8a4; z-index: 25; }
.back-top { position: absolute; right: 18px; bottom: 11px; width: 46px; height: 46px; min-height: 0; padding: 0; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 5px 16px #09182c25; font-weight: 900; }
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid #adb8ca; border-radius: 11px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; background: white; font-size: .9rem; line-height: 1.65; }
th, td { text-align: left; vertical-align: top; border: 1px solid #cbd3df; padding: 11px 12px; }
th { background: #203d65; color: white; font-weight: 800; }
tbody tr:nth-child(even) { background: #eff2f6; }
td:first-child { min-width: 150px; }
.check-cell { min-width: 46px !important; width: 46px; }
.price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-heading { margin: 26px 0 12px; font-size: 1.2rem; }
.detail { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-top: 14px; scroll-margin-top: 22px; background: var(--paper); }
.detail summary { cursor: pointer; font-weight: 800; color: var(--navy); }
.detail ul { margin: 12px 0; padding-left: 1.3em; }
.detail li + li { margin-top: 8px; }
.collect { width: 22px; height: 22px; accent-color: var(--green); }
.collection-count { color: var(--green); font-weight: 700; }
.row-done { background: #e7f3ed !important; }
.row-done .row-name::after { content: " ✓"; color: var(--green); }
.footer { text-align: center; padding: 25px 15px 10px; }
.muted { color: #4b5563; font-size: .88rem; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .action-bar { padding: 8px 82px 8px 15px; gap: 8px; }
  .bar-group { gap: 6px; }
  .bar-group button { font-size: .8rem; min-height: 36px; padding: 6px 10px; }
  .bar-group a { font-size: .8rem; }
  .hero-inner { padding: 27px 20px 29px; }
  h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); text-wrap: wrap; }
  html[lang="en"] h1 { font-size: clamp(1.55rem, 7.2vw, 2.2rem); }
  .edition { font-size: .75rem; }
  .nav-inner { gap: 19px; padding: 9px 20px; }
  .category-nav a { font-size: .84rem; }
  .floating-progress { width: 58px; height: 58px; right: 10px; border-width: 2px; font-size: .9rem; }
  .shell { padding-top: 17px; }
  .notice { padding: 14px 16px; }
  .search-controls { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .search-controls label { grid-column: 1 / -1; font-size: .9rem; }
  .search-panel { padding: 13px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .toc { position: static; max-height: none; padding: 14px; box-shadow: none; }
  .toc a { padding: 6px; }
  .panel { padding: 18px 16px; }
  .progress-number { font-size: 1.15rem; }
  .chapter-body { padding: 0 10px 13px; }
  details.chapter > summary { padding: 17px 16px; }
  summary h2 { font-size: 1.1rem; }
  .route-card { padding: 16px 14px; }
  .route-head { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
  .route-head h3 { grid-column: 1 / -1; grid-row: 2; }
  .route-head .badge { grid-column: 2; justify-self: start; align-self: center; }
  .route-card ol { margin-left: 0; }
  .reference-link { margin-left: 0; }
  .detail { padding: 14px; }
  td:first-child { min-width: 145px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  html, body { height: auto; background: white; }
  .page-scroll { height: auto; overflow: visible; }
  .action-bar, .category-nav, .toc, .search-panel, .utility-rail, .floating-progress, .chapter-tools, .progress-reset, #retry-save { display: none !important; }
  .shell { padding: 12px; }
  .layout { display: block; }
  .hero { color: black; background: white; }
  .edition { color: #333; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 9pt; }
  .panel, details.chapter { box-shadow: none; break-inside: avoid; }
  .route-card { break-inside: avoid; }
  a { color: black; }
}
