:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #f2efe7;
  --panel: #fffef9;
  --ink: #15233d;
  --muted: #46536a;
  --blue: #075b9a;
  --gold: #a76800;
  --line: #b8ac97;
  --green: #237858;
  --red: #b3332f;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 22px; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #e8e2d5, var(--paper) 36rem);
  font: 16px/1.78 "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}
button, input { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: .2em; }
a:hover { color: #003c6e; }
:focus-visible { outline: 3px solid #c18d3c; outline-offset: 4px; }
button {
  min-height: 42px;
  border: 1px solid #8a7d69;
  border-radius: 9px;
  padding: 7px 14px;
  background: var(--panel);
  cursor: pointer;
}
button:hover { background: #eee7d9; }
.skip { position: absolute; left: -10000px; }
.skip:focus { left: 12px; top: 10px; z-index: 999; background: white; padding: 12px; }
.language-bar { background: #eee8dc; border-bottom: 1px solid var(--line); }
.language-inner {
  max-width: 1480px;
  margin: auto;
  padding: 8px 114px 8px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.language-inner button { border-radius: 999px; min-height: 34px; padding: 4px 14px; font-size: .82rem; font-weight: 800; }
.language-inner button[aria-pressed="true"] { background: var(--navy); color: white; }
.hero {
  color: white;
  background: radial-gradient(circle at 83% -55%, #ffffff20, transparent 31rem), linear-gradient(118deg, var(--navy), var(--navy-light));
}
.hero-inner { max-width: 1480px; margin: auto; padding: 36px clamp(24px, 5.2vw, 80px) 34px; }
.edition { margin: 0 0 9px; font-size: .86rem; letter-spacing: .04em; color: #f3e7cf; }
h1 {
  margin: 0;
  font-family: YuMincho, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2rem, 4.1vw, 3.45rem);
  line-height: 1.24;
  font-weight: 700;
  overflow-wrap: anywhere;
}
html[lang="en"] h1 { font-size: clamp(1.8rem, 3.7vw, 3.25rem); }
.category-nav { background: var(--panel); border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px #14233c12; }
.category-inner { max-width: 1480px; margin: auto; padding: 10px clamp(24px, 5.2vw, 80px); display: flex; flex-wrap: wrap; gap: 8px 24px; }
.category-inner a { padding: 2px 0; font-size: .92rem; font-weight: 850; text-decoration: none; border-bottom: 2px solid transparent; }
.category-inner a[aria-current="page"] { color: var(--navy); border-color: var(--gold); }
.category-inner .guide-return { margin-left: auto; }
.tools { max-width: 1480px; margin: auto; padding: 12px clamp(20px, 4vw, 56px); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.search-panel { max-width: 1328px; margin: 4px auto 0; padding: 16px 20px; background: #f8f5ee; border: 1px solid var(--line); border-radius: 12px; }
.search-row { display: flex; align-items: flex-end; gap: 10px; }
.search-field { flex: 1; min-width: 0; }
.search-field label { display: block; margin-bottom: 6px; color: var(--navy); font-size: .83rem; font-weight: 800; }
input[type="search"] { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #8295b0; border-radius: 7px; background: white; }
.search-count { margin: 8px 0 0; font-size: .84rem; }
.search-results { margin: 10px 0 0; padding-left: 23px; }
.search-results li { padding: 5px 0; }
.search-results small { display: block; color: var(--muted); font-size: .83rem; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1440px; margin: auto; padding: 30px clamp(20px, 4vw, 56px) 90px; }
.contents { align-self: start; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; border: 1px solid #9c8b70; border-radius: 18px; background: var(--panel); padding: 16px; box-shadow: 0 16px 34px #2e261b17; }
.contents h2 { font-size: .82rem; letter-spacing: .12em; color: var(--gold); margin: 0 0 10px; }
.contents a { display: block; padding: 6px 8px; font-size: .85rem; line-height: 1.5; text-decoration: none; }
.contents .group { margin-top: 10px; padding-top: 10px; border-top: 1px solid #d5c8b4; }
main { min-width: 0; }
.panel, .chapter { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 10px 26px #2e261b0e; margin-bottom: 20px; }
.panel { padding: 22px 24px; }
h2 { font-size: 1.45rem; line-height: 1.45; margin: 0 0 14px; color: var(--navy); }
h3 { margin: 0 0 9px; font-size: 1.07rem; line-height: 1.5; }
p { margin: 8px 0 12px; }
p:last-child { margin-bottom: 0; }
.progress-panel { background: linear-gradient(110deg, #fffdf8, #f6f0e5); }
.progress-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.progress-top h2 { font-size: 1rem; margin: 0; }
.progress-number { color: #926000; white-space: nowrap; font-size: 1.24rem; font-weight: 800; }
.progress-track { margin: 13px 0; height: 10px; border: 1px solid #a99b83; border-radius: 99px; background: #e8e0d2; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); width: 0; transition: width .35s ease; }
.progress-note, .save-status { font-size: .85rem; line-height: 1.65; }
.save-status { color: #8c2b22; }
.progress-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
.notice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.notice { border: 1px solid #987e53; border-radius: 15px; padding: 17px 18px; background: #f2e9d7; }
.notice.warning { border-color: #9b5a4a; background: #f5e7df; }
.notice p { font-size: .9rem; }
.critical-notice { max-width: 1328px; margin: 18px auto 0; }
.critical-notice h2 { font-size: 1rem; margin: 0 0 5px; }
.chapter > summary { list-style: none; display: flex; gap: 15px; align-items: center; justify-content: space-between; padding: 20px 22px; cursor: pointer; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { flex: 0 0 30px; height: 30px; display: grid; place-items: center; content: "+"; border: 1px solid #b5a285; border-radius: 50%; color: var(--gold); }
.chapter[open] > summary::after { content: "−"; }
.chapter-title { font-size: 1.2rem; font-weight: 800; }
.chapter-body { padding: 0 20px 22px; background: #ebe4d6; border-radius: 0 0 18px 18px; }
.prerequisite { margin: 0; padding: 15px 4px 5px; font-size: .9rem; }
.step-card { position: relative; margin-top: 13px; padding: 19px 20px 20px 61px; border: 1px solid #b9ab94; border-radius: 14px; background: var(--panel); box-shadow: 0 6px 14px #4a3a2210; }
.step-check { position: absolute; width: 24px; height: 24px; left: 18px; top: 21px; accent-color: var(--green); cursor: pointer; }
.step-card ul, .step-card ol { margin: 8px 0 0; padding-left: 1.35em; }
.step-card li + li { margin-top: 5px; }
.step-card .tip { border: 1px solid #c6b89f; background: #f2ead9; border-radius: 8px; padding: 10px 12px; margin-top: 12px; font-size: .87rem; font-weight: 600; }
.step-card.is-done { border-color: var(--green); padding-bottom: 60px; box-shadow: 0 7px 18px #1857421a; }
.stamp { display: none; }
.is-done > .stamp {
  display: grid; place-items: center; position: absolute; bottom: 12px; right: 15px; width: 62px; height: 31px;
  color: var(--red); border: 2px solid #b3332feb; border-radius: 4px 6px 5px 3px;
  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: .1em; transform: none;
}
.step-card.bump { animation: card-bump .58s ease; }
.step-card.bump > .stamp { animation: stamp-pop .58s ease; }
.progress-bubble { position: fixed; top: 15px; right: 10px; z-index: 50; width: 64px; height: 64px; display: grid; place-items: center; border: 3px solid var(--navy-light); border-radius: 50%; background: #fffdf8f7; color: #194a3c; box-shadow: 0 7px 22px #09182c33, inset 0 0 0 4px white; font-weight: 900; pointer-events: none; }
.progress-bubble.bump { animation: progress-bump .64s ease; }
.chart-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0 13px; }
.table-wrap { overflow-x: auto; border: 1px solid #aab5c5; border-radius: 11px; }
table { border-collapse: collapse; width: 100%; min-width: 710px; font-size: .88rem; line-height: 1.65; }
th, td { border: 1px solid #cbd3df; padding: 11px 12px; text-align: left; vertical-align: top; }
th { background: #203e66; color: white; font-weight: 800; }
tbody tr:nth-child(even) { background: #eef2f7; }
td:first-child { font-weight: 700; min-width: 155px; }
td p { margin: 0; }
.back-top { position: fixed; z-index: 60; width: 46px; height: 46px; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); padding: 0; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c38; font-weight: 900; }
footer { padding: 0 80px 60px; text-align: center; }
.small { font-size: .85rem; color: var(--muted); }
[hidden] { display: none !important; }
@keyframes card-bump { 36% { transform: scale(1.012); } 68% { transform: scale(.997); } }
@keyframes stamp-pop { 0% { opacity: 0; transform: scale(1.42); } 58% { transform: scale(.92); } 100% { opacity: 1; transform: none; } }
@keyframes progress-bump { 34% { transform: scale(1.18); } 62% { transform: scale(.93); } 82% { transform: scale(1.05); } }
@media (max-width: 760px) {
  .language-inner { padding-right: 86px; padding-left: 12px; }
  .hero-inner { padding: 26px 76px 25px 20px; }
  h1 { font-size: clamp(1.7rem, 7vw, 2.15rem); }
  .edition { padding-right: 55px; }
  .category-inner { padding: 10px 76px 10px 20px; gap: 10px 18px; }
  .category-inner a { font-size: .84rem; }
  .category-inner .guide-return { margin-left: 0; }
  .tools { padding: 13px 76px 13px 18px; }
  .search-panel { margin: 3px 76px 0 14px; padding: 13px; }
  .critical-notice { margin: 18px 76px 0 14px; }
  .search-row { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .search-row button { margin-left: auto; }
  .layout { grid-template-columns: 1fr; gap: 18px; padding: 22px 76px 100px 14px; }
  .contents { position: static; max-height: none; }
  .contents a { padding-top: 8px; padding-bottom: 8px; }
  .notice-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .progress-top { flex-wrap: wrap; gap: 5px; }
  .progress-number { font-size: 1.15rem; }
  .chapter > summary { padding: 18px 16px; }
  .chapter-body { padding: 0 10px 15px; }
  .step-card { padding: 58px 15px 19px; }
  .step-check { top: 18px; left: 17px; }
  .step-card.is-done { padding-bottom: 60px; }
  .progress-bubble { top: 10px; right: 10px; width: 58px; height: 58px; border-width: 2px; font-size: .9rem; }
  h2 { font-size: 1.28rem; }
  footer { padding: 0 75px 50px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: white; color: black; font-size: 11pt; }
  .no-print, .contents, .tools, .search-panel, .progress-actions, .progress-bubble, .back-top, .language-bar, footer, .category-nav, .chart-actions { display: none !important; }
  .hero { background: none; color: black; }
  .hero-inner { padding: 10px 0 20px; }
  h1 { font-size: 25pt; }
  .edition { color: black; }
  .layout { display: block; padding: 0; }
  .panel, .chapter, .step-card, .contents { box-shadow: none; }
  .step-card { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 9pt; }
  th { background: white; color: black; }
  .chapter-body { background: white; }
}

/* Keep topic names and related walkthroughs readable beside long response lists. */
#collection-table table { table-layout: fixed; }
#collection-table th:first-child { width: 22%; }
#collection-table th:nth-child(2) { width: 60%; }
#collection-table th:nth-child(3) { width: 18%; }
