:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #667085;
  --line: #dfe3ea;
  --row: #f1f3f7;
  --link: #1d5fbf;
  --accent: #d6392c;
  --header: #25304a;
  --header-text: #ffffff;
  --quirk-bg: #fff4d6;
  --quirk-line: #e0a100;
  --diff: #ffd84d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --surface: #1c2029;
    --text: #e6e9ef;
    --muted: #9aa4b5;
    --line: #2e3442;
    --row: #232835;
    --link: #7fb2ff;
    --accent: #ff6b5e;
    --header: #0f1218;
    --header-text: #e6e9ef;
    --quirk-bg: #3a3013;
    --quirk-line: #d39e00;
    --diff: #d39e00;
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 1.2rem 0 0.8rem; }
h2 { font-size: 1.2rem; margin: 1.8rem 0 0.6rem; }
p { margin: 0.5rem 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); }

/* header and footer */
.site-header { background: var(--header); color: var(--header-text); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding-top: 8px; padding-bottom: 8px; }
.brand { color: var(--header-text); font-weight: 700; font-size: 1.05rem; }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a { color: var(--header-text); padding: 6px 12px; border-radius: 6px; opacity: 0.8; }
#nav a:hover { text-decoration: none; opacity: 1; }
#nav a.active { background: rgba(255, 255, 255, 0.16); opacity: 1; }
.site-footer { margin-top: 48px; padding: 20px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

/* filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 12px; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.count { color: var(--muted); margin-left: auto; }
input, select, button.button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
}
input[type="number"] { width: 6.5em; }
a.button, button.button { display: inline-block; cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }

/* tables */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.data { border-collapse: collapse; width: 100%; }
table.data th, table.data td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--row); }
table.data th { background: var(--row); font-weight: 600; font-size: 0.9rem; }
table.data th button { all: unset; cursor: pointer; }
table.data th.sorted { color: var(--accent); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .total { font-weight: 700; }
table.data .name { font-weight: 600; }
table.data .icon { width: 56px; padding: 0 4px; }
table.data .wrap-cell { white-space: normal; min-width: 260px; }
/* The 96px sprites carry wide transparent margins, so they overlap the row padding. */
.sprite { display: block; width: 60px; height: 60px; margin: -9px auto; image-rendering: pixelated; }

/* type badges */
.type {
  display: inline-block; min-width: 68px; padding: 1px 8px; border-radius: 4px; text-align: center;
  color: #fff; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}
.type-normal { background: #9a9966; } .type-fire { background: #e8712a; } .type-water { background: #4f7fe8; }
.type-electric { background: #d8ae10; } .type-grass { background: #5fae3c; } .type-ice { background: #5fbfbb; }
.type-fighting { background: #c22e28; } .type-poison { background: #a33ea1; } .type-ground { background: #c9a246; }
.type-flying { background: #9079e0; } .type-psychic { background: #ef4479; } .type-bug { background: #94a516; }
.type-rock { background: #a8942e; } .type-ghost { background: #735797; } .type-dragon { background: #6f35fc; }

/* move category symbols */
.cat { display: inline-block; vertical-align: middle; line-height: 0; }
.cat svg { display: block; width: 30px; height: 20px; }
.cat rect { fill: var(--cat); }
.cat .fill { fill: var(--glyph); }
.cat .line { fill: none; stroke: var(--glyph); stroke-width: 1.6; }
.cat-physical { --cat: #d6532b; --glyph: #ffe27a; }
.cat-special { --cat: #3f62b8; --glyph: #dfe8ff; }
.cat-status { --cat: #8b919c; --glyph: #ffffff; }

.tag-quirk {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 0.72rem; font-weight: 600;
  background: var(--quirk-bg); border: 1px solid var(--quirk-line); color: var(--text); vertical-align: middle;
}
.quirk { background: var(--quirk-bg); border-left: 4px solid var(--quirk-line); border-radius: 4px; padding: 8px 12px; margin: 10px 0; }

/* Red/Blue ↔ Yellow toggle, above move tables that differ between the versions */
.version-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 1.8rem; }
.version-toggle + h2 { margin-top: 0.8rem; }
.version-switch { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.version-switch button { background: transparent; color: var(--text); border: 0; padding: 4px 12px; font: inherit; cursor: pointer; }
.version-switch button.active { background: var(--link); color: var(--surface); font-weight: 600; }
.version-toggle .swatch { display: inline-block; width: 22px; margin-right: 6px; border-radius: 4px; border: 1px solid var(--quirk-line); }
table.data tbody tr.differs, .version-toggle .swatch { background: var(--quirk-bg); }

/* Pokémon and move pages */
.pager { display: flex; justify-content: space-between; margin-top: 12px; color: var(--muted); }
.dexno { color: var(--muted); font-weight: 400; }
.summary { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: 24px; align-items: start; }
.art { width: 100%; height: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.panel.narrow { max-width: 420px; }
table.facts { border-collapse: collapse; width: 100%; }
table.facts th, table.facts td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.facts tr:last-child th, table.facts tr:last-child td { border-bottom: 0; }
table.facts th { width: 9.5em; color: var(--muted); font-weight: 500; }

table.stats { border-collapse: collapse; width: 100%; max-width: 640px; }
table.stats th { text-align: left; color: var(--muted); font-weight: 500; width: 5.5em; padding: 3px 8px 3px 0; }
table.stats td { padding: 3px 8px; }
table.stats td.num { text-align: right; width: 3.2em; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { height: 12px; border-radius: 4px; min-width: 2px; }
.bar-1 { background: #f34444; } .bar-2 { background: #ff7f0f; } .bar-3 { background: #ffdd57; }
.bar-4 { background: #a0e515; } .bar-5 { background: #23cd5e; } .bar-6 { background: #00c2b8; }

.defenses { display: flex; flex-wrap: wrap; gap: 6px; }
.defense { text-align: center; }
.defense .type { min-width: 62px; display: block; }
.mult { display: block; margin-top: 2px; border-radius: 4px; font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid var(--line); }
.mult-0 { background: #2d2d2d; color: #fff; } .mult-quarter { background: #7c0000; color: #fff; }
.mult-half { background: #a40000; color: #fff; } .mult-1 { color: var(--muted); font-weight: 400; }
.mult-2 { background: #4e9a06; color: #fff; } .mult-4 { background: #73d216; color: #000; }

.evo { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.evo-branches { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.evo-branch { display: flex; align-items: center; gap: 6px; }
.evo-how { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.evo-mon { display: flex; flex-direction: column; align-items: center; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.evo-mon.current { border-color: var(--accent); font-weight: 600; }
.evo-mon .sprite { margin: -4px 0; }

/* type chart */
table.chart { border-collapse: collapse; background: var(--surface); }
table.chart th, table.chart td { border: 1px solid var(--line); width: 38px; height: 34px; text-align: center; padding: 0; font-weight: 700; }
table.chart th .type { min-width: 0; width: 100%; padding: 1px 2px; font-size: 0.7rem; border-radius: 0; }
table.chart th.side .type { width: 70px; }
table.chart th.corner { font-size: 0.7rem; font-weight: 500; line-height: 1.2; white-space: nowrap; padding: 2px 4px; }
table.chart td.diff { outline: 3px solid var(--diff); outline-offset: -3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0; color: var(--muted); }
.legend span.swatch { display: inline-block; width: 22px; text-align: center; border-radius: 4px; margin-right: 4px; font-weight: 700; }
.swatch.diff { outline: 3px solid var(--diff); outline-offset: -3px; }

.chart-box, .calc-box { display: inline-block; max-width: 100%; }
.changes { padding-left: 1.2rem; }
.changes li { margin: 6px 0; }
table.facts.panel-table { max-width: 720px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }

/* calculator */
table.calc { border-collapse: collapse; }
table.calc th, table.calc td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--line); }
table.calc td.result { font-weight: 700; font-size: 1.1rem; text-align: right; font-variant-numeric: tabular-nums; }
.calc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

@media (max-width: 700px) {
  .summary { grid-template-columns: 1fr; }
  .art { max-width: 260px; }
}
