:root {
  color-scheme: dark;
  --bg: #020b16;
  --bg-deep: #010712;
  --surface: #071a2c;
  --surface-raised: #0a2035;
  --surface-soft: #0d2840;
  --surface-hover: #102f4a;
  --line: #17354d;
  --line-strong: #24516e;
  --text: #fbfdff;
  --muted: #afc0cc;
  --muted-strong: #d5dfe6;
  --gold: #f3c650;
  --gold-soft: #8d6925;
  --cyan: #42c9ff;
  --bar: #eab83f;
  --good: #f4d873;
  --danger: #ff6688;
  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 16px;
  --shadow: 0 18px 45px rgb(0 4 12 / 42%);
  --top-chrome-height: 139px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  scrollbar-color: #315875 #081827;
  scrollbar-width: thin;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% -8%, rgb(23 83 122 / 25%), transparent 34rem),
    radial-gradient(circle at 88% 12%, rgb(16 62 101 / 17%), transparent 30rem),
    linear-gradient(180deg, #020b16 0%, #04111f 46%, #020a14 100%);
  background-attachment: scroll;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgb(72 132 167 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(72 132 167 / 3%) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.top-chrome {
  position: sticky;
  z-index: 40;
  top: 0;
  margin: 0 0 18px;
  clip-path: none;
  border-bottom: 1px solid var(--line);
  background: rgb(2 11 22 / 94%);
  box-shadow: 0 12px 30px rgb(0 5 14 / 34%);
  backdrop-filter: none;
}

.site-header {
  display: flex;
  width: min(calc(100% - 48px), 1680px);
  max-width: none;
  min-height: 82px;
  margin: 0 auto;
  padding: 18px 0 13px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border: 0;
  background: transparent;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background:
    linear-gradient(180deg, var(--gold) 0 43%, #091727 43% 57%, #e8edf2 57%);
  box-shadow: 0 0 20px rgb(243 198 80 / 16%);
}

.brand-mark::before {
  position: absolute;
  top: 50%;
  left: -3px;
  width: 34px;
  height: 3px;
  background: #091727;
  content: "";
  transform: translateY(-50%);
}

.brand-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: #081828;
  content: "";
  transform: translate(-50%, -50%);
}

h1 {
  overflow: hidden;
  color: var(--text);
  font-size: clamp(22px, 2.2vw, 31px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.search-wrap {
  position: relative;
  display: block;
  width: min(360px, 38vw);
  flex: 0 1 360px;
}

.search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  outline: 0;
  background: #061625;
  box-shadow: inset 0 1px 4px rgb(0 3 10 / 45%);
  color: var(--text);
  padding: 0 41px 0 15px;
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search::placeholder {
  color: #718a9f;
}

.search:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgb(66 201 255 / 18%), 0 0 18px rgb(66 201 255 / 10%), inset 0 1px 4px rgb(0 3 10 / 45%);
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  pointer-events: none;
  transform: translateY(-58%);
}

.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  content: "";
  transform: rotate(45deg);
}

.tabs {
  display: flex;
  width: min(calc(100% - 48px), 1680px);
  max-width: none;
  margin: 0 auto;
  padding: 0 0 12px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 6px;
  background: transparent;
}

.mobile-menu-toggle,
.mobile-nav-head,
.nav-backdrop {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  min-width: 112px;
  height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(180deg, #0b2236, #071a2b);
  box-shadow: none;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-shadow: none;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease, transform 120ms ease;
}

.tab::before,
.icon-button::before,
.sprite-toggle::before,
.type-filter-toggle::before,
.type-filter-clear::before,
.back-to-top::before {
  display: none;
}

.tab:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  box-shadow: none;
  color: var(--text);
  transform: translateY(-1px);
}

.tab:active {
  transform: translateY(0);
}

.tab.active {
  border-color: var(--gold-soft);
  background: linear-gradient(180deg, #4b3919, #292112);
  box-shadow: inset 0 0 0 1px rgb(243 198 80 / 5%), 0 0 16px rgb(243 198 80 / 7%);
  color: var(--gold);
}

main {
  width: min(calc(100% - 48px), 1680px);
  max-width: none;
  margin: 0 auto;
  padding: 0 0 56px;
}

#items,
#abilities {
  width: min(100%, 1440px);
  margin-inline: auto;
}

#encounters {
  width: min(100%, 1440px);
  margin-inline: auto;
}

#trainers {
  width: min(100%, 1360px);
  margin-inline: auto;
}

.panel {
  display: none;
  min-width: 0;
}

.panel.active {
  display: block;
  animation: panel-in 180ms ease-out both;
}

.panel-status {
  min-height: 1.4rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.panel-status.loading::before {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -0.05rem;
  animation: docs-spin 0.75s linear infinite;
}

.panel-status.error {
  color: #ffb4a8;
}

.panel-status button {
  margin-left: 0.45rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid currentColor;
  border-radius: 0.45rem;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.detail-loading {
  min-height: 10rem;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.dex-entry,
.ability-row:not(.ability-head) {
  content-visibility: auto;
  contain-intrinsic-size: auto 76px;
}

@keyframes docs-spin {
  to { transform: rotate(360deg); }
}

.data-panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(10 35 56 / 96%), rgb(5 22 37 / 97%));
  box-shadow: var(--shadow), inset 0 1px 0 rgb(116 177 208 / 5%);
}

.table-shell {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(10 35 56 / 96%), rgb(5 22 37 / 97%));
  box-shadow: var(--shadow), inset 0 1px 0 rgb(116 177 208 / 5%);
  backdrop-filter: none;
}

.pokedex-shell {
  overflow: visible;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-strong);
  text-align: left;
  vertical-align: middle;
}

td strong {
  color: var(--text);
}

td {
  font-size: 15px;
}

th {
  background: #0c2439;
  color: #bed0dc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

#machines th,
#items th,
#trainers th {
  position: sticky;
  z-index: 20;
  top: var(--top-chrome-height);
}

tbody tr {
  transition: background 110ms ease, box-shadow 110ms ease;
}

tbody tr:nth-child(even) {
  background: rgb(11 35 55 / 34%);
}

.tm-row,
.item-row {
  cursor: pointer;
}

.tm-row:hover,
.item-row:hover {
  background: var(--surface-hover);
}

.trainer-row {
  cursor: default;
}

.tm-row:focus-visible,
.item-row:focus-visible,
.trainer-row:focus-visible,
.dex-entry:focus-visible,
.ability-row:focus-visible {
  position: relative;
  z-index: 2;
  outline-offset: -2px;
}

#machines th:nth-child(1) {
  width: 64px;
}

#machines th:nth-child(2) {
  width: 150px;
}

#machines th:nth-child(3) {
  width: 88px;
}

#machines th:nth-child(4),
#machines th:nth-child(5),
#machines th:nth-child(6),
#machines th:nth-child(7) {
  width: 54px;
}

#machines td:nth-child(8) {
  min-width: 230px;
}

#machines td:nth-child(9) {
  min-width: 210px;
}

#items th:first-child {
  width: 210px;
}

#items th:last-child {
  width: 38%;
}

#items table {
  table-layout: fixed;
}

#trainers th:first-child,
#trainers td:first-child {
  width: 190px;
}

.dex-row {
  display: grid;
  grid-template-columns: 46px 48px minmax(125px, .85fr) 102px minmax(330px, 1.8fr) minmax(220px, 1.35fr);
  min-width: 1030px;
  min-height: 0;
  padding: 0 12px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.dex-head {
  position: sticky;
  z-index: 20;
  top: var(--top-chrome-height);
  height: 44px;
  background: #0c2439;
  color: #bed0dc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  backdrop-filter: none;
}

.dex-scroller,
#dexRows {
  position: relative;
  overflow: visible;
}

