:root {
  /* 墨と金茶 */
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-2: #f2ede2;
  --text: #1d1a16;
  --muted: #6e665a;
  --line: #e5dccb;
  --accent: #8c6418;
  --accent-2: #2a241e;
  --accent-soft: #f3e9d2;
  --accent-text: #ffffff;
  --link: #1d4f91;
  --h2-bg: #f1e9d8;
  --header-bg: #1b1815;
  --header-text: #f5efe2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-hover: 0 8px 24px rgba(16, 24, 40, .10);
  --red: #e11d48;  --red-bg: #ffe4ea;
  --green: #059669; --green-bg: #d9f7ec;
  --blue: #2563eb;  --blue-bg: #e0eaff;
  --gold: #b7791f;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12100d; --surface: #1b1814; --surface-2: #231f1a; --text: #ece6da; --muted: #a89f90; --line: #2f2a23;
    --accent: #d9b25c; --accent-2: #8a7a63; --accent-soft: #2e2617; --accent-text: #12100d; --link: #8fb4e8; --h2-bg: #221d16;
    --header-bg: #0b0a08; --header-text: #f5efe2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-hover: 0 8px 24px rgba(0, 0, 0, .5);
    --red: #fb7185; --red-bg: #3b1520; --green: #34d399; --green-bg: #0f2e24; --blue: #7aa2ff; --blue-bg: #17213f;
    --gold: #f2c25b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.75; font-size: 16px; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.8rem; line-height: 1.35; margin: .4em 0 .3em; letter-spacing: .01em; }
h2 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; line-height: 1.45; margin: 2em 0 .8em; padding: .35em .7em; background: var(--h2-bg); border-radius: 8px; }
h2::before { content: ""; width: 4px; height: 1.1em; border-radius: 4px; background: linear-gradient(180deg, #b5861c, #e0c27a); flex: none; }
h3 { font-size: 1.05rem; margin: 1.4em 0 .5em; }
.muted { color: var(--muted); }
.lead { color: var(--muted); }
small { color: var(--muted); }

/* header / footer */
html { scroll-padding-top: 96px; }
.site-header { background: var(--header-bg); border-bottom: 1px solid rgba(255, 255, 255, .08); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.logo { font-weight: 900; text-decoration: none; font-size: 1.15rem; letter-spacing: .02em;
  background: linear-gradient(90deg, #f0d58c, #c9953f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo:hover { text-decoration: none; }
.gnav { display: flex; gap: 4px; flex-wrap: wrap; }
.hsearch { flex: 1 1 160px; max-width: 240px; margin: 0; }
.hsearch input { width: 100%; box-sizing: border-box; font: inherit; font-size: .88rem; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: var(--header-text); }
.hsearch input::placeholder { color: var(--header-text); opacity: .6; }
.hsearch input:focus { outline: 2px solid #d9b25c; outline-offset: 1px; background: rgba(255, 255, 255, .14); }
.gnav a { text-decoration: none; color: var(--header-text); font-weight: 600; font-size: .92rem; padding: 6px 12px; border-radius: 999px; opacity: .85; }
.gnav a:hover { opacity: 1; background: rgba(255, 255, 255, .1); text-decoration: none; }
.site-footer { margin-top: 72px; padding: 28px 0 44px; background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.crumbs { font-size: .82rem; color: var(--muted); margin: 18px 0 0; }
.crumbs a { color: var(--muted); }

/* badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1; padding: .4em .65em; border-radius: 999px; 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; background: var(--surface); }
.rar-sr { color: var(--blue); border-color: currentColor; }
.rar-dr { color: var(--gold); border-color: currentColor; }
.rar-sec { color: #fff; background: linear-gradient(90deg, #d97706, #db2777); border-color: transparent; }

/* buttons */
.btn { display: inline-block; background: #1f1b17; color: #f3dfa8; border: 1px solid #b5861c; border-radius: 10px; padding: .65em 1.3em; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); transition: transform .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.btn-ghost { background: var(--surface); color: var(--accent); border: 1px solid var(--line); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .btn:not(.btn-ghost) { background: #2a241e; } }

/* card list */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.cl-name { font-weight: 700; flex: 1 1 auto; min-width: 0; }
.cl-meta { grid-column: 1 / -1; grid-row: 2; font-size: .76rem; color: var(--muted); }
.card-link > .badge { justify-self: start; }
.cl-rar { grid-column: 3; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.cl-rar .rar { margin-left: 0; }

/* card page */
.card-head { margin-top: 14px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.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); } .card-cols .ability { order: -1; } }
table { font-size: .94rem; line-height: 1.6; border-collapse: separate; border-spacing: 0; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
tr:last-child > th, tr:last-child > td { border-bottom: 0; }
th { width: 9em; font-weight: 700; color: var(--text); background: var(--surface-2); font-size: .92em; }
thead th { font-size: .85em; }
tbody tr:hover > td { background: var(--surface-2); }
.prints th, .race-table th { width: auto; white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.table-scroll.is-scrollable::before { content: "横にずらすと続きが見られる →"; display: block; position: sticky; left: 0; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.ability-text { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; box-shadow: var(--shadow); }
.ability-text.tint-red { background: color-mix(in srgb, var(--red-bg) 45%, var(--surface)); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.ability-text.tint-green { background: color-mix(in srgb, var(--green-bg) 45%, var(--surface)); border-color: color-mix(in srgb, var(--green) 30%, var(--line)); }
.ability-text.tint-blue { background: color-mix(in srgb, var(--blue-bg) 45%, var(--surface)); border-color: color-mix(in srgb, var(--blue) 30%, var(--line)); }
blockquote { margin: 0; padding: 4px 16px; border-left: 3px solid var(--accent-soft); 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: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; align-items: end; box-shadow: var(--shadow); }
.search-form label { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); font-weight: 600; gap: 4px; }
.search-form .wide { grid-column: 1 / -1; }
.filter-toggle { display: none; }
input, select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .55em .75em; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.count { font-weight: 700; margin: 18px 0 8px; }

/* top */
.hero { margin-top: 20px; padding: 36px 32px 28px; border-radius: 20px; color: #f4f4fb;
  background: radial-gradient(circle at 85% 10%, rgba(201, 149, 63, .35), transparent 45%),
              radial-gradient(circle at 10% 100%, rgba(140, 100, 24, .35), transparent 50%),
              #1b1815; }
.hero h1 { font-size: 2.2rem; margin-top: 0; }
.hero p { color: rgba(244, 244, 251, .85); }
.hero .muted { color: rgba(244, 244, 251, .65); }
.hero-search { display: flex; gap: 8px; max-width: 580px; }
.hero-search input { flex: 1; background: rgba(255, 255, 255, .95); color: #111827; border-color: transparent; }
.hero-search .btn { box-shadow: none; }
/* 検索欄の虫めがね */
input[type=search], .hero-search input[type=search], .hsearch input[type=search] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8fa3' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: .8em 50%; background-size: 1.1em; padding-left: 2.4em; }
.hsearch input[type=search] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d8cfbd' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E"); background-position: 11px 50%; background-size: 15px; padding-left: 32px; }
@media (max-width: 600px) { .hero { padding: 26px 18px 20px; } .hero h1 { font-size: 1.8rem; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px; border-radius: var(--radius); font-weight: 800; font-size: 1.25rem; text-decoration: none; border: 1px solid transparent; transition: transform .15s, box-shadow .15s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: currentColor; }
.tile small { font-size: .8rem; font-weight: 600; color: inherit; opacity: .8; }
.race-list { columns: 3 200px; padding-left: 1.2em; }
.product-list { padding-left: 0; list-style: none; }
.product-list li { margin: 6px 0; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.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: var(--radius); padding: 10px 18px; box-shadow: var(--shadow); }
.toc ol { margin: 0; padding-left: 1.4em; columns: 2 220px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; }
.card-toc { margin: 14px 0 0; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.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); }
.term:target { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.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); }
.guide { max-width: 760px; }
.guide .guide-lead { font-weight: 700; font-size: 1.05rem; padding: 12px 16px; background: var(--accent-soft); border-radius: 12px; }
.guide h3 { margin: 1.6em 0 .4em; padding: 0 0 .2em 8px; border-left: 3px solid var(--accent); border-bottom: 1px solid var(--line); }
.guide ol, .guide ul { padding-left: 1.4em; }
.guide li { margin: 4px 0; }
.guide a { overflow-wrap: anywhere; }

/* tables: keep short cells on one line */
.race-table td { white-space: nowrap; }
.doc table th, .doc table td:not(:last-child) { white-space: nowrap; }

/* phone */
@media (max-width: 600px) {
  html { scroll-padding-top: 0; }
  .site-header { position: static; }
  .site-header .wrap { min-height: 0; padding-top: 10px; padding-bottom: 6px; gap: 2px; }
  .gnav { flex-wrap: nowrap; overflow-x: auto; width: 100%; gap: 2px; scrollbar-width: none; }
  .gnav::-webkit-scrollbar { display: none; }
  .gnav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .gnav::after { content: ""; flex: 0 0 24px; }
  .search-form .filter-toggle { display: block; grid-column: 1 / -1; width: 100%; }
  .search-form:not(.open) > label:not(.wide), .search-form:not(.open) > button[type=reset] { display: none; }
  .gnav a { padding: 4px 10px; font-size: .88rem; white-space: nowrap; }
  .gnav a:first-child { padding-left: 0; }
  .hsearch { flex: 1 1 120px; max-width: none; margin-left: 12px; }
  h1 { font-size: 1.5rem; }
  .card-head { padding: 14px 16px; }
}

/* official Q&A */
.qa { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 14px; }
.qa-cat { margin: 0 0 8px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.qa-q, .qa-a { display: flex; gap: 10px; align-items: flex-start; }
.qa-q { font-weight: 700; margin-bottom: 10px; }
.qa-a { padding-top: 10px; border-top: 1px dashed var(--line); }
.qa-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: #fff; margin-top: 2px; }
.qa-q .qa-mark { background: #2a241e; }
@media (prefers-color-scheme: dark) { .qa-q .qa-mark { background: #5a5045; } }
.qa-a .qa-mark { background: #b5861c; }
.qa-cards { margin: 12px 0 0; font-size: .88rem; color: var(--muted); }
.qa:target { outline: 2px solid var(--accent); outline-offset: 2px; }

/* link to official card image */
.official-img { margin: 10px 0 0; font-size: .9rem; }
.official-img a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 700; }
.official-img a:hover { border-color: var(--accent); }

/* deck pages */
.note { font-size: .9rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent-2); border-radius: var(--radius); padding: 10px 14px; }
.deck-roles { padding-left: 0; list-style: none; }
.deck-roles li { margin: 0 0 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.deck-roles .muted { font-size: .85rem; }
.deck-recipe .deck-group th { text-align: left; background: var(--accent-soft); }
.deck-recipe tfoot th { text-align: left; }
.deck-note { margin-top: 10px; font-weight: 700; }
.deck-list small { color: var(--muted); }
.q-search { margin: 0 0 12px; }
.q-search p { margin: 6px 0 0; min-height: 1.2em; }
.chart { margin: 16px 0; }
.chart img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.chart figcaption { font-size: .8rem; color: var(--muted, #666); margin-top: 4px; }

/* card page: questions fold, decks with this card */
.qa-fold { padding: 0; }
.qa-fold > summary { list-style: none; cursor: pointer; padding: 12px 40px 12px 18px; position: relative; }
.qa-fold > summary::-webkit-details-marker { display: none; }
.qa-fold > summary::after { content: "＋"; position: absolute; right: 16px; top: 12px; color: var(--accent); font-weight: 800; }
.qa-fold[open] > summary::after { content: "－"; }
.qa-fold > summary .qa-q { margin-bottom: 0; }
.qa-fold > .qa-a, .qa-fold > .qa-cards { margin: 0 18px; }
.qa-fold > :last-child { margin-bottom: 14px; }
.qa-fold > summary:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: var(--radius); }
.deck-use small { color: var(--muted); }
.cl-snip { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.cl-snip mark { background: color-mix(in srgb, #b5861c 30%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
#gloss-hint { margin: 8px 0; }
.wins th { width: auto; }
.wins td { width: 4.5em; white-space: nowrap; text-align: right; }

/* 種族ページの表：スマホでは名前・コスト・パワーだけ列にする */
.rt-sub { display: none; }
@media (max-width: 600px) {
  .race-table .rt-wide { display: none; }
  .race-table .rt-sub { display: block; font-size: .8em; color: var(--muted, #777); margin-top: 2px; }
  .race-table { min-width: 0; width: 100%; }
  .race-table td:first-child { white-space: normal; }
}
.about { margin: 4px 0 12px; }
.key-cards .kc-text { font-size: .92rem; margin-top: 4px; }
.key-cards .kc-text p { margin: .15em 0; line-height: 1.6; }
.key-cards .kc-role { font-size: .85rem; margin: .3em 0 0; }
.prod-table .badge.rar { margin-right: 2px; }
@media (max-width: 600px) {
  .race-table td.rt-name { white-space: normal; }
}
.prod-table td.rt-name { width: 100%; }
.prod-table td.num, .prod-table td:last-child { width: 1%; white-space: nowrap; }
@media (max-width: 600px) {
  .prod-table th, .prod-table td { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 600px) {
  .prod-table td:last-child { white-space: normal; }
  .prod-table td:last-child .badge { display: block; width: fit-content; margin: 0 0 2px; }
  .prod-table th, .prod-table td { padding-top: 7px; padding-bottom: 7px; }
  .prod-table .rt-sub { line-height: 1.4; }
}
.nowrap { white-space: nowrap; }

/* デッキ：強み・弱み */
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.pc-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.pc-box .pc-head { font-weight: 700; margin: 0 0 4px; }
.pc-box ul { margin: 0; padding-left: 1.2em; }
.pc-box li { margin: .2em 0; line-height: 1.6; }
.pc-pros { border-left: 4px solid var(--green); }
.pc-cons { border-left: 4px solid var(--red); }
.pc-more { margin: 6px 0 0; font-size: .88rem; }
@media (max-width: 600px) { .pros-cons { grid-template-columns: 1fr; } }
/* デッキ：採用候補を1行ずつ */
.cand-list { list-style: none; padding: 0; margin: 8px 0 16px; border-top: 1px solid var(--line); }
.cand-list li { border-bottom: 1px solid var(--line); }
.cand-list summary { cursor: pointer; padding: 9px 4px; line-height: 1.5; }
.cand-list details p { margin: 0 4px 10px 1.2em; line-height: 1.7; }
/* デッキ：入れ替えの型 */
.swap-table th, .swap-table td { width: 50%; }
.swap-table td { line-height: 1.6; }
