:root {
  --navy: #17375f;
  --navy-light: #1d3f6b;
  --paper: #f2efe7;
  --panel: #fffef9;
  --ink: #182332;
  --muted: #47556a;
  --line: #c9bba4;
  --blue: #075b9a;
  --gold: #a76800;
  --green: #237858;
  --red: #b3332f;
  --sans: "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --serif: YuMincho, "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.78 var(--sans); }
[hidden] { display: none !important; }
html[lang="ja"] [lang="en"], html[lang="en"] [lang="ja"] { display: none !important; }
a { color: var(--blue); text-underline-offset: .2em; }
a:hover { color: var(--navy); }
button, input { font: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
:is(a, button, input, summary, [tabindex]):focus-visible { outline: 3px solid #c28a2e; outline-offset: 4px; }
button { min-height: 42px; padding: 7px 15px; color: var(--navy); background: var(--panel); border: 1px solid #9d927f; border-radius: 9px; }
button:hover { background: #eee8da; }
button[aria-pressed="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }
.skip { position: absolute; z-index: 20; left: 15px; top: -100px; padding: 8px 15px; background: var(--panel); }
.skip:focus { top: 8px; }
.topline { background: #eee8dc; border-bottom: 1px solid var(--line); }
.topline-inner { max-width: 1440px; margin: auto; padding: 8px clamp(20px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.back-guides { font-size: .86rem; font-weight: 700; }
.languages { display: flex; gap: 7px; flex-shrink: 0; }
.languages button { min-height: 34px; padding: 4px 13px; border-radius: 999px; font-size: .8rem; }
.hero { background: linear-gradient(118deg, var(--navy), var(--navy-light)); color: white; }
.hero-inner { max-width: 1440px; margin: auto; padding: 40px clamp(20px, 4vw, 56px) 34px; }
.edition { margin: 0 0 10px; font-size: .84rem; color: #f2e4c8; }
h1 { margin: 0; max-width: 1280px; font: 700 clamp(2rem, 4vw, 3.45rem)/1.25 var(--serif); overflow-wrap: anywhere; }
html[lang="en"] h1 { font-size: clamp(1.85rem, 3.7vw, 3.25rem); }
.category-nav { overflow-x: auto; background: var(--panel); border-bottom: 1px solid #acb6c4; box-shadow: 0 3px 10px #17375f10; }
.category-inner { display: flex; gap: 22px; width: max-content; min-width: min(100%, 1440px); max-width: none; margin: auto; padding: 10px clamp(20px, 4vw, 56px); }
.category-inner a { min-height: 30px; display: inline-flex; align-items: center; font-size: .91rem; font-weight: 800; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.category-inner a:hover { border-bottom-color: var(--gold); }
.tools { max-width: 1440px; margin: auto; padding: 15px clamp(20px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tools-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.progress-summary { display: flex; align-items: center; gap: 12px; min-width: 220px; color: var(--green); font-weight: 800; }
.progress-track { width: min(15vw, 180px); min-width: 80px; height: 9px; border: 1px solid #a89c86; border-radius: 99px; overflow: hidden; background: #e8e0d1; }
.progress-fill { width: 0; height: 100%; background: var(--green); transition: width .45s ease; }
.page { max-width: 1440px; margin: auto; padding: 18px clamp(20px, 4vw, 56px) 85px; }
.cautions { margin: 0 0 24px; padding: 18px 22px; border: 1px solid #b57c67; border-radius: 14px; background: #f7eae2; }
.cautions h2 { margin: 0 0 7px; font-size: 1.05rem; color: #713a2a; }
.cautions ul { margin: 0; padding-left: 1.3em; }
.cautions li + li { margin-top: 5px; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; align-items: start; }
.toc { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow: auto; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 12px 28px #202b3610; }
.toc h2 { margin: 0 0 10px; color: var(--gold); font-size: .86rem; letter-spacing: .06em; }
.toc a { display: block; padding: 6px 7px; color: var(--muted); text-decoration: none; font-size: .86rem; line-height: 1.55; }
.toc a:hover { color: var(--blue); background: #f0ebdf; border-radius: 6px; }
.toc hr { margin: 11px 0; border: 0; border-top: 1px solid var(--line); }
.content { min-width: 0; }
.panel, .search-panel { margin: 0 0 23px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 8px 24px #202b360d; }
h2 { margin: 0 0 14px; color: var(--navy); font: 700 1.55rem/1.45 var(--serif); }
h3 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.55; }
p { margin: 8px 0; }
.muted, .scope { color: var(--muted); font-size: .89rem; }
.intro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 13px; margin-top: 16px; }
.info { padding: 16px; background: #f3eee2; border: 1px solid var(--line); border-radius: 11px; }
.info p { margin: 0; }
.panel > .info + .info { margin-top: 14px; }
.search-form { display: flex; gap: 8px; }
.search-form input { min-width: 0; width: 100%; padding: 10px 12px; border: 1px solid #8c9bb1; border-radius: 8px; background: white; }
.search-form button { flex-shrink: 0; }
.search-status { margin: 8px 0 0; color: var(--muted); font-size: .88rem; }
.search-results { padding: 0; margin: 12px 0 0; list-style: none; }
.search-results li { padding: 13px 0; border-top: 1px solid var(--line); }
.search-results a { font-weight: 700; }
.search-results p { margin: 3px 0; font-size: .88rem; line-height: 1.6; }
.search-category { color: var(--gold); font-size: .8rem; }
.chart-actions { display: flex; gap: 9px; margin: 12px 0 18px; flex-wrap: wrap; }
.chapter { margin: 0 0 20px; border: 1px solid var(--line); border-radius: 16px; background: #e9e2d3; overflow: clip; box-shadow: 0 8px 24px #202b360d; }
.chapter > summary { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 15px; background: var(--panel); color: var(--navy); list-style: none; font: 700 1.18rem/1.5 var(--serif); }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::after { content: "+"; display: grid; place-items: center; flex-shrink: 0; width: 29px; height: 29px; color: var(--gold); border: 1px solid #b6a17e; border-radius: 50%; font: 500 1rem var(--sans); }
.chapter[open] > summary::after { content: "−"; }
.chapter-body { padding: 4px 20px 20px; }
.step { position: relative; margin-top: 14px; padding: 19px 18px 20px 61px; border: 1px solid #cbbda6; border-radius: 14px; background: var(--panel); box-shadow: 0 4px 12px #202b3608; }
.step-check { position: absolute; top: 20px; left: 19px; width: 23px; height: 23px; margin: 0; accent-color: var(--green); cursor: pointer; }
.step ol, .step ul { margin: 8px 0 0; padding-left: 1.3em; }
.step li + li { margin-top: 5px; }
.step .note { margin-top: 13px; padding: 10px 12px; background: #f3ebd8; border: 1px solid #cbbda6; border-radius: 8px; font-size: .9rem; font-weight: 600; }
.step.is-done { padding-bottom: 62px; border-color: var(--green); }
.step.is-done::after { content: "完了"; position: absolute; right: 15px; bottom: 12px; display: grid; place-items: center; width: 62px; height: 31px; color: var(--red); border: 2px solid var(--red); border-radius: 4px 6px 5px 3px; background: radial-gradient(circle at 16% 28%, #fffef9dd 0 1px, transparent 1.4px) 0 0 / 9px 8px, #fffef9da; font-size: .92rem; font-weight: 900; letter-spacing: .1em; line-height: 1; transform: none; box-shadow: inset 0 0 0 1px #b3332f20; }
html[lang="en"] .step.is-done::after { content: "DONE"; }
.step.bump { animation: card-bump .58s ease-out; }
.step.bump::after { animation: stamp-in .58s ease-out; }
@keyframes card-bump { 0%,100% { transform: scale(1); } 36% { transform: scale(1.012); } 68% { transform: scale(.997); } }
@keyframes stamp-in { 0% { opacity: 0; transform: scale(1.4); } 58% { opacity: 1; transform: scale(.93); } 100% { opacity: 1; transform: none; } }
.table-wrap { width: 100%; overflow: auto; overscroll-behavior-inline: contain; border: 1px solid #adbacd; border-radius: 10px; }
.table-hint { display: none; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 740px; font-size: .91rem; }
th, td { padding: 11px 12px; text-align: left; vertical-align: top; border-right: 1px solid #ced6e2; border-bottom: 1px solid #ced6e2; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { background: var(--navy); color: white; font-weight: 800; }
tbody th { min-width: 145px; font-weight: 700; }
#skills :is(th, td):nth-child(2) { min-width: 8em; overflow-wrap: normal; }
tbody tr:nth-child(even) { background: #edf1f6; }
tbody tr:target { outline: 3px solid #c28a2e; outline-offset: -3px; }
.context-link { display: block; margin-top: 6px; font-size: .82rem; }
.section-lead { margin-bottom: 16px; }
.storage-warning { padding: 12px; border: 1px solid #b38a48; background: #fff4d7; border-radius: 8px; color: #614422; }
.storage-warning button { margin-top: 8px; }
.search-target:target { background-color: #fff5db; }
.site-footer { padding: 25px 0 0; margin-top: 30px; border-top: 1px solid var(--line); }
.back-top { position: fixed; z-index: 50; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: 46px; height: 46px; min-height: 0; 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 var(--sans); }
.optional-check { display: inline-flex; align-items: center; gap: 9px; }
.optional-check input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--green); }
.optional-check:has(input:checked) { position: relative; padding-bottom: 36px; }
.optional-check:has(input:checked)::after { content: "完了"; position: absolute; right: 0; bottom: 0; display: grid; place-items: center; width: 48px; height: 25px; border: 2px solid var(--red); border-radius: 4px 6px 5px 3px; color: var(--red); background: var(--panel); font-size: .75rem; font-weight: 900; line-height: 1; transform: none; animation: stamp-in .58s ease-out; }
html[lang="en"] .optional-check:has(input:checked)::after { content: "DONE"; }
tr:has(.optional-check input:checked) { background: #e5f2e9; }
.noscript { padding: 15px; border: 1px solid var(--line); background: var(--panel); }
@media (max-width: 800px) {
  .topline-inner { padding: 8px 18px; align-items: flex-start; }
  .back-guides { font-size: .76rem; max-width: 125px; line-height: 1.5; padding-top: 5px; }
  .languages { gap: 5px; }
  .languages button { padding: 4px 10px; font-size: .75rem; }
  .hero-inner { padding: 28px 20px 25px; }
  h1 { font-size: clamp(1.55rem, 7vw, 2.15rem); }
  html[lang="ja"] body[data-guide-id^="megami-ibunroku-devil-survivor-ds-jp"] h1 { font-size: clamp(1.55rem, 6.6vw, 2.15rem); }
  html[lang="en"] h1 { font-size: clamp(1.55rem, 7.38vw, 2.15rem); }
  .edition { font-size: .75rem; margin-bottom: 8px; }
  .category-inner { padding: 9px 20px; gap: 18px; }
  .category-inner a { font-size: .83rem; }
  .tools { padding: 12px 16px; align-items: stretch; flex-direction: column; gap: 10px; }
  .tools-actions { gap: 7px; }
  .tools-actions button { padding: 7px 10px; font-size: .83rem; }
  .progress-summary { justify-content: space-between; font-size: .9rem; }
  .progress-track { flex: 1; max-width: 150px; width: auto; }
  .page { padding: 12px 74px 95px 15px; }
  .cautions { padding: 16px; margin-bottom: 17px; }
  .cautions h2 { font-size: 1rem; }
  .cautions li { font-size: .9rem; }
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .toc { position: static; max-height: none; padding: 15px; }
  .toc-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .toc a { font-size: .82rem; }
  .panel, .search-panel { padding: 18px 15px; border-radius: 14px; }
  h2 { font-size: 1.33rem; }
  .intro-grid { grid-template-columns: 1fr; }
  .search-form { flex-wrap: wrap; }
  .search-form input { flex-basis: 100%; }
  .search-form button { font-size: .86rem; }
  .chapter > summary { padding: 17px 16px; font-size: 1.08rem; }
  .chapter-body { padding: 1px 10px 12px; }
  .step { padding: 18px 14px 19px; }
  .step-check { position: static; display: block; margin: 0 0 12px; }
  .step h3 { font-size: 1.02rem; }
  .step > .scope a[href^="#person-"] { display: inline-block; max-width: 100%; margin-right: .5em; }
  .step.is-done { padding-bottom: 62px; }
  table { min-width: 690px; font-size: .86rem; }
  .table-hint { display: block; margin: 8px 0; font-size: .82rem; color: var(--muted); }
  th, td { padding: 10px; }
  .back-top { right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: white; color: black; font-size: 10pt; }
  .topline, .category-nav, .tools, .toc, .search-panel, .chart-actions, .back-top, .site-footer, .step-check, .storage-warning { display: none !important; }
  .hero { color: black; background: white; }
  .hero-inner { padding: 10px 0; }
  .edition { color: #333; }
  h1, html[lang="en"] h1 { color: black; font-size: 22pt; }
  .page { padding: 0; }
  .layout { display: block; }
  .panel, .chapter, .step, .cautions { box-shadow: none; break-inside: avoid; }
  .chapter-body { padding: 5px; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8pt; }
  th, td { padding: 5px; }
  a { color: black; text-decoration: none; }
}