.dex-entry {
  height: auto;
  min-height: 76px;
  margin: 0;
  padding-top: 8px;
  padding-bottom: 8px;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: none;
}

.dex-entry:nth-child(even) {
  background: rgb(11 35 55 / 34%);
}

.dex-entry:hover {
  background: linear-gradient(90deg, var(--gold) 0 3px, var(--surface-hover) 3px);
  box-shadow: none;
}

.dex-id {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dex-name {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dex-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  align-items: center;
  gap: 4px;
}

.dex-stats-head {
  color: var(--muted);
}

.dex-stats-head > span {
  text-align: center;
}

.dex-stat {
  min-width: 0;
  color: var(--muted-strong);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.dex-stat-bst {
  color: var(--text);
}

.sprite {
  width: 42px;
  height: 42px;
  object-fit: contain;
  image-rendering: pixelated;
}

.mini-sprite {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}

.tiny-sprite {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
}

.type-list,
.pill-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.type,
.pill {
  display: inline-flex;
  min-width: 47px;
  height: 24px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 5px;
  box-shadow: inset 0 1px rgb(255 255 255 / 12%);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .025em;
  line-height: 1;
  text-shadow: 0 1px 2px rgb(0 0 0 / 66%);
  text-transform: uppercase;
}

.pill {
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: 24px;
  overflow: hidden;
  border-color: var(--line-strong);
  border-radius: 5px;
  background: rgb(13 43 68 / 42%);
  color: var(--muted-strong);
  font-size: 12px;
  text-overflow: ellipsis;
  text-shadow: none;
  text-transform: none;
  white-space: nowrap;
}

.ability-pill {
  cursor: help;
  box-shadow: none;
  font-weight: 700;
  letter-spacing: .01em;
}

.base-ability-pill {
  border-color: rgb(87 172 121 / 34%);
  background: rgb(23 77 52 / 30%);
  color: #bce8cc;
}

.hidden-ability-pill {
  border-color: rgb(158 113 190 / 36%);
  background: rgb(71 43 91 / 30%);
  color: #dec9ef;
}

.innate-ability-pill {
  border-color: rgb(196 157 61 / 38%);
  background: rgb(91 70 24 / 28%);
  color: #ead18b;
}

.dex-ability-groups {
  display: grid;
  max-height: none;
  overflow: visible;
  align-content: center;
  gap: 3px;
}

.dex-entry .pill-list {
  max-height: none;
  overflow: visible;
}

.type-icon {
  display: block;
  width: 58px;
  height: 22px;
  object-fit: contain;
}

.category-display {
  display: inline-flex;
  min-width: 46px;
  min-height: 20px;
  align-items: center;
  justify-content: center;
}

.category-icon {
  width: 48px;
  height: 22px;
  object-fit: contain;
}

.category-badge {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 8px;
}

.card {
  padding: 0;
  overflow: hidden;
}

.encounter-card > summary {
  display: flex;
  min-height: 50px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.encounter-card > summary::-webkit-details-marker {
  display: none;
}

.encounter-card > summary h2 {
  font-size: 18px;
}

.encounter-card > summary span {
  color: var(--muted);
  font-size: 12px;
}

.encounter-card > summary::after {
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  content: "";
  transform: rotate(45deg);
  transition: transform 130ms ease;
}

.encounter-card[open] > summary {
  border-bottom: 1px solid var(--line);
  background: #091e31;
}

.encounter-card[open] > summary::after {
  transform: rotate(225deg);
}

.encounter-card-body {
  padding: 10px 12px 12px;
}

.encounter-variant + .encounter-variant {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.encounter-time {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 15px;
}

.encounter-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 580px));
  justify-content: start;
  gap: 12px;
}

.encounter-methods > section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgb(2 14 25 / 48%);
}

.encounter-methods .section-title {
  margin: 0 0 9px;
}

.encounter-mon {
  display: grid;
  grid-template-columns: 38px minmax(130px, 1fr) 86px 54px;
  min-height: 46px;
  padding: 4px 7px;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgb(23 53 77 / 64%);
  font-size: 16px;
}

.encounter-mon:nth-child(odd) {
  background: rgb(15 43 66 / 30%);
}

.encounter-mon > span {
  color: var(--muted-strong);
}

.encounter-head {
  min-height: 34px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line-strong);
  color: #b8cad7;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.encounter-species {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.encounter-species:hover {
  color: var(--gold);
}

