:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-dark: #102746;
  --blue: #285a82;
  --ink: #252a2f;
  --muted: #59636c;
  --paper: #fffdf7;
  --page: #f1eee5;
  --line: #c9c4b7;
  --gold: #a66b16;
  --gold-pale: #f6eddb;
  --blue-pale: #edf3f7;
  --green: #23674f;
  --red: #923c37;
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; }
button, input { font: inherit; }
button { color: inherit; }
a { color: #075b9a; text-underline-offset: 0.18em; }
a:hover { color: var(--navy-dark); }
:focus-visible { outline: 3px solid #d78a18; outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  z-index: 30;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  padding: 0.5rem 0.85rem;
  transform: translateY(-180%);
  border: 1px solid #fff;
  background: var(--navy-dark);
  color: #fff;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  border-block-end: 5px solid #c6a264;
  background: var(--navy);
  color: #fff;
}
.header-inner, .page-shell { width: min(1160px, calc(100% - 36px)); margin-inline: auto; }
.header-inner { padding-block: 2.2rem 1.9rem; text-align: center; }
.series-name { margin: 0; color: #e8dcc2; font-size: 0.9rem; letter-spacing: 0.16em; }
h1, h2, h3, h4 { margin-block-start: 0; }
h1 {
  margin-block: 0.2rem 0.7rem;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.035em;
}
.edition-line { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.45rem; }
.edition-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.12rem 0.75rem;
  border: 1px solid #e1d0aa;
  border-radius: 999px;
  color: #fff9ea;
  font-size: 0.83rem;
}
.header-return { margin: 0.8rem 0 0; }
.header-return a { display: inline-block; padding: 0.18rem 0.65rem; border: 1px solid #e1d0aa; border-radius: 6px; color: #fff; text-decoration: none; }
.header-return a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: underline; }

.tool-panel, .progress-panel, .info-card, .notice-card, .story-chapter {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.tool-panel { margin-block: 1.25rem 1rem; padding: 1rem 1.1rem; }
.search-wrap label { display: block; color: var(--navy); font-weight: 700; }
.search-input-row { display: flex; gap: 0.55rem; margin-block-start: 0.35rem; }
#guide-search {
  width: 100%;
  min-width: 0;
  padding: 0.68rem 0.8rem;
  border: 1px solid #89929a;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.field-hint { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.86rem; }
.tool-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.7rem; margin-block-start: 0.85rem; }
.language-switch, .sound-controls { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.language-switch button, .sound-controls button, .quiet-button, .story-tools button, .text-button {
  min-height: 40px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--navy);
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.quiet-button { flex: 0 0 auto; }
.language-switch button[aria-pressed="true"], #sound-toggle[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
.language-switch button:hover, .sound-controls button:hover, .quiet-button:hover, .story-tools button:hover, .text-button:hover { background: var(--blue-pale); }
.language-switch button[aria-pressed="true"]:hover, #sound-toggle[aria-pressed="true"]:hover { background: var(--navy-dark); }
.sound-controls button:disabled { cursor: not-allowed; opacity: 0.58; }
.search-panel { margin-block-start: 0.9rem; padding-block-start: 0.8rem; border-block-start: 1px solid var(--line); }
.search-status { margin: 0 0 0.45rem; color: var(--navy); font-weight: 700; }
.search-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.search-results a { display: block; min-height: 100%; padding: 0.45rem 0.6rem; border: 1px solid #d5d9dc; border-radius: 6px; background: #fff; text-decoration: none; }
.search-results a:hover { background: var(--blue-pale); }
.search-results small { display: block; color: var(--muted); font-size: 0.8rem; }

.main-nav {
  position: sticky;
  z-index: 10;
  inset-block-start: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.65rem;
  margin-block: 0.9rem 1.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #bac4cb;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.97);
  box-shadow: 0 2px 8px rgba(16, 39, 70, 0.06);
}
.main-nav a { padding: 0.18rem 0.35rem; font-weight: 700; text-decoration-thickness: 1px; }
.layout-grid { display: grid; grid-template-columns: minmax(185px, 225px) minmax(0, 1fr); align-items: start; gap: 1.35rem; }
.guide-toc {
  position: sticky;
  inset-block-start: 4.7rem;
  display: grid;
  gap: 0.22rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.guide-toc h2 { margin: 0 0 0.2rem; color: var(--navy); font-size: 1rem; }
.guide-toc a { padding: 0.14rem 0.2rem; font-size: 0.91rem; }
.toc-sub { display: grid; margin-inline-start: 0.65rem; }
.guide-main { min-width: 0; }
.guide-section { margin-block: 0 2.8rem; scroll-margin-top: 6.5rem; }
.section-heading { margin-block-end: 0.85rem; padding-block-end: 0.65rem; border-block-end: 2px solid #c6ad7b; }
.eyebrow { margin: 0; color: #805717; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; }
.section-heading h2 {
  margin: 0.1rem 0 0;
  color: var(--navy);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.4;
}
.section-intro { margin: 0.65rem 0 1rem; color: #414a50; }
.info-card, .notice-card { margin-block: 0.8rem; padding: 1rem clamp(0.85rem, 2.5vw, 1.25rem); scroll-margin-top: 6.7rem; }
.info-card h3, .notice-card h3 { margin: 0; color: var(--navy); font-size: 1.18rem; line-height: 1.5; }
.info-card h4 { margin: 1rem 0 0.4rem; color: var(--navy); font-size: 1.03rem; }
.info-card p, .notice-card p { margin-block: 0.62rem; }
.notice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.notice-card { margin: 0 0 0.8rem; }
.notice-alert { background: #fbf2e4; }
.notice-info { background: #edf4f6; }

.progress-panel { margin-block: 1rem 1.2rem; padding: 0.85rem 1rem 0.75rem; }
.progress-heading-row, .progress-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.progress-heading-row h2 { margin: 0; color: var(--navy); font-size: 1.1rem; }
.progress-count { color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-meter { height: 12px; overflow: hidden; margin-block: 0.55rem; border: 1px solid #aeb5ba; border-radius: 999px; background: #e7e8e5; }
#progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width 260ms ease; }
.progress-footer { min-height: 34px; }
.progress-warning { flex: 1 1 260px; margin: 0; color: var(--red); font-size: 0.88rem; }
.text-button { min-height: 34px; padding: 0.2rem 0.6rem; font-size: 0.85rem; }

.story-tools { display: flex; justify-content: flex-end; margin-block: 0.7rem; }
.story-tools button { min-height: 38px; font-size: 0.9rem; }
.story-chapter { overflow: clip; margin-block: 0.85rem; scroll-margin-top: 6.4rem; }
.story-chapter > summary {
  padding: 0.72rem 1rem;
  background: #eaf0f3;
  color: var(--navy);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.story-chapter[open] > summary { border-block-end: 1px solid var(--line); }
.story-chapter > summary:focus-visible { outline-offset: -4px; }
.chapter-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.72rem; padding: 0.8rem; }
.route-card { min-width: 0; padding: 0.85rem; border: 1px solid #d0ccc1; border-radius: 7px; background: #fff; scroll-margin-top: 6.5rem; }
.route-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.route-heading h4 { margin: 0; color: var(--navy); font-size: 1.05rem; line-height: 1.45; }
.route-status { flex: 0 0 auto; min-height: 1.45rem; padding: 0.02rem 0.42rem; border: 1px solid transparent; border-radius: 999px; color: transparent; font-size: 0.72rem; font-weight: 700; }
.route-status.is-done { border-color: #83aa96; background: #eaf4ef; color: #14583f; }
.route-list, .paired-list { margin: 0.62rem 0; padding-inline-start: 1.45rem; }
.route-list li, .paired-list li { margin-block: 0.35rem; padding-inline-start: 0.12rem; }
.route-list li::marker, .paired-list li::marker { color: var(--gold); font-weight: 700; }
.route-note { margin-block: 0.65rem; padding: 0.65rem 0.75rem; border: 1px solid #d8cfb8; border-radius: 6px; background: var(--gold-pale); color: #574516; font-size: 0.94rem; }
.card-actions { display: flex; justify-content: flex-end; margin-block-start: 0.7rem; }
.progress-toggle { display: inline-flex; align-items: center; gap: 0.42rem; min-height: 38px; padding: 0.2rem 0.65rem; border: 1px solid #697986; border-radius: 6px; background: #fff; color: var(--navy); cursor: pointer; font-size: 0.88rem; }
.progress-toggle input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--green); }
.progress-toggle:has(input:checked) { border-color: #438269; background: #eaf4ef; color: #14583f; }
.progress-toggle:hover { background-color: var(--blue-pale); }
.progress-toggle:has(input:checked):hover { background: #dcefe5; }

.table-scroll { overflow-x: auto; margin-block: 0.7rem; border: 1px solid #b8bdc0; border-radius: 6px; background: #fff; }
.data-table { width: 100%; min-width: 680px; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { padding: 0.55rem 0.65rem; border: 1px solid #cbd0d2; text-align: start; vertical-align: top; }
.data-table thead th { background: var(--navy); color: #fff; font-weight: 700; }
.data-table tbody tr:nth-child(even) { background: #f7f7f3; }
.data-table tbody th { background: #edf1f3; color: var(--navy); }
.data-table .search-item[hidden] { display: none; }
.event-name-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.12rem 1.4rem; margin: 0.45rem 0; padding-inline-start: 1.3rem; }
.event-name-list li::marker { color: var(--gold); }
.birthday-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1rem; }
.birthday-grid p { margin: 0.45rem 0; }
.site-footer { margin-block: 2.3rem 0.5rem; padding: 1.05rem; border: 1px solid var(--navy); border-radius: 8px; background: var(--navy); text-align: center; }
.site-footer a { color: #fff; font-weight: 700; }
.site-footer a:hover { color: #f5dfae; }
.to-top {
  position: fixed;
  z-index: 20;
  inset-inline-end: 18px;
  inset-block-end: 18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 39, 70, 0.22);
  font-size: 1.35rem;
  cursor: pointer;
}
.to-top:hover { background: var(--navy-dark); }
.search-item[hidden] { display: none !important; }
.lang-ja, .lang-en { display: inline; }
html[data-guide-lang="ja"] .lang-en { display: none !important; }
html[data-guide-lang="en"] .lang-ja { display: none !important; }

@media (max-width: 840px) {
  .layout-grid { grid-template-columns: minmax(0, 1fr); }
  .guide-toc { display: none; }
  .guide-section { scroll-margin-top: 1rem; }
  .info-card, .notice-card, .route-card { scroll-margin-top: 1rem; }
}
@media (max-width: 640px) {
  :root { font-size: 15px; }
  .header-inner, .page-shell { width: calc(100% - 22px); }
  .header-inner { padding-block: 1.55rem; }
  .tool-panel { padding: 0.8rem; }
  .search-input-row { align-items: stretch; }
  .tool-actions { align-items: stretch; }
  .language-switch, .sound-controls { flex: 1 1 100%; }
  .language-switch button, .sound-controls button { flex: 1 1 0; }
  .main-nav { position: static; justify-content: flex-start; gap: 0.28rem; margin-block-end: 1.2rem; }
  .main-nav a { flex: 1 1 auto; text-align: center; }
  .notice-grid, .chapter-body, .event-name-list, .birthday-grid { grid-template-columns: minmax(0, 1fr); }
  .chapter-body { padding: 0.6rem; }
  .story-chapter > summary { padding: 0.65rem 0.75rem; }
  .route-card { padding: 0.75rem; }
  .to-top { inset-inline-end: 12px; inset-block-end: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
@media print {
  :root { color: #000; background: #fff; }
  body { background: #fff; }
  .tool-panel, .progress-panel, .main-nav, .guide-toc, .story-tools, .card-actions, .to-top, .skip-link { display: none !important; }
  .layout-grid { display: block; }
  .site-header { border: 0; background: #fff; color: #000; }
  .header-inner { padding: 0.5rem; }
  h1, .section-heading h2, .info-card h3, .route-heading h4 { color: #000; }
  .edition-pill { border-color: #777; color: #000; }
  .story-chapter { overflow: visible; break-inside: auto; }
  .story-chapter > summary { border-block-end: 1px solid #777; background: #fff; color: #000; }
  .story-chapter:not([open]) > .chapter-body { display: grid !important; }
  .info-card, .notice-card, .route-card { break-inside: avoid; background: #fff; }
  .table-scroll { overflow: visible; }
  .data-table { min-width: 0; }
  .lang-ja, .lang-en { display: inline !important; }
  .lang-en { margin-inline-start: 0.15em; }
  a { color: #000; }
}

.episode-number { display:inline-block; margin-inline-end:.5rem; padding:.05rem .55rem; border:1px solid #b7a16f; border-radius:999px; background:#fffaf0; color:#60481c; font-size:.78rem; vertical-align:.12em; }
.route-card h5 { margin:.82rem 0 .35rem; color:var(--navy); font-size:.99rem; }
.battle-block { min-width:0; margin-block:.7rem; padding:.7rem; border:1px solid #d4cdbb; border-radius:7px; background:#fffefa; }
.battle-block h5 { margin:0 0 .4rem; color:var(--navy); font-size:1rem; }
.battle-block p { margin:.35rem 0; }
.partner-table { min-width:760px; }

.episode-number { display:inline-block; margin-inline-end:.5rem; padding:.05rem .55rem; border:1px solid #b7a16f; border-radius:999px; background:#fffaf0; color:#60481c; font-size:.78rem; vertical-align:.12em; }
.route-card h4 { margin:.8rem 0 .35rem; color:var(--navy); font-size:1rem; }
.route-list { margin:.35rem 0 .75rem; padding-inline-start:1.5rem; }
.route-list li { margin-block:.36rem; padding-inline-start:.2rem; }
.battle-block { min-width:0; margin-block:.7rem; padding:.7rem; border:1px solid #d4cdbb; border-radius:7px; background:#fffefa; }
.battle-block h4 { margin:0 0 .38rem; color:var(--navy); font-size:.98rem; }
.battle-block p { margin:.3rem 0; }
.route-table { min-width:720px; }
