:root {
  color-scheme: light;
  --paper: #f2efe7;
  --panel: #fffef9;
  --inset: #e9e1d2;
  --ink: #15233d;
  --muted: #46536a;
  --navy: #17375f;
  --blue: #075b9a;
  --gold: #9a6500;
  --green: #237858;
  --red: #b3332f;
  --line: #b8ac97;
  --shadow: 0 12px 32px rgb(46 38 25 / 10%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 22px; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font: 16px/1.78 "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button, .button { min-height: 42px; border: 1px solid #8e816d; border-radius: 9px; padding: 7px 14px; background: var(--panel); }
button:hover, .button:hover { background: #f4ecdc; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #b87719; outline-offset: 4px; }
a { color: var(--blue); text-underline-offset: .2em; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 100; padding: 10px; background: white; }
.skip:focus { top: 10px; }
.language-bar { padding: 8px max(20px, calc((100vw - 1440px) / 2 + 56px)); display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; background: #eee8dc; }
.language-bar button { min-height: 34px; border-radius: 999px; padding: 4px 14px; font-size: .83rem; }
.language-bar button[aria-pressed="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.edition-picker { margin-right: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.edition-picker select { max-width: 100%; padding: 4px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.hero { background: radial-gradient(circle at 85% -75%, rgb(255 255 255 / 14%), transparent 32rem), linear-gradient(118deg, #17375f, #1d3f6b); color: white; }
.hero-inner { max-width: 1440px; margin: auto; padding: 44px 56px 34px; }
.hero h1 { margin: 0; font: 700 clamp(2rem, 4.1vw, 3.45rem)/1.24 YuMincho, "Yu Mincho", serif; letter-spacing: .015em; text-wrap: balance; overflow-wrap: anywhere; }
.hero .edition { display: block; margin-top: 14px; font: 700 .95rem/1.5 "Yu Gothic UI", "Yu Gothic", sans-serif; color: #f1e6cf; }
html[lang="en"] .hero h1 { font-size: clamp(1.8rem, 3.7vw, 3.25rem); }
.category-nav { overflow-x: auto; background: var(--panel); border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px rgb(20 35 60 / 7%); }
.category-inner { display: flex; align-items: center; gap: 24px; width: max-content; min-width: min(100%, 1440px); margin: auto; padding: 11px 56px 10px; }
.category-inner a { font-size: .92rem; font-weight: 850; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none; }
.category-inner a[aria-current="page"] { color: var(--navy); border-color: var(--gold); }
.utility { max-width: 1440px; margin: auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; padding: 12px 56px; }
.utility-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.guides-link { font-size: .9rem; font-weight: 700; }
.notice-wrap { max-width: 1440px; margin: auto; padding: 16px 56px 0; }
.notices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.notice { margin: 0; padding: 16px 18px; border: 1px solid #a77a64; border-radius: 14px; background: #f6e8df; }
.notice:nth-child(even) { border-color: #7b9c91; background: #e6f0ea; }
.notice h2 { margin: 0 0 6px; font-size: 1rem; }
.notice p { margin: 0; font-size: .92rem; }
.search-panel { max-width: 1328px; margin: 22px auto 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.search-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-row label { font-weight: 800; }
.search-row input { min-width: 180px; flex: 1 1 380px; max-width: 100%; border: 1px solid #8394ac; border-radius: 7px; padding: 9px 12px; background: white; }
.search-count { font-size: .87rem; color: var(--muted); }
.results { margin: 14px 0 0; padding-left: 22px; }
.results li { margin: 12px 0; }
.result-category { margin-right: 9px; font-size: .8rem; color: var(--gold); }
.result-context { margin: 2px 0; color: var(--muted); font-size: .9rem; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: auto; padding: 30px 56px 84px; }
.toc { position: sticky; top: 18px; align-self: start; max-height: calc(100vh - 36px); overflow: auto; padding: 16px; border: 1px solid #968873; border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.toc h2 { margin: 0 0 12px; font-size: .8rem; color: var(--gold); letter-spacing: .12em; }
.toc a { display: block; margin: 3px 0; padding: 6px 8px; border-radius: 7px; font-size: .87rem; line-height: 1.45; text-decoration: none; color: var(--muted); }
.toc a:hover { background: #f4ecdc; color: var(--blue); }
main { min-width: 0; }
.progress-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 24px; padding: 22px 24px; margin: 0 0 22px; border: 1px solid #c8b99e; border-radius: 18px; background: linear-gradient(120deg, #fffefa, #f5eee1); box-shadow: var(--shadow); }
.progress-panel h2 { margin: 0; font-size: 1rem; }
.progress-panel p { margin: 7px 0; font-size: .86rem; color: var(--muted); }
.progress-number { display: block; margin-bottom: 8px; text-align: right; color: var(--gold); font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.progress-track { height: 11px; overflow: hidden; border: 1px solid #b1a083; border-radius: 999px; background: #e8dfd1; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #237858, #b38a37); transition: width .24s ease; }
.save-message { padding: 12px 15px; margin: 0 0 18px; border: 1px solid #a77a64; border-radius: 10px; background: #f6e8df; }
.save-message button { margin-top: 8px; }
.section-title { margin: 22px 0 14px; font: 700 1.6rem/1.4 YuMincho, "Yu Mincho", serif; }
.chart-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px; margin-bottom: 18px; }
.chapter { margin-bottom: 20px; border: 1px solid #a99b84; border-radius: 18px; background: var(--inset); overflow: clip; box-shadow: var(--shadow); }
.chapter > summary { padding: 19px 22px; cursor: pointer; list-style: none; background: var(--panel); display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { content: "+"; flex: 0 0 30px; width: 30px; height: 30px; line-height: 28px; text-align: center; border: 1px solid #a99b84; border-radius: 50%; color: var(--gold); }
.chapter[open] > summary::after { content: "−"; }
.chapter-title { font-size: 1.2rem; font-weight: 800; line-height: 1.5; }
.chapter-subtitle { display: block; margin-top: 4px; font-size: .85rem; color: var(--blue); font-weight: 500; }
.chapter-body { padding: 10px 20px 22px; }
.step { position: relative; margin: 12px 0 0; padding: 18px 18px 20px 62px; border: 1px solid #c4b8a4; border-radius: 14px; background: var(--panel); box-shadow: 0 3px 10px rgb(44 34 20 / 5%); }
.step h3 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.5; }
.step p { margin: 8px 0; }
.step ol, .step ul { margin: 8px 0; padding-left: 1.3em; }
.step li + li { margin-top: 7px; }
.step input[type="checkbox"] { position: absolute; left: 20px; top: 22px; width: 24px; height: 24px; margin: 0; cursor: pointer; accent-color: var(--green); }
.step .tip { margin-top: 12px; padding: 10px 12px; font-size: .9rem; border: 1px solid #c4b8a4; border-radius: 8px; background: #f4ecdc; }
.step.is-done { padding-bottom: 58px; border-color: var(--green); opacity: 1; }
.stamp { display: none; position: absolute; right: 15px; bottom: 12px; width: 62px; height: 31px; place-items: center; border: 2px solid var(--red); border-radius: 4px 6px 5px 3px; color: var(--red); font-size: .9rem; font-weight: 900; line-height: 1; letter-spacing: .08em; transform: none; background: radial-gradient(circle at 16% 28%, #fffef9 0 1px, transparent 1.35px) 0 0 / 9px 8px, #fffdf8; text-shadow: .4px 0 #8d2828; }
.is-done > .stamp { display: grid; }
.step.bump { animation: card-bump .58s ease; }
.step.bump > .stamp { animation: stamp-pop .58s 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); } }
.related { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 0; font-size: .87rem; }
.table-panel { margin: 0 0 22px; padding: 20px; border: 1px solid #a9b4c3; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.table-panel h2 { margin: 0 0 14px; font-size: 1.25rem; }
.table-panel > p { margin-top: 0; font-size: .9rem; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid #bdc6d2; border-radius: 10px; }
table { width: 100%; min-width: 690px; border-collapse: collapse; font-size: .92rem; line-height: 1.65; }
th, td { padding: 11px 12px; text-align: left; vertical-align: top; border: 1px solid #d0d8e2; }
th { background: #213d65; color: white; font-weight: 800; }
tbody tr:nth-child(even) { background: #eff3f7; }
td:first-child { min-width: 140px; font-weight: 750; }
td { min-width: 120px; }
tr:target, .step:target, .target-flash { outline: 3px solid #a76800; outline-offset: 3px; }
.back-top { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 60; 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-size: 1.15rem; font-weight: 900; }
footer { padding: 24px 80px 90px; border-top: 1px solid var(--line); text-align: center; }
footer a { font-weight: 800; }
@media (max-width: 760px) {
  .hero-inner { padding: 28px 20px 25px; }
  .hero h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); text-wrap: wrap; }
  html[lang="en"] .hero h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); }
  .hero .edition { font-size: .83rem; margin-top: 12px; }
  .language-bar { padding: 8px 18px; }
  .edition-picker { flex-basis: 100%; flex-wrap: wrap; }
  .category-inner { padding: 9px 20px 8px; gap: 18px; }
  .category-inner a { font-size: .85rem; }
  .utility { padding: 12px 18px; }
  .notice-wrap { padding: 16px 14px 0; }
  .notices { grid-template-columns: 1fr; }
  .notice { padding-right: 66px; }
  .search-panel { margin: 20px 14px 0; padding: 14px; }
  .search-panel { padding-right: 66px; }
  .search-row { gap: 8px; }
  .search-row input { width: 100%; flex-basis: 100%; }
  .layout { display: flex; flex-direction: column; padding: 20px 14px 90px; gap: 22px; }
  .toc { position: static; width: 100%; max-height: none; padding: 14px; }
  .toc nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; padding-right: 52px; }
  main { width: 100%; }
  .progress-panel { grid-template-columns: 1fr; padding: 18px 70px 18px 18px; gap: 12px; }
  .progress-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
  .progress-number { margin: 0; font-size: 1.15rem; }
  .chapter > summary { padding: 16px 68px 16px 16px; }
  .chapter-title { font-size: 1.12rem; }
  .chapter-body { padding: 2px 10px 16px; }
  .step { padding: 58px 64px 18px 14px; }
  .step .stamp { right: 68px; }
  .step input[type="checkbox"] { top: 19px; left: 17px; }
  .step h3 { font-size: 1.04rem; }
  .step p, .step li { overflow-wrap: anywhere; }
  .table-panel { padding: 15px; }
  .table-panel > h2, .table-panel > p { margin-right: 52px; }
  .table-wrap { margin-right: 52px; }
  .table-panel h2 { font-size: 1.12rem; }
  footer { padding: 22px 72px 90px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .language-bar, .category-nav, .utility, .search-panel, .toc, .chart-controls, .back-top, .progress-actions, .save-message, footer { display: none !important; }
  .hero { color: #111; background: white; }
  .hero-inner { padding: 10px 0; }
  .hero h1 { font-size: 25px; }
  .hero .edition { color: #333; }
  .notice-wrap, .layout { display: block; padding: 0; }
  .chapter, .step, .table-panel { box-shadow: none; break-inside: avoid; }
  body { background: white; color: black; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 10px; }
  td, th { min-width: 0; padding: 4px; }
}
