:root {
  color-scheme: dark;
  --background: #171d2b;
  --surface: #212a3b;
  --surface-deep: #192232;
  --field: #192333;
  --ink: #f1f5fb;
  --soft: #b3c1d5;
  --line: #39475d;
  --accent: #f9bf77;
  --accent-hover: #ffcf93;
  --lead: #a2f0d6;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 100%;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 8% 0%, #28354d 0%, transparent 44rem),
    radial-gradient(ellipse at 97% 6%, #302d48 0%, transparent 33rem),
    var(--background);
}
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:where(button, select, input, summary, a):focus-visible { outline: 3px solid #ffd49b; outline-offset: 3px; }
a { color: #d3dcf1; text-underline-offset: .2em; }
.wrap { width: min(100% - 3.5rem, 85rem); margin-inline: auto; }

.masthead { border-bottom: 1px solid #46516b; background: #1b2332dd; }
.masthead-inner {
  min-height: 4.15rem;
  display: flex;
  align-items: center;
  gap: clamp(.62rem, 1.6vw, 1.45rem);
  padding-block: .5rem;
}
.brand { display: flex; align-items: center; min-width: 0; gap: .55rem; color: var(--ink); text-decoration: none; }
.brand-copy { display: grid; gap: .16rem; min-width: 0; }
.brand-title { margin: 0; font-size: clamp(.98rem, 2vw, 1.28rem); font-weight: 740; letter-spacing: -.03em; line-height: 1.1; }
.brand-title strong { color: #f6d298; font-weight: inherit; }
.brand-credit { margin: 0; color: var(--soft); font-size: .76rem; font-weight: 510; line-height: 1.15; }
.brand-credit strong { color: #dce9ef; font-weight: 690; }
.site-nav { display: flex; align-items: center; gap: .3rem; flex: none; margin-inline-start: auto; }
.nav-link {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.4rem;
  padding: .32rem .65rem; border: 1px solid transparent; border-radius: .45rem;
  color: var(--soft); font-size: .875rem; font-weight: 650; text-decoration: none;
}
a.nav-link:hover { color: var(--ink); background: #2a364a; }
.nav-link[aria-current="page"] { color: var(--ink); background: #2a364a; border-color: #3a4a64; }
.catalog-link { color: #ffcf96; }
.catalog-count {
  padding: .07rem .31rem; border-radius: .25rem; background: #3d342e;
  color: #ffd097; font-size: .78rem; font-variant-numeric: tabular-nums;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.4rem;
  padding-block: 1.12rem .92rem;
}
h1 {
  margin: 0;
  font-size: clamp(1.62rem, 2.55vw, 2.24rem);
  line-height: 1.12;
  letter-spacing: -.04em;
  font-weight: 760;
}
.heading p { margin: .27rem 0 0; color: var(--soft); line-height: 1.45; max-width: 42rem; font-size: .875rem; }
.heading p:empty { display: none; }
.primary, #retry {
  border: 1px solid #ffd196;
  border-radius: .68rem;
  background: var(--accent);
  color: #2d2218;
  font-weight: 760;
  padding: .65rem .95rem;
  white-space: nowrap;
  min-height: 2.75rem;
  box-shadow: 0 .22rem .95rem #15192566;
  transition: background-color .18s ease, transform .18s ease;
}
.primary:not(:disabled):hover, #retry:hover { background: var(--accent-hover); transform: translateY(-2px); }
.primary span[aria-hidden="true"] { margin-right: .24rem; font-size: 1.13em; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1.2rem; }
:where(.card, .move, .compact-pokemon, .catalog-portrait, .species-detail-hero) { --type-rgb: 151 173 214; }
.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: 0 .62rem 2rem #10182766;
  animation: card-enter .48s both;
}
.card:nth-child(even) { animation-delay: .075s; }
.reference-card {
  border-color: rgb(var(--type-rgb) / .7);
  box-shadow: 0 .62rem 2rem #10182766, 0 0 0 1px rgb(var(--type-rgb) / .3);
}
:where(.card, .species-detail-hero) { --scene: url("./assets/cenarios/rocha.webp"); }
:is(.card, .species-detail-hero)[data-type="electric"] { --scene: url("./assets/cenarios/eletrico.webp"); }
:is(.card, .species-detail-hero)[data-type="fire"] { --scene: url("./assets/cenarios/fogo.webp"); }
:is(.card, .species-detail-hero):is([data-type="water"], [data-type="ice"]) {
  --scene: url("./assets/cenarios/agua.webp");
}
:is(.card, .species-detail-hero):is([data-type="grass"], [data-type="bug"]) {
  --scene: url("./assets/cenarios/floresta.webp");
}
:is(.card, .species-detail-hero):is([data-type="psychic"], [data-type="ghost"], [data-type="dark"], [data-type="poison"], [data-type="fairy"], [data-type="dragon"]) {
  --scene: url("./assets/cenarios/astral.webp");
}
.card-heading, .species-detail-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.card-heading {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 78% 64%, rgb(var(--type-rgb) / .32), transparent 61%),
    #233047;
}
.card-scenery, .species-detail-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--scene) center 55% / cover no-repeat;
}
.card-heading::after, .species-detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #151f31 0%, #172136ed 22%, #17213675 52%, #17213618 80%),
    linear-gradient(0deg, #111b2dcc, transparent 34%),
    radial-gradient(ellipse at 76% 57%, rgb(var(--type-rgb) / .25), transparent 50%);
}
.profile-copy { position: relative; z-index: 1; max-width: 62%; min-width: 0; }
.card-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3.4vw, 3.05rem);
  line-height: 1;
  letter-spacing: -.046em;
  overflow-wrap: anywhere;
  text-shadow: 0 3px 14px #111927;
}
.profile-badges { position: absolute; bottom: 100%; display: flex; gap: .38rem; flex-wrap: wrap; width: max-content; max-width: 100%; }
.shiny-label, .reference-label {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  margin: 0 0 .45rem;
  padding: .16rem .43rem;
  border: 1px solid rgb(var(--type-rgb) / .42);
  border-radius: .36rem;
  background: #1e2a3de0;
  color: rgb(var(--type-rgb));
  font-size: .8rem;
  font-weight: 720;
}
.shiny-label { color: #ffdfaa; }
.shiny-label span { display: inline-block; animation: shine 1.6s ease-in-out 2; }
.types { display: flex; flex-wrap: wrap; gap: .36rem; margin-top: .64rem; }
.type {
  display: inline-block;
  padding: .19rem .55rem;
  border: 1px solid rgb(var(--type-rgb) / .43);
  border-radius: 9rem;
  background: #202c3c;
  color: rgb(var(--type-rgb));
  font-size: .84rem;
  font-weight: 680;
}
:is([data-type="electric"], .type-electric) { --type-rgb: 251 209 105; }
:is([data-type="fire"], .type-fire) { --type-rgb: 255 155 118; }
:is([data-type="flying"], .type-flying) { --type-rgb: 191 185 252; }
:is([data-type="water"], .type-water) { --type-rgb: 132 196 255; }
:is([data-type="ice"], .type-ice) { --type-rgb: 145 230 243; }
:is([data-type="grass"], .type-grass) { --type-rgb: 158 223 145; }
:is([data-type="bug"], .type-bug) { --type-rgb: 197 216 134; }
:is([data-type="poison"], .type-poison) { --type-rgb: 225 157 237; }
:is([data-type="psychic"], .type-psychic) { --type-rgb: 247 159 196; }
:is([data-type="fairy"], .type-fairy) { --type-rgb: 248 177 228; }
:is([data-type="ground"], .type-ground) { --type-rgb: 222 180 133; }
:is([data-type="rock"], .type-rock) { --type-rgb: 220 199 145; }
:is([data-type="fighting"], .type-fighting) { --type-rgb: 243 161 155; }
:is([data-type="steel"], .type-steel) { --type-rgb: 164 209 223; }
:is([data-type="ghost"], .type-ghost) { --type-rgb: 190 164 252; }
:is([data-type="dragon"], .type-dragon) { --type-rgb: 174 173 253; }
:is([data-type="dark"], .type-dark) { --type-rgb: 187 176 201; }
:is([data-type="normal"], [data-type="neutral"], .type-normal, .type-neutral) { --type-rgb: 211 213 228; }
.portrait {
  width: min(48%, 17rem);
  height: 100%;
  position: absolute;
  right: 2.55rem;
  bottom: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.portrait-light {
  position: absolute;
  bottom: 6%;
  width: 87%;
  height: 29%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgb(var(--type-rgb) / .5), rgb(var(--type-rgb) / .19) 30%, transparent 70%);
  opacity: .78;
  transform: scale(.93);
  transition: opacity .4s ease, transform .6s ease;
}
.card-heading:focus-within .portrait-light {
  opacity: 1;
  transform: scale(1.12);
}
@media (hover: hover) {
  .card-heading:hover .portrait-light {
    opacity: 1;
    transform: scale(1.12);
  }
}
.portrait-fallback { color: rgb(var(--type-rgb) / .5); font-size: 4.25rem; font-weight: 780; transition: opacity .24s; }
.image-ready .portrait-fallback { opacity: 0; }
.artwork {
  position: absolute;
  inset: -.22rem 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(.93);
  transition: opacity .35s ease, transform .35s ease;
}
.image-ready .artwork { opacity: 1; transform: scale(1); }
.pokemon-art {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 11.35rem;
  object-fit: contain;
  filter: drop-shadow(0 .55rem .45rem #111829b5);
  user-select: none;
}
.image-ready .pokemon-art { animation: portrait-arrival .8s cubic-bezier(.25, .7, .35, 1) both; }
.card[data-shiny="true"] .image-ready .pokemon-art { animation-duration: 1.05s; }
.card[data-shiny="true"] .pokemon-art { filter: drop-shadow(0 .55rem .43rem #101624d9) drop-shadow(0 0 .4rem #ffb69448); }
.quiet {
  position: absolute;
  top: .74rem;
  right: .72rem;
  z-index: 2;
  background: #1c2637e8;
  color: var(--soft);
  border: 1px solid #56627a;
  border-radius: .53rem;
  min-height: 2.15rem;
  padding: .28rem .57rem;
  font-size: .875rem;
  transition: color .18s, border-color .18s;
}
.quiet:not(:disabled):hover { color: #ffddbb; border-color: #d5a78b; }

form { padding: 1rem 1.25rem 1.1rem; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) 5.15rem 6.15rem; gap: .7rem; }
.field { display: grid; gap: .31rem; align-content: start; color: var(--soft); font-size: .875rem; }
.field select, .field input, .species-picker {
  min-width: 0;
  width: 100%;
  height: 2.55rem;
  padding: .42rem .57rem;
  color: var(--ink);
  border: 1px solid #495971;
  border-radius: .47rem;
  background-color: var(--field);
  font-weight: 550;
  transition: border-color .16s, background-color .16s;
}
.field select:hover, .field input:hover, .species-picker:hover { border-color: #8393ac; }
.field select {
  appearance: none;
  padding-right: 1.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23b3c1d5' stroke-width='1.5'/%3E%3C/svg%3E");
  background-position: right .5rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
}
.species-field { grid-column: 1; }
.fields label:has([name="nature"]) { grid-column: 1 / 3; grid-row: 2; }
.toggle {
  grid-column: 3;
  grid-row: 2;
  align-self: end;
  display: flex;
  align-items: center;
  gap: .42rem;
  min-height: 2.55rem;
  padding: .35rem .5rem;
  border: 1px solid #495971;
  border-radius: .47rem;
  white-space: nowrap;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}
.toggle:hover { border-color: #8393ac; }
.toggle:has(input:checked) { background: #46342c; border-color: #bc885d; }
.toggle input { margin: 0; width: 1rem; height: 1rem; flex: 0 0 auto; accent-color: var(--accent); }
.shiny-mult { color: #f9cb8f; font-weight: 690; }
fieldset { margin: .85rem 0 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .35rem; font-size: .875rem; font-weight: 700; color: var(--ink); }
.iv-total { color: var(--soft); margin-left: .28rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.iv-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .45rem; }
.iv-field {
  display: grid;
  min-width: 0;
  gap: .05rem;
  padding: .35rem .44rem .22rem;
  border: 1px solid var(--line);
  border-radius: .48rem;
  background: var(--field);
}
.iv-field:focus-within { border-color: #8edce2; }
.iv-caption { display: flex; align-items: center; justify-content: space-between; gap: .2rem; color: var(--soft); font-size: .74rem; }
.iv-readout {
  min-width: 2ch;
  color: #d3f5f5;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.iv-slider {
  --track: linear-gradient(to right, #7ce2de var(--iv-fill), #405770 var(--iv-fill));
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  height: 1.95rem;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: pan-y;
}
.iv-slider::-webkit-slider-runnable-track { height: .36rem; border-radius: 1rem; background: var(--track); }
.iv-slider::-moz-range-track { height: .36rem; border-radius: 1rem; background: var(--track); }
.iv-slider::-webkit-slider-thumb {
  appearance: none;
  width: .93rem;
  height: .93rem;
  margin-top: -.285rem;
  border: 2px solid #183046;
  border-radius: 50%;
  background: #cbfcf2;
  box-shadow: 0 0 0 1px #8edce2;
}
.iv-slider::-moz-range-thumb {
  box-sizing: border-box;
  width: .93rem;
  height: .93rem;
  border: 2px solid #183046;
  border-radius: 50%;
  background: #cbfcf2;
  box-shadow: 0 0 0 1px #8edce2;
}
@media (forced-colors: active) {
  .iv-slider { appearance: auto; }
}
.error { padding: .8rem 1.25rem; margin: 0; color: #ffcec1; border-top: 1px solid #9b615b; background: #4a3035; }

.results { padding: 0 1.25rem; }
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin: .85rem 1.25rem 0;
}
.metrics div {
  padding: .65rem .72rem;
  min-width: 0;
  display: grid;
  justify-items: start;
  background: linear-gradient(145deg, rgb(var(--type-rgb) / .085), #192333 78%);
  border: 1px solid rgb(var(--type-rgb) / .24);
  border-radius: .65rem;
}
.metrics dt { font-size: .85rem; color: var(--soft); }
dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 730; }
.metrics dd { font-size: clamp(1.3rem, 2.55vw, 1.95rem); line-height: 1.14; letter-spacing: -.025em; margin-top: .21rem; }
.leading { color: var(--lead); }
.metrics div:has(.leading) { border-color: #548c79; background: linear-gradient(148deg, #294642, #1e3036); }
.result-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.12rem; padding: 0 0 .9rem; }
.result-columns h3 { font-size: 1rem; margin: 0 0 .42rem; }
.unit { color: var(--soft); font-size: .82rem; font-weight: 550; }
.stats, .moves { margin: 0; padding: 0; }
.stats > div, .moves li { border-top: 1px solid #3a475c; }
.stats > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .15rem .45rem;
  padding: .32rem 0 .38rem;
}
.stats dt { color: var(--soft); font-size: .89rem; }
.stats dd { white-space: nowrap; }
.stat-track-value { grid-column: 1 / -1; }
.stat-meter {
  display: block; height: .42rem; overflow: hidden; border-radius: 9rem;
  background: rgb(var(--type-rgb) / .17); box-shadow: inset 0 1px 2px #151d2d77;
}
.stat-fill {
  display: block; width: 100%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, rgb(var(--type-rgb) / .82), rgb(var(--type-rgb)));
  transform: scaleX(0); transform-origin: left;
  transition: transform .24s ease-out;
}
.moves { list-style: none; }
.move {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  padding: .48rem .35rem;
  text-align: left;
  color: inherit;
  border: 0;
  background: transparent;
  border-radius: .36rem;
  transition: background-color .18s, color .18s;
}
.move:hover { background: rgb(var(--type-rgb) / .1); }
.move-name { display: grid; gap: .23rem; font-size: .9rem; overflow-wrap: anywhere; }
.move-meta { display: flex; align-items: center; gap: .38rem; flex-wrap: wrap; }
.move-meta small { color: var(--soft); font-size: .77rem; }
.move-meta .move-type {
  padding: .08rem .32rem; border-radius: .24rem;
  background: rgb(var(--type-rgb) / .13); color: rgb(var(--type-rgb)); font-weight: 690;
}
.move-value { font-variant-numeric: tabular-nums; font-weight: 730; white-space: nowrap; color: rgb(var(--type-rgb)); }
.explanation { border-top: 1px solid var(--line); padding: .84rem 0 .92rem; }
.explanation summary { width: fit-content; cursor: pointer; font-weight: 720; color: #ffcf95; }
.explanation .field { margin-top: .72rem; max-width: 19rem; }
.steps { padding-left: 1.43rem; margin: .8rem 0 .1rem; }
.steps li { padding: .45rem .2rem; }
.steps li + li { border-top: 1px solid var(--line); }
.steps li::marker { font-weight: 720; color: var(--soft); }
.steps p { margin: .15rem 0 0; color: var(--soft); line-height: 1.48; font-size: .94rem; overflow-wrap: anywhere; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.1rem; color: var(--soft); font-size: .85rem; margin: 1.35rem 0 1.6rem; }
footer p { margin: 0; line-height: 1.45; }

.catalog-panel {
  overflow: hidden; border: 1px solid var(--line); border-radius: .86rem; background: var(--surface);
}
.catalog-filters {
  display: grid; grid-template-columns: minmax(9rem, 1.55fr) minmax(9rem, 1fr) auto;
  gap: .72rem; align-items: end; padding: .85rem 1rem; background: #1e293b;
}
.catalog-mobile-sort { display: none; }
.catalog-filters:has(.catalog-advanced[open]) { grid-template-columns: minmax(9rem, 1.55fr) minmax(9rem, 1fr); }
.catalog-advanced[open] { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: .66rem; }
.catalog-advanced summary {
  width: fit-content; min-height: 2.55rem; padding: .52rem .62rem; cursor: pointer;
  color: var(--ink); border: 1px solid #50607a; border-radius: .48rem;
  background: #253146; font-size: .875rem; font-weight: 650;
}
.catalog-advanced summary:hover { border-color: #91a4c1; background: #303e56; }
.catalog-filter-summary {
  margin-left: .3rem; padding: .14rem .36rem; border-radius: .3rem;
  background: #423529; color: #ffe0bc; font-variant-numeric: tabular-nums;
}
.catalog-range-fields {
  display: grid; grid-template-columns: minmax(9rem, 1.3fr) minmax(6rem, .8fr) minmax(6rem, .8fr) auto;
  gap: .55rem; align-items: end; margin-top: .58rem;
}
.catalog-range-fields input[aria-invalid="true"] { border-color: #cc8279; }
.catalog-filter-error { margin-bottom: 0; color: #ffb7ab; }
.catalog-table {
  width: 100%; border-spacing: 0; table-layout: fixed;
  color: var(--ink); font-size: .9rem; font-variant-numeric: tabular-nums;
}
.catalog-table :is(th, td) { text-align: right; padding: .52rem .7rem; border-top: 1px solid var(--line); }
.catalog-table thead th { color: var(--soft); font-weight: 650; background: #26334a; }
.catalog-table th:first-child { width: 32%; text-align: left; padding-inline: 1rem; }
.catalog-table thead th, .catalog-table thead th:first-child { padding: 0; }
.catalog-sort-button {
  display: flex; justify-content: end; align-items: center; gap: .27rem;
  width: 100%; min-height: 2.55rem; padding: .45rem .7rem;
  border: 0; background: transparent; color: inherit; font-weight: 650; text-align: right;
}
.catalog-table thead th:first-child .catalog-sort-button { justify-content: start; padding-left: 1rem; text-align: left; }
.catalog-sort-button:hover { color: var(--ink); background: #32425c; }
.catalog-sort-button:focus-visible { outline-offset: -3px; }
.catalog-sort-button span:first-child { min-width: 0; overflow-wrap: anywhere; }
.catalog-sort-marker { flex: 0 0 auto; color: #99adc9; }
.catalog-table th[aria-sort] .catalog-sort-button { background: #354156; color: #ffdaaa; }
.catalog-table th[aria-sort] .catalog-sort-marker { color: #ffbc75; }
.catalog-table tbody tr:nth-child(even) { background: #243045; }
.catalog-table tbody tr:hover { background: #29384e; }
.catalog-species-card { display: flex; align-items: center; gap: .63rem; min-width: 0; }
.catalog-species-name { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.catalog-types { display: flex; flex-wrap: wrap; gap: .25rem; }
.catalog-types .type { padding: .07rem .41rem; font-size: .76rem; }
.catalog-portrait {
  position: relative; display: grid; place-items: center; flex: 0 0 2.65rem; height: 2.65rem;
  border: 1px solid rgb(var(--type-rgb) / .32); border-radius: .63rem;
  background: rgb(var(--type-rgb) / .12); color: rgb(var(--type-rgb)); font-size: 1.12rem;
}
.catalog-portrait img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0;
}
.catalog-portrait.has-image img { opacity: 1; }
.catalog-portrait.has-image span { visibility: hidden; }
.catalog-cell-label { display: none; }
.catalog-base { font-weight: 640; }
.catalog-total { color: #ffd29a; }
.catalog-empty { margin: 0; padding: 1rem; color: var(--soft); }
.catalog-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: .7rem;
  padding: .75rem 1rem; border-top: 1px solid var(--line); color: var(--soft); font-size: .875rem;
}
.catalog-pagination > div { display: flex; gap: .35rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.comparison-actions { display: flex; flex-wrap: wrap; gap: .42rem; }
.secondary, .card-tools summary {
  min-height: 2.45rem; padding: .35rem .64rem; border: 1px solid #50607a; border-radius: .48rem;
  color: var(--ink); background: #253146; font-size: .875rem; font-weight: 650;
}
.secondary:not(:disabled):hover, .card-tools summary:hover { border-color: #91a4c1; background: #303e56; }
.secondary[aria-pressed="true"] { border-color: #c08855; background: #423529; color: #ffe0bc; }
.target-panel { margin: .8rem 0; }
.target-panel summary, .card-tools summary { cursor: pointer; }
.target-panel summary {
  min-height: 2.45rem; width: fit-content; padding: .55rem .58rem;
  border: 1px solid var(--line); border-radius: .48rem;
  background: #243145; color: #d0dcef; font-size: .875rem;
}
.target-fields { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; margin-top: .65rem; }
.target-fields .field { flex: 0 1 9rem; }

.comparison-page { padding-top: clamp(.85rem, 2.2vw, 1.6rem); }
.comparison-navigation {
  display: flex; flex-wrap: wrap; justify-content: end; align-items: center; gap: .42rem;
  padding-inline-start: clamp(.6rem, 1.2vw, 1rem);
  border-inline-start: 1px solid var(--line);
}
.comparison-navigation .secondary { min-height: 2.75rem; }
.graphical-action { display: inline-flex; align-items: center; gap: .43rem; }
.graph-icon { width: .96rem; height: .83rem; display: inline-block; background: currentColor; clip-path: polygon(0 62%, 20% 62%, 20% 100%, 40% 100%, 40% 32%, 60% 32%, 60% 100%, 80% 100%, 80% 0, 100% 0, 100% 100%, 0 100%); }
.comparison-page .cards { gap: clamp(.75rem, 1.55vw, 1.4rem); }
.comparison-page .card {
  background: linear-gradient(171deg, #252f43, #1e293c 58%, #202b3d);
  border-color: #42516b;
  border-radius: 1.18rem;
}
.comparison-page .reference-card { border-color: rgb(var(--type-rgb) / .7); }
.comparison-page .card-heading {
  min-height: 12.65rem; border-top: 2px solid rgb(var(--type-rgb) / .72);
  border-bottom-color: rgb(var(--type-rgb) / .21);
}
.comparison-page .card-heading h2 { font-size: clamp(1.85rem, 4vw, 3.35rem); }
.comparison-page .portrait { width: min(47%, 18.8rem); right: 2.55rem; }
.comparison-page .pokemon-art { max-height: 12.45rem; }
.comparison-page .metrics {
  gap: 0; margin: 0; padding: 0 .42rem;
  border-bottom: 1px solid #414e65; background: #1a2435;
}
.comparison-page .metrics div {
  padding: .68rem .8rem; border: 0; border-radius: 0;
  background: transparent;
}
.comparison-page .metrics div + div { border-left: 1px solid #374761; }
.comparison-page .metrics div:has(.leading) { background: linear-gradient(140deg, #273e40b0, transparent 88%); }
.comparison-page .metrics dd { font-size: clamp(1.34rem, 2.55vw, 2rem); }
.comparison-page .result-columns { gap: .62rem; }
.comparison-page .result-columns > section {
  min-width: 0; padding: .65rem .68rem; border: 1px solid #3c4b64;
  border-radius: .66rem; background: #1a2538;
}
.profile-dialog { width: min(100% - 2rem, 56rem); }
.profile-legend, .profile-lines, .catalog-replacement-list, .species-detail-moves, .catalog-evolution-tree {
  list-style: none; padding: 0; margin: 0;
}
.profile-legend { display: flex; flex-wrap: wrap; gap: .35rem .65rem; margin-bottom: .8rem; }
.profile-legend li { display: flex; align-items: center; gap: .32rem; font-size: .86rem; }
[data-series="0"] { --series-color: #f8c978; }
[data-series="1"] { --series-color: #80daca; }
[data-series="2"] { --series-color: #ffa39f; }
[data-series="3"] { --series-color: #b9b5ff; }
.profile-key {
  display: inline-grid; place-items: center; width: 1.3rem; min-height: 1.3rem;
  border-radius: .32rem; background: var(--series-color); color: #172234;
  font-size: .72rem; font-weight: 790; flex-shrink: 0;
}
.profile-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .62rem; }
.profile-stat {
  min-width: 0; padding: .7rem; border: 1px solid #41516c; border-radius: .62rem; background: #1a2638;
}
.profile-stat h3 { margin: 0 0 .54rem; font-size: .98rem; }
.profile-lines { display: grid; gap: .4rem; }
.profile-line { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.9rem; align-items: center; gap: .44rem; }
.profile-line strong { font-size: .83rem; text-align: right; font-variant-numeric: tabular-nums; }
.profile-track { display: block; height: .53rem; border-radius: 9rem; background: #34445e; overflow: hidden; }
.profile-bar { display: block; height: 100%; border-radius: inherit; background: var(--series-color); }
.profile-axis { display: flex; justify-content: space-between; color: var(--soft); font-size: .73rem; margin: .28rem 4.35rem 0 1.74rem; }

.catalog-ranges { display: grid; gap: .5rem; margin-top: .48rem; }
.catalog-range { min-width: 0; padding: .6rem; border-radius: .52rem; background: #1a2639; }
.catalog-range-fields { margin-top: 0; }
.catalog-filter-actions { display: flex; flex-wrap: wrap; gap: .43rem; margin-top: .58rem; }
.catalog-table-region { max-height: min(65vh, 50rem); overflow: auto; outline-offset: -3px; }
.catalog-table-region thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px #3f4e65; }
.catalog-species-name { flex: 1 1 auto; }
.catalog-species-button, .catalog-evolution-link {
  width: fit-content; padding: .1rem 0; background: transparent; border: 0;
  color: var(--ink); font-weight: 700; text-align: left; text-decoration: underline;
  text-decoration-color: #8190ac; text-underline-offset: .19em;
}
.catalog-species-button:hover, .catalog-evolution-link:hover { color: #ffd29a; }
.catalog-compare.secondary {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.08rem; padding: .24rem .55rem; text-decoration: none; color: #ffe0b5;
  background: #352f34; border-color: #846c5a; font-size: .83rem;
}
.catalog-compare.secondary:hover { color: #fff; background: #524134; border-color: #e0b581; }
.catalog-page { padding-top: clamp(.8rem, 2vw, 1.4rem); }
.species-detail { width: min(100% - 2rem, 42rem); }
.species-detail-hero {
  display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .6rem .8rem;
  border: 1px solid rgb(var(--type-rgb) / .32); border-radius: .68rem;
  background: radial-gradient(ellipse at 16% 60%, rgb(var(--type-rgb) / .19), transparent 66%), #1a2638;
}
.species-detail-hero::after {
  background: linear-gradient(270deg, #162135ec, #16213591 42%, #16213523 80%), linear-gradient(0deg, #142033bf, transparent 62%);
}
.species-detail-hero .catalog-portrait { flex-basis: min(38%, 10rem); height: clamp(6.5rem, 20vw, 9rem); border: 0; background: transparent; }
.species-detail-hero .catalog-portrait img { filter: drop-shadow(0 .35rem .4rem #101826c9); }
.species-detail-hero .catalog-portrait.has-image img { animation: portrait-arrival .8s ease-out both; }
.species-detail-actions { display: grid; justify-items: end; gap: .52rem; }
.species-detail-actions .catalog-types { justify-content: end; }
.species-detail-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .32rem; margin: .68rem 0 0;
}
.species-detail-stats div { min-width: 0; padding: .38rem .46rem; border: 1px solid #3c4d64; border-radius: .4rem; background: #1b273a; }
.species-detail-stats dt { color: var(--soft); font-size: .77rem; }
.species-detail-section { margin-top: .9rem; }
.species-detail-section h3 { margin: 0 0 .35rem; font-size: 1rem; }
.species-detail-moves li, .catalog-replacement-list li { border-top: 1px solid var(--line); padding: .35rem 0; }
.species-detail-moves li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .13rem .42rem; }
.species-detail-moves span { color: var(--soft); font-size: .8rem; }
.species-detail-moves li span:last-child { grid-area: 1 / 2 / span 2; align-self: center; color: #ffd29a; }
.catalog-evolution-tree { display: grid; gap: .17rem; }
.catalog-evolution-tree .catalog-evolution-tree { margin-left: .48rem; padding-left: .64rem; border-left: 1px solid #596c88; }
.catalog-evolution-link { font-size: .86rem; }
.catalog-evolution-link[aria-current] { color: #ffd29a; }
.catalog-replacement-list .secondary { display: block; min-height: 2.35rem; text-decoration: none; }
.panel-status { color: var(--soft); font-size: .875rem; line-height: 1.45; }
.panel-status:empty { display: none; }
.species-picker { text-align: left; padding-right: 1.55rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.species-field { position: relative; }
.species-field::after {
  content: ""; position: absolute; right: .55rem; bottom: .96rem; width: .45rem; height: .45rem;
  border-right: 2px solid var(--soft); border-bottom: 2px solid var(--soft); transform: rotate(45deg);
  pointer-events: none;
}
.card-tools { display: flex; gap: .4rem; align-items: start; flex-wrap: wrap; padding: 0 1.25rem .85rem; }
.card-tools summary { line-height: 1.62rem; display: list-item; width: fit-content; }
.evolution[open] { flex-basis: 100%; border-left: 2px solid #50607a; padding-left: .55rem; }
.evolution[open] .field { margin: .5rem 0; max-width: 16rem; }
.evolution-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.stat-value { display: flex; align-items: baseline; gap: .35rem; }
.delta { color: var(--soft); white-space: nowrap; font-weight: 650; font-size: .75rem; }
.delta[data-change="up"] { color: var(--lead); }
.delta[data-change="down"] { color: #ffaf9f; }
.metrics .delta, .move-values .delta { display: block; letter-spacing: normal; }
.move-values { text-align: right; }
.potential-results, .compact-results { overflow: auto; }
.compact-results { border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; font-variant-numeric: tabular-nums; }
.data-table :is(th, td) { padding: .44rem .65rem; border-bottom: 1px solid var(--line); text-align: left; }
.data-table thead { background: #28354b; }
.data-table tbody th { color: var(--soft); font-weight: 550; }
.data-table tr:last-child :is(td, th) { border-bottom: 0; }
.compact-results .data-table :is(td, th) { min-width: 7rem; vertical-align: top; }
.compact-results .data-table th:first-child { position: sticky; left: 0; background: #28354b; z-index: 1; }
.compact-results .data-table tbody tr:nth-child(even) td { background: #233045; }
.compact-pokemon {
  display: flex; align-items: center; gap: .38rem; color: rgb(var(--type-rgb));
}
.compact-portrait { width: 2.45rem; height: 2.45rem; object-fit: contain; }
.compact-pokemon-labels { display: grid; gap: .12rem; }
.compact-pokemon-labels small { color: var(--soft); font-weight: 550; }
.compact-cell { display: flex; gap: .3rem; align-items: baseline; flex-wrap: wrap; }
.compact-moves { list-style: none; padding: 0; margin: 0; min-width: 8rem; }
.compact-moves li + li { margin-top: .3rem; }
.compact-moves .delta { display: block; }
.modal {
  width: min(100% - 2rem, 36rem); max-height: calc(100% - 2rem); padding: 1rem 1.15rem;
  background: var(--surface); color: var(--ink); border: 1px solid #50607a; border-radius: .9rem;
  box-shadow: 0 1rem 4rem #121824aa;
}
.modal::backdrop { background: #101724ba; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; gap: .8rem; margin: 0 0 .85rem; }
.modal-heading h2 { margin: 0; line-height: 1.2; font-size: 1.45rem; }
.modal > .primary { margin-top: .6rem; }
.species-results {
  list-style: none; padding: 0 .13rem 0 0; margin: .6rem 0 0; display: grid; gap: .45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 48vh; overflow: auto;
}
.species-result {
  display: flex; align-items: center; gap: .45rem; text-align: left; width: 100%; min-height: 3.5rem;
  color: var(--ink); background: var(--surface-deep); border: 1px solid var(--line); border-radius: .5rem;
}
.species-result:hover { background: #303e56; }
.thumbnails { display: flex; align-items: center; flex-shrink: 0; }
.thumbnail { width: 2.05rem; height: 2.05rem; object-fit: contain; }
.species-description, .favorite-caption { display: grid; min-width: 0; gap: .14rem; overflow-wrap: anywhere; }
.species-description small, .favorite-caption span { color: var(--soft); font-size: .79rem; }
.favorite-editor { padding: 0; display: flex; flex-wrap: wrap; align-items: end; gap: .52rem; }
.favorite-editor .field { flex: 1 1 10rem; }
.favorites-list { list-style: none; padding: 0; margin: .7rem 0 0; }
.favorite-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .45rem; align-items: center; padding: .53rem 0; border-top: 1px solid var(--line); }
.card[data-shiny="true"] .portrait.image-ready::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse, rgb(var(--type-rgb) / .38), transparent 68%);
  animation: shiny-flash .52s ease-out both;
}
@keyframes shiny-flash {
  0%, 100% { opacity: 0; transform: scale(.8); }
  33% { opacity: 1; transform: scale(1.08); }
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(.7rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes portrait-arrival {
  from { transform: translateY(.65rem) scale(.92); }
  62% { transform: translateY(-.26rem) scale(1.02); }
  to { transform: translateY(0) scale(1); }
}
@keyframes shine {
  0%, 100% { transform: scale(.88); opacity: .74; }
  50% { transform: scale(1.15); opacity: 1; }
}

@media (max-width: 52rem) {
  .wrap { width: min(100% - 2rem, 41.5rem); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .heading { gap: .7rem; }
  .card-heading h2 { font-size: clamp(1.8rem, 6vw, 2.7rem); }
  .comparison-page .card-heading h2 { font-size: clamp(1.8rem, 7vw, 3rem); }
}
@media (max-width: 62rem) {
  .calculator-masthead .masthead-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem .6rem;
  }
  .calculator-masthead .comparison-navigation {
    grid-column: 1 / -1; justify-content: start; padding: .42rem 0 0;
    border-inline-start: 0; border-top: 1px solid var(--line);
  }
}
@media (max-width: 42rem) {
  .catalog-filters, .catalog-filters:has(.catalog-advanced[open]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-filters > .catalog-mobile-sort { display: grid; }
  .catalog-advanced { grid-column: 1 / -1; }
  .catalog-range-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-range-fields .secondary { justify-self: start; }
  .catalog-filters .field:first-child { grid-column: 1 / -1; }
  .catalog-table, .catalog-table tbody { display: block; }
  .catalog-table-region { max-height: none; overflow: visible; }
  .catalog-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .catalog-table .catalog-sort-button { display: none; }
  .catalog-table tbody { display: grid; gap: .55rem; padding: .6rem; }
  .catalog-table tbody tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem;
    padding: .55rem; border: 1px solid var(--line); border-radius: .55rem; background: #202c3f;
  }
  .catalog-table tbody th:first-child { grid-column: 1 / -1; width: auto; padding: 0 0 .3rem; border: 0; }
  .catalog-table td {
    display: grid; gap: .06rem; padding: .25rem .34rem; border: 0; border-radius: .29rem;
    background: #1a2436; text-align: left;
  }
  .catalog-cell-label { display: block; color: var(--soft); font-size: .76rem; font-weight: 500; }
  .catalog-table td.catalog-total {
    grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .4rem;
    padding: .24rem .34rem; background: #293348;
  }
}
@media (max-width: 27rem) {
  .wrap { width: calc(100% - 1.1rem); }
  .masthead-inner { min-height: 3.6rem; gap: .5rem; }
  .brand { gap: .38rem; }
  .brand-title { font-size: .95rem; }
  .brand-credit { font-size: .72rem; }
  .site-nav { gap: .12rem; }
  .nav-link { padding-inline: .32rem; gap: .23rem; font-size: .79rem; }
  .catalog-count { font-size: .69rem; }
  .comparison-navigation .primary { font-size: .82rem; padding-inline: .58rem; }
  .comparison-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .comparison-actions .secondary { padding-inline: .32rem; font-size: .81rem; line-height: 1.2; }
  .comparison-navigation { justify-content: start; }
  .comparison-navigation .secondary { padding-inline: .45rem; font-size: .82rem; }
  .comparison-page .card-heading { min-height: 10.3rem; }
  .comparison-page .portrait { right: .95rem; }
  .comparison-page .pokemon-art { max-height: 10rem; }
  .comparison-page .metrics div { padding: .56rem .4rem; }
  .comparison-page .result-columns > section { padding: .48rem .4rem; }
  .profile-charts { grid-template-columns: minmax(0, 1fr); }
  .species-detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-heading { min-height: 9.5rem; padding: .9rem; }
  .portrait { right: .88rem; }
  .pokemon-art { max-height: 8.7rem; }
  .quiet { top: .44rem; right: .43rem; font-size: .78rem; }
  form, .results { padding-inline: .8rem; }
  .card-tools { padding-inline: .8rem; }
  .fields { grid-template-columns: minmax(0, 1fr) 4.1rem 5.5rem; gap: .43rem; }
  .metrics { gap: .33rem; margin-inline: .8rem; }
  .metrics div { padding: .55rem .4rem; }
  .metrics dt { font-size: .75rem; }
  .result-columns { gap: .65rem; }
  .iv-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .iv-slider { height: 2.25rem; }
  .species-results { grid-template-columns: minmax(0, 1fr); }
  .data-table :is(td, th) { padding-inline: .43rem; }
  .compact-results .data-table th:first-child { min-width: 5.5rem; }
  .compact-moves { min-width: 0; }
  .compact-portrait { width: 1.75rem; height: 1.75rem; flex: 0 0 auto; }
  .compact-pokemon-labels { overflow-wrap: anywhere; }
  .catalog-filters, .catalog-pagination { padding-inline: .65rem; }
  .catalog-filters { gap: .5rem; }
  .catalog-pagination { gap: .33rem; font-size: .81rem; }
  .catalog-pagination .secondary { padding-inline: .42rem; font-size: .81rem; }
}
@media (max-width: 22.5rem) {
  .masthead .brand-title { font-size: .85rem; }
  .masthead .brand-credit { font-size: .67rem; }
  .add-species-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
