:root {
  color-scheme: light;
  --ink: #15253a;
  --ink-soft: #607086;
  --paper: #f5f2eb;
  --paper-deep: #e8e1d4;
  --card: #fffdf9;
  --line: #d7d5cf;
  --line-strong: #bdc0bc;
  --navy: #183f61;
  --navy-deep: #102d48;
  --blue-wash: #eaf1f4;
  --gold: #b47a2c;
  --gold-soft: #f7ebd4;
  --green: #17684f;
  --green-soft: #e4f2eb;
  --amber: #895716;
  --amber-soft: #fff1d3;
  --radius: 16px;
  --shadow: 0 18px 45px rgba(28, 42, 53, 0.07), 0 2px 8px rgba(28, 42, 53, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #d69f4c; outline-offset: 3px; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .93em; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: 10px; left: 14px; padding: 8px 12px; color: #fff; background: var(--navy-deep); border-radius: 8px; transform: translateY(-150%); transition: transform .18s ease; }
.skip-link:focus { transform: translateY(0); }
.site-shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 50px; }

.hero { position: relative; padding: 18px 28px 25px; color: #f8f3e9; background: linear-gradient(135deg, #112e49 0%, #1a4566 58%, #2d6177 100%); border-radius: 24px; overflow: hidden; box-shadow: 0 18px 42px rgba(19, 51, 75, .2); }
.hero::before, .hero::after { content: ""; position: absolute; pointer-events: none; border: 1px solid rgba(250, 223, 170, .23); border-radius: 50%; }
.hero::before { width: 390px; height: 390px; right: -140px; top: -170px; }
.hero::after { width: 250px; height: 250px; right: -55px; top: -100px; }
.hero-row { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-top: 0; }
.eyebrow { margin: 0 0 3px; color: #bda982; font-size: 11px; line-height: 1.4; letter-spacing: .16em; font-weight: 700; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; color: #fffaf0; font-family: Georgia, "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: clamp(2.05rem, 4vw, 3.35rem); line-height: 1.15; letter-spacing: .02em; font-weight: 600; }
h1 .game-brand, h1 .game-season { display: block; overflow-wrap: anywhere; }
h1 .game-season { margin-top: .22em; color: #f0d8a4; font-size: .7em; letter-spacing: .08em; font-weight: 500; }
.catalogue-title { margin: 13px 0 0; color: #fffaf0; font-family: Georgia, "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: clamp(1.35rem, 2.4vw, 2rem); line-height: 1.3; letter-spacing: .04em; font-weight: 600; }
.hero-lede { max-width: 600px; margin: 15px 0 0; color: #d9e5e8; font-size: 15px; }
.hero-stats { display: flex; flex: 0 0 auto; gap: 26px; margin: 0 0 3px; }
.hero-stats div { min-width: 58px; padding-left: 14px; border-left: 1px solid rgba(251, 229, 183, .32); }
.hero-stats dt { color: #bad0d5; font-size: 11px; }
.hero-stats dd { margin: 1px 0 0; color: #f8dfad; font-family: Georgia, serif; font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-rule { display: flex; align-items: center; gap: 8px; width: 112px; margin-top: 29px; opacity: .7; }
.hero-rule::before { content: ""; flex: 1; height: 1px; background: #d9b66d; }
.hero-rule span { width: 4px; height: 4px; background: #d9b66d; transform: rotate(45deg); }

.controls { margin: 26px 0 34px; padding: 20px; background: rgba(255, 253, 249, .75); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(48, 47, 41, .04); }
.search-row { display: flex; align-items: center; gap: 12px; }
.search-field { display: flex; align-items: center; flex: 1; min-width: 0; height: 48px; padding: 0 13px; background: #fff; border: 1px solid var(--line-strong); border-radius: 11px; transition: border-color .18s ease, box-shadow .18s ease; }
.search-field:focus-within { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(24, 63, 97, .11); }
.search-glyph { margin-right: 10px; color: var(--gold); font-family: Georgia, serif; font-size: 29px; line-height: 1; transform: translateY(-2px); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-field input::placeholder { color: #8993a0; }
.clear-search { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; color: var(--ink-soft); background: transparent; font-size: 22px; line-height: 1; }
.clear-search:hover { background: var(--blue-wash); }
.reset-button, .secondary-button { height: 42px; padding: 0 15px; color: var(--navy); background: transparent; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.reset-button:hover, .secondary-button:hover { border-color: var(--navy); background: var(--blue-wash); }
.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; }
.select-field { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; min-width: 0; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.select-field[hidden] { display: none; }
.select-field select { width: 100%; min-width: 0; height: 38px; padding: 0 30px 0 10px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 33px; margin-top: 15px; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.legend-label { margin-right: 3px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.status-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border: 1px solid transparent; border-radius: 999px; font-size: 11px; line-height: 1.2; white-space: nowrap; }
.status-chip b { font-size: 12px; }
.status-active { color: var(--green); background: var(--green-soft); border-color: #c1e1d2; }
.status-conditional { color: var(--amber); background: var(--amber-soft); border-color: #ecd39f; }
.result-count { flex: 0 0 auto; margin: 0; color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.result-count strong { color: var(--ink); font-size: 15px; }
.stamp-rule-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: -17px 0 30px; padding: 10px 13px; color: var(--ink-soft); background: rgba(255, 253, 249, .72); border: 1px solid var(--line); border-radius: 11px; font-size: 12px; }
.stamp-rule-nav > span { margin-right: 3px; color: var(--navy); font-weight: 800; }
.stamp-rule-nav a { padding: 3px 9px; color: var(--navy); background: var(--blue-wash); border: 1px solid #d2e1e6; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.stamp-rule-nav a:hover { border-color: var(--navy); background: #dfecef; }

.catalogue-section { scroll-margin-top: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 16px; padding: 0 4px; }
.section-heading h2 { margin: 0; color: var(--navy-deep); font-family: Georgia, "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 28px; line-height: 1.25; font-weight: 600; }
.section-hint { margin: 0 0 2px; color: var(--ink-soft); font-size: 12px; text-align: right; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 17px; }
.catalogue-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); scroll-margin-top: 18px; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.catalogue-card:hover { border-color: #a7b5ba; box-shadow: 0 22px 48px rgba(28, 42, 53, .11), 0 3px 9px rgba(28, 42, 53, .06); transform: translateY(-2px); }
.catalogue-card.is-target { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(180, 122, 44, .18), var(--shadow); }
.card-top { position: relative; display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 14px; align-items: start; min-height: 139px; padding: 17px 17px 13px; background: linear-gradient(110deg, #fffdf9 0%, #fbfaf5 70%, #f2f5f3 100%); border-bottom: 1px solid var(--line); }
.card-art { display: grid; place-items: center; width: 92px; height: 112px; margin: 0; background: radial-gradient(circle at center, #f8f1df 0 44%, #f1e6d0 45% 100%); border: 1px solid #e7dbc6; border-radius: 12px; overflow: hidden; }
.card-art img { width: 100%; height: 100%; object-fit: contain; }
.card-art.is-missing::after { content: "画像なし"; color: var(--ink-soft); font-size: 11px; }
.card-head { min-width: 0; padding-top: 2px; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; }
.category-label { color: var(--navy); font-weight: 800; }
.meta-dot { color: #aeb4b6; }
.card-head h3 { margin: 0; color: var(--navy-deep); font-family: Georgia, "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 20px; line-height: 1.35; font-weight: 600; }
.card-id { display: inline-block; margin-top: 7px; color: #87909a; font-size: 11px; font-variant-numeric: tabular-nums; }
.card-link { position: absolute; top: 8px; right: 10px; display: inline-grid; place-items: center; width: 24px; height: 24px; color: #7e8a8f; border-radius: 50%; text-decoration: none; font-size: 15px; }
.card-link:hover { color: var(--navy); background: var(--blue-wash); }
.stamp-rail { grid-column: 3; display: flex; flex-wrap: wrap; justify-content: end; gap: 5px; width: 70px; padding-top: 22px; }
.stamp-badge { position: relative; display: inline-grid; place-items: center; width: 31px; height: 31px; padding: 2px; color: inherit; background: #fff; border: 1px solid #ced6d4; border-radius: 8px; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.stamp-badge:hover { border-color: var(--navy); transform: translateY(-1px); }
.stamp-badge img { width: 100%; height: 100%; object-fit: contain; }
.stamp-badge .stamp-mark { position: absolute; right: -4px; bottom: -5px; display: grid; place-items: center; width: 14px; height: 14px; color: #fff; border: 2px solid #fff; border-radius: 50%; font-size: 9px; line-height: 1; font-weight: 900; }
.stamp-badge.status-active { border-color: #82c7a9; background: #f3fbf6; }
.stamp-badge.status-active .stamp-mark { background: var(--green); }
.stamp-badge.status-conditional { border-color: #e5bd6c; background: #fffaf0; }
.stamp-badge.status-conditional .stamp-mark { background: var(--amber); }
.stamp-badge .sr-only { width: 1px; }
.status-mark-active::after { content: "✓"; }
.status-mark-conditional::after { content: "~"; }
.stamp-reference-link { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 3px 7px 3px 4px; color: var(--navy); background: #fbfcfb; border: 1px solid #c9d2d1; border-radius: 999px; text-decoration: none; }
.stamp-reference-link:hover { border-color: var(--navy); background: var(--blue-wash); }
.stamp-reference-link img { width: 22px; height: 22px; object-fit: contain; }
.stamp-reference-name { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

.card-body { padding: 0 17px; }
.variant-block { padding: 15px 0 16px; border-bottom: 1px solid #e5e3dd; }
.variant-block:last-child { border-bottom: 0; }
.variant-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-bottom: 7px; }
.variant-pill { display: inline-block; padding: 2px 7px; color: var(--navy); background: var(--blue-wash); border: 1px solid #d2e1e6; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1.35; }
.variant-pill.plus { color: #8c5819; background: var(--gold-soft); border-color: #edd6aa; }
.variant-name { color: var(--ink-soft); font-size: 12px; }
.variant-id { margin-left: auto; color: #9aa2a7; font-size: 11px; font-variant-numeric: tabular-nums; }
.card-text { margin: 0; color: #28384a; font-size: 15px; line-height: 1.9; white-space: pre-wrap; }
.dynamic-markers { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 10px 0 0; color: var(--ink-soft); font-size: 11px; }
.dynamic-label { margin-right: 2px; font-weight: 700; }
.marker { padding: 1px 6px; color: var(--navy); background: #eef4f3; border: 1px solid #d2dfdc; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.stamp-rules { margin: 0 17px 16px; padding: 11px 13px 12px; color: #4c5964; background: #f0f4f2; border: 1px solid #d9e3de; border-radius: 11px; }
.stamp-rules-heading { margin: 0 0 5px; color: var(--navy); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.stamp-rules-list { display: grid; gap: 5px; margin: 0; padding-left: 1.25em; font-size: 13px; line-height: 1.65; }
.card-notes { margin: 0 17px 16px; padding: 0 13px 11px; background: #f7f5ef; border: 1px solid #e5e0d4; border-radius: 11px; }
.card-notes-heading { display: flex; align-items: center; gap: 6px; margin: 0; padding: 11px 0 6px; color: var(--navy); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.note-content { padding-bottom: 1px; }
.note-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.note-item { display: block; color: #4c5964; font-size: 13px; line-height: 1.7; }
.note-text { margin: 0; }
.note-title { margin: 0 0 3px; color: var(--navy); font-size: 13px; line-height: 1.5; font-weight: 800; }
.note-kind { display: inline-block; margin-right: 6px; padding: 1px 5px; border: 1px solid transparent; border-radius: 4px; font-size: 10px; line-height: 1.4; font-weight: 800; vertical-align: baseline; }
.note-kind-correction { color: #7d4b23; background: #f8ecd7; border-color: #ead5ae; }
.note-kind-interaction { color: #245d6e; background: #e6f1f3; border-color: #c7dfe4; }
.note-kind-exception { color: #674b79; background: #eee7f2; border-color: #d9cbe1; }
.note-quote { margin: 7px 0 0; padding: 5px 9px; color: #68737b; border-left: 2px solid #c9d2d1; font-size: 12px; line-height: 1.55; }
.note-quote-text { margin: 0; white-space: pre-wrap; }
.note-quote-cite { display: block; margin-top: 2px; font-size: 11px; font-style: normal; }
.note-quote-cite a { color: #627b83; text-decoration: underline; text-underline-offset: 2px; }
.note-stamp-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.public-source { display: flex; justify-content: end; padding: 0 17px 14px; }
.public-source a { color: #7a8587; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.public-source a:hover { color: var(--navy); }

.empty-state, .load-error { padding: 65px 20px; color: var(--ink-soft); background: rgba(255, 253, 249, .65); border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }
.empty-mark { color: var(--gold); font-family: Georgia, serif; font-size: 48px; line-height: 1; }
.empty-state h2, .load-error h2 { margin: 12px 0 4px; color: var(--navy-deep); font-family: Georgia, serif; font-size: 22px; font-weight: 600; }
.empty-state p, .load-error p { margin: 0 0 17px; font-size: 14px; }
.site-footer { margin-top: 42px; padding: 20px 4px 0; color: #75818b; border-top: 1px solid var(--line); font-size: 12px; }
.site-footer p { margin: 3px 0; }
.site-footer code { padding: 1px 4px; background: #e9e5dc; border-radius: 4px; }

@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .site-shell { width: min(100% - 24px, 620px); padding-top: 12px; }
  .hero { padding: 15px 18px 22px; border-radius: 18px; }
  .hero-row { display: block; }
  .hero-stats { gap: 18px; margin-top: 22px; }
  .hero-stats div { min-width: 54px; }
  .controls { margin-top: 17px; padding: 14px; }
  .search-row { align-items: stretch; flex-direction: column; }
  .reset-button { width: 100%; }
  .filter-row { grid-template-columns: 1fr 1fr; gap: 9px; }
  .select-field { display: block; }
  .select-field span { display: block; margin: 0 0 4px; }
  .toolbar-row { display: block; }
  .legend { gap: 5px; }
  .result-count { margin-top: 9px; }
  .section-heading { display: block; }
  .section-hint { margin-top: 6px; text-align: left; }
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .card-top { grid-template-columns: 78px minmax(0, 1fr) auto; gap: 11px; padding: 14px 14px 12px; }
  .card-art { width: 78px; height: 102px; }
  .card-head h3 { font-size: 18px; }
  .stamp-rail { width: 64px; gap: 4px; }
  .stamp-badge { width: 28px; height: 28px; }
  .card-body { padding: 0 14px; }
  .stamp-rules, .card-notes { margin-left: 14px; margin-right: 14px; }
  .public-source { padding-right: 14px; }
}
@media (max-width: 410px) {
  .filter-row { grid-template-columns: 1fr; }
  .hero-stats { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
