:root {
  color-scheme: light;
  --ink: #17243a;
  --muted: #586477;
  --navy: #17375f;
  --navy-2: #24476f;
  --blue: #12649c;
  --gold: #a87922;
  --paper: #f3efe5;
  --paper-light: #fbf9f3;
  --card: #fffefa;
  --line: #cfc4ae;
  --line-dark: #a99779;
  --good: #14745e;
  --good-bg: #e5f2eb;
  --warn: #9e3e26;
  --warn-bg: #fae9e2;
  --info-bg: #e8f0f7;
  --shadow: 0 8px 24px rgba(35, 42, 54, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 76% 0%, rgba(255,255,255,.72), transparent 48rem),
    var(--paper);
  font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.78;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: #0a456e; }
button {
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--navy);
  background: var(--card);
  min-height: 42px;
  padding: .48rem .95rem;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
button:hover { background: #f5f0e4; box-shadow: var(--shadow); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid #e0ad48;
  outline-offset: 3px;
}
.masthead {
  color: white;
  background:
    radial-gradient(circle at 88% -38%, rgba(255,255,255,.16), transparent 31rem),
    linear-gradient(118deg, var(--navy), var(--navy-2));
}
.masthead-inner { max-width: 1440px; margin: auto; padding: 2.2rem clamp(1rem, 5.3vw, 4.8rem) 2.3rem; }
.series-label { margin: 0 0 .35rem; color: #dce8f5; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, h4 { line-height: 1.35; }
h1 { margin: 0; font: 700 clamp(2rem, 5vw, 3.25rem)/1.18 "YuMincho", "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: .02em; }
.subtitle { margin: .65rem 0 0; color: #e2ebf4; }
.utility-bar { background: #fbf8f0; border-bottom: 1px solid var(--line); }
.utility-inner {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .55rem;
  max-width: 1440px; margin: auto; padding: .7rem clamp(1rem, 4vw, 3.6rem);
}
.language-switch { display: flex; gap: .35rem; margin-right: auto; }
.language-button { min-width: 7rem; }
.language-button.is-active, .primary-button { color: white; background: var(--navy); border-color: var(--navy); }
.language-button.is-active:hover, .primary-button:hover { color: white; background: #244a75; }
.utility-button { border-radius: .7rem; }
.section-nav { background: #fffdf8; border-bottom: 1px solid var(--line); box-shadow: 0 3px 12px rgba(36, 47, 61, .04); }
.section-nav-inner {
  display: flex; flex-wrap: wrap; gap: .1rem .35rem;
  max-width: 1440px; margin: auto; padding: .4rem clamp(1rem, 4vw, 3.6rem);
}
.section-nav a { padding: .48rem .78rem; font-size: .93rem; font-weight: 700; text-decoration: none; border-radius: .5rem; }
.section-nav a:hover { background: var(--info-bg); }
.page-shell { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr); gap: clamp(1rem, 2.4vw, 2.2rem); max-width: 1440px; margin: 0 auto; padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1rem, 4vw, 3.6rem) 3rem; }
.side-panel {
  align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto;
  padding: 1.1rem; border: 1px solid var(--line-dark); border-radius: 1rem; background: var(--card); box-shadow: var(--shadow);
}
.side-panel h2 { margin: 0 0 .65rem; color: var(--navy); font-size: 1.03rem; }
.toc-list { display: grid; gap: .15rem; }
.toc-list a { display: block; padding: .38rem .48rem; color: #33445d; border-radius: .4rem; text-decoration: none; font-size: .91rem; }
.toc-list a:hover { background: var(--info-bg); color: var(--navy); }
.main-column { min-width: 0; }
.progress-panel {
  display: flex; align-items: end; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.25rem; padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: 1rem;
  background: linear-gradient(135deg, #fffdf8, #f8f3e8); box-shadow: var(--shadow);
}
.progress-copy { min-width: 0; flex: 1; }
.progress-panel h2 { margin: 0; color: var(--navy); font-size: 1.08rem; }
#progress-summary { margin: .15rem 0 .55rem; color: #78570e; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; overflow: hidden; border: 1px solid var(--line-dark); border-radius: 999px; background: #ebe5d8; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #14745e, #4c9e7c); transition: width .35s ease; }
.secondary-button { border-radius: .7rem; }
.intro-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem; margin: 0 0 1.1rem; }
.notice-card { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .9rem; box-shadow: 0 4px 12px rgba(35, 42, 54, .04); }
.notice-card h2 { margin: 0 0 .4rem; font-size: 1.03rem; }
.notice-card p { margin: 0; }
.notice-red { background: var(--warn-bg); border-color: #bb826c; }
.notice-red h2 { color: #762d1c; }
.notice-blue { background: var(--info-bg); border-color: #8ca8bf; }
.notice-blue h2 { color: var(--navy); }
.search-panel { margin: 0 0 1.4rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255,254,250,.88); }
.search-panel > label { display: block; margin-bottom: .35rem; color: var(--navy); font-weight: 800; }
.search-row { display: flex; gap: .5rem; }
.search-row input { flex: 1; min-width: 0; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--line-dark); border-radius: .65rem; background: white; color: var(--ink); }
.search-hint { margin: .3rem 0 0; color: var(--muted); font-size: .88rem; }
.search-results { display: grid; gap: .5rem; margin-top: .8rem; }
.search-results:empty { display: none; }
.search-result { padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .7rem; background: #fff; }
.search-result h3 { margin: 0; font-size: 1rem; }
.search-result p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.guide-section { margin: 0 0 1.2rem; scroll-margin-top: .8rem; }
.guide-section > h2 { margin: 0 0 .8rem; padding: .7rem .1rem .45rem; color: var(--navy); font-size: clamp(1.35rem, 2.6vw, 1.8rem); border-bottom: 2px solid var(--line-dark); }
.section-lead { margin: -.25rem 0 .9rem; color: var(--muted); }
.chapter-group { display: grid; gap: .8rem; }
.chapter-card, .data-card {
  min-width: 0; overflow: clip; border: 1px solid var(--line); border-radius: .95rem; background: var(--card); box-shadow: 0 5px 16px rgba(31, 42, 56, .05);
}
.chapter-card[open] { box-shadow: var(--shadow); }
.chapter-card > summary {
  display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; color: var(--navy); cursor: pointer; list-style: none;
  background: linear-gradient(90deg, #f4efe3, #fffdf8);
}
.chapter-card > summary::-webkit-details-marker { display: none; }
.chapter-card > summary::after { content: "+"; margin-left: auto; flex: 0 0 auto; color: var(--gold); font-size: 1.3rem; font-weight: 800; }
.chapter-card[open] > summary::after { content: "−"; }
.chapter-number { display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 auto; border: 1px solid var(--line-dark); border-radius: 50%; color: #78570e; background: white; font-size: .88rem; font-weight: 800; }
.chapter-heading { min-width: 0; font-weight: 800; }
.chapter-place { display: block; margin-top: .05rem; color: var(--muted); font-size: .84rem; font-weight: 500; }
.chapter-body { padding: .2rem 1rem 1rem; }
.chapter-summary { margin: .35rem 0 .75rem; color: #33445d; }
.step-list { display: grid; gap: .55rem; padding: 0; margin: .7rem 0; list-style: none; }
.step-item {
  display: grid; grid-template-columns: 1.35rem minmax(0,1fr); gap: .6rem; align-items: start;
  padding: .68rem .72rem; border: 1px solid #ddd3c1; border-radius: .7rem; background: #fff;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.step-item.is-checked { border-color: #7eae99; background: #f0f8f3; }
.step-check { width: 1.18rem; height: 1.18rem; margin: .22rem 0 0; accent-color: var(--good); cursor: pointer; }
.step-copy { min-width: 0; }
.step-title { margin: 0; font-weight: 700; }
.step-detail { margin: .25rem 0 0; color: #38465b; }
.step-note { margin: .5rem 0 0; padding: .6rem .72rem; border: 1px solid #d6c6a7; border-radius: .55rem; background: #f7efdf; color: #3b3324; font-size: .94rem; }
.step-note.note-warn { border-color: #c08b73; background: #fff1ea; color: #642d20; }
.step-note.note-good { border-color: #83ad98; background: #edf7f0; color: #164d40; }
.completion-stamp { display: none; margin: .7rem 0 0 auto; width: fit-content; padding: .22rem .65rem; border: 2px solid #bd3434; border-radius: .25rem; color: #bd3434; background: rgba(255,255,255,.86); font-weight: 900; letter-spacing: .14em; line-height: 1.35; transform: rotate(-2deg); }
.chapter-card.is-complete .completion-stamp { display: block; animation: stamp-in .32s ease-out both; }
@keyframes stamp-in { from { opacity: 0; transform: translateY(4px) rotate(-4deg) scale(.94); } to { opacity: 1; transform: translateY(0) rotate(-2deg) scale(1); } }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .75rem; }
.data-card { padding: .9rem 1rem; }
.data-card h3 { margin: 0 0 .55rem; color: var(--navy); font-size: 1.08rem; }
.data-card h4 { margin: .85rem 0 .3rem; color: #344766; font-size: .98rem; }
.data-card p { margin: .35rem 0; }
.data-card ul, .data-card ol { padding-left: 1.35rem; margin: .4rem 0; }
.data-card li + li { margin-top: .25rem; }
.data-card.wide { grid-column: 1 / -1; }
table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line-dark); border-radius: .7rem; overflow: hidden; background: white; }
th, td { padding: .58rem .64rem; text-align: left; vertical-align: top; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
th:last-child, td:last-child { border-right: 0; }
tr:last-child td { border-bottom: 0; }
th { color: white; background: var(--navy); font-size: .92rem; }
.table-wrap { max-width: 100%; overflow-x: auto; border-radius: .7rem; }
.table-wrap table { min-width: 34rem; }
.small-table table { min-width: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 !important; list-style: none; }
.chip-list li { margin: 0 !important; padding: .28rem .58rem; border: 1px solid var(--line); border-radius: 999px; background: #f8f4eb; }
.boss-card { border: 1px solid var(--line); border-radius: .75rem; padding: .85rem .95rem; background: white; }
.boss-card + .boss-card { margin-top: .65rem; }
.boss-card h4 { margin: 0 0 .4rem; color: #5f3d0e; }
.boss-card p { margin: .25rem 0; }
.search-hit { outline: 3px solid #e0ad48; outline-offset: 3px; }
.empty-state { padding: 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-dark); border-radius: .75rem; }
.storage-status { margin: .65rem 0 0; color: var(--muted); font-size: .88rem; }
.page-footer { display: flex; justify-content: space-between; gap: .8rem; align-items: center; margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--line-dark); color: var(--muted); }
.page-footer p { margin: 0; }
.top-button { position: fixed; right: 1rem; bottom: 1rem; z-index: 5; width: 3rem; height: 3rem; padding: 0; font-size: 1.25rem; border-radius: 50%; box-shadow: var(--shadow); }
.is-hidden { display: none !important; }
@media (max-width: 850px) {
  .page-shell { grid-template-columns: 1fr; }
  .side-panel { position: static; max-height: none; }
  .toc-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  body { font-size: 16px; line-height: 1.78; }
  .masthead-inner { padding-top: 1.55rem; padding-bottom: 1.6rem; }
  .utility-inner { justify-content: flex-start; gap: .45rem; }
  .language-switch { width: 100%; margin: 0 0 .15rem; }
  .language-button { flex: 1; }
  .utility-button { min-height: 40px; padding: .4rem .7rem; font-size: .88rem; }
  .section-nav-inner { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .section-nav a { white-space: nowrap; }
  .page-shell { padding: 1rem .8rem 2rem; gap: 1rem; }
  .side-panel { padding: .8rem; }
  .toc-list { grid-template-columns: 1fr 1fr; }
  .progress-panel { align-items: stretch; flex-direction: column; padding: .9rem; }
  .progress-panel > button { align-self: flex-start; }
  .intro-grid, .data-grid { grid-template-columns: 1fr; }
  .data-card.wide { grid-column: auto; }
  .search-row { flex-wrap: wrap; }
  .search-row input { flex-basis: 100%; }
  .search-row button { flex: 1; }
  .chapter-card > summary { padding: .78rem .72rem; }
  .chapter-body { padding: .15rem .7rem .8rem; }
  .step-item { padding: .62rem .6rem; }
  .table-wrap table { min-width: 39rem; }
  .small-table table { min-width: 32rem; }
  .page-footer { align-items: flex-start; flex-direction: column; }
  .top-button { right: .65rem; bottom: .65rem; }
}
@media print {
  body { background: white; color: #111; }
  .utility-bar, .section-nav, .side-panel, .search-panel, .top-button, #reset-progress, .progress-track { display: none !important; }
  .page-shell { display: block; max-width: none; padding: 0; }
  .masthead { color: #111; background: white; border-bottom: 1px solid #777; }
  .masthead-inner { padding: 1rem 0; }
  .masthead h1, .masthead p { color: #111; }
  .guide-section, .chapter-card, .data-card { break-inside: avoid; box-shadow: none; }
  details > .chapter-body { display: block !important; }
  a { color: #111; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body[data-lang="ja"] [lang="en"], body[data-lang="en"] [lang="ja"] { display: none !important; }
.bulk-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .75rem; }
.bulk-controls button { border-radius: .65rem; }
.search-count { margin: 0; color: var(--muted); font-size: .9rem; }
.completion-stamp { transform: none; }
@keyframes stamp-in { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.guide-return-bar {
  display: flex;
  justify-content: flex-end;
  padding: .55rem clamp(1rem, 5.3vw, 4.8rem);
  background: #fbf8f0;
}
.guide-list-back {
  color: var(--link);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.guide-list-back:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 3px;
}
.guide-return-footer {
  padding: 1.2rem 1rem 2rem;
  text-align: center;
}
@media print {
  .guide-return-bar, .guide-return-footer, .gtl-guide-footer71 { display: none !important; }
}
