:root {
  color-scheme: dark;
  --night: #0f1419;
  --ground: #161d24;
  --line: #2e3a46;
  --ink: #e8edf2;
  --soft: #9aa8b5;
  --faint: #6b7a88;
  --lamp: #ffd166;
  --display: var(--fy-round);
  --body: var(--fy-body);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--night);
  color: var(--ink);
  font: 15px/1.6 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 48px;
}
.wrap { max-width: 1240px; margin-inline: auto; display: grid; gap: 18px; }
h1 { margin: 0; font: 900 clamp(30px, 5vw, 44px)/1.15 var(--display); letter-spacing: .02em; }
h1 .brand { color: var(--lamp); }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.lead { margin: 6px 0 0; color: var(--soft); max-width: 68ch; text-wrap: pretty; }
.lead a { color: var(--lamp); }
.counts { display: flex; flex-wrap: wrap; gap: 6px 16px; border-block: 1px solid var(--line); padding-block: 10px; font-size: 13px; color: var(--soft); }
.counts b { font: 900 18px/1.2 var(--display); color: var(--ink); margin-right: 3px; }
.filters { display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.row > span { font-size: 12px; color: var(--faint); min-width: 3.4em; }
.row button {
  font: 500 12.5px/1 var(--body); padding: 7px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--soft); cursor: pointer;
}
.row button.on { background: var(--lamp); border-color: var(--lamp); color: #241b05; font-weight: 700; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools input[type=text] { background: var(--ground); border: 1px solid var(--line); color: var(--ink); font: 400 14px/1.4 var(--body); padding: 9px 11px; border-radius: 8px; flex: 1 1 240px; min-width: 0; }
.tools .big { font: 700 14px/1 var(--display); padding: 11px 14px; border-radius: 8px; border: 1px solid var(--lamp); background: var(--lamp); color: #241b05; cursor: pointer; }
.tools label { font-size: 13px; color: var(--soft); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.cell { background: var(--ground); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 8px; text-align: center; cursor: pointer; min-width: 0; font: inherit; color: inherit; }
.cell:hover { border-color: var(--lamp); }
.cell .art { aspect-ratio: 1; display: block; }
.cell .art svg { display: block; width: 100%; height: auto; }
.cell strong { display: block; font: 700 13px/1.3 var(--display); overflow-wrap: anywhere; margin-top: 2px; }
.cell small { display: block; font-size: 11px; color: var(--faint); line-height: 1.3; margin-top: 2px; }
.cell .rare { color: var(--lamp); font-weight: 600; }
body.silhouette .cell .art svg { filter: brightness(0) invert(.86); }
.fold summary { cursor: pointer; font-size: 14px; color: var(--soft); padding-block: 2px; }
.fold[open] summary { margin-bottom: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .cell:hover .fy-float { animation: fy-float 3.4s ease-in-out infinite; }
  .cell:hover .fy-wing { animation: fy-wing .9s ease-in-out infinite; }
  .cell:hover .fy-spin { animation: fy-spin 1.6s linear infinite; }
  .cell:hover .fy-prop { animation: fy-spin .5s linear infinite; }
  .cell:hover .fy-slow { animation: fy-spin 9s linear infinite; }
  .cell:hover .fy-blink { animation: fy-blink 4.6s linear infinite; }
}
.more { justify-self: center; font: 700 14px/1 var(--display); padding: 12px 18px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
footer { color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); padding-top: 12px; min-width: 0; }
footer p { margin: 0 0 4px; max-width: 74ch; }
.odds h2 { margin: 14px 0 6px; font: 700 15px/1.3 var(--display); color: var(--soft); }
.odds-wrap { overflow-x: auto; margin-bottom: 6px; }
.odds table { border-collapse: collapse; font-size: 12.5px; }
.odds th, .odds td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-weight: 400; }
.odds thead th, .odds tbody th { color: var(--soft); }
.odds td { font-variant-numeric: tabular-nums; }
.empty { color: var(--soft); }
/* めずらしさの上 2 段。まぼろしは薄紫、超伝説は虹色（DESIGN.md 2.19） */
.cell .rare.rare-phantom { color: #c9b8ff; }
.cell .rare.rare-legend { background: linear-gradient(120deg, #ffd166, #ff8fd8, #9be7ff); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.odds tr.rare-phantom th { color: #c9b8ff; }
.odds tr.rare-legend th, .odds tr.rare-legend td { color: #ffd6f2; font-weight: 700; }
#rareTraits li.rare-phantom b { color: #c9b8ff; }
#rareTraits li.rare-legend b { background: linear-gradient(120deg, #ffd166, #ff8fd8, #9be7ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