.rod-divider {
  margin: 8px 0 3px;
  padding-top: 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ability-list {
  display: grid;
  min-height: 0;
  max-height: none;
  overflow: visible;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(10 35 56 / 96%), rgb(5 22 37 / 97%));
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.ability-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(340px, 1fr) 130px;
  min-width: 700px;
  min-height: 62px;
  padding: 11px 16px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.ability-row:nth-child(odd) {
  background: rgb(11 35 55 / 34%);
}

.ability-row:hover {
  background: var(--surface-hover);
}

.ability-row h2 {
  font-size: 15px;
}

.ability-row p {
  color: var(--muted-strong);
  font-size: 15px;
}

.ability-row .muted {
  color: var(--muted);
  font-size: 12px;
}

.ability-head {
  position: sticky;
  z-index: 20;
  top: var(--top-chrome-height);
  min-height: 44px;
  background: #0c2439;
  color: #bed0dc;
  cursor: default;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  backdrop-filter: none;
}

.ability-head:hover {
  background: #0c2439;
}

.ability-tooltip {
  position: fixed;
  z-index: 100;
  display: grid;
  width: min(300px, calc(100vw - 24px));
  padding: 10px 12px;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #0b2135;
  box-shadow: 0 12px 35px rgb(0 4 12 / 60%);
  color: var(--muted-strong);
  font-size: 12px;
  pointer-events: none;
}

.ability-tooltip strong {
  color: var(--gold);
  font-size: 13px;
}

.ability-tooltip[hidden] {
  display: none;
}

dialog {
  position: fixed;
  width: min(92vw, 1320px);
  max-width: none;
  max-height: 88dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  outline: 0;
  background: linear-gradient(180deg, #0a2034, #061625);
  box-shadow: 0 28px 90px rgb(0 3 10 / 78%), inset 0 1px rgb(142 202 231 / 8%);
  color: var(--text);
  backdrop-filter: none;
}

dialog[open] {
  display: flex;
  flex-direction: column;
  animation: modal-in 180ms ease-out both;
}

dialog::backdrop {
  background: rgb(0 5 13 / 78%);
  backdrop-filter: blur(4px);
}

.sheet-handle {
  display: none;
}

.modal-head {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 62px;
  padding: 12px 18px 12px 24px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #0b2237;
  backdrop-filter: none;
}

.modal-head h2 {
  font-size: 20px;
  letter-spacing: -.02em;
}

.icon-button {
  position: relative;
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  overflow: visible;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #0d2941;
  box-shadow: none;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  transition: border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.icon-button:hover {
  border-color: var(--gold);
  box-shadow: none;
  color: var(--gold);
  transform: rotate(4deg);
}

#modalBody {
  min-height: 0;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 16px;
}

.species-summary {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  min-height: 0;
  margin: 0 0 12px;
  padding: 10px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 58px 50%, rgb(46 128 167 / 18%), transparent 85px),
    rgb(3 16 28 / 52%);
}

.species-hero-grid {
  display: grid;
  grid-template-columns: minmax(330px, .9fr) minmax(380px, 1.1fr);
  align-items: stretch;
  gap: 8px;
}

.species-hero-grid > * {
  min-width: 0;
}

.species-hero-grid .species-summary,
.species-hero-grid > .detail-accordion {
  margin: 0;
}

.species-summary .sprite {
  width: 92px;
  height: 92px;
}

.species-sprite-panel {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.sprite-toggle {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  padding: 4px;
  overflow: visible;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #0c2941;
  box-shadow: none;
  cursor: pointer;
}

.sprite-toggle:hover,
.sprite-toggle[aria-pressed="true"] {
  border-color: var(--gold);
  background: #312814;
  box-shadow: 0 0 12px rgb(243 198 80 / 12%);
  transform: none;
}

.shiny-toggle-icon {
  position: relative;
  z-index: 1;
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.species-summary .section-title {
  margin: 10px 0 6px;
  font-size: 13px;
}

.detail-accordion {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgb(3 16 28 / 46%);
}

.detail-accordion > summary {
  display: flex;
  min-height: 48px;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0a2034;
  cursor: pointer;
  list-style: none;
}

.detail-accordion > summary::-webkit-details-marker {
  display: none;
}

.learnset-section > summary::after {
  display: none;
  content: none;
}

.detail-accordion > summary h3 {
  color: var(--gold);
  font-size: 15px;
  letter-spacing: .02em;
}

.detail-accordion[open] > summary {
  border-bottom: 1px solid var(--line);
}

.accordion-icon {
  position: relative;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.accordion-icon::before,
.accordion-icon::after {
  position: absolute;
  top: 5px;
  left: 1px;
  width: 10px;
  height: 1px;
  background: var(--gold);
  content: "";
  transition: transform 130ms ease;
}

.accordion-icon::after {
  transform: rotate(90deg);
}

.detail-accordion[open] .accordion-icon::after {
  transform: rotate(0);
}

.accordion-body {
  min-width: 0;
  padding: 14px 16px 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: 40px 38px minmax(0, 1fr);
  margin: 7px 0;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.stat-row > span {
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar {
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #0d2a3e;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 55%);
}

.bar > span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--bar), var(--good));
  box-shadow: 0 0 9px rgb(243 198 80 / 20%);
}

.location-list,
.move-list,
.item-location-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #041524;
}

.location-list {
  max-height: none;
}

.species-locations .location-list {
  max-height: 180px;
  overflow-y: auto;
}

.location-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(110px, 150px) 80px 50px;
  min-height: 42px;
  padding: 9px 11px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.location-row span {
  color: var(--muted);
}

.location-head,
.move-head {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #0a2034;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  backdrop-filter: none;
}

.move-row {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1fr) 62px 52px 42px 42px;
  min-height: 44px;
  padding: 9px 12px;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  transition: background 110ms ease;
}

.move-row:not(.move-head):hover {
  background: rgb(66 201 255 / 5%);
}

.move-row-compat,
.move-head-compat {
  grid-template-columns: minmax(150px, 1fr) 62px 52px 42px 42px;
}

.move-name {
  min-width: 0;
  padding: 0;
  overflow-wrap: anywhere;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: help;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.move-name:hover {
  color: var(--gold);
}

.move-row .type {
  min-width: 52px;
}

.move-row .category-display {
  min-width: 46px;
}

.move-row .category-icon {
  width: 46px;
}

.evolution-chain {
  display: grid;
  margin: 0;
  gap: 8px;
}

.evolution-line {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
}

.evolution-name {
  display: inline-flex;
  padding: 0;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.evolution-name:hover {
  color: var(--gold);
}

.evolution-arrow {
  color: var(--gold);
}

.evolution-method {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.held-item-list {
  display: grid;
  gap: 4px;
}

.held-item-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.held-item-row span {
  color: var(--muted);
  text-transform: capitalize;
}

.tm-detail {
  display: grid;
  padding: 12px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #041524;
  font-size: 15px;
}

.section-title {
  margin: 16px 0 8px;
  color: var(--gold);
  font-size: 15px;
}

.muted {
  color: var(--muted);
}

.ability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 7px;
}

.species-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  min-height: 44px;
  width: 100%;
  padding: 5px 8px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0a2237;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.species-card:hover {
  border-color: var(--gold-soft);
  background: #102d45;
}

.item-location-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(100px, 200px);
  padding: 8px 10px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.item-location-row span {
  color: var(--muted);
}

.item-name-cell {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.location-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 14px;
  color: var(--muted-strong);
  line-height: 1.35;
}

.location-lines > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.location-lines > span:only-child {
  grid-column: 1 / -1;
}

.item-icon {
  width: 25px;
  height: 25px;
  object-fit: contain;
  image-rendering: pixelated;
}

.trainer-party {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.trainer-name-cell {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.trainer-sprite {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}

.trainer-party-summary {
  display: none;
}

.trainer-mon {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  width: auto;
  min-width: 0;
  max-width: 360px;
  flex: 1 1 270px;
  padding: 7px 8px;
  align-items: start;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0b263c;
  box-shadow: none;
}

.trainer-mon-info {
  display: grid;
  min-width: 0;
  gap: 2px;
  font-size: 12px;
}

.trainer-mon-sprite,
.trainer-mon-name {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.trainer-mon-sprite {
  width: 32px;
  height: 32px;
}

.trainer-mon-title strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trainer-mon-name:hover {
  color: var(--gold);
}

.trainer-mon-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  min-height: 30px;
  align-items: start;
  gap: 4px;
}

.trainer-held-item-button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: help;
}

.trainer-held-item {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.trainer-mon-details {
  display: grid;
  margin-top: 4px;
  padding-top: 4px;
  gap: 3px;
  border-top: 1px solid var(--line);
}

.trainer-mon-detail {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.trainer-mon-detail span {
  color: var(--gold);
  font-weight: 700;
}

.trainer-mon-detail strong {
  color: var(--muted-strong);
  font-size: 12px;
}

.trainer-stat-spread,
.trainer-moves {
  grid-template-columns: 58px minmax(0, 1fr);
}

.trainer-move-name {
  display: inline;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.trainer-ability {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: help;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.trainer-ability:hover,
.trainer-ability:focus-visible {
  color: var(--gold);
}

.trainer-detail-hero {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  min-height: 120px;
  padding: 12px;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 52px 55%, rgb(46 128 167 / 18%), transparent 80px),
    #041524;
}

.trainer-detail-sprite {
  width: 92px;
  height: 92px;
  object-fit: contain;
  image-rendering: pixelated;
}

.trainer-detail-hero p {
  margin-top: 6px;
  color: var(--muted-strong);
  font-size: 14px;
}

.type-filter {
  position: fixed;
  z-index: 35;
  bottom: 16px;
  left: 16px;
  display: none;
}

body[data-active-tab="pokedex"] .type-filter {
  display: block;
}

.type-filter-toggle,
.type-filter-clear,
.back-to-top {
  position: relative;
  height: 32px;
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #0a2135;
  box-shadow: 0 8px 22px rgb(0 4 12 / 44%);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.type-filter-toggle {
  min-width: 54px;
  padding: 0 11px;
  opacity: .88;
}

.type-filter-toggle:hover,
.type-filter-clear:hover,
.back-to-top:hover,
.type-filter-toggle.has-filter {
  border-color: var(--gold);
  color: var(--gold);
  transform: none;
}

.type-filter-panel {
  position: absolute;
  width: min(310px, calc(100vw - 24px));
  padding: 10px;
  bottom: 39px;
  left: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #081c2e;
  box-shadow: 0 16px 40px rgb(0 4 12 / 65%);
  backdrop-filter: none;
}

.type-filter-panel[hidden] {
  display: none;
}

.type-filter-title {
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.type-filter-clear {
  width: 100%;
  margin-bottom: 7px;
}

.type-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.type-filter-chip {
  width: 100%;
  height: 23px;
  cursor: pointer;
  opacity: .5;
}

.type-filter-chip.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgb(243 198 80 / 20%);
  opacity: 1;
}

.back-to-top {
  position: fixed;
  z-index: 30;
  right: 16px;
  bottom: 16px;
  display: none;
  width: 32px;
  padding: 0;
  font-size: 15px;
}

@media (min-width: 1680px) {
  body {
    zoom: 1.5;
  }

  dialog {
    width: min(61.3333vw, 1320px);
    max-height: 58.6667dvh;
  }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.985) translateY(5px); }
  to { opacity: 1; transform: none; }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 1100px) {
  :root {
    --top-chrome-height: 129px;
  }

  body {
    overflow-x: hidden;
    font-size: 15px;
  }

  .top-chrome {
    position: sticky;
    margin-bottom: 10px;
  }

  .site-header {
    display: grid;
    width: 100%;
    min-height: 0;
    padding: 10px 12px 8px;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
    border-width: 2px;
  }

  .brand-mark::before {
    left: -2px;
    width: 26px;
    height: 2px;
  }

  .brand-mark::after {
    width: 8px;
    height: 8px;
    border-width: 1px;
  }

  h1 {
    font-size: 17px;
  }

  .site-header p {
    display: none;
  }

  .search-wrap {
    width: 100%;
    flex: none;
    grid-column: 1 / -1;
  }

  .search {
    height: 34px;
    padding-left: 12px;
    font-size: 14px;
  }

  .tabs {
    position: fixed;
    z-index: 60;
    top: 0;
    left: 0;
    display: flex;
    width: min(84vw, 320px);
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    justify-content: flex-start;
    flex-direction: column;
    gap: 7px;
    border-right: 1px solid var(--line-strong);
    background: linear-gradient(165deg, #0a2033, #03101d 72%);
    box-shadow: 18px 0 48px rgb(0 3 10 / 52%);
    transform: translateX(-105%);
    transition: transform 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .tabs {
    transform: translateX(0);
    transition-delay: 0s;
    visibility: visible;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    width: 38px;
    height: 38px;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #071a2b;
    color: var(--text);
    cursor: pointer;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .mobile-menu-toggle:hover,
  .mobile-menu-toggle:focus-visible,
  .mobile-menu-close:hover,
  .mobile-menu-close:focus-visible {
    border-color: var(--gold-soft);
    outline: 0;
    color: var(--gold);
  }

  .mobile-nav-head {
    display: flex;
    min-height: 48px;
    margin-bottom: 5px;
    padding: 0 2px 12px 5px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 17px;
  }

  .mobile-menu-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #061625;
    color: var(--muted-strong);
    cursor: pointer;
    font: inherit;
    font-size: 24px;
    line-height: 1;
  }

  .nav-backdrop {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: block;
    background: rgb(0 5 14 / 68%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
    visibility: visible;
  }

  .tab {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: auto;
    flex: none;
    padding: 10px 13px;
    justify-content: flex-start;
    border-radius: 8px;
    font-size: 14px;
  }

  .tab[data-tab="encounters"] {
    min-width: 0;
  }

  main {
    width: 100%;
    padding: 0 9px 52px;
  }

  .pokedex-shell {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .dex-head {
    display: none;
  }

  .dex-row {
    min-width: 0;
  }

  .dex-entry {
    display: grid;
    grid-template-columns: 42px 54px minmax(0, 1fr);
    height: auto;
    min-height: 0;
    margin-bottom: 7px;
    padding: 8px;
    align-items: center;
    gap: 4px 7px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #0a2338, #061827);
    box-shadow: none;
  }

  .dex-entry:nth-child(even) {
    background: linear-gradient(145deg, #0b263d, #071a2a);
  }

  .dex-entry:hover {
    background: linear-gradient(145deg, #102f49, #082036);
    box-shadow: inset 3px 0 var(--gold);
  }

  .dex-id {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding-top: 3px;
    font-size: 12px;
    font-weight: 800;
  }

  .dex-sprite {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .dex-sprite .sprite {
    width: 50px;
    height: 50px;
  }

  .dex-name {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    font-size: 18px;
  }

  .dex-types {
    grid-column: 3;
    grid-row: 2;
    align-self: start;
  }

  .dex-stats {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin-top: 4px;
    padding: 6px 4px;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgb(2 14 25 / 48%);
  }

  .dex-stat {
    display: flex;
    grid-column: auto;
    grid-row: auto;
    min-height: 0;
    padding: 0;
    flex-direction: column;
    gap: 1px;
    border: 0;
    background: transparent;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
  }

  .dex-stat::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .dex-stat::after {
    display: none;
    content: none;
  }

  .dex-abilities {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 2px;
  }

  .dex-ability-groups {
    display: grid;
    max-height: none;
    gap: 3px;
  }

  .dex-entry .pill {
    height: 22px;
    font-size: 10px;
  }

  #machines .table-shell,
  #items .table-shell,
  #trainers .table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #machines table,
  #machines tbody,
  #items table,
  #items tbody,
  #trainers table,
  #trainers tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #machines thead,
  #items thead,
  #trainers thead {
    display: none;
  }

  #machines .tm-row,
  #items .item-row,
  #trainers .trainer-row {
    width: 100%;
    min-width: 0;
    margin-bottom: 7px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #0a2338, #061827);
    box-shadow: 0 8px 24px rgb(0 4 12 / 27%);
  }

  #machines .tm-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px;
  }

  #machines td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 5px 6px;
    border: 0;
    overflow-wrap: anywhere;
  }

  #machines td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }

  #machines td:nth-child(2) {
    grid-column: 2 / -1;
  }

  #machines td:nth-child(8),
  #machines td:nth-child(9) {
    grid-column: 1 / -1;
    padding-top: 7px;
    border-top: 1px solid var(--line);
    color: var(--muted-strong);
    font-size: 14px;
  }

  #items .item-row,
  #trainers .trainer-row {
    display: grid;
  }

  #items td,
  #trainers td {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  #items td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }

  #items td:first-child {
    padding-top: 9px;
  }

  #items td:first-child::before,
  #trainers td::before {
    display: none;
  }

  #items td:nth-child(2),
  #items td:nth-child(3) {
    color: var(--muted-strong);
    font-size: 14px;
  }

  #trainers .trainer-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  #trainers td {
    padding: 7px 9px;
    border: 0;
  }

  #trainers td:first-child {
    width: 100%;
  }

  #trainers td + td {
    border-top: 1px solid var(--line);
  }

  .trainer-name-cell {
    grid-template-columns: 45px minmax(0, 1fr);
  }

  .trainer-sprite {
    width: 42px;
    height: 42px;
  }

  .trainer-party-details {
    display: block;
  }

  .trainer-party-summary {
    display: none;
  }

  #trainers .trainer-party {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  #trainers .trainer-mon {
    width: 100%;
    max-width: none;
  }

  .location-lines {
    grid-template-columns: minmax(0, 1fr);
  }

  .ability-list {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 7px;
  }

  .ability-head {
    display: none;
  }

  .ability-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 58px;
    padding: 9px 10px;
    gap: 4px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #0a2338, #061827);
    box-shadow: 0 8px 24px rgb(0 4 12 / 27%);
  }

  .ability-row.ability-head {
    display: none;
  }

  .ability-row:nth-child(odd) {
    background: linear-gradient(145deg, #0b263d, #071a2a);
  }

  .ability-row h2 {
    grid-column: 1;
    grid-row: 1;
  }

  .ability-row > p:not(.muted) {
    grid-column: 1 / -1;
    grid-row: 2;
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted-strong);
    font-size: 13px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .ability-row .muted {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    white-space: nowrap;
  }

  .encounter-card > summary {
    min-height: 39px;
    padding: 0 10px;
  }

  .encounter-card > summary h2 {
    font-size: 18px;
  }

  .encounter-card-body {
    padding: 8px;
  }

  .encounter-methods {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .encounter-methods > section {
    padding: 7px;
  }

  .encounter-mon {
    grid-template-columns: 28px minmax(76px, 1fr) 66px 36px;
    padding: 1px 3px;
    gap: 4px;
    min-height: 42px;
    padding: 4px 5px;
    font-size: 14px;
  }

  .encounter-mon .mini-sprite {
    width: 28px;
    height: 28px;
  }

  .species-hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 85dvh;
    margin: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  dialog[open] {
    display: flex;
    animation: sheet-up 220ms cubic-bezier(.2, .8, .25, 1) both;
  }

  .sheet-handle {
    display: block;
    width: 42px;
    height: 4px;
    margin: 8px auto 1px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #537084;
  }

  .modal-head {
    min-height: 45px;
    padding: 5px 10px 8px 14px;
    background: transparent;
  }

  .modal-head h2 {
    font-size: 18px;
  }

  #modalBody {
    padding: 14px 12px max(20px, env(safe-area-inset-bottom));
    font-size: 15px;
  }

  .species-summary {
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 100px;
    padding: 8px;
    gap: 10px;
  }

  .species-summary .sprite {
    width: 76px;
    height: 76px;
  }

  .species-summary .section-title {
    margin: 8px 0 4px;
  }

  .detail-accordion {
    margin-top: 7px;
  }

  .detail-accordion > summary {
    min-height: 44px;
    padding: 0 12px;
  }

  .accordion-body {
    padding: 10px;
  }

  .move-row {
    grid-template-columns: 27px minmax(72px, 1fr) 50px 46px 28px 28px;
    min-height: 40px;
    padding: 7px 4px;
    gap: 3px;
    font-size: 11px;
  }

  .move-row-compat,
  .move-head-compat {
    grid-template-columns: minmax(72px, 1fr) 50px 46px 28px 28px;
  }

  .move-name {
    font-size: 11px;
  }

  .move-row .type {
    min-width: 48px;
    height: 18px;
    padding: 0 3px;
    font-size: 9px;
  }

  .move-row .category-display,
  .move-row .category-icon {
    width: 44px;
    min-width: 44px;
    height: 20px;
  }

  .location-row {
    grid-template-columns: minmax(90px, 1fr) 80px 62px 34px;
    min-height: 40px;
    padding: 7px 5px;
    gap: 4px;
    font-size: 11px;
  }

  .evolution-line {
    flex-wrap: wrap;
    font-size: 12px;
  }

  .ability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .species-card {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 43px;
    padding: 4px 6px;
    font-size: 11px;
  }

  dialog[data-kind="trainer"] .trainer-party {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  dialog[data-kind="trainer"] .trainer-mon {
    width: 100%;
  }

  .trainer-detail-hero {
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 100px;
    padding: 8px;
    gap: 10px;
  }

  .trainer-detail-sprite {
    width: 76px;
    height: 76px;
  }

  .type-filter {
    bottom: 11px;
    left: 10px;
  }

  .back-to-top {
    right: 10px;
    bottom: 11px;
    display: block;
  }
}

@media (max-width: 380px) {
  .ability-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .location-row {
    grid-template-columns: minmax(82px, 1fr) 72px 55px 30px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Movedex */
#moves th {
  position: sticky;
  z-index: 20;
  top: var(--top-chrome-height);
}

#moves th:nth-child(1) {
  width: 58px;
}

#moves th:nth-child(2) {
  width: 170px;
}

