/*
 * Dimension Gate — カード検索データベース
 * 色は「文明」を表すときだけ使う。それ以外は無彩色で、情報の読みやすさを優先する。
 */

:root {
  --bg: #edeff2;
  --surface: #ffffff;
  --sunken: #f5f6f8;
  --ink: #1f232a;
  --text: #333a45;
  --muted: #5f6774;
  --faint: #868d98;
  --line: #d9dde3;
  --line-soft: #e8ebef;
  --line-strong: #b3bac4;
  --focus: #2563c9;
  --danger: #b4372b;

  /* 文明 */
  --c-light: #d8ac0c;
  --c-water: #2068c3;
  --c-dark: #463f55;
  --c-fire: #c9392d;
  --c-nature: #2e8746;
  --c-zero: #8e949d;

  --font: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", Meiryo, sans-serif;
  --radius: 6px;
  --page: 1240px;

  color-scheme: light;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
main { flex: 1; width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 24px 64px; }
h1, h2, h3, p, ul { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

select {
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  /* 画像は CSP で禁止しているので、矢印はグラデーションで描く */
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  font-size: 13px;
}
select:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- ヘッダー ---------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: var(--page);
  height: 56px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { display: inline-flex; gap: 2px; }
.brand-mark i { display: block; width: 4px; height: 20px; border-radius: 1px; }
.brand-mark i:nth-child(1) { background: var(--c-light); }
.brand-mark i:nth-child(2) { background: var(--c-water); }
.brand-mark i:nth-child(3) { background: var(--c-dark); }
.brand-mark i:nth-child(4) { background: var(--c-fire); }
.brand-mark i:nth-child(5) { background: var(--c-nature); }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .01em; }

.site-nav { display: flex; height: 100%; padding-left: 20px; border-left: 1px solid var(--line); }
.site-nav a:first-child { padding-left: 8px; }
.site-nav a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }

/* ---------- 名前検索 ---------- */

.search-area { max-width: 760px; padding-top: 28px; }
.home .search-area { margin: 0 auto; max-width: 720px; padding-top: min(10vh, 88px); }
.advanced-link { margin-top: 18px; font-size: 13px; color: var(--muted); }
.advanced-link a { color: var(--ink); font-weight: 700; text-underline-offset: 3px; }
main:not(.home) .advanced-link { display: none; }

/* 今日の1枚 */
.today { max-width: 720px; margin: 56px auto 0; }
main:not(.home) .today { display: none; }
.today-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.today-head h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
#today-date { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
#today-card .card-button { width: 100%; }
.search-title { font-size: 26px; font-weight: 700; color: var(--ink); margin-bottom: 16px; }
main:not(.home) .search-title { display: none; }

#search { position: relative; }
.search-box {
  display: flex;
  height: 52px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.search-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
main:not(.home) .search-box { height: 44px; }
#query { flex: 1; min-width: 0; border: 0; padding: 0 16px; font-size: 17px; background: transparent; outline: none; color: var(--ink); }
#query::placeholder { color: var(--faint); }
#query::-webkit-search-cancel-button { cursor: pointer; }
#submit {
  flex-shrink: 0;
  padding: 0 24px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
#submit:disabled { background: var(--faint); }

#suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  list-style: none;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(20 26 36 / .14);
}
#suggestions button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 4px;
  background: none;
  text-align: left;
  font-size: 15px;
  color: var(--ink);
}
#suggestions button:hover, #suggestions button.selected { background: var(--sunken); }
#suggestions .suggest-reading { display: block; font-size: 12px; color: var(--faint); }

.hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
main:not(.home) .hint { display: none; }

.civ-shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 36px; }
main:not(.home) .civ-shortcuts { display: none; }
.civ-shortcuts > span { font-size: 13px; color: var(--muted); margin-right: 4px; }
.civ-shortcuts a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
.civ-shortcuts a:hover { border-color: var(--line-strong); }
.civ-shortcuts a::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--civ); box-shadow: 0 0 0 1px rgb(0 0 0 / .25); }

/* ---------- 文明の色（ボタン・ジェム共通） ---------- */

