:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #f2efe7;
  --panel: #fffef9;
  --line: #b8aa94;
  --ink: #15233d;
  --muted: #46536a;
  --blue: #075b9a;
  --gold: #a76800;
  --green: #237858;
  --red: #b3332f;
  --shadow: 0 10px 28px rgb(46 38 25 / 10%);
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.78; }
button, input, select { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: .2em; }
a:hover { color: #073d67; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #a76800;
  outline-offset: 4px;
}
button, .button {
  min-height: 42px;
  padding: 7px 14px;
  border: 1px solid #9a8b74;
  border-radius: 9px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 700;
}
button:hover { border-color: var(--navy); box-shadow: 0 4px 12px rgb(23 55 95 / 12%); }
.skip { position: absolute; left: 16px; top: -100px; z-index: 1000; padding: 12px; background: white; }
.skip:focus { top: 8px; }
.language-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px max(24px, calc((100vw - 1328px) / 2)) 8px;
  padding-right: max(112px, calc((100vw - 1328px) / 2 + 88px));
  border-bottom: 1px solid var(--line);
  background: #eee8dc;
}
.language-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.language-buttons button { min-height: 34px; border-radius: 999px; font-size: .82rem; }
.language-buttons button[aria-pressed="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.back-guides { font-size: .86rem; font-weight: 800; }
.hero { color: white; background: linear-gradient(118deg, var(--navy), var(--navy-light)); }
.hero-inner { max-width: 1480px; margin: auto; padding: 32px clamp(24px, 5.2vw, 80px) 34px; }
.edition { margin: 0 0 8px; color: #f3dfb9; font-size: .86rem; font-weight: 750; letter-spacing: .035em; }
h1 { margin: 0; font-family: YuMincho, "Yu Mincho", serif; font-size: clamp(2rem, 4vw, 3.45rem); line-height: 1.24; text-wrap: balance; }
html[lang="en"] h1 { font-size: clamp(1.8rem, 3.7vw, 3.25rem); }
.category-nav { overflow-x: auto; background: #fffdf8; border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px rgb(20 35 60 / 7%); }
.category-inner { display: flex; gap: 24px; width: max-content; min-width: min(100%, 1480px); margin: auto; padding: 10px clamp(24px, 5.2vw, 80px); }
.category-nav a { padding: 5px 0; min-height: 32px; border-bottom: 2px solid transparent; font-size: .92rem; font-weight: 850; text-decoration: none; white-space: nowrap; }
.category-nav a[aria-current="page"] { border-bottom-color: var(--gold); color: var(--navy); }
.progress-bubble { position: fixed; top: 12px; right: 16px; z-index: 100; display: grid; place-content: center; width: 72px; height: 72px; border: 3px solid var(--navy-light); border-radius: 50%; background: #fffef9f7; box-shadow: 0 6px 22px rgb(9 24 44 / 20%), inset 0 0 0 4px white; color: #194a3c; font-size: 1.05rem; font-weight: 900; pointer-events: none; }
.tool-area { max-width: 1440px; margin: auto; padding: 18px clamp(20px, 4vw, 56px) 0; }
.tools { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.search-form { flex: 1 1 400px; }
.search-label { display: block; font-size: .85rem; font-weight: 800; margin-bottom: 5px; }
.search-controls { display: flex; gap: 8px; }
.search-controls button { flex: 0 0 auto; white-space: nowrap; }
input[type="search"] { width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid #8999ad; border-radius: 8px; color: var(--ink); background: white; }
.tool-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
#sound[aria-pressed="true"] { color: #155a42; border-color: var(--green); background: #e6f4ed; }
.search-results { margin-top: 15px; padding: 16px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.search-results:empty { display: none; }
.search-results h2 { font-size: 1rem; margin: 0 0 8px; }
.search-results ol { margin: 0; padding-left: 24px; }
.search-results li { padding: 9px 0; }
.search-context { display: block; color: var(--muted); font-size: .85rem; }
.intro-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 1440px; margin: auto; padding: 22px clamp(20px, 4vw, 56px) 0; }
.note { border: 1px solid #b79a76; border-radius: 12px; padding: 15px 18px; background: #f4ead9; }
.note p { margin: 4px 0 0; }
.note strong { color: #714a00; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: auto; padding: 28px clamp(20px, 4vw, 56px) 70px; }
.toc { position: sticky; top: 22px; align-self: start; max-height: calc(100vh - 44px); overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); padding: 18px 16px; box-shadow: var(--shadow); }
.toc h2 { margin: 0 0 10px; color: var(--gold); font-size: .78rem; letter-spacing: .13em; }
.toc a { display: block; padding: 7px 8px; font-size: .88rem; line-height: 1.5; text-decoration: none; color: var(--muted); }
.toc a:hover { color: var(--blue); background: #f4ecdc; border-radius: 6px; }
main { min-width: 0; }
h2, h3, h4 { color: var(--navy); line-height: 1.5; }
h2 { font-size: 1.35rem; }
.progress-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 21px 24px; border: 1px solid #cbbda7; border-radius: 17px; background: linear-gradient(135deg, #fffefa, #f7f1e5); box-shadow: var(--shadow); margin-bottom: 24px; }
.progress-panel h2 { font-size: 1rem; margin: 0 0 8px; }
.progress-panel p { margin: 0; color: var(--muted); font-size: .84rem; }
.progress-summary { display: grid; gap: 10px; justify-items: end; }
.progress-number { color: #875b06; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
progress { display: block; width: 100%; height: 11px; margin-top: 12px; accent-color: var(--green); }
.storage-warning { margin-bottom: 15px; border: 1px solid #b48648; border-radius: 9px; background: #fff2d9; color: #663d0a; padding: 12px 15px; }
.chapter { margin-bottom: 24px; border: 1px solid var(--line); border-radius: 17px; overflow: clip; background: #e9e1d2; box-shadow: var(--shadow); }
.chapter > summary { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 20px 22px; background: var(--panel); list-style: none; cursor: pointer; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { content: "+"; display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); }
.chapter[open] > summary::after { content: "−"; }
.chapter > summary h2 { margin: 0; font-size: 1.23rem; }
.chapter-body { padding: 14px 20px 20px; }
.chapter-intro { margin: 2px 2px 18px; color: #334155; }
.step { position: relative; padding: 20px 20px 20px 62px; margin-top: 13px; border: 1px solid #c4b8a4; border-radius: 14px; background: var(--panel); scroll-margin-top: 20px; }
.step > input { position: absolute; top: 25px; left: 20px; width: 24px; height: 24px; margin: 0; accent-color: var(--green); cursor: pointer; }
.step h3 { font-size: 1.05rem; margin: 0; }
.step label { cursor: pointer; }
.area { display: inline-block; font-size: .75rem; color: #875b06; margin: 3px 0 5px; }
.step ol { padding-left: 1.35em; margin: 8px 0 0; }
.step li + li { margin-top: 6px; }
.step .tip { padding: 10px 12px; margin-top: 12px; border: 1px solid #c4b8a4; border-radius: 8px; background: #f4ecdc; font-size: .88rem; }
.step.is-done { padding-bottom: 66px; border-color: var(--green); opacity: 1; box-shadow: 0 5px 14px rgb(24 87 66 / 10%); }
.stamp { display: none; position: absolute; right: 16px; bottom: 14px; place-items: center; width: 62px; height: 31px; border: 2px solid #b3332feb; border-radius: 4px 6px 5px 3px; color: var(--red); background: radial-gradient(circle at 16% 28%, #fffdf8eb 0 1px, transparent 1.35px) 0 0 / 9px 8px, #fffdf8dc; font-size: .9rem; font-weight: 900; letter-spacing: .08em; line-height: 1; transform: none; }
.is-done .stamp { display: grid; }
.bump { animation: card-bump .58s cubic-bezier(.22, 1.3, .36, 1); }
.bump .stamp { animation: stamp-pop .58s cubic-bezier(.22, 1.3, .36, 1); }
.progress-bubble.bump { animation: progress-bump .64s ease; }
@keyframes card-bump { 0%, 100% { transform: scale(1); } 36% { transform: scale(1.012); } 68% { transform: scale(.997); } }
@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); } 35% { transform: scale(1.14); } 65% { transform: scale(.96); } }
.chapter-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; }
.data-panel { border: 1px solid var(--line); border-radius: 15px; padding: 20px; margin-bottom: 22px; background: var(--panel); box-shadow: var(--shadow); }
.data-panel h2 { margin: 0 0 12px; }
.table-scroll { overflow: auto; max-width: 100%; border: 1px solid #9cacc1; border-radius: 11px; margin-top: 16px; }
table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .9rem; line-height: 1.65; }
th { color: white; background: #203d65; text-align: left; font-size: .84rem; white-space: nowrap; }
th, td { padding: 11px 12px; border: 1px solid #ccd5e1; vertical-align: top; }
thead th { border-color: #617a9a; }
tr:nth-child(even) { background: #eff2f6; }
td:first-child { min-width: 140px; }
td p { margin: 0; }
.row-check { display: flex; align-items: start; gap: 8px; }
.row-check input { flex-shrink: 0; width: 20px; height: 20px; accent-color: var(--green); margin-top: 3px; }
tr.collected { background: #e5f2eb; }
.context-link { display: block; font-size: .82rem; margin-top: 6px; }
.empty-note { color: var(--muted); }
.back-top { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); right: max(18px, env(safe-area-inset-right)); z-index: 101; display: grid; place-items: center; width: 46px; height: 46px; min-height: 46px; padding: 0; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px rgb(9 24 44 / 22%); font-weight: 900; }
footer { text-align: center; padding: 15px 70px 84px; border-top: 1px solid var(--line); }
.screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .language-row { padding: 8px 80px 8px 18px; align-items: start; flex-direction: column; gap: 6px; }
  .hero-inner { padding: 25px 20px; }
  h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); overflow-wrap: anywhere; }
  html[lang="en"] h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); }
  .edition { font-size: .78rem; }
  .category-inner { padding: 9px 20px; gap: 20px; }
  .category-nav a { font-size: .84rem; }
  .progress-bubble { width: 58px; height: 58px; top: 10px; right: 10px; font-size: .88rem; border-width: 2px; }
  .tool-area { padding: 17px 72px 0 16px; }
  .tools { gap: 12px; }
  .search-form { flex-basis: 100%; }
  .tool-buttons { width: 100%; justify-content: flex-end; }
  .intro-notes { grid-template-columns: 1fr; padding: 19px 72px 0 16px; }
  .layout { grid-template-columns: 1fr; gap: 22px; padding: 22px 72px 60px 16px; }
  .toc { position: static; max-height: none; padding: 16px; }
  .toc-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
  .toc a { font-size: .82rem; padding: 7px 4px; }
  .progress-panel { grid-template-columns: 1fr; gap: 14px; padding: 18px; }
  .progress-summary { grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
  .progress-number { font-size: 1.08rem; }
  .chapter > summary { padding: 16px; }
  .chapter > summary h2 { font-size: 1.1rem; }
  .chapter-body { padding: 12px 10px 15px; }
  .step { padding: 20px 14px 18px; }
  .step > input { position: static; margin: 0 8px 10px 0; vertical-align: middle; }
  .step h3 { font-size: 1rem; }
  .step.is-done { padding-bottom: 64px; }
  .area { font-size: .75rem; }
  .step .tip { padding: 10px; }
  .data-panel { padding: 16px 12px; }
  table { min-width: 720px; }
  td:first-child { min-width: 155px; }
  .search-results { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .language-row, .category-nav, .tool-area, .toc, .progress-bubble, .back-top, .chapter-controls, .progress-summary button, footer, .skip { display: none !important; }
  .hero { color: black; background: none; }
  .hero-inner { padding: 12px 0; }
  .edition, h1 { color: black; }
  h1, html[lang="en"] h1 { font-size: 24pt; }
  body { color: black; background: white; font-size: 10pt; }
  .intro-notes, .layout { display: block; padding: 0; }
  .note { margin-bottom: 10px; }
  .chapter, .data-panel, .step { box-shadow: none; break-inside: auto; }
  .step { break-inside: avoid; }
  .table-scroll { overflow: visible; }
  table { min-width: 0; font-size: 8pt; }
  th, td { padding: 5px; }
  td:first-child { min-width: 0; }
}
