:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --line: #e4ded3;
  --accent: #b3261e;
  --accent-text: #ffffff;
  --red: #c62828;  --red-bg: #fdecea;
  --green: #2e7d32; --green-bg: #e8f5e9;
  --blue: #1565c0;  --blue-bg: #e7f0fb;
  --gold: #a07600;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514; --surface: #201f1d; --text: #ece8e1; --muted: #a39d93; --line: #35322e;
    --accent: #ef6b5e; --accent-text: #161514;
    --red: #ff8a80; --red-bg: #3a1f1d; --green: #81c784; --green-bg: #1d2e1f; --blue: #90caf9; --blue-bg: #1b2736;
    --gold: #e0b84a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  line-height: 1.75; font-size: 16px;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.7rem; line-height: 1.35; margin: .4em 0 .3em; }
h2 { font-size: 1.2rem; margin: 2em 0 .6em; padding-bottom: .3em; border-bottom: 2px solid var(--line); }
h3 { font-size: 1rem; margin: 1.4em 0 .5em; }
.muted { color: var(--muted); }
.lead { color: var(--muted); }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.logo { font-weight: 800; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.gnav { display: flex; gap: 16px; }
.gnav a { text-decoration: none; color: var(--text); font-weight: 600; }
.gnav a:hover { color: var(--accent); }
.site-footer { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 16px 0 0; }
.crumbs a { color: var(--muted); }

/* badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; line-height: 1; padding: .35em .55em; border-radius: 4px; vertical-align: middle; white-space: nowrap; }
.color-red { color: var(--red); background: var(--red-bg); }
.color-green { color: var(--green); background: var(--green-bg); }
.color-blue { color: var(--blue); background: var(--blue-bg); }
.rar { border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }
.rar-sr { color: var(--blue); border-color: currentColor; }
.rar-dr { color: var(--gold); border-color: currentColor; }
.rar-sec { color: var(--accent-text); background: var(--gold); border-color: var(--gold); }

/* buttons */
.btn { display: inline-block; background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px; padding: .6em 1.1em; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

/* card list */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.card-link { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); }
.card-link:hover { border-color: var(--accent); }
.cl-name { font-weight: 700; flex: 1 1 auto; min-width: 0; }
.cl-meta { width: 100%; order: 3; font-size: .78rem; color: var(--muted); }

/* card page */
.card-head { margin-top: 12px; padding: 4px 0 8px 16px; border-left: 6px solid var(--line); }
.color-border-red { border-left-color: var(--red); }
.color-border-green { border-left-color: var(--green); }
.color-border-blue { border-left-color: var(--blue); }
.kana { margin: 0; color: var(--muted); font-size: .85rem; }
.card-head h1 { margin: 0 0 .2em; }
.head-meta { margin: 0; }
.card-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0 32px; }
@media (max-width: 760px) { .card-cols { grid-template-columns: minmax(0, 1fr); } }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { width: 9em; font-weight: 600; color: var(--muted); background: transparent; }
.prints th { width: auto; }
.num { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.ability-text { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; }
blockquote { margin: 0; padding: 4px 16px; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.shop-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; font-size: .9rem; }
.pager a { max-width: 48%; }

/* search */
.search-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; align-items: end; }
.search-form label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); font-weight: 600; gap: 4px; }
.search-form .wide { grid-column: 1 / -1; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .5em .6em; width: 100%; }
.count { font-weight: 700; margin: 16px 0 8px; }

/* top */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 2rem; }
.hero-search { display: flex; gap: 8px; max-width: 560px; }
.hero-search input { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 8px; font-weight: 800; font-size: 1.2rem; text-decoration: none; }
.tile small { font-size: .8rem; font-weight: 600; }
.race-list { columns: 3 200px; padding-left: 1.2em; }
.product-list li { margin: 4px 0; }
.facts { max-width: 560px; }
.kind { color: var(--muted); margin-top: 0; }

/* rules / glossary */
.doc { max-width: 760px; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px; }
.toc ol { margin: 0; padding-left: 1.4em; columns: 2 220px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; }
.ref { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; }
p.ref { margin-top: 0; }
.source { margin-top: 40px; font-size: .85rem; color: var(--muted); }
.glossary { margin: 0; }
.term { padding: 12px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.term:target { background: var(--surface); outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.term dt { font-weight: 800; }
.term dd { margin: 4px 0 0; }
.doc td, .doc th { width: auto; }
.terms { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; border-top: 1px dashed var(--line); padding-top: 8px; }
.gq { display: inline-flex; align-items: center; justify-content: center; width: 1.3em; height: 1.3em; border-radius: 50%; border: 1px solid currentColor; font-size: .75rem; font-weight: 700; text-decoration: none; margin-left: 4px; vertical-align: middle; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-links a { color: var(--muted); }