#moves th:nth-child(3) {
  width: 120px;
}

#moves th:nth-child(4) {
  width: 70px;
}

#moves th:nth-child(n + 5):nth-child(-n + 8) {
  width: 72px;
}

.move-dex-row {
  cursor: pointer;
}

.move-dex-row:hover {
  background: var(--surface-hover);
}

.move-dex-row:focus-visible {
  position: relative;
  z-index: 2;
  outline-offset: -2px;
}

.move-detail-summary {
  display: grid;
  gap: 14px;
}

.move-detail-summary > .type-list {
  justify-self: start;
}

.move-detail-summary > .category-display {
  justify-self: start;
}

.move-detail-summary dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.move-detail-summary dl > div {
  display: grid;
  padding: 10px 12px;
  gap: 2px;
  border-right: 1px solid var(--line);
}

.move-detail-summary dl > div:last-child {
  border-right: 0;
}

.move-detail-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.move-detail-summary dd {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.move-learner-groups {
  display: grid;
  gap: 7px;
}

.move-learner-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.move-learner-group > summary {
  display: flex;
  min-height: 42px;
  padding: 8px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.move-learner-group > summary::-webkit-details-marker {
  display: none;
}

.move-learner-group > summary span {
  color: var(--muted);
  font-size: 12px;
}

.move-learner-body {
  padding: 10px;
  border-top: 1px solid var(--line);
}

/* Expandable player guides */
#guides {
  width: min(100%, 1280px);
  margin-inline: auto;
}

.guide-list {
  display: grid;
  gap: 10px;
}

.guide-card,
.guide-empty {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #0a2135, #061523);
  box-shadow: 0 12px 30px rgb(0 4 12 / 28%);
}

.guide-card > summary {
  display: grid;
  min-height: 82px;
  padding: 15px 18px;
  align-items: center;
  grid-template-columns: 120px minmax(0, 1fr) 26px;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.guide-card > summary::-webkit-details-marker {
  display: none;
}

.guide-card > summary:hover {
  background: var(--surface-hover);
}

.guide-card[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.guide-category {
  display: inline-flex;
  min-height: 27px;
  padding: 4px 9px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background: #2b2213;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.guide-summary-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.guide-summary-copy strong {
  color: var(--text);
  font-size: 18px;
}

.guide-summary-copy > span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-expand {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.guide-expand::before,
.guide-expand::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 1px;
  background: var(--gold);
  content: "";
  transform: translate(-50%, -50%);
}

.guide-expand::after {
  transform: translate(-50%, -50%) rotate(90deg);
  transition: transform 140ms ease;
}

.guide-card[open] .guide-expand::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.guide-content {
  padding: clamp(18px, 3vw, 36px);
  color: var(--muted-strong);
  font-size: 16px;
  line-height: 1.7;
}

.guide-content > * + * {
  margin-top: 16px;
}

.guide-content h2,
.guide-content h3,
.guide-content h4 {
  color: var(--text);
  line-height: 1.25;
}

.guide-content h2 {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  font-size: 22px;
}

.guide-content h3 {
  font-size: 18px;
}

.guide-content h4 {
  font-size: 16px;
}

.guide-content ul,
.guide-content ol {
  display: grid;
  margin-bottom: 0;
  padding-left: 25px;
  gap: 7px;
}

.guide-content a {
  color: var(--cyan);
}

.guide-content code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #03101c;
  color: #d8efff;
  padding: 2px 5px;
  font-size: .9em;
}

.guide-content pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #020b14;
  padding: 13px;
}

.guide-content pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.guide-content blockquote {
  margin-right: 0;
  margin-left: 0;
  border-left: 3px solid var(--gold);
  background: rgb(243 198 80 / 6%);
  padding: 11px 14px;
}

.guide-content figure {
  display: grid;
  margin-right: 0;
  margin-left: 0;
  justify-items: center;
  gap: 7px;
}

.guide-image {
  display: block;
  width: auto;
  max-width: min(100%, 1000px);
  max-height: 70vh;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: var(--shadow);
}

.guide-image.guide-image-small {
  max-width: min(100%, 360px);
}

.guide-image.guide-image-medium {
  max-width: min(100%, 640px);
}

.guide-image.guide-image-large {
  max-width: min(100%, 1000px);
}

.guide-content figcaption {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.guide-content hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.guide-empty {
  padding: 28px;
  text-align: center;
}

.guide-empty p {
  margin-top: 6px;
}

@media (max-width: 1100px) {
  #moves .table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #moves table,
  #moves tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #moves thead {
    display: none;
  }

  #moves .move-dex-row {
    display: grid;
    width: 100%;
    min-width: 0;
    margin-bottom: 7px;
    padding: 6px;
    overflow: hidden;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #0a2338, #061827);
    box-shadow: 0 8px 24px rgb(0 4 12 / 27%);
  }

  #moves td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 5px 6px;
    border: 0;
    overflow-wrap: anywhere;
  }

  #moves td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }

  #moves td:nth-child(2) {
    grid-column: 2 / -1;
  }

  #moves td:nth-child(9) {
    grid-column: 1 / -1;
    padding-top: 7px;
    border-top: 1px solid var(--line);
    color: var(--muted-strong);
    font-size: 14px;
  }

  .move-detail-summary dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .move-detail-summary dl > div:nth-child(2) {
    border-right: 0;
  }

  .move-detail-summary dl > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .guide-card > summary {
    min-height: 74px;
    padding: 11px;
    grid-template-columns: minmax(0, 1fr) 24px;
    gap: 7px 10px;
  }

  .guide-category {
    grid-column: 1;
    justify-self: start;
    min-height: 22px;
    padding: 2px 7px;
    font-size: 9px;
  }

  .guide-summary-copy {
    grid-column: 1;
  }

  .guide-summary-copy strong {
    font-size: 16px;
  }

  .guide-summary-copy > span {
    display: -webkit-box;
    font-size: 12px;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .guide-expand {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
  }

  .guide-content {
    padding: 15px 13px 20px;
    font-size: 14px;
  }

  .guide-content h2 {
    font-size: 19px;
  }

  .guide-image {
    max-height: 58vh;
  }
}

