@font-face {
  font-family: 'Archivo Narrow';
  src: url('assets/fonts/ArchivoNarrow-Variable.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

/* Versão Preto: noite de Zekrom. Versão Branco: dia de Reshiram. */
:root,
:root[data-version='black'] {
  color-scheme: dark;
  --bg: #000;
  --fg: #fff;
  --muted: #a9a9ad;
  --panel: #151517;
  --panel-2: #222226;
  --line: #34343a;
  --accent: #3fc8ff;      /* brilho elétrico de Zekrom */
  --accent-ink: #000;
  --accent-soft: #3fc8ff26;
  --other: #ff6a3d;       /* o lado oposto */
  --shadow: 0 1px 0 #ffffff14;
}
:root[data-version='white'] {
  color-scheme: light;
  --bg: #fff;
  --fg: #000;
  --muted: #5d5d63;
  --panel: #f3f3f1;
  --panel-2: #e7e7e4;
  --line: #d2d2cd;
  --accent: #c93a12;      /* chama de Reshiram, escurecida para texto */
  --accent-ink: #fff;
  --accent-soft: #ff6a3d22;
  --other: #0a7fb0;
  --shadow: 0 1px 0 #0000000d;
}

*, *::before, *::after { box-sizing: border-box; }
:root { --font: 'Archivo Narrow', 'Arial Narrow', system-ui, sans-serif; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
/* A barra fixa já está à vista: sem isto, dar-lhe foco com Tab fazia a página saltar por causa do scroll-padding. */
.bar a, .bar button { scroll-margin-top: -4.5rem; }
@media (max-width: 62rem) { html { scroll-padding-top: 0; } .bar a, .bar button { scroll-margin-top: 0; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.55 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s, color .35s;
}
img { max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
h1, h2, h3, p, figure, ol, ul { margin: 0; }
h1, h2, h3 { line-height: 1.02; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: clamp(2rem, 5vw, 3.4rem); }
h3 { font-size: 1.35rem; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
abbr { text-decoration: none; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 .3rem; border-radius: .25rem; font: inherit; }
.wrap { width: min(100% - 2rem, 76rem); margin-inline: auto; }
.skip { position: absolute; z-index: 30; left: 1rem; top: .5rem; padding: .5rem .8rem; background: var(--accent); color: var(--accent-ink); transform: translateY(-200%); }
.skip:focus { transform: none; }
.small { font-size: .9rem; color: var(--muted); }
.loading { color: var(--muted); padding: 1rem; }

/* --- Barra ------------------------------------------------------------------------------- */
.bar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); transition: background-color .35s; }
.bar-inner { display: flex; align-items: center; gap: .5rem 1.4rem; min-height: 3.6rem; }
.wordmark { display: flex; align-items: center; gap: .15rem; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.3rem; margin-right: auto; }
.mark { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid var(--fg); background: linear-gradient(105deg, #000 50%, #fff 50%); }
.wordmark span { margin-left: .45rem; }
.bar-nav { display: flex; gap: .2rem 1rem; flex-wrap: wrap; }
.bar-nav a { color: var(--fg); text-decoration: none; padding: .4rem 0; font-weight: 500; }
.bar-nav a:hover { color: var(--accent); }
.version-switch { display: inline-flex; border: 1px solid var(--fg); border-radius: 999px; overflow: hidden; flex: none; }
.version-switch button {
  font: 600 .95rem/1 var(--font); padding: .48rem .9rem; border: 0; cursor: pointer;
  background: transparent; color: var(--fg); font-family: inherit;
}
.version-switch button[aria-checked='false'] { color: var(--muted); }
.version-switch button[data-set-version='black'][aria-checked='true'] { background: #000; color: #fff; }
.version-switch button[data-set-version='white'][aria-checked='true'] { background: #fff; color: #000; }
.version-switch button[aria-checked='true'] { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; border-radius: 999px; }
/* O contentor corta (overflow: hidden): o foco desenha-se por dentro, noutra cor que a seleção. */
.version-switch button:focus-visible { outline: 2px dashed var(--fg); outline-offset: -5px; border-radius: 999px; }
.version-switch button[data-set-version='black'][aria-checked='true']:focus-visible { outline-color: #fff; }
.version-switch button[data-set-version='white'][aria-checked='true']:focus-visible { outline-color: #000; }
@media (max-width: 62rem) {
  .bar-inner { flex-wrap: wrap; padding-block: .5rem; }
  .bar { position: static; }
  .bar-nav { order: 3; width: 100%; gap: 0 1rem; }
}

/* --- Hero: as duas versões lado a lado ------------------------------------------------- */
.hero { position: relative; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; isolation: isolate; border-bottom: 1px solid var(--line); }
.hero-side { position: relative; min-height: clamp(24rem, 62vh, 40rem); display: grid; place-items: start center; padding-top: clamp(1.5rem, 5vh, 4rem); }
.hero-black { background: #000; clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%); margin-right: -12%; z-index: 1; }
.hero-white { background: #fff; }
.hero-white::after, .hero-black::after {
  content: ''; position: absolute; left: 50%; bottom: 18%; width: 60%; aspect-ratio: 4 / 1; translate: -50% 0;
  border-radius: 50%; z-index: -1;
}
.hero-white::after { background: radial-gradient(closest-side, #ff6a3d40, transparent); }
.hero-black::after { background: radial-gradient(closest-side, #3fc8ff40, transparent); }
.hero-motion {
  position: absolute; right: .75rem; top: .75rem; z-index: 3; padding: .35rem .6rem; border-radius: .3rem; cursor: pointer;
  font: 600 .82rem/1 var(--font); color: #000; background: #fffc; border: 1px solid #000;
}
/* Está sempre sobre a metade branca: foco escuro nos dois temas; em pausa, o botão fica invertido. */
.hero-motion:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.hero-motion[aria-pressed='true'] { background: #000; color: #fff; }
.hero-motion[aria-pressed='true']::before { content: '✓ ' / ''; }
.hero-mon { image-rendering: pixelated; width: auto; height: clamp(10rem, 34vh, 19rem); max-width: 90%; object-fit: contain; }
.hero-black .hero-mon { transform: scaleX(-1); }
.hero-mon[data-mon='644'] { aspect-ratio: 309 / 276; }
.hero-mon[data-mon='643'] { aspect-ratio: 321 / 249; }
.hero-copy { position: absolute; inset: auto 0 0 0; padding-bottom: clamp(1.5rem, 5vh, 3rem); mix-blend-mode: difference; z-index: 2; pointer-events: none; }
.hero h1 {
  color: #fff; text-align: center;
  font-size: clamp(3.4rem, 14vw, 12rem); line-height: .82; letter-spacing: -.045em; font-weight: 700;
}
.hero h1 span { display: inline-block; }
.h1-amp { font-weight: 400; }
.hero-band { border-bottom: 1px solid var(--line); }
.hero-band-inner { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 1rem 2rem; align-items: center; padding-block: 1.6rem; }
.hero-band p { max-width: 58ch; font-size: 1.2rem; }
.hero-band .hero-meta-line { margin-top: .35rem; font-size: .95rem; color: var(--muted); }
.hero-band .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
@media (max-width: 45rem) {
  .hero-side { min-height: 17rem; }
  .hero-mon { height: 8.5rem; }
  .hero-band-inner { grid-template-columns: 1fr; }
}

.btn-download, .btn-ghost {
  display: inline-flex; align-items: center; gap: .5rem; padding: .72rem 1.15rem; border-radius: .4rem;
  font: 700 1.05rem/1 var(--font); text-decoration: none; cursor: pointer;
}
.btn-download { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.btn-download::before { content: ''; width: .8rem; height: .8rem; background: currentColor; clip-path: polygon(35% 0, 65% 0, 65% 45%, 100% 45%, 50% 100%, 0 45%, 35% 45%); }
.btn-download:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--fg); }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }

/* --- Secções ---------------------------------------------------------------------------- */
.section { padding-block: clamp(2.5rem, 7vw, 5rem); border-bottom: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: .6rem 2.5rem; align-items: end; margin-bottom: 1.6rem; }
.section-head p { color: var(--muted); max-width: 60ch; }
@media (max-width: 50rem) { .section-head { grid-template-columns: 1fr; } }
.subhead { margin-block: 2.4rem 1rem; font-size: 1.6rem; }

/* Galeria */
.screens {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(84vw, 44rem); gap: 1rem;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: .25rem max(1rem, calc((100vw - 76rem) / 2)) 1rem;
  scroll-padding-inline: max(1rem, calc((100vw - 76rem) / 2));
}
.screens figure { scroll-snap-align: start; }
.screens img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: .5rem; border: 1px solid var(--line); background: var(--panel); }
.screens figcaption { margin-top: .55rem; color: var(--muted); font-size: .98rem; }
.screens figcaption strong { color: var(--fg); margin-right: .35rem; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; padding: 0; list-style: none; }
.facts li { border-top: 2px solid var(--fg); padding-top: .6rem; color: var(--muted); }
.facts strong { display: block; color: var(--fg); font-size: 2.2rem; line-height: 1; margin-bottom: .2rem; }
@media (max-width: 50rem) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Tipos ------------------------------------------------------------------------------ */
.type {
  display: inline-block; padding: .14rem .5rem .12rem; border-radius: .25rem; font-size: .8rem; font-weight: 700;
  line-height: 1.2; background: var(--t); color: var(--tt); white-space: nowrap;
}
.types { display: flex; flex-wrap: wrap; gap: .3rem; }

/* --- Pokédex ---------------------------------------------------------------------------- */
.dex-tools { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: end; padding: 1rem; background: var(--panel); border-radius: .6rem; }
.field { display: grid; gap: .25rem; font-size: .88rem; color: var(--muted); }
.field-search { flex: 1 1 14rem; }
.field input, .field select {
  font: 500 1rem/1.2 var(--font); color: var(--fg); background: var(--bg);
  border: 1px solid var(--muted); border-radius: .35rem; padding: .55rem .6rem; min-width: 9rem; width: 100%; /* ≥3:1 contra o painel e o fundo */
}
.toggle { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .2rem; cursor: pointer; font-weight: 600; }
.toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.dex-count { margin-block: 1rem .6rem; color: var(--muted); }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.2rem, 1fr)); gap: .6rem; padding: 0; list-style: none; }
.dex-card {
  position: relative; display: grid; width: 100%; padding: .4rem .6rem .7rem; text-align: left; cursor: pointer;
  font: inherit; color: var(--fg); background: var(--panel); border: 1px solid transparent; border-radius: .55rem;
}
.dex-card:hover { border-color: var(--fg); }
.dex-card .num { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dex-card img { justify-self: center; width: 96px; height: 96px; image-rendering: pixelated; }
.dex-card .name { font-weight: 700; font-size: 1.08rem; line-height: 1.15; margin-bottom: .3rem; }
.dex-card .flag { position: absolute; top: .45rem; right: .5rem; width: .75rem; height: .75rem; border-radius: 50%; border: 1px solid var(--fg); }
.dex-card .flag-black { background: #000; }
.dex-card .flag-white { background: #fff; }
.dex-empty { padding: 2rem 0; color: var(--muted); }
.dex-more { margin-top: 1rem; }

/* --- Tabela de estatísticas ------------------------------------------------------------ */
/* contain: paint — sem isto, a largura mínima da tabela de tipos (605 px) alarga a página a 390 px e um gesto lateral desloca-a toda. */
.table-scroll { overflow-x: auto; contain: paint; border: 1px solid var(--line); border-radius: .5rem; }
/* A tabela de estatísticas desliza dentro da própria caixa: é aí que o cabeçalho fica fixo. */
.stat-scroll { max-height: min(78vh, 46rem); overflow: auto; }
.stat-table thead th { z-index: 1; }
.stat-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stat-table th, .stat-table td { padding: .35rem .55rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stat-table th:nth-child(-n+3), .stat-table td:nth-child(-n+3) { text-align: left; }
.stat-table thead th { position: sticky; top: 0; background: var(--panel-2); font-size: .92rem; }
.stat-table th button { font: inherit; font-weight: 700; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.stat-table th[aria-sort='ascending'] button::after { content: ' ▲'; font-size: .7em; }
.stat-table th[aria-sort='descending'] button::after { content: ' ▼'; font-size: .7em; }
.stat-table tbody tr { cursor: pointer; scroll-margin-top: 2.6rem; }
.stat-table tbody tr:hover { background: var(--panel); }
/* A coluna do nome fica fixa ao deslizar para o lado: o foco que volta da ficha fica sempre à vista. */
.stat-table td.mon { font-weight: 700; position: sticky; left: 0; background: var(--bg); }
.stat-table tbody tr:hover td.mon { background: var(--panel); }
.stat-table thead th:nth-child(2) { left: 0; z-index: 2; }
/* Separador da coluna fixa: com border-collapse a borda não acompanha a célula, a sombra sim. */
.stat-table td.mon, .stat-table thead th:nth-child(2) { box-shadow: 1px 0 0 var(--line); }
.stat-table td.mon > span { display: flex; align-items: center; gap: .35rem; }
.stat-table td.mon img { flex: none; max-width: none; width: 32px; height: 32px; image-rendering: pixelated; margin-block: -.4rem; }
.stat-table td.stat { background: color-mix(in srgb, var(--accent) calc(var(--v) * 1%), transparent); }
.stat-table td.total { font-weight: 700; }
.table-more { margin-top: 1rem; }

/* --- Ginásios --------------------------------------------------------------------------- */
.gyms { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1px; padding: 0; list-style: none; background: var(--line); border: 1px solid var(--line); border-radius: .6rem; overflow: hidden; counter-reset: gym; }
.gym-card { background: var(--bg); padding: 1rem 1.1rem 1.2rem; counter-increment: gym; }
.gym-card h3 { display: flex; align-items: baseline; gap: .5rem; }
.gym-card h3::before { content: counter(gym); font-size: 2.6rem; line-height: .8; color: var(--accent); }
.gym-card .where { color: var(--muted); font-size: .95rem; margin-top: .2rem; }
.leader { margin-top: .75rem; }
.leader-name { font-weight: 700; }
.team { display: flex; flex-wrap: wrap; gap: .15rem; margin-top: .2rem; padding: 0; list-style: none; }
.team button { display: grid; justify-items: center; padding: 0 .1rem; border: 0; background: none; color: var(--muted); font: .78rem/1 var(--font); cursor: pointer; border-radius: .3rem; }
.team button:hover { background: var(--panel); color: var(--fg); }
.team img { width: 48px; height: 48px; image-rendering: pixelated; }
.league { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .8rem 1.6rem; padding: 0; list-style: none; }
.league li { border-top: 1px solid var(--line); padding-top: .7rem; }

/* --- Quem é este Pokémon ---------------------------------------------------------------- */
.who { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; }
.who-stage {
  display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: .6rem; overflow: hidden;
  background: repeating-conic-gradient(from 0deg at 50% 60%, var(--panel) 0 15deg, var(--panel-2) 15deg 30deg);
}
.who-stage img { width: min(70%, 20rem); height: auto; image-rendering: pixelated; filter: brightness(0); }
.who-stage.revealed img { transition: filter .5s; }
:root[data-version='black'] .who-stage img { filter: brightness(0) invert(1); }
.who-stage.revealed img, :root[data-version='black'] .who-stage.revealed img { filter: none; }
.who-copy p { color: var(--muted); margin-top: .5rem; }
.who-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: 1.2rem; }
.who-options button {
  padding: .75rem .9rem; font: 700 1.1rem/1.1 var(--font); text-align: left; cursor: pointer;
  color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: .45rem;
}
.who-options button:hover:not(:disabled) { border-color: var(--fg); }
.who-options button.right { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.who-options button.wrong { text-decoration: line-through; opacity: .55; }
.who-result { min-height: 1.6em; font-weight: 700; color: var(--fg) !important; }
.who-result button { margin-left: .5rem; }
@media (max-width: 45rem) { .who { grid-template-columns: 1fr; } }

/* --- Tabela de tipos ------------------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding: 0; margin-bottom: .8rem; list-style: none; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .4rem; }
.type-chart { border-collapse: collapse; font-size: .82rem; margin: 0 auto; }
.type-chart th, .type-chart td { width: 2.3rem; height: 2.1rem; text-align: center; padding: 0; }
.type-chart th[scope='col'] { height: 6.2rem; vertical-align: bottom; padding-bottom: .3rem; }
.type-chart th[scope='col'] span { writing-mode: vertical-rl; transform: rotate(180deg); }
.type-chart th[scope='row'] { width: auto; text-align: right; padding-right: .4rem; position: sticky; left: 0; z-index: 1; background: var(--bg); }
.type-chart td { border: 1px solid var(--line); font-weight: 700; }
.type-chart thead td { border: 0; }
.type-chart td.x2 { background: #3fae5a; color: #000; }
.type-chart td.x05 { background: #c43834; color: #fff; }
.type-chart td.x0 { background: #555; color: #fff; }
.type-chart .hl { box-shadow: inset 0 0 0 999px var(--accent-soft); }
.type-chart td.cross { outline: 2px solid var(--fg); outline-offset: -2px; }
.eff { display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.5rem; border-radius: .2rem; font-weight: 700; }
.eff-2 { background: #3fae5a; color: #000; }
.eff-05 { background: #c43834; color: #fff; }
.eff-0 { background: #555; color: #fff; }
.eff-1 { border: 1px solid var(--line); vertical-align: middle; }
.eff-4 { background: #1f7a37; color: #fff; }
.eff-025 { background: #8f2622; color: #fff; }

/* --- Mapas e guia ---------------------------------------------------------------------- */
.maps, .guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.map, .guide { border: 1px solid var(--line); border-radius: .6rem; padding: clamp(1rem, 3vw, 1.6rem); }
.map { --route: var(--accent); }
.map-central { --route: #e8a33b; }
.map-north { --route: #7d8cff; }
.map-east { --route: #d06ad0; }
:root[data-version='white'] .map-central { --route: #9a6300; }
:root[data-version='white'] .map-north { --route: #3b4cc0; }
:root[data-version='white'] .map-east { --route: #993099; }
.map figcaption { display: grid; gap: .2rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.map h3 { font-size: 1.7rem; color: var(--route); }
.map figcaption span, .route span, .route-note { color: var(--muted); }
.route-note { margin-top: .8rem; }
.route { list-style: none; margin-top: .9rem; padding: 0; }
.route li { position: relative; display: grid; padding: 0 0 .9rem 1.7rem; }
.route li:last-child { padding-bottom: 0; }
.route li::before, .route li:not(:last-child)::after { content: ''; position: absolute; }
.route li::before { z-index: 1; inset: .42rem auto auto .1rem; width: .7rem; aspect-ratio: 1; border: 2px solid var(--route); border-radius: 50%; background: var(--bg); }
.route li::after { inset: .65rem auto -.65rem .4rem; border-left: 2px solid var(--route); opacity: .6; }
.route li.gym::before { border-radius: 0; background: var(--route); transform: rotate(45deg); }
.guide h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
.guide ol { margin-block: 1rem 1.2rem; padding-inline-start: 1.4rem; }
.guide li + li { margin-top: .55rem; }
.guide li::marker { color: var(--accent); font-weight: 700; }
details { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: .7rem; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details p { margin-block: .45rem; }
.checksum { overflow-wrap: anywhere; font-size: .88rem; }
@media (max-width: 50rem) { .maps, .guide-grid { grid-template-columns: 1fr; } }

.footer { padding-block: 1.6rem 2.4rem; color: var(--muted); font-size: .95rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 2rem; }
.footer p { max-width: 70ch; }

/* --- Ficha do Pokémon ------------------------------------------------------------------- */
.mon-dialog {
  width: min(100% - 1.5rem, 68rem); max-height: calc(100dvh - 1.5rem); padding: 0; border: 1px solid var(--line);
  border-radius: .8rem; background: var(--bg); color: var(--fg); overflow: hidden;
}
/* Com a ficha aberta, a página por trás não se desloca (nem pela roda sobre o fundo, nem ao chegar ao fim de um painel). */
html:has(.mon-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.mon-sheet, .mon-stage, .mon-info { overscroll-behavior: contain; }
.mon-dialog::backdrop { background: #000a; backdrop-filter: blur(3px); }
.mon-dialog[open] { height: calc(100dvh - 1.5rem); }
.mon-sheet { position: relative; display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; }
.mon-sheet > * { min-height: 0; }
.mon-stage { position: relative; display: grid; grid-template-rows: auto auto 1fr; align-content: start; gap: .8rem; padding: 1rem; background: var(--panel); overflow-y: auto; }
.mon-nav { display: flex; justify-content: space-between; gap: .5rem; }
.mon-nav button, .mon-close {
  font: 600 .95rem/1 var(--font); color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: .35rem; padding: .5rem .7rem; cursor: pointer;
}
.mon-nav button:hover, .mon-close:hover { border-color: var(--fg); }
.mon-platform { position: relative; display: grid; place-items: end center; min-height: 15rem; padding-bottom: 1.6rem; }
.mon-platform::before {
  content: ''; position: absolute; bottom: 1rem; left: 50%; translate: -50% 0; width: 78%; height: 2.6rem; border-radius: 50%;
  background: radial-gradient(closest-side, var(--panel-2), transparent); box-shadow: 0 0 0 1px var(--line) inset;
}
.mon-platform img { position: relative; image-rendering: pixelated; max-width: 100%; }
.mon-platform.shiny::after {
  content: '✦'; position: absolute; top: .5rem; right: .8rem; font-size: 1.6rem; color: var(--accent);
  animation: twinkle 1.6s ease-in-out infinite;
}
@keyframes twinkle { 50% { opacity: .25; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .mon-platform.shiny::after { animation: none; } .who-stage.revealed img { transition: none; } }
.motion-paused .mon-platform.shiny::after { animation: none; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg-labelled { display: inline-flex; align-items: center; gap: .45rem; }
.seg-label { font-size: .82rem; color: var(--muted); }
.seg-group { display: inline-flex; border: 1px solid var(--line); border-radius: .4rem; overflow: hidden; }
.seg-group button {
  font: 600 .9rem/1 var(--font); padding: .5rem .65rem; border: 0; cursor: pointer;
  background: var(--bg); color: var(--fg);
}
.seg-group button + button { border-left: 1px solid var(--line); }
.seg-group button[aria-pressed='true'] { background: var(--fg); color: var(--bg); }
.seg-group button:disabled { opacity: .35; cursor: not-allowed; }
/* O grupo corta o que sai das margens (overflow: hidden), por isso o foco desenha-se por dentro. */
.seg-group button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; box-shadow: inset 0 0 0 5px var(--bg); }
.seg-group button[aria-pressed='true']:focus-visible { box-shadow: inset 0 0 0 5px var(--fg); }
.forms { display: flex; flex-wrap: wrap; gap: .3rem; }
.forms button {
  display: grid; justify-items: center; gap: .1rem; width: 4.6rem; padding: .25rem; font: .74rem/1.1 var(--font);
  color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: .4rem; cursor: pointer;
}
.forms button[aria-pressed='true'] { border-color: var(--fg); color: var(--fg); }
.forms img { width: 56px; height: 56px; image-rendering: pixelated; object-fit: contain; }
.forms.compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.1rem, 1fr)); max-width: 100%; }
.forms.compact button { width: auto; min-width: 0; padding: .1rem; place-items: center; }
.forms.compact img { width: 48px; height: 48px; }
.table-empty { padding: 1rem; color: var(--muted); text-align: left !important; }
.stage-label { font-size: .85rem; color: var(--muted); }

.mon-info { position: relative; overflow-y: auto; padding: 1.2rem clamp(1rem, 3vw, 2rem) 2rem; }
/* Fora da grelha: fica no canto da ficha, por cima da coluna de informação (que tem o seu próprio scroll). */
.mon-close { position: absolute; top: 1.2rem; right: 2rem; z-index: 2; }
.mon-head > .num, .mon-head > h2 { padding-right: 5.5rem; }
.mon-head .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.mon-head h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-block: .05rem .3rem; }
.mon-head .category { color: var(--muted); margin-bottom: .5rem; }
.mon-entry { margin-top: .9rem; max-width: 62ch; font-size: 1.12rem; }
.mon-version { display: inline-flex; align-items: center; gap: .4rem; margin-top: .6rem; font-size: .92rem; font-weight: 600; }
.mon-version i { width: .8rem; height: .8rem; border-radius: 50%; border: 1px solid var(--fg); }
.block { margin-top: 1.8rem; }
.block h3 { margin-bottom: .7rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: .3rem .7rem; align-items: center; font-variant-numeric: tabular-nums; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; grid-column: span 2; display: grid; grid-template-columns: subgrid; align-items: center; }
.stats dd > span { text-align: right; }
.stats .bar-track { height: .6rem; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.stats .bar-fill { height: 100%; width: calc(var(--v) / 255 * 100%); border-radius: inherit; background: hsl(calc(var(--v) / 180 * 130) 70% 48%); }
.stats .total-row { font-weight: 700; color: var(--fg); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .9rem 1.2rem; }
.kv div { border-left: 2px solid var(--line); padding-left: .6rem; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 600; }
.abilities { display: grid; gap: .6rem; padding: 0; list-style: none; }
.abilities strong { display: block; }
.abilities span { color: var(--muted); }
.abilities em.inactive { color: var(--muted); font-style: italic; }
.abilities em { font-style: normal; font-size: .8rem; color: var(--accent); margin-left: .15rem; }
.matchups { display: grid; gap: .55rem; }
.matchups div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .6rem; align-items: start; }
.matchups dt { color: var(--muted); }
.matchups dd { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.evo { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: 0; list-style: none; }
.evo-step { display: flex; align-items: center; gap: .5rem; }
.evo-stage { display: flex; flex-direction: column; gap: .3rem; }
.evo button {
  display: grid; justify-items: center; padding: .2rem .5rem .4rem; font: 600 .95rem/1.1 var(--font);
  color: var(--fg); background: var(--panel); border: 1px solid transparent; border-radius: .45rem; cursor: pointer;
}
.evo button.is-self { border-color: var(--fg); } /* todas as ocorrências; aria-current só na primeira */
.evo img { width: 72px; height: 72px; image-rendering: pixelated; }
.evo-how { max-width: 10rem; font-size: .82rem; color: var(--muted); text-align: center; }
.evo-stage > div { display: grid; justify-items: center; }
.evo-arrow { color: var(--muted); }
.evo-paths { display: grid; gap: .9rem; }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .98rem; }
.data-table th, .data-table td { padding: .38rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); font-weight: 600; font-size: .88rem; }
.data-table th.n, .data-table td.n { text-align: right; }
.cat { font-size: .82rem; color: var(--muted); }
.none { color: var(--muted); }
@media (max-width: 52rem) {
  .mon-dialog, .mon-dialog[open] { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .mon-sheet { display: block; height: 100%; overflow-y: auto; }
  .mon-close { position: fixed; top: .6rem; right: .6rem; z-index: 5; }
  .mon-head > .num, .mon-head > h2 { padding-right: 0; }
  .mon-nav { padding-right: 5.2rem; }
  .mon-stage, .mon-info { overflow: visible; }
  .mon-platform { min-height: 11rem; }
}

/* Utilitários que têm de ganhar a classes com display próprio (ex.: .btn-ghost). */
[hidden] { display: none !important; }
.kv-title { margin: 1.3rem 0 .7rem; font-size: .88rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dex-count a { color: inherit; }
/* Recebe foco ao fechar uma ficha sem cartão na grelha: com teclado, o contorno vê-se; com rato ou toque, não. */
#pokedex-titulo:focus:not(:focus-visible) { outline: none; }
#pokedex-titulo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: .2rem; }
.mon-info:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
