:root {
  color-scheme: light;
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #fffef9;
  --ground: #f2efe7;
  --ink: #152238;
  --muted: #475569;
  --line: #c6b99f;
  --blue: #075b9a;
  --gold: #a76800;
  --green: #237858;
  --red: #b3332f;
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 22px; }
body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #e9e2d5, var(--ground) 640px);
  color: var(--ink);
  line-height: 1.78;
}
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--blue); text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #a76800;
  outline-offset: 4px;
}
.skip { position: absolute; left: 12px; top: -90px; z-index: 1000; }
.skip:focus { top: 8px; background: white; padding: 8px 16px; }
.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  padding: 8px max(24px, calc((100vw - 1328px) / 2));
  padding-right: max(112px, calc((100vw - 1328px) / 2 + 92px));
  background: #eee8dc;
  border-bottom: 1px solid var(--line);
}
.guide-return { font-size: .84rem; font-weight: 700; }
.languages { display: flex; gap: 8px; flex-shrink: 0; }
.languages button {
  padding: 5px 14px;
  min-height: 34px;
  border: 1px solid #7e8998;
  border-radius: 999px;
  background: var(--paper);
  color: var(--navy);
  font-size: .8rem;
  font-weight: 800;
}
.languages button[aria-pressed="true"] { color: white; background: var(--navy); border-color: var(--navy); }
.hero {
  color: white;
  background: radial-gradient(circle at 85% -70%, #ffffff1a, transparent 500px), linear-gradient(118deg, var(--navy), var(--navy-light));
}
.hero-inner { max-width: 1440px; margin: auto; padding: 30px 56px 32px; }
.edition { margin: 0 0 8px; font-size: .82rem; letter-spacing: .06em; color: #f3e4c2; }
h1 {
  margin: 0;
  font-family: YuMincho, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2rem, 3.84vw, 3.45rem);
  font-weight: 700;
  line-height: 1.26;
  letter-spacing: .015em;
  text-wrap: balance;
}
html[lang="en"] h1 { font-size: clamp(1.8rem, 3.61vw, 3.25rem); }
.category-nav { background: var(--paper); border-bottom: 1px solid #aeb8c7; box-shadow: 0 3px 12px #14233c12; }
.category-inner {
  max-width: 1328px;
  margin: auto;
  display: flex;
  gap: 22px;
  padding: 10px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.category-nav a { flex-shrink: 0; padding: 4px 0; border-bottom: 2px solid transparent; font-size: .92rem; font-weight: 850; text-decoration: none; }
.category-nav a[aria-current="page"] { border-color: var(--gold); color: var(--navy); }
.category-nav a:hover { border-color: #c39a5c; }
.toolbar {
  max-width: 1328px;
  margin: auto;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
}
.control {
  min-height: 40px;
  padding: 7px 14px;
  border: 1px solid #9f8c70;
  border-radius: 10px;
  background: var(--paper);
  color: #24334a;
  font-size: .84rem;
  font-weight: 750;
  transition: background .16s ease, box-shadow .16s ease;
}
.control:hover { background: #f5ecdc; box-shadow: 0 3px 9px #17375f18; }
.control[aria-pressed="true"] { color: #155a42; background: #e6f4ed; border-color: var(--green); }
.search-area { max-width: 1328px; margin: 0 auto 22px; }
.search-form { border: 1px solid var(--line); border-radius: 13px; padding: 14px 18px; background: #f9f6ee; }
.search-label { display: block; margin-bottom: 6px; font-size: .83rem; font-weight: 800; color: var(--navy); }
.search-row { display: flex; gap: 10px; align-items: stretch; }
.search-row input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #8194ae;
  border-radius: 7px;
  background: white;
  color: var(--ink);
}
.search-row .control { flex-shrink: 0; }
.search-results { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 15px 20px; margin-top: 10px; }
.search-results h2 { margin: 0 0 10px; font-size: 1rem; }
.search-results ol { margin: 0; padding-left: 24px; }
.search-results li + li { margin-top: 12px; }
.search-results a { font-weight: 800; }
.search-results small { display: block; color: var(--muted); }
.category-label { display: inline-block; margin-right: 8px; font-size: .76rem; color: #77500d; }
.preflight { max-width: 1328px; margin: 0 auto 24px; padding: 20px 24px; border: 1px solid #bda67d; border-radius: 16px; background: #f9f1df; }
.preflight h2 { margin: 0 0 10px; color: var(--navy); font-size: 1.08rem; }
.preflight ul { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 32px; margin: 0; padding-left: 21px; }
.preflight li { padding-right: 8px; font-size: .92rem; }
.layout { max-width: 1440px; margin: auto; padding: 0 56px 80px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; }
.contents {
  position: sticky;
  top: 22px;
  align-self: start;
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 18px 16px;
  border: 1px solid #a99a82;
  border-radius: 17px;
  background: var(--paper);
  box-shadow: 0 12px 30px #30261814;
}
.contents h2 { font-size: .8rem; color: var(--gold); letter-spacing: .12em; margin: 0 0 10px; }
.contents a { display: block; margin: 2px 0; padding: 7px 8px; color: #40506a; font-size: .86rem; line-height: 1.45; text-decoration: none; border-radius: 6px; }
.contents a:hover { background: #f1eadc; }
.contents .toc-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
main { min-width: 0; }
.progress-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(135deg, #fffefa, #f7f1e5);
  box-shadow: 0 10px 28px #40301a15;
}
.progress-panel h2 { font-size: 1rem; color: var(--navy); margin: 0 0 5px; }
.progress-panel p { font-size: .82rem; color: var(--muted); margin: 0 0 10px; }
.progress-track { height: 12px; border: 1px solid #a99a82; border-radius: 999px; overflow: hidden; background: #e9e2d6; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #d29b2e); transition: width .24s ease; }
.progress-actions { display: grid; justify-items: end; gap: 8px; }
.progress-number { color: #875b06; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.save-state { font-size: .76rem; color: #34654e; }
.save-problem { grid-column: 1 / -1; margin: 0; color: #8c2d25; font-size: .88rem; }
.save-problem .control { margin-top: 8px; }
.progress-orb {
  position: fixed;
  z-index: 70;
  top: 12px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 2px solid var(--navy-light);
  border-radius: 50%;
  background: #fffdf8f7;
  box-shadow: 0 6px 20px #09182c30, inset 0 0 0 4px white;
  color: #194a3c;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
body:not([data-page="chart"]) .progress-orb { display: none; }
.progress-panel { padding-right: 36px; }
.chart-heading { font-size: 1.55rem; font-family: YuMincho, "Yu Mincho", serif; color: var(--navy); margin: 24px 0 10px; }
.chart-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.chapter { margin-bottom: 22px; border: 1px solid #a99a82; border-radius: 17px; background: #eae2d2; box-shadow: 0 8px 24px #30261812; overflow: clip; }
.chapter > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; background: var(--paper); cursor: pointer; list-style: none; font-size: 1.13rem; font-weight: 850; line-height: 1.5; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary { padding-right: 36px; }
.chapter > summary::after { content: "+"; display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; font-size: 1rem; font-weight: 500; color: var(--gold); border: 1px solid var(--line); border-radius: 50%; }
.chapter[open] > summary::after { content: "−"; }
.chapter-body { padding: 5px 20px 20px; }
.chapter-lead { margin: 12px 4px; font-size: .9rem; color: #485463; }
.step {
  position: relative;
  margin-top: 12px;
  padding: 19px 20px 20px 62px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.step-check { position: absolute; left: 18px; top: 22px; width: 24px; height: 24px; margin: 0; accent-color: var(--green); cursor: pointer; }
.step h3 { margin: 0 0 10px; font-size: 1.05rem; line-height: 1.5; }
.step p { margin: 9px 0; }
.step ol, .step ul { margin: 0; padding-left: 23px; }
.step li + li { margin-top: 7px; }
.step-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.step-links a { display: inline-block; border: 1px solid #8b9cb1; border-radius: 6px; padding: 3px 9px; font-size: .8rem; text-decoration: none; }
.step-note { border: 1px solid #c9b991; border-radius: 8px; background: #f4ecd8; padding: 10px 12px; margin-top: 12px; font-size: .9rem; }
.step.is-done { border-color: var(--green); padding-bottom: 62px; box-shadow: 0 7px 18px #18574217; }
.step.is-done::after {
  content: "完了";
  position: absolute;
  right: 15px;
  bottom: 12px;
  width: 62px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 2px solid var(--red);
  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-weight: 900;
  font-size: .92rem;
  line-height: 1;
  letter-spacing: .1em;
  transform: none;
}
html[lang="en"] .step.is-done::after { content: "DONE"; letter-spacing: .06em; }
.step.is-bumping { animation: card-bump .58s cubic-bezier(.22, 1.3, .36, 1); }
.step.is-bumping::after { animation: stamp-pop .58s cubic-bezier(.22, 1.3, .36, 1); }
.progress-orb.is-bumping { animation: progress-bump .64s cubic-bezier(.22, 1.35, .36, 1); }
@keyframes card-bump { 0%, 100% { transform: scale(1); } 36% { transform: scale(1.014); } 68% { transform: scale(.995); } }
@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.18); } 62% { transform: scale(.94); } }
.data-section, .boss-card { padding: 22px; margin-bottom: 22px; border: 1px solid #b7aa93; border-radius: 16px; background: var(--paper); box-shadow: 0 8px 24px #30261812; }
.data-section h2, .boss-card h2 { margin: 0 0 10px; font-size: 1.35rem; color: var(--navy); }
.section-note { margin: 0 0 18px; color: var(--muted); font-size: .9rem; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid #bdc9d7; border-radius: 10px; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; min-width: 730px; font-size: .88rem; line-height: 1.65; }
th { background: #203d65; color: white; text-align: left; font-size: .84rem; }
th, td { padding: 11px 12px; border: 1px solid #cbd5e1; vertical-align: top; }
th:first-child, td:first-child { min-width: 145px; }
th { min-width: 110px; }
td { min-width: 100px; }
tr:nth-child(even) td { background: #f0f4f8; }
tbody tr:target td { background: #fff0bf; }
.boss-table { min-width: 940px; }
.boss-card dl { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 9px 15px; }
.boss-card dt { color: #80550b; font-weight: 850; }
.boss-card dd { margin: 0; }
.boss-card .step-links { margin-top: 18px; }
.endnote { color: var(--muted); font-size: .9rem; margin-top: 28px; }
footer { padding: 26px 74px 38px; border-top: 1px solid var(--line); text-align: center; background: #eae4d7; }
.back-top { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid #7e8998; border-radius: 50%; background: #fffdf8; color: var(--navy); box-shadow: 0 8px 22px #09182c30; font: 900 1.15rem/1 "Yu Gothic UI", sans-serif; }
[hidden] { display: none !important; }
@media (max-width: 1390px) {
  .category-inner, .toolbar, .search-area, .preflight { margin-left: 4vw; margin-right: 4vw; }
}
@media (max-width: 760px) {
  .topline { padding: 8px 80px 8px 15px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .guide-return { font-size: .77rem; }
  .languages button { padding: 4px 12px; }
  .hero-inner { padding: 25px 20px 27px; }
  h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); }
  html[lang="en"] h1 { font-size: clamp(1.55rem, 7.38vw, 2.15rem); }
  .edition { font-size: .73rem; }
  .category-inner { margin: 0; padding: 9px 20px; gap: 19px; }
  .category-nav a { font-size: .84rem; }
  .toolbar, .search-area, .preflight { margin-left: 15px; margin-right: 15px; }
  .toolbar { justify-content: flex-start; padding: 12px 0; }
  .search-area { margin-bottom: 18px; }
  .search-form { padding: 12px; }
  .search-row { flex-wrap: wrap; }
  .search-row input { flex: 1 0 100%; }
  .search-row .control { padding: 5px 13px; min-height: 36px; }
  .preflight { padding: 17px 19px; }
  .preflight ul { grid-template-columns: 1fr; gap: 10px; }
  .layout { display: block; padding: 0 15px 70px; }
  .contents { position: static; max-height: none; margin-bottom: 20px; padding: 17px; }
  .contents a { padding: 7px; }
  .contents .toc-group { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; }
  .progress-panel { grid-template-columns: 1fr; padding: 17px; gap: 12px; }
  .progress-actions { grid-template-columns: 1fr; justify-items: start; align-items: center; }
  .save-state { grid-column: 1 / -1; }
  .progress-orb { width: 58px; height: 58px; top: 10px; right: 10px; font-size: .88rem; }
  .chart-heading { font-size: 1.38rem; }
  .chapter > summary { padding: 17px; font-size: 1.04rem; }
  .chapter-body { padding: 3px 10px 12px; }
  .step { padding: 54px 14px 17px; }
  .step { padding-right: 64px; }
  .step.is-done::after { right: 64px; }
  .step-check { top: 18px; left: 16px; }
  .step h3 { font-size: 1.02rem; }
  .step ol, .step ul { padding-left: 20px; }
  .step-links { gap: 7px; }
  .step.is-done { padding-bottom: 62px; }
  .data-section, .boss-card { padding: 18px 14px; }
  .preflight, .search-form, .search-results, .contents, .progress-panel, .data-section, .boss-card, .chapter > summary { padding-right: 64px; }
  #sound-status { padding-right: 64px; }
  .data-section h2, .boss-card h2 { font-size: 1.23rem; }
  .boss-card dl { grid-template-columns: 1fr; gap: 4px; }
  .boss-card dd { margin-bottom: 12px; }
  table { font-size: .85rem; }
  th, td { padding: 10px 11px; }
  .back-top { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: white; color: black; font-size: 11pt; }
  .skip, .topline, .category-nav, .toolbar, .search-area, .contents, .progress-orb, .back-top, .chart-actions, .progress-actions, .save-problem, footer, .step-check { display: none !important; }
  .hero { color: black; background: none; border-bottom: 1px solid #999; }
  .hero-inner { padding: 15px 0; }
  .edition { color: black; }
  h1, html[lang="en"] h1 { font-size: 24pt; }
  .layout { display: block; padding: 0; }
  .preflight { margin: 15px 0; padding: 12px; }
  .progress-panel { display: block; box-shadow: none; }
  .chapter, .data-section, .boss-card { box-shadow: none; overflow: visible; }
  .step { padding: 12px; break-inside: avoid; }
  .step.is-done { padding-bottom: 58px; }
  .table-wrap { overflow: visible; }
  table, .boss-table { min-width: 0; font-size: 8pt; }
  th, td, th:first-child, td:first-child { min-width: 0; padding: 5px; }
  th { color: black; background: #eee; }
}
