:root {
  color-scheme: light;
  --navy: #17375f;
  --blue: #075b9a;
  --paper: #fffef9;
  --ink: #162334;
  --muted: #475569;
  --line: #bdaf99;
  --green: #237858;
  --red: #b3332f;
  --gold: #986300;
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.78;
  background: #f2efe7;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input { font: inherit; }
button, a, input { touch-action: manipulation; }
button { cursor: pointer; }
button, .button {
  min-height: 42px;
  padding: 7px 14px;
  border: 1px solid #94846e;
  border-radius: 9px;
  color: var(--navy);
  background: var(--paper);
  font-weight: 700;
}
:focus-visible { outline: 3px solid #a76800; outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 900; background: white; }
.skip:focus { top: 8px; }
.language-row {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 52px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 7px max(110px, calc((100vw - 1440px) / 2 + 110px)) 7px 20px;
  background: #eee8dc;
  border-bottom: 1px solid var(--line);
}
.language-row button { min-height: 34px; border-radius: 999px; font-size: .82rem; }
.language-row [aria-pressed="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.hero { color: white; background: linear-gradient(118deg, #17375f, #274c77); }
.title-part { display: inline-block; max-width: 100%; }
.hero-inner { max-width: 1440px; margin: auto; padding: 38px 56px 33px; }
h1 {
  margin: 0;
  font-family: YuMincho, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2rem, 3.84vw, 3.45rem);
  line-height: 1.25;
  letter-spacing: .01em;
  overflow-wrap: break-word;
}
html[lang="en"] h1 { font-size: clamp(1.9rem, 3.5vw, 3.25rem); }
.edition { display: block; margin-top: 12px; color: #f6edda; font-size: .85rem; }
.global-nav { background: var(--paper); border-bottom: 1px solid #aab5c4; box-shadow: 0 3px 12px #17243a12; }
.nav-inner {
  display: flex;
  gap: 25px;
  max-width: 1440px;
  margin: auto;
  padding: 10px 56px;
  overflow-x: auto;
}
.nav-inner a { flex: none; text-decoration: none; font-weight: 800; font-size: .91rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav-inner [aria-current="page"] { border-color: #a76800; color: var(--navy); }
.utility {
  max-width: 1440px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 56px;
}
.utility a { font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button { font-size: .85rem; }
.progress-bubble {
  position: fixed; z-index: 90; right: 18px; top: 12px;
  display: grid; place-items: center;
  width: 66px; height: 66px;
  border: 3px solid var(--navy); border-radius: 50%;
  background: #fffef9fa; color: #16513e;
  box-shadow: 0 7px 20px #182c4240, inset 0 0 0 4px white;
  font-weight: 900;
}
.search-area { max-width: 1328px; margin: 4px auto 0; padding: 0 56px; }
.warning-shell { max-width: 1440px; margin: 12px auto 0; padding: 0 76px 0 56px; }
.warning-shell .notice { padding: 16px 22px; }
.warning-shell p { font-size: .9rem; }
.search-area label { font-size: .85rem; font-weight: 800; color: var(--navy); }
.search-form { display: flex; gap: 8px; }
.search-form input {
  min-width: 0; flex: 1; width: 100%; min-height: 44px;
  border: 1px solid #8799b3; border-radius: 8px;
  padding: 8px 12px; background: white; color: var(--ink);
}
.search-results { margin: 10px 0 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.search-results:empty { display: none; }
.search-hit { margin: 10px 0; }
.search-hit p { margin: 2px 0; color: var(--muted); font-size: .85rem; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: 0 auto; padding: 26px 76px 90px 56px; }
.toc { position: sticky; top: 74px; align-self: start; max-height: calc(100vh - 94px); overflow: auto; border: 1px solid #a99b85; border-radius: 17px; background: var(--paper); padding: 15px; box-shadow: 0 10px 30px #34271917; }
.chapter, .table-section, tr { scroll-margin-top: 76px; }
.toc summary { font-weight: 800; color: var(--gold); cursor: pointer; }
.toc a { display: block; padding: 6px 8px; color: var(--muted); text-decoration: none; font-size: .85rem; line-height: 1.5; }
.toc a:hover { background: #f0eadf; }
main { min-width: 0; }
h2, h3, h4 { color: var(--navy); line-height: 1.5; }
h2 { font-size: 1.4rem; margin: 0 0 15px; }
h3 { font-size: 1.06rem; margin: 0 0 12px; }
p { margin: 0 0 12px; }
ul, ol { margin: 8px 0 12px; padding-left: 1.45em; }
li + li { margin-top: 8px; }
.panel, .chapter, .table-section { margin-bottom: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: 0 8px 24px #42321a12; }
.chapter { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.panel, .table-section { padding: 22px 24px; }
.notice { background: #f6e8df; border-color: #a96650; }
.notice p:last-child, .step p:last-child { margin-bottom: 0; }
.progress-panel { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; background: linear-gradient(130deg, #fffefa, #f5eee0); }
.progress-panel h2 { font-size: 1rem; margin-bottom: 5px; }
.progress-panel p { font-size: .85rem; color: var(--muted); }
.progress-count { font-size: 1.25rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; border: 1px solid #b5a68d; border-radius: 20px; background: #e9e2d6; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #237858, #bc962f); transition: width .25s ease; }
.save-message { margin: 8px 0 0; color: #8f2e25; font-size: .85rem; }
.chapter > summary { padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--navy); font-size: 1.16rem; font-weight: 800; cursor: pointer; }
.chapter-body { padding: 14px 0 0; }
.chapter-intro { padding: 2px 3px 8px; font-size: .91rem; }
.step { position: relative; margin: 0 0 15px; padding: 20px 20px 18px 58px; border: 1px solid #c1b39c; border-radius: 14px; background: var(--paper); box-shadow: 0 4px 12px #42321a10; scroll-margin-top: 76px; }
.step-check { position: absolute; top: 24px; left: 20px; width: 23px; height: 23px; accent-color: var(--green); }
.step-title { display: block; margin: 0 0 9px; font-weight: 800; }
.step.complete { border-color: var(--green); padding-bottom: 58px; }
.stamp { position: absolute; right: 15px; bottom: 12px; display: none; place-items: center; min-width: 62px; height: 31px; padding: 0 8px; border: 2px solid #b3332feb; border-radius: 4px 6px 5px 3px; color: var(--red); background: radial-gradient(circle at 20% 25%,#fffef9 0 1px,transparent 1.5px) 0 0/10px 9px,#fffef9ee; font-size: .85rem; font-weight: 900; letter-spacing: .09em; line-height: 1; transform: none; }
.complete .stamp { display: grid; }
.step-note { margin: 14px 0 0; padding: 10px 12px; background: #f3ebd8; border: 1px solid #c9b99c; border-radius: 8px; font-size: .88rem; }
.step-links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 12px; font-size: .86rem; }
.chart-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 13px 0 20px; }
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid #9cacc0; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; line-height: 1.65; min-width: 650px; }
th, td { padding: 11px 12px; text-align: left; border: 1px solid #ccd5e1; vertical-align: top; }
th { background: #203e64; color: white; font-size: .84rem; }
tbody tr:nth-child(even) { background: #edf1f5; }
tbody tr:has(.collection-check:checked) { background: #e5f0e8; }
td:first-child { min-width: 135px; max-width: 230px; word-break: normal; overflow-wrap: break-word; font-weight: 700; }
td { min-width: 110px; }
table:has(.collection-check) th:first-child, table:has(.collection-check) td:first-child { min-width: 44px; width: 44px; padding: 11px 8px; }
table:has(.collection-check) td:nth-child(2) { min-width: 135px; font-weight: 700; }
.table-section > .step-links { margin: 0 0 14px; }
td .step-links { margin-top: 0; }
.collection-check { width: 20px; height: 20px; accent-color: var(--green); }
.table-filter { margin-bottom: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.table-filter input { flex: 1; min-width: 120px; min-height: 42px; padding: 7px 10px; border: 1px solid #8799b3; border-radius: 7px; }
.table-filter label { font-size: .85rem; font-weight: 700; }
.table-count { font-size: .85rem; color: var(--muted); }
.back-top { position: fixed; z-index: 90; bottom: max(18px, env(safe-area-inset-bottom)); right: 18px; width: 46px; height: 46px; padding: 0; border-radius: 50%; background: var(--paper); box-shadow: 0 7px 20px #09202e35; font-size: 1.15rem; }
footer { padding: 25px 76px 35px 20px; text-align: center; border-top: 1px solid var(--line); font-size: .9rem; }
.bump { animation: card-bump .58s ease; }
.bump .stamp { animation: stamp-pop .58s ease; }
.progress-bubble.bump { animation: progress-bump .64s ease; }
@keyframes card-bump { 0%,100% { transform: scale(1); } 36% { transform: scale(1.015); } 68% { transform: scale(.996); } }
@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.2); } 62% { transform: scale(.93); } }
@media (max-width: 760px) {
  .language-row { padding-right: 85px; }
  .language-row button { padding: 4px 10px; }
  .hero-inner { padding: 26px 20px 24px; }
  h1, html[lang="en"] h1 { font-size: 1.8rem; line-height: 1.3; }
  .nav-inner { padding: 9px 20px; gap: 19px; }
  .nav-inner a { font-size: .84rem; }
  .progress-bubble { width: 56px; height: 56px; top: 10px; right: 10px; border-width: 2px; font-size: .88rem; }
  .utility { padding: 12px 64px 10px 14px; }
  .actions { gap: 6px; }
  .actions button { padding: 6px 10px; font-size: .8rem; }
  .search-area { padding: 0 64px 0 14px; }
  .search-form { flex-wrap: wrap; }
  .search-form input { flex-basis: 100%; }
  .layout { display: flex; flex-direction: column; padding: 18px 64px 80px 14px; gap: 18px; }
  .toc { position: static; width: 100%; max-height: none; padding: 12px; order: 0; }
  main { order: 1; width: 100%; }
  .warning-shell { padding: 0 64px 0 14px; }
  .panel, .table-section { padding: 18px 16px; }
  .progress-panel { grid-template-columns: 1fr; gap: 10px; }
  .chapter > summary { padding: 16px; font-size: 1.02rem; }
  .chapter-body { padding: 12px 0 1px; }
  .step { padding: 55px 14px 16px; }
  .step-check { top: 18px; left: 16px; }
  .step.complete { padding-bottom: 58px; }
  .step-title { line-height: 1.65; }
  .step li { margin-top: 10px; }
  .search-results { padding: 12px; }
  h2 { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .language-row, .utility, .progress-bubble, .search-area, .toc, .chart-actions, .back-top, .step-check, .table-filter, .no-print { display: none !important; }
  .hero { color: black; background: white; }
  .hero-inner { padding: 12px 0; }
  .edition { color: black; }
  .layout { display: block; padding: 0; }
  .panel, .step, .chapter, .table-section { box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 9pt; }
  th { color: black; background: #ddd; }
  .global-nav, footer { display: none; }
}