/*
 * Field guide theme
 *
 * Keep the dense documentation UI, but trade the glossy dashboard treatment
 * for flat, ruled surfaces inspired by printed game guides and fan wikis.
 */
:root {
  color-scheme: light;
  --bg: #e8e5dc;
  --bg-deep: #d9d5ca;
  --surface: #f7f5ee;
  --surface-raised: #fffdf7;
  --surface-soft: #ece8dd;
  --surface-hover: #f4eccf;
  --line: #c9c3b5;
  --line-strong: #85877e;
  --text: #202a28;
  --muted: #6a716d;
  --muted-strong: #3e4946;
  --gold: #b7622e;
  --gold-soft: #9a6d36;
  --cyan: #1f6872;
  --bar: #b7622e;
  --good: #687b4d;
  --danger: #a13d38;
  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;
  --shadow: none;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  scrollbar-color: #85877e #e8e5dc;
}

html {
  background: var(--bg-deep);
}

body {
  background: var(--bg);
  color: var(--text);
}

body::before {
  display: none;
}

button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline-color: var(--gold);
}

.top-chrome {
  border-top: 4px solid var(--gold);
  border-bottom: 1px solid #101a18;
  background: #263532;
  box-shadow: none;
}

.site-header {
  min-height: 72px;
  padding-block: 14px 10px;
}