[data-civ="光"] { --civ: var(--c-light); --on-civ: var(--ink); }
[data-civ="水"] { --civ: var(--c-water); --on-civ: #fff; }
[data-civ="闇"] { --civ: var(--c-dark); --on-civ: #fff; }
[data-civ="火"] { --civ: var(--c-fire); --on-civ: #fff; }
[data-civ="自然"] { --civ: var(--c-nature); --on-civ: #fff; }
[data-civ="ゼロ文明"] { --civ: var(--c-zero); --on-civ: #fff; }

/* コストのジェム：丸に白い数字（黒の縁取り）。多色の塗り分けは results.js の gem() */
.gem {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #15171c;
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .35);
  background: var(--gem, var(--c-zero));
  color: #fff;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
  text-indent: -.06em;
  text-shadow:
    1.5px 0 #15171c, -1.5px 0 #15171c, 0 1.5px #15171c, 0 -1.5px #15171c,
    1.1px 1.1px #15171c, -1.1px -1.1px #15171c, 1.1px -1.1px #15171c, -1.1px 1.1px #15171c;
  flex-shrink: 0;
}
.gem.long { font-size: 19px; }

/* ---------- 検索結果の見出し・操作 ---------- */

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 28px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.results-title h1 { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.4; }
#count { margin-top: 2px; font-size: 13px; color: var(--muted); }
.results-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.tool-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.view-toggle button { height: 34px; padding: 0 14px; border: 0; background: var(--surface); font-size: 13px; color: var(--muted); }
.view-toggle button + button { border-left: 1px solid var(--line-strong); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }

#list-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.pager .page-range { margin-right: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pager button:disabled { color: var(--faint); border-color: var(--line); }
.pager button[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
#pager-bottom { margin-top: 16px; justify-content: flex-end; }

/* ---------- カード表示 ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; align-items: stretch; }

.card-button {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-button:hover { border-color: var(--line-strong); }
.card-button:hover .card-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.part { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 14px 16px 12px 14px; }
.part + .part { border-top: 1px dashed var(--line); }
.part-body { min-width: 0; }
.card-name { display: block; font-size: 16px; font-weight: 700; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.card-reading { display: block; margin-top: 1px; font-size: 11.5px; line-height: 1.5; color: var(--faint); overflow-wrap: anywhere; }
.detail-head .card-reading { margin-top: 2px; font-size: 13px; }
.part-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin-top: 3px; font-size: 13px; font-weight: 700; color: var(--text); }
.part-meta span:not(:last-child)::after { content: ""; display: inline-block; width: 1px; height: .85em; margin: 0 8px; background: var(--line-strong); vertical-align: -1px; }
.part-race { margin-top: 1px; font-size: 12.5px; color: var(--faint); overflow-wrap: anywhere; }
.ability-preview { margin-top: 8px; font-size: 13.5px; line-height: 1.75; color: var(--text); overflow-wrap: anywhere; }
.ability-preview.empty { color: var(--faint); }

.card-foot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 10px 16px 12px 14px;
  border-top: 1px solid var(--line-soft);
}
.release-date { font-size: 12px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* タグ */
.tag-strip { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.tag-chip {
  display: inline-block;
  max-width: 100%;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--sunken);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-ability { background: #eef3fa; border-color: #cdd9ea; color: #27466f; }
.tag-format { background: var(--surface); border-color: var(--ink); color: var(--ink); font-weight: 700; }
.tag-civil { background: var(--surface); }
.tag-more { background: none; border-style: dashed; color: var(--muted); }

/* ---------- リスト表示（表のように1行1枚） ---------- */

.list { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list .card-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.list .card-button:last-child { border-bottom: 0; }
.list .card-button:hover { background: #fafbfc; }
.list .part { grid-column: 1; grid-template-columns: 40px minmax(160px, 260px) minmax(0, 1fr); gap: 14px; padding: 12px 14px; }
.list .gem { width: 40px; height: 40px; font-size: 25px; }
.list .ability-preview { grid-column: 3; grid-row: 1; margin-top: 0; font-size: 13px; }
.list .card-foot {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-items: flex-start;
  margin: 0;
  padding: 12px 14px;
  border-top: 0;
  border-left: 1px solid var(--line-soft);
}

/* ---------- その他の結果表示 ---------- */

#empty { padding: 40px 0; }
#empty h2 { font-size: 17px; color: var(--ink); }
#empty p { margin-top: 6px; color: var(--muted); }

.more {
  display: block;
  width: 100%;
  max-width: 360px;
  height: 44px;
  margin: 20px auto 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.more:hover { border-color: var(--ink); }

/* ---------- 詳細ダイアログ ---------- */

dialog {
  width: min(760px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 48px rgb(15 20 30 / .25);
}
dialog::backdrop { background: rgb(20 24 31 / .5); }
.close {
  position: sticky;
  float: right;
  top: 12px;
  margin: 12px 12px 0 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
}
.close:hover { color: var(--ink); border-color: var(--line-strong); }
#detail-body { padding: 24px 28px 28px; }
.detail-head h2 { font-size: 22px; font-weight: 700; line-height: 1.45; color: var(--ink); padding-right: 40px; overflow-wrap: anywhere; }
.detail-head .release-date { display: block; margin-top: 4px; font-size: 13px; }
.detail-head .tag-strip { margin-top: 10px; }
.detail-part { padding: 20px 0 4px; border-top: 1px solid var(--line-soft); margin-top: 18px; }
.detail-part-head { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; }
.detail-part-head h3 { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.45; }
.detail-part .part-meta { font-size: 13px; }
.detail-part .part-race { margin-top: 12px; font-size: 13px; color: var(--muted); }
.detail-part .tag-strip { margin-top: 8px; }
.ability-list { list-style: none; padding: 0; margin-top: 14px; }
.ability-list li { padding: 2px 0 2px 12px; margin-bottom: 10px; border-left: 3px solid var(--line); font-size: 14.5px; line-height: 1.8; overflow-wrap: anywhere; }
.ability-list .empty { border-left-color: transparent; padding-left: 0; color: var(--faint); }
.official-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  margin-top: 22px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}
.official-link:hover { background: var(--ink); color: #fff; }

/* ---------- 詳細検索 ---------- */

#advanced { max-width: 980px; padding-top: 28px; }
.advanced-title { font-size: 24px; font-weight: 700; color: var(--ink); }
.advanced-lead { margin: 6px 0 18px; font-size: 13.5px; color: var(--muted); }

.filter-panel { padding: 18px 20px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.filter-heading strong { font-size: 15px; color: var(--ink); }
#filter-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.filter-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 40px 56px; gap: 8px; margin-bottom: 8px; align-items: start; }
.filter-row > select, .filter-value select, .filter-value input { height: 40px; font-size: 14px; }
.filter-row > select { width: 100%; }
.filter-value { position: relative; display: flex; gap: 8px; min-width: 0; }
.filter-value input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}
.filter-value input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.filter-value .number-op { width: 96px; flex-shrink: 0; }
.filter-value > select:only-child { width: 100%; }
.remove-filter, .condition-toggle {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
}
.remove-filter { font-size: 18px; line-height: 1; }
.remove-filter:hover { color: var(--ink); border-color: var(--line-strong); }
.condition-toggle { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.condition-toggle[aria-pressed="true"] { background: #fbeceb; border-color: #e3b3ae; color: var(--danger); }

.filter-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(20 26 36 / .14);
}
.filter-suggestions button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 4px; background: none; text-align: left; font-size: 14px; }
.filter-suggestions button:hover, .filter-suggestions [aria-selected="true"] button { background: var(--sunken); }

.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.filter-actions button { height: 36px; padding: 0 14px; border-radius: 4px; font-size: 13px; }
#add-filter { border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font-weight: 700; }
#add-filter:disabled { border-color: var(--line); color: var(--faint); }
#clear-filters { border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.filter-help { margin-top: 14px; font-size: 12.5px; line-height: 1.8; color: var(--muted); }
#filter-error { margin-top: 8px; font-size: 13px; color: var(--danger); }
#filter-error:empty { display: none; }

/* 文明の3段階ボタン */
.civil-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; width: 100%; padding: 10px 12px; background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; }
.civ-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.civ-button {
  position: relative;
  height: 36px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text);
}
.civ-button::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--civ); vertical-align: 1px; }
.civ-button[data-state="include"] { background: var(--civ); border-color: var(--civ); color: var(--on-civ); font-weight: 700; }
.civ-button[data-state="include"]::before { display: none; }
.civ-button[data-state="exclude"] {
  border-color: var(--civ);
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--civ) 22%, #fff) 0 3px, #fff 3px 7px);
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.civ-button[data-state="exclude"]::before { display: none; }
.civ-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; }
.civ-mode { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; background: var(--surface); }
.civ-mode label { position: relative; }
.civ-mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.civ-mode span { display: block; height: 32px; padding: 0 12px; line-height: 32px; color: var(--muted); }
.civ-mode label + label span { border-left: 1px solid var(--line-strong); }
.civ-mode input:checked + span { background: var(--ink); color: #fff; font-weight: 700; }
.civ-mode input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.civ-mode input:disabled + span { opacity: .45; }
.civ-only { display: inline-flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.civ-only input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.civ-only:has(input:disabled) { opacity: .45; cursor: default; }
.civ-info {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
}
.civ-info:hover, .civ-info[aria-expanded="true"] { color: #fff; background: var(--ink); border-color: var(--ink); }

.civ-legend {
  width: min(380px, calc(100vw - 24px));
  margin: 0;
  inset: auto;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgb(15 20 30 / .2);
  font-size: 13px;
  line-height: 1.7;
}
.civ-legend h2 { font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.civ-legend dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; align-items: center; }
.civ-legend dt { margin: 0; }
.civ-legend dd { margin: 0; }
.civ-legend .civ-button { height: 28px; min-width: 0; font-size: 12px; pointer-events: none; }
.civ-legend h3 { font-size: 13px; color: var(--ink); margin: 14px 0 6px; }
.civ-legend ul { padding-left: 1.2em; }
.civ-legend li { margin-bottom: 2px; }

/* ---------- フッター ---------- */

.site-footer { border-top: 1px solid var(--line); }
.site-footer p { max-width: var(--page); margin: 0 auto; padding: 16px 24px; font-size: 12px; color: var(--faint); }

/* ---------- 狭い画面 ---------- */

@media (max-width: 860px) {
  .list .card-button { grid-template-columns: minmax(0, 1fr); }
  .list .part { grid-template-columns: 40px minmax(0, 1fr); }
  .list .ability-preview { grid-column: 2; grid-row: auto; margin-top: 6px; }
  .list .card-foot { grid-column: 1; grid-row: auto; border-left: 0; border-top: 1px solid var(--line-soft); }
  .filter-row { grid-template-columns: minmax(0, 1fr) 40px 56px; }
  .filter-row .filter-value { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 600px) {
  main { padding: 0 14px 48px; }
  .header-inner { padding: 0 14px; }
  .brand-name { font-size: 15px; }
  .site-nav a { padding: 0 10px; font-size: 13px; }
  .home .search-area { padding-top: 36px; }
  .header-inner { gap: 14px; }
  .site-nav { padding-left: 8px; }
  .today { margin-top: 40px; }
  .search-title, .advanced-title { font-size: 21px; }
  #query { font-size: 16px; padding: 0 12px; }
  #submit { padding: 0 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .results-head { margin-top: 20px; }
  .filter-panel { padding: 14px; }
  .civil-filter { padding: 10px; }
  #detail-body { padding: 18px 18px 22px; }
  .detail-head h2 { font-size: 19px; }
}


/* 通常時とハイパーモード：共通の能力は一度だけ表示する */
.mode-label { font-size: 12px; font-weight: 700; color: var(--ink); }
.mode-text { margin: 3px 0 0; }
.hyper-mode { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.mode-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.mode-power { font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.mode-note { display: block; margin: 3px 0; font-size: 11px; color: var(--muted); }
.detail-hyper-mode { padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.detail-hyper-mode .mode-heading h3 { font-size: 16px; }
.detail-hyper-mode .mode-power { font-size: 14px; }