.brand {
  gap: 12px;
}

.brand > div::after {
  display: block;
  margin-top: 3px;
  color: #bfc6bf;
  content: "JOHTO FIELD REFERENCE";
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

.brand-mark {
  border-color: #d8a23f;
  border-radius: 50%;
  background:
    linear-gradient(180deg, #c96e36 0 43%, #263532 43% 57%, #f2ead7 57%);
  box-shadow: none;
}

.brand-mark::before {
  background: #263532;
}

.brand-mark::after {
  border-color: #d8a23f;
  background: #263532;
}

h1 {
  color: #fffaf0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.1vw, 31px);
  font-weight: 700;
  letter-spacing: -.015em;
}

.search {
  height: 36px;
  padding-left: 12px;
  border-color: #73817c;
  border-radius: 2px;
  background: #f5f1e6;
  box-shadow: none;
  color: var(--text);
}

.search::placeholder {
  color: #777d77;
}

.search:focus {
  border-color: #d8a23f;
  box-shadow: 0 0 0 2px rgb(216 162 63 / 24%);
}

.search-icon {
  border-color: #9f572c;
}

.search-icon::after {
  border-radius: 0;
  background: #9f572c;
}

.tabs {
  gap: 0;
  padding-bottom: 0;
}

.tab {
  min-width: 0;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid #40504c;
  border-right: 1px solid #40504c;
  border-radius: 0;
  background: #1e2c2a;
  color: #d9ded8;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.tab:first-of-type {
  border-left: 1px solid #40504c;
}

.tab:hover {
  border-color: #40504c;
  background: #33433f;
  color: #fffaf0;
  transform: none;
}

.tab.active {
  border-color: #40504c;
  background: #f0e7d2;
  box-shadow: inset 0 4px var(--gold);
  color: #28332f;
}

main {
  padding-bottom: 64px;
}

.panel.active {
  animation: none;
}

.panel-status {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

.panel-status.error {
  color: var(--danger);
}

.data-panel,
.card,
.table-shell,
.ability-list {
  border-color: var(--line-strong);
  border-radius: 2px;
  background: var(--surface-raised);
  box-shadow: none;
}

th,
td {
  border-bottom-color: var(--line);
  color: var(--muted-strong);
}

th,
.dex-head,
.ability-head {
  background: #3d4b47;
  color: #f6f0e2;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: .08em;
}

td {
  font-size: 14px;
}

tbody tr:nth-child(even),
.dex-entry:nth-child(even),
.ability-row:nth-child(odd) {
  background: #f1eee6;
}

tbody tr:hover,
.tm-row:hover,
.item-row:hover,
.move-dex-row:hover,
.ability-row:hover {
  background: var(--surface-hover);
}

.dex-entry {
  border-bottom-color: var(--line);
  background: var(--surface-raised);
}

.dex-entry:hover {
  background: var(--surface-hover);
  box-shadow: inset 4px 0 var(--gold);
}

.dex-id,
.dex-stats-head,
.dex-stat {
  color: var(--muted);
}

.dex-head .dex-stats-head {
  color: #f6f0e2;
}

.dex-name,
.dex-stat-bst {
  color: var(--text);
}

.type,
.pill {
  border-radius: 2px;
  box-shadow: none;
  text-shadow: none;
}

.type {
  border-color: rgb(0 0 0 / 14%);
  font-size: 10px;
}

.pill {
  border-color: #aaa99f;
  background: #f0eee7;
  color: #39423f;
}

.base-ability-pill {
  border-color: #88a18a;
  background: #e2ede2;
  color: #315b3d;
}

.hidden-ability-pill {
  border-color: #a995ae;
  background: #ebe3ee;
  color: #654c70;
}

.innate-ability-pill {
  border-color: #b7a46e;
  background: #f2ead2;
  color: #72581f;
}

.category-badge {
  border-radius: 2px;
  background: #e8e5dc;
}

.encounter-card > summary,
.detail-accordion > summary,
.move-learner-group > summary {
  background: #eeeae0;
}

.encounter-card > summary:hover,
.detail-accordion > summary:hover,
.move-learner-group > summary:hover {
  background: #e7dfca;
}

.encounter-card[open] > summary,
.guide-card[open] > summary {
  background: #e7dfca;
}

.encounter-card > summary h2,
.ability-row h2 {
  color: var(--text);
}

.encounter-methods > section {
  border-radius: 2px;
  background: #f3f0e8;
}

.encounter-mon:nth-child(odd) {
  background: #ebe8df;
}

.encounter-head,
.rod-divider,
.encounter-time,
.section-title,
.detail-accordion > summary h3 {
  color: #8f4b27;
}

.encounter-species,
.move-name,
.evolution-name,
.trainer-mon-name,
.trainer-mon-sprite,
.trainer-ability {
  color: var(--text);
}

.encounter-species:hover,
.move-name:hover,
.evolution-name:hover,
.trainer-mon-name:hover,
.trainer-ability:hover,
.trainer-ability:focus-visible {
  color: var(--gold);
}

.ability-tooltip {
  border-radius: 2px;
  background: #263532;
  box-shadow: 4px 4px 0 rgb(32 42 40 / 18%);
  color: #f2eee3;
}

.ability-tooltip strong {
  color: #e1ae62;
}

dialog {
  border-color: #5e6864;
  border-radius: 4px;
  background: var(--surface-raised);
  box-shadow: 10px 12px 0 rgb(32 42 40 / 22%);
  color: var(--text);
}

dialog[open] {
  animation: none;
}

dialog::backdrop {
  background: rgb(27 34 32 / 72%);
  backdrop-filter: none;
}

.modal-head {
  border-color: #182421;
  background: #32413d;
}

.modal-head h2 {
  color: #fffaf0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.icon-button,
.sprite-toggle {
  border-color: #8d928b;
  border-radius: 2px;
  background: #f1ede3;
  color: #37423f;
}

.icon-button:hover,
.sprite-toggle:hover,
.sprite-toggle[aria-pressed="true"] {
  border-color: #d19865;
  background: #f1dfc6;
  box-shadow: none;
  color: #7d4223;
  transform: none;
}

.species-summary,
.trainer-detail-hero {
  border-radius: 2px;
  background: #f1eee5;
}

.detail-accordion,
.location-list,
.move-list,
.item-location-list,
.tm-detail,
.move-detail-summary dl,
.move-learner-group {
  border-radius: 2px;
  background: var(--surface-raised);
}

.accordion-icon::before,
.accordion-icon::after {
  background: var(--gold);
}

.bar {
  border-radius: 0;
  background: #d7d4ca;
  box-shadow: none;
}

.bar > span {
  border-radius: 0;
  background: var(--bar);
  box-shadow: none;
}

.location-head,
.move-head {
  background: #e5e1d7;
}

.move-row:not(.move-head):hover {
  background: var(--surface-hover);
}

.evolution-arrow,
.evolution-method,
.trainer-mon-detail span {
  color: var(--gold);
}

.species-card,
.trainer-mon {
  border-radius: 2px;
  background: #f1eee6;
}

.species-card:hover {
  border-color: var(--gold-soft);
  background: var(--surface-hover);
}

.trainer-mon-details {
  border-top-color: var(--line);
}

.type-filter-toggle,
.type-filter-clear,
.back-to-top {
  border-color: #6f7772;
  border-radius: 2px;
  background: #f7f4eb;
  box-shadow: 3px 3px 0 rgb(38 53 50 / 16%);
  color: #3d4945;
}

.type-filter-panel {
  border-color: #6f7772;
  border-radius: 2px;
  background: #f7f4eb;
  box-shadow: 5px 5px 0 rgb(38 53 50 / 18%);
}

.type-filter-title {
  color: #8f4b27;
}

.type-filter-chip.active {
  border-color: #714220;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 32%);
}

.guide-card,
.guide-empty {
  border-radius: 2px;
  background: var(--surface-raised);
  box-shadow: none;
}

.guide-card > summary:hover {
  background: var(--surface-hover);
}

.guide-category {
  border-color: #9e7343;
  border-radius: 2px;
  background: #eee2ca;
  color: #774322;
}

.guide-summary-copy strong,
.guide-content h2,
.guide-content h3,
.guide-content h4 {
  color: var(--text);
}

.guide-expand {
  border-radius: 2px;
}

.guide-content {
  color: var(--muted-strong);
}

.guide-content a {
  color: #1f6872;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.guide-content code {
  border-radius: 2px;
  background: #e7e3d9;
  color: #34433f;
}

.guide-content pre {
  border-radius: 2px;
  background: #26312f;
  color: #f1eee4;
}

.guide-content pre code {
  color: inherit;
}

.guide-content blockquote {
  background: #eee7d6;
}

.guide-image {
  border-radius: 2px;
  box-shadow: none;
}

@media (min-width: 1680px) {
  body {
    zoom: 1;
  }

  dialog {
    width: min(92vw, 1320px);
    max-height: 88dvh;
  }
}

@media (max-width: 1100px) {
  .top-chrome {
    border-top-width: 3px;
  }

  .site-header {
    padding: 9px 10px 8px;
  }

  .brand > div::after {
    display: none;
  }

  h1 {
    font-size: 19px;
  }

  .search {
    background: #f5f1e6;
  }

  .mobile-menu-toggle,
  .mobile-menu-close {
    border-color: #697771;
    border-radius: 2px;
    background: #1e2c2a;
    color: #f5f0e5;
  }

  .tabs {
    border-color: #17221f;
    background: #263532;
    box-shadow: 8px 0 0 rgb(27 34 32 / 24%);
  }

  .mobile-nav-head {
    color: #fffaf0;
  }

  .tab,
  .tab:first-of-type {
    min-height: 42px;
    border: 0;
    border-bottom: 1px solid #43534f;
    background: transparent;
    color: #e0e4df;
  }

  .tab:hover {
    background: #33443f;
  }

  .tab.active {
    background: #f0e7d2;
    box-shadow: inset 4px 0 var(--gold);
    color: #28332f;
  }

  .nav-backdrop {
    background: rgb(27 34 32 / 66%);
  }

  .dex-entry,
  .dex-entry:nth-child(even),
  #machines .tm-row,
  #items .item-row,
  #trainers .trainer-row,
  #moves .move-dex-row,
  .ability-row,
  .ability-row:nth-child(odd) {
    border-color: #aaa69b;
    border-radius: 2px;
    background: var(--surface-raised);
    box-shadow: none;
  }

  .dex-entry:hover,
  #machines .tm-row:hover,
  #items .item-row:hover,
  #moves .move-dex-row:hover,
  .ability-row:hover {
    background: var(--surface-hover);
    box-shadow: inset 4px 0 var(--gold);
  }

  .dex-stats {
    border-radius: 2px;
    background: #eeeae0;
  }

  .dex-name {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
  }

  dialog {
    border-radius: 4px 4px 0 0;
    box-shadow: 0 -5px 0 rgb(32 42 40 / 16%);
  }

  .sheet-handle {
    border-radius: 0;
    background: #8c8d84;
  }

  .modal-head {
    background: #32413d;
  }

  .guide-card > summary {
    background: var(--surface-raised);
  }
}

/* Header identity and optional color theme */
.brand-mark {
  display: none;
}

.brand {
  gap: 0;
}

.header-actions {
  display: flex;
  width: min(470px, 46vw);
  margin-left: auto;
  align-items: center;
  gap: 7px;
}

.header-actions .search-wrap {
  width: 100%;
  flex: 1 1 auto;
}

.theme-toggle {
  display: inline-flex;
  min-width: 78px;
  height: 36px;
  padding: 0 11px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #73817c;
  border-radius: 2px;
  background: transparent;
  color: #e2e3dc;
  cursor: pointer;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.theme-toggle:hover {
  border-color: #d8a23f;
  background: #33433f;
  color: #fffaf0;
}

.theme-toggle-icon {
  display: block;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171c1a;
  --bg-deep: #0f1311;
  --surface: #202622;
  --surface-raised: #252b27;
  --surface-soft: #2d342f;
  --surface-hover: #3b382c;
  --line: #444c47;
  --line-strong: #69716c;
  --text: #f0ece1;
  --muted: #a5aaa4;
  --muted-strong: #d0d3cd;
  --gold: #d17d46;
  --gold-soft: #b7895d;
  --cyan: #75b6bd;
  --bar: #c87542;
  --good: #899c6b;
  --danger: #e4867e;
}

:root[data-theme="dark"] * {
  scrollbar-color: #68716b #171c1a;
}

:root[data-theme="dark"] .search {
  border-color: #65726d;
  background: #161d1a;
  color: var(--text);
}

:root[data-theme="dark"] .search::placeholder {
  color: #929a94;
}

:root[data-theme="dark"] .search:focus {
  border-color: #d6a25f;
  box-shadow: 0 0 0 2px rgb(209 125 70 / 24%);
}

:root[data-theme="dark"] .search-icon {
  border-color: #d6a25f;
}

:root[data-theme="dark"] .search-icon::after {
  background: #d6a25f;
}

:root[data-theme="dark"] .theme-toggle {
  border-color: #8f745a;
  background: #362d24;
  color: #f0d7b9;
}

:root[data-theme="dark"] .theme-toggle:hover {
  border-color: #d6a25f;
  background: #463526;
}

:root[data-theme="dark"] .theme-toggle-icon {
  background: currentColor;
}

:root[data-theme="dark"] .tab.active {
  background: #40372b;
  box-shadow: inset 0 4px var(--gold);
  color: #f5e8d3;
}

:root[data-theme="dark"] .panel-status.error {
  color: var(--danger);
}

:root[data-theme="dark"] tbody tr:nth-child(even),
:root[data-theme="dark"] .dex-entry:nth-child(even),
:root[data-theme="dark"] .ability-row:nth-child(odd) {
  background: #202622;
}

:root[data-theme="dark"] tbody tr:hover,
:root[data-theme="dark"] .tm-row:hover,
:root[data-theme="dark"] .item-row:hover,
:root[data-theme="dark"] .move-dex-row:hover,
:root[data-theme="dark"] .ability-row:hover,
:root[data-theme="dark"] .dex-entry:hover {
  background: var(--surface-hover);
}

:root[data-theme="dark"] .pill {
  border-color: #59625c;
  background: #303732;
  color: #dadcd6;
}

:root[data-theme="dark"] .base-ability-pill {
  border-color: #55745d;
  background: #263c2d;
  color: #b9d5bf;
}

:root[data-theme="dark"] .hidden-ability-pill {
  border-color: #74617e;
  background: #392f3e;
  color: #d7c5dd;
}

:root[data-theme="dark"] .innate-ability-pill {
  border-color: #7e704c;
  background: #3b3422;
  color: #dfcb92;
}

:root[data-theme="dark"] .category-badge {
  background: #303732;
}

:root[data-theme="dark"] .encounter-card > summary,
:root[data-theme="dark"] .detail-accordion > summary,
:root[data-theme="dark"] .move-learner-group > summary,
:root[data-theme="dark"] .location-head,
:root[data-theme="dark"] .move-head {
  background: #303631;
}

:root[data-theme="dark"] .encounter-card > summary:hover,
:root[data-theme="dark"] .detail-accordion > summary:hover,
:root[data-theme="dark"] .move-learner-group > summary:hover,
:root[data-theme="dark"] .encounter-card[open] > summary,
:root[data-theme="dark"] .guide-card[open] > summary {
  background: #3b382c;
}

:root[data-theme="dark"] .encounter-methods > section,
:root[data-theme="dark"] .species-summary,
:root[data-theme="dark"] .trainer-detail-hero,
:root[data-theme="dark"] .species-card,
:root[data-theme="dark"] .trainer-mon {
  background: #292f2b;
}

:root[data-theme="dark"] .encounter-mon:nth-child(odd) {
  background: #303631;
}

:root[data-theme="dark"] .encounter-head,
:root[data-theme="dark"] .rod-divider,
:root[data-theme="dark"] .encounter-time,
:root[data-theme="dark"] .section-title,
:root[data-theme="dark"] .detail-accordion > summary h3 {
  color: #e09057;
}

:root[data-theme="dark"] dialog {
  background: var(--surface-raised);
  box-shadow: 10px 12px 0 rgb(0 0 0 / 28%);
}

:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .sprite-toggle {
  border-color: #67716b;
  background: #252c28;
  color: #e1e2dc;
}

:root[data-theme="dark"] .icon-button:hover,
:root[data-theme="dark"] .sprite-toggle:hover,
:root[data-theme="dark"] .sprite-toggle[aria-pressed="true"] {
  border-color: #d19865;
  background: #453326;
  color: #efbd91;
}

:root[data-theme="dark"] .bar {
  background: #464b46;
}

:root[data-theme="dark"] .type-filter-toggle,
:root[data-theme="dark"] .type-filter-clear,
:root[data-theme="dark"] .back-to-top {
  border-color: #69716c;
  background: #252c28;
  box-shadow: 3px 3px 0 rgb(0 0 0 / 24%);
  color: #d8d9d3;
}

:root[data-theme="dark"] .type-filter-panel {
  border-color: #69716c;
  background: #252c28;
  box-shadow: 5px 5px 0 rgb(0 0 0 / 28%);
}

:root[data-theme="dark"] .type-filter-title {
  color: #e09057;
}

:root[data-theme="dark"] .guide-card > summary {
  background: var(--surface-raised);
}

:root[data-theme="dark"] .guide-card > summary:hover {
  background: var(--surface-hover);
}

:root[data-theme="dark"] .guide-category {
  border-color: #9e7343;
  background: #3c3223;
  color: #e4b983;
}

:root[data-theme="dark"] .guide-content a {
  color: #81c1c8;
}

:root[data-theme="dark"] .guide-content code {
  border-color: #525b55;
  background: #1b211e;
  color: #dde1db;
}

:root[data-theme="dark"] .guide-content pre {
  background: #111613;
}

:root[data-theme="dark"] .guide-content blockquote {
  background: #343126;
}

@media (max-width: 1100px) {
  .header-actions {
    width: 100%;
    margin: 0;
    grid-column: 1 / -1;
    gap: 6px;
  }

  .theme-toggle {
    width: 36px;
    min-width: 36px;
    height: 34px;
    padding: 0;
  }

  .theme-toggle-label {
    display: none;
  }

  :root[data-theme="dark"] .tab.active {
    background: #40372b;
    box-shadow: inset 4px 0 var(--gold);
    color: #f5e8d3;
  }

  :root[data-theme="dark"] .dex-entry,
  :root[data-theme="dark"] .dex-entry:nth-child(even),
  :root[data-theme="dark"] #machines .tm-row,
  :root[data-theme="dark"] #items .item-row,
  :root[data-theme="dark"] #trainers .trainer-row,
  :root[data-theme="dark"] #moves .move-dex-row,
  :root[data-theme="dark"] .ability-row,
  :root[data-theme="dark"] .ability-row:nth-child(odd) {
    border-color: #59625c;
    background: var(--surface-raised);
  }

  :root[data-theme="dark"] .dex-entry:hover,
  :root[data-theme="dark"] #machines .tm-row:hover,
  :root[data-theme="dark"] #items .item-row:hover,
  :root[data-theme="dark"] #moves .move-dex-row:hover,
  :root[data-theme="dark"] .ability-row:hover {
    background: var(--surface-hover);
  }

  :root[data-theme="dark"] .dex-stats {
    background: #303631;
  }

  :root[data-theme="dark"] .guide-card > summary {
    background: var(--surface-raised);
  }
}
