/* Cobblemon Wiki (scoped under .wiki, MSS theme) */

/* Tighter top spacing vs site-wide section/page-hero gaps */
.page-hero:has(+ .section .wiki) {
  padding-block: clamp(1.1rem, 2.5vw, 1.75rem);
}

.page-hero:has(+ .section .wiki) .page-hero__title {
  margin-bottom: 0.55rem;
}

.section:has(.wiki) {
  padding-top: clamp(1.1rem, 2.5vw, 1.75rem);
}

.wiki {
  overflow: visible;
  --space: 1rem;
  --space-lg: 1.5rem;
  --radius: var(--radius-sm, 8px);
  --border: rgba(155, 135, 196, 0.22);
  --text: var(--color-text, #e4e2de);
  --muted: var(--color-text-muted, #a8a4b8);
  --bg: var(--color-bg, #0c1224);
  --card-bg: var(--color-bg-card, #161f3a);
  --max: var(--container-max, 1120px);
  color: var(--text);
}

.wiki a {
  color: inherit;
}

/* Overview */
.toolbar {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.wiki-search,
.toolbar input[type="search"] {
  flex: 1 1 200px;
  min-width: 180px;
  min-height: 2.65rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  background: var(--color-bg-raised, #121a32);
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.wiki-search:hover,
.toolbar input[type="search"]:hover {
  border-color: rgba(155, 135, 196, 0.45);
}

.wiki-search:focus,
.toolbar input[type="search"]:focus {
  border-color: var(--color-gold, #c4956a);
  box-shadow: 0 0 0 2px rgba(196, 149, 106, 0.25);
}

.wiki-search::placeholder,
.toolbar input[type="search"]::placeholder {
  color: var(--muted);
}

/* Kill browser default search cancel / clear chrome where possible */
.wiki-search::-webkit-search-decoration,
.wiki-search::-webkit-search-cancel-button,
.wiki-search::-webkit-search-results-button,
.wiki-search::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

.filter-clear {
  flex: 0 0 auto;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--color-bg-raised, #121a32);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.filter-clear:hover {
  border-color: var(--color-gold, #c4956a);
  color: var(--text);
}

.ms-dropdown {
  position: relative;
  flex: 0 1 150px;
  min-width: 130px;
  max-width: 180px;
}

.ms-dropdown__toggle {
  width: 100%;
  height: 100%;
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--color-bg-raised, #121a32);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
}

.ms-dropdown__toggle:hover,
.ms-dropdown.is-open .ms-dropdown__toggle,
.ms-dropdown.has-selection .ms-dropdown__toggle {
  border-color: #7c8798;
}

.ms-dropdown__value {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-dropdown__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
}

.ms-dropdown.is-open .ms-dropdown__caret {
  transform: rotate(180deg);
}

.ms-dropdown__menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--color-bg-raised, #121a32);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.ms-dropdown__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.ms-dropdown__option:hover {
  background: rgba(155, 135, 196, 0.1);
}

.ms-dropdown__option input {
  margin: 0;
  flex-shrink: 0;
}

.sort-select {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 260px;
  min-height: 2.65rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--color-bg-raised, #121a32);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.sort-select option {
  background: var(--color-bg-raised, #121a32);
  color: var(--text);
}

.sort-select:hover,
.sort-select:focus {
  border-color: #7c8798;
  outline: none;
}

/* Poster overview grid — room above for hover lift (no clip) */
.species-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0.4rem 0 0;
  overflow: visible;
}

@media (max-width: 960px) {
  .species-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .species-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .species-grid {
    grid-template-columns: 1fr;
  }
}

.type-badge-link {
  text-decoration: none;
  display: inline-block;
}

.type-badge-link:hover .type-badge {
  outline: 1px solid var(--color-gold, #c4956a);
}

.wiki-hub-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wiki-hub-nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.wiki-hub-nav__link {
  color: var(--muted);
  text-decoration: none;
}

.wiki-hub-nav__link:hover,
.wiki-hub-nav__link.is-active {
  color: var(--color-gold-light, #d4aa7f);
}

.wiki-section-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
}

.wiki-section-nav__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 12, 24, 0.35);
  color: rgba(232, 238, 248, 0.9);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wiki-section-nav__pill:hover {
  border-color: rgba(232, 168, 74, 0.45);
  background: rgba(232, 168, 74, 0.12);
  color: #f0d2a0;
  text-decoration: none;
}

.wiki-section-nav__pill.is-active {
  border-color: rgba(232, 168, 74, 0.6);
  background: rgba(232, 168, 74, 0.22);
  color: #f6dfb3;
  box-shadow: 0 0 0 1px rgba(232, 168, 74, 0.12);
}

.page-hero--has-bg .wiki-section-nav__pill {
  text-shadow: none;
}

.wiki .wiki-section-nav {
  justify-content: flex-start;
  margin: 0 0 1rem;
}

.wiki-hub-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.hub-index-grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}

.hub-index-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
}

.hub-index-card:hover {
  border-color: var(--color-gold, #c4956a);
}

.hub-index-card__count {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.hub-text-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.hub-text-item.is-hidden,
.hub-text-item.is-collapsed,
.hub-load-more.is-hidden {
  display: none;
}

.hub-text-item a {
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
}

.hub-text-item a:hover {
  border-color: var(--color-gold, #c4956a);
}

.hub-text-item__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.hub-text-item__meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.hub-text-item__desc {
  font-size: 0.84rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hub-text-item__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.hub-text-item__stats span {
  white-space: nowrap;
}

.hub-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(10, 14, 26, 0.45);
}

.hub-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 36rem;
}

.hub-table thead th {
  padding: 0.65rem 0.85rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(186, 198, 216, 0.78);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

.hub-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.12s ease;
  cursor: pointer;
}

.hub-table tbody tr:last-child {
  border-bottom: 0;
}

.hub-table tbody tr:hover {
  background: rgba(232, 168, 74, 0.08);
}

.hub-table td,
.hub-table tbody th {
  padding: 0.7rem 0.85rem;
  vertical-align: middle;
  font-size: 0.9rem;
}

.hub-table__name {
  font-weight: 700;
  white-space: nowrap;
}

.hub-table__name a {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #f2f6fc;
  text-decoration: none;
}

.hub-table__name a:hover {
  border: 0;
  color: var(--color-gold, #e8a84a);
}

.hub-table__num {
  width: 5.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #e8eef8;
  white-space: nowrap;
}

.hub-table thead .hub-table__num {
  text-align: right;
}

.hub-table__flag {
  width: 6.5rem;
  white-space: nowrap;
}

.hub-flag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 168, 74, 0.35);
  background: rgba(232, 168, 74, 0.12);
  color: #f0d2a0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hub-flag--empty {
  border-color: transparent;
  background: transparent;
  color: rgba(186, 198, 216, 0.45);
  padding-left: 0;
}

.hub-table__desc {
  color: var(--muted, #9aa8bc);
  font-size: 0.84rem;
  line-height: 1.35;
  max-width: 42rem;
}

@media (max-width: 720px) {
  .hub-table__desc {
    max-width: 18rem;
  }
}

.hub-toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
}

.hub-result-count {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
}

.hub-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.85rem auto 0;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hub-load-more:hover {
  border-color: var(--color-gold, #c4956a);
}

.hub-load-more-wrap {
  display: flex;
  justify-content: center;
}

.learner-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 1rem 0 0.5rem;
}

.learner-toolbar .wiki-search {
  flex: 1 1 220px;
  max-width: 320px;
}

.learner-method-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.species-card__hub-meta {
  position: absolute;
  right: 0.65rem;
  bottom: 2.05rem;
  z-index: 2;
  display: block;
  max-width: 85%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #c5d0e0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: right;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.species-grid--hub {
  margin-top: 1rem;
}

.move-meta {
  --move-meta-accent: rgba(232, 168, 74, 0.35);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem 0.85rem;
  margin: 0.45rem 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--move-meta-accent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--move-meta-accent) 12%, transparent), transparent 55%),
    rgba(10, 14, 26, 0.55);
}

.move-meta--fire { --move-meta-accent: #ef6830; }
.move-meta--water { --move-meta-accent: #3884dc; }
.move-meta--grass { --move-meta-accent: #34a853; }
.move-meta--electric { --move-meta-accent: #eab308; }
.move-meta--ice { --move-meta-accent: #22b4c4; }
.move-meta--fighting { --move-meta-accent: #dc463c; }
.move-meta--poison { --move-meta-accent: #a855f7; }
.move-meta--ground { --move-meta-accent: #b48232; }
.move-meta--flying { --move-meta-accent: #6378dc; }
.move-meta--psychic { --move-meta-accent: #dc468c; }
.move-meta--bug { --move-meta-accent: #84b428; }
.move-meta--rock { --move-meta-accent: #a08c5a; }
.move-meta--ghost { --move-meta-accent: #785ac8; }
.move-meta--dragon { --move-meta-accent: #5a46dc; }
.move-meta--dark { --move-meta-accent: #6b6b78; }
.move-meta--steel { --move-meta-accent: #94a3b8; }
.move-meta--fairy { --move-meta-accent: #dc5aa0; }
.move-meta--normal { --move-meta-accent: #a8a8b0; }

.move-meta__identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.6rem;
}

.move-meta__identity .type-badge {
  font-size: 0.74rem;
  padding: 0.28rem 0.7rem;
}

.move-meta__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #d7e0ee;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.move-meta__chip--physical {
  background: rgba(220, 90, 70, 0.2);
  border-color: rgba(220, 90, 70, 0.4);
  color: #f0b4a8;
}

.move-meta__chip--special {
  background: rgba(90, 140, 220, 0.2);
  border-color: rgba(90, 140, 220, 0.4);
  color: #a8c4f0;
}

.move-meta__chip--status {
  background: rgba(160, 160, 170, 0.18);
  border-color: rgba(160, 160, 170, 0.32);
  color: #c8c8d0;
}

.move-meta__body {
  display: flex;
  flex: 1 1 18rem;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem 0.9rem;
  min-width: 0;
}

.move-meta__stats {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  margin: 0;
  width: 15.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.move-meta__stat {
  display: grid;
  gap: 0.12rem;
  flex: 1 1 0;
  justify-items: center;
  text-align: center;
  padding: 0.45rem 0.55rem;
  min-width: 0;
}

.move-meta__stat + .move-meta__stat {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.move-meta__stat dt {
  margin: 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(186, 198, 216, 0.72);
}

.move-meta__stat dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #f2f6fc;
}

.move-meta__desc {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--muted, #9aa8bc);
}

@media (max-width: 640px) {
  .move-meta {
    padding: 0.6rem 0.7rem;
  }

  .move-meta__identity {
    width: 100%;
    min-height: 0;
  }

  .move-meta__body {
    flex-basis: 100%;
  }

  .move-meta__stats {
    width: 13.5rem;
  }

  .move-meta__stat {
    padding: 0.4rem 0.3rem;
  }

  .move-meta__stat dd {
    font-size: 1.05rem;
  }

  .move-meta__desc {
    font-size: 0.86rem;
  }
}

.compare-pickers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}

.compare-picker {
  display: grid;
  gap: 0.35rem;
  position: relative;
}

.compare-picker__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-picker__panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg, #0f1628);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.compare-picker__option {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0.45rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.compare-picker__option:hover,
.compare-picker__option.is-active {
  background: rgba(155, 135, 196, 0.16);
}

.compare-picker__thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.compare-picker__thumb img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.compare-picker__meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.compare-picker__name {
  font-weight: 700;
  font-size: 0.9rem;
}

.compare-picker__sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.compare-picker.is-filled .compare-picker__input {
  display: none;
}

.compare-picker__selected {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(232, 168, 74, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(232, 168, 74, 0.1), transparent 55%),
    rgba(12, 18, 34, 0.72);
}

.compare-picker__selected.is-empty {
  display: none;
}

.compare-picker__selected-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.compare-picker__selected-thumb img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.compare-picker__selected-info {
  flex: 1 1 auto;
  min-width: 0;
}

.compare-picker__selected-name {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: #f2f6fc;
}

.compare-picker__selected-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.12rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.compare-picker__clear {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(232, 238, 248, 0.88);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0.28rem 0.6rem;
  flex: 0 0 auto;
}

.compare-picker__clear:hover {
  border-color: rgba(232, 168, 74, 0.45);
  color: #f0d2a0;
  background: rgba(232, 168, 74, 0.12);
}

.compare-picker__empty {
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.compare-table-wrap {
  margin-top: 0.5rem;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.compare-table th,
.compare-table td {
  border-bottom: 1px solid rgba(155, 135, 196, 0.18);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.compare-table thead th {
  background: var(--color-bg-raised, #121a32);
}

.compare-thumb {
  margin: 0.35rem 0;
}

.compare-thumb img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.compare-best {
  color: var(--color-gold-light, #d4aa7f);
  font-weight: 700;
}

.breeding-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.wiki-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.wiki-tip__btn {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(196, 149, 106, 0.55);
  background: rgba(196, 149, 106, 0.14);
  color: var(--color-gold-light, #d4aa7f);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wiki-tip__btn:hover,
.wiki-tip.is-open .wiki-tip__btn {
  background: rgba(196, 149, 106, 0.28);
  border-color: rgba(196, 149, 106, 0.85);
  color: #f0d2b0;
}

.wiki-tip__panel {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.45rem);
  z-index: 40;
  width: min(28rem, calc(100vw - 2rem));
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(196, 149, 106, 0.45);
  border-radius: var(--radius);
  background: #121a2e;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

.wiki-tip__panel[hidden] {
  display: none !important;
}

.wiki-tip__panel::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #121a2e;
  border-left: 1px solid rgba(196, 149, 106, 0.45);
  border-top: 1px solid rgba(196, 149, 106, 0.45);
  transform: translateX(-50%) rotate(45deg);
}

.wiki-mss-note__title {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-gold-light, #d4aa7f);
}

.wiki-tip__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.85rem;
}

.wiki-tip__fact {
  display: block;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text);
}

.wiki-tip__fact-label {
  display: inline-block;
  min-width: 2.6rem;
  margin-right: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-gold-light, #d4aa7f);
  opacity: 0.85;
}

.wiki-mss-note a {
  display: inline-block;
  margin-top: 0.55rem;
  color: var(--color-gold-light, #d4aa7f);
  font-weight: 600;
  font-size: 0.8rem;
}

@media (max-width: 520px) {
  .wiki-tip__facts {
    grid-template-columns: 1fr;
  }
}

.viewer-controls {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  max-width: calc(100% - 1rem);
}

.viewer-controls__btn,
.viewer-controls__select {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(12, 18, 36, 0.88);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.viewer-controls__btn.is-active {
  border-color: var(--color-gold, #c4956a);
  color: var(--color-gold-light, #d4aa7f);
}

.viewer-controls__select {
  max-width: 9.5rem;
}

.wiki-browse-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: center;
  margin-top: 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.wiki-browse-links a {
  color: var(--color-gold-light, #d4aa7f);
  text-decoration: none;
}

.wiki-browse-links a:hover {
  text-decoration: underline;
}

.utility-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.utility-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--color-bg-raised, #121a32);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.utility-chip:has(input:checked) {
  border-color: var(--color-gold, #c4956a);
  color: var(--text);
  background: rgba(196, 149, 106, 0.12);
}

.utility-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.species-card-wrap {
  --type-a: #7c8798;
  --type-b: var(--type-a);
  overflow: visible;
  /* content-visibility clips translateY hover — keep off */
}

.species-card-wrap[data-ptype="fire"] { --type-a: #ef6830; }
.species-card-wrap[data-ptype="water"] { --type-a: #3b82f6; }
.species-card-wrap[data-ptype="grass"] { --type-a: #34a853; }
.species-card-wrap[data-ptype="electric"] { --type-a: #eab308; }
.species-card-wrap[data-ptype="ice"] { --type-a: #22b4c4; }
.species-card-wrap[data-ptype="fighting"] { --type-a: #dc463c; }
.species-card-wrap[data-ptype="poison"] { --type-a: #a855f7; }
.species-card-wrap[data-ptype="ground"] { --type-a: #b48232; }
.species-card-wrap[data-ptype="flying"] { --type-a: #6378dc; }
.species-card-wrap[data-ptype="psychic"] { --type-a: #dc468c; }
.species-card-wrap[data-ptype="bug"] { --type-a: #84b428; }
.species-card-wrap[data-ptype="rock"] { --type-a: #a08c5a; }
.species-card-wrap[data-ptype="ghost"] { --type-a: #785ac8; }
.species-card-wrap[data-ptype="dragon"] { --type-a: #5a46dc; }
.species-card-wrap[data-ptype="dark"] { --type-a: #6b7280; }
.species-card-wrap[data-ptype="steel"] { --type-a: #94a3b8; }
.species-card-wrap[data-ptype="fairy"] { --type-a: #dc5aa0; }
.species-card-wrap[data-ptype="normal"] { --type-a: #a1a1aa; }

.species-card-wrap[data-stype="fire"] { --type-b: #ef6830; }
.species-card-wrap[data-stype="water"] { --type-b: #3b82f6; }
.species-card-wrap[data-stype="grass"] { --type-b: #34a853; }
.species-card-wrap[data-stype="electric"] { --type-b: #eab308; }
.species-card-wrap[data-stype="ice"] { --type-b: #22b4c4; }
.species-card-wrap[data-stype="fighting"] { --type-b: #dc463c; }
.species-card-wrap[data-stype="poison"] { --type-b: #a855f7; }
.species-card-wrap[data-stype="ground"] { --type-b: #b48232; }
.species-card-wrap[data-stype="flying"] { --type-b: #6378dc; }
.species-card-wrap[data-stype="psychic"] { --type-b: #dc468c; }
.species-card-wrap[data-stype="bug"] { --type-b: #84b428; }
.species-card-wrap[data-stype="rock"] { --type-b: #a08c5a; }
.species-card-wrap[data-stype="ghost"] { --type-b: #785ac8; }
.species-card-wrap[data-stype="dragon"] { --type-b: #5a46dc; }
.species-card-wrap[data-stype="dark"] { --type-b: #6b7280; }
.species-card-wrap[data-stype="steel"] { --type-b: #94a3b8; }
.species-card-wrap[data-stype="fairy"] { --type-b: #dc5aa0; }
.species-card-wrap[data-stype="normal"] { --type-b: #a1a1aa; }

.species-card {
  --type-a-border: color-mix(in srgb, var(--type-a) 42%, #0a1020 58%);
  --type-b-border: color-mix(in srgb, var(--type-b) 42%, #0a1020 58%);
  position: relative;
  display: flex;
  flex-direction: column;
  border: 2.5px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(#080c18, #080c18) padding-box,
    linear-gradient(
      to right,
      var(--type-a-border) 0 50%,
      var(--type-b-border) 50% 100%
    ) border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--type-a-border) 35%, transparent),
    0 8px 22px rgba(0, 0, 0, 0.28);
  text-decoration: none;
  overflow: hidden;
  min-height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.species-card:hover {
  transform: scale(1.02);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--type-a-border) 50%, transparent),
    0 0 18px color-mix(in srgb, var(--type-a) 12%, transparent),
    0 0 14px color-mix(in srgb, var(--type-b) 10%, transparent),
    0 14px 30px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.species-card__thumb {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 0;
}

.species-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.species-card__body {
  position: absolute;
  inset: 0;
  padding: 0;
  display: block;
  background: linear-gradient(
    to top left,
    rgba(4, 8, 18, 0.42) 0%,
    rgba(4, 8, 18, 0.12) 28%,
    transparent 48%
  );
  pointer-events: none;
}

.species-card__dex {
  position: absolute;
  top: 0.55rem;
  left: 0.6rem;
  z-index: 1;
  margin: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d7e0ee;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
}

.species-card .type-list {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  max-width: 58%;
  justify-content: flex-end;
  gap: 0.22rem;
}

.species-card .type-badge {
  font-size: 0.58rem;
  padding: 0.12rem 0.38rem;
  letter-spacing: 0.03em;
  backdrop-filter: blur(6px);
}

.species-card__name {
  position: absolute;
  right: 0.65rem;
  bottom: 0.55rem;
  z-index: 1;
  max-width: 85%;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: right;
  line-height: 1.2;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

.species-card__dex-mark,
.species-card__gen,
.species-card__bst,
.species-card__bst-bar {
  display: none;
}

.type-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.type-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #eceff4;
  color: #2c3340;
}

.type-badge--fire { background: #ffe3d3; color: #9c2b09; }
.type-badge--water { background: #d6ecff; color: #0c4a8a; }
.type-badge--grass { background: #daf5dd; color: #196127; }
.type-badge--electric { background: #fff4c2; color: #7a5800; }
.type-badge--ice { background: #dbf7fa; color: #0e5c66; }
.type-badge--fighting { background: #ffd8d6; color: #8c1b15; }
.type-badge--poison { background: #f2dbfa; color: #671c80; }
.type-badge--ground { background: #f7e6c4; color: #6e480b; }
.type-badge--flying { background: #e3e8ff; color: #2b3c8f; }
.type-badge--psychic { background: #ffd9e8; color: #8c194b; }
.type-badge--bug { background: #e9f5c6; color: #476309; }
.type-badge--rock { background: #ede3ce; color: #594622; }
.type-badge--ghost { background: #e3daf5; color: #422775; }
.type-badge--dragon { background: #ddd6ff; color: #361f99; }
.type-badge--dark { background: #dcd9d6; color: #2e2925; }
.type-badge--steel { background: rgba(155, 135, 196, 0.2); color: var(--color-purple-light, #b8a8d8); }
.type-badge--fairy { background: #ffe0f0; color: #851d56; }
.type-badge--normal { background: #eaeaea; color: #3f3f46; }

/* Dark type chips — wiki + filter dropdown (not light pastel) */
.ms-dropdown__menu .type-badge,
.wiki .type-badge {
  border-color: rgba(255, 255, 255, 0.12);
}

.ms-dropdown__menu .type-badge--normal,
.wiki .type-badge--normal { background: rgba(168, 168, 176, 0.22); color: #d4d4d8; }
.ms-dropdown__menu .type-badge--fire,
.wiki .type-badge--fire { background: rgba(239, 104, 48, 0.28); color: #fdba8c; }
.ms-dropdown__menu .type-badge--water,
.wiki .type-badge--water { background: rgba(56, 132, 220, 0.28); color: #93c5fd; }
.ms-dropdown__menu .type-badge--grass,
.wiki .type-badge--grass { background: rgba(52, 168, 83, 0.28); color: #86efac; }
.ms-dropdown__menu .type-badge--electric,
.wiki .type-badge--electric { background: rgba(234, 179, 8, 0.28); color: #fde047; }
.ms-dropdown__menu .type-badge--ice,
.wiki .type-badge--ice { background: rgba(34, 180, 196, 0.28); color: #67e8f9; }
.ms-dropdown__menu .type-badge--fighting,
.wiki .type-badge--fighting { background: rgba(220, 70, 60, 0.28); color: #fca5a5; }
.ms-dropdown__menu .type-badge--poison,
.wiki .type-badge--poison { background: rgba(168, 85, 247, 0.28); color: #d8b4fe; }
.ms-dropdown__menu .type-badge--ground,
.wiki .type-badge--ground { background: rgba(180, 130, 50, 0.28); color: #fcd34d; }
.ms-dropdown__menu .type-badge--flying,
.wiki .type-badge--flying { background: rgba(99, 120, 220, 0.28); color: #a5b4fc; }
.ms-dropdown__menu .type-badge--psychic,
.wiki .type-badge--psychic { background: rgba(220, 70, 140, 0.28); color: #f9a8d4; }
.ms-dropdown__menu .type-badge--bug,
.wiki .type-badge--bug { background: rgba(132, 180, 40, 0.28); color: #bef264; }
.ms-dropdown__menu .type-badge--rock,
.wiki .type-badge--rock { background: rgba(160, 140, 90, 0.28); color: #e7d5a8; }
.ms-dropdown__menu .type-badge--ghost,
.wiki .type-badge--ghost { background: rgba(120, 90, 200, 0.28); color: #c4b5fd; }
.ms-dropdown__menu .type-badge--dragon,
.wiki .type-badge--dragon { background: rgba(90, 70, 220, 0.28); color: #a5b4fc; }
.ms-dropdown__menu .type-badge--dark,
.wiki .type-badge--dark { background: rgba(90, 90, 100, 0.35); color: #d4d4d8; }
.ms-dropdown__menu .type-badge--steel,
.wiki .type-badge--steel { background: rgba(148, 163, 184, 0.28); color: #cbd5e1; }
.ms-dropdown__menu .type-badge--fairy,
.wiki .type-badge--fairy { background: rgba(220, 90, 160, 0.28); color: #f9a8d4; }

.species-card-wrap.is-hidden,
.species-card.is-hidden,
.empty-state.is-hidden,
.filter-clear.is-hidden {
  display: none;
}

.empty-state {
  color: var(--muted);
  padding: var(--space);
}

/* Detail Page */
.wiki-detail-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  margin-bottom: var(--space-lg);
}

.wiki-detail-nav .wiki-section-nav {
  margin: 0;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  color: var(--color-gold-light, #d4aa7f);
  text-decoration: underline;
}

.wiki-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
  align-items: stretch;
}

.wiki-pager__link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 11.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px dashed rgba(155, 135, 196, 0.35);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, border-style 0.15s ease, background 0.15s ease;
}

.wiki-pager__link:hover {
  border-style: solid;
  border-color: var(--color-gold, #c4956a);
  background: transparent;
}

.wiki-pager__link--next {
  flex-direction: row-reverse;
  text-align: right;
}

.wiki-pager__link--next .wiki-pager__meta {
  align-items: flex-end;
}

.wiki-pager__link--disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.wiki-pager__arrow {
  color: var(--color-gold-light, #d4aa7f);
  font-weight: 700;
  flex: 0 0 auto;
  opacity: 0.55;
}

.wiki-pager__thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.wiki-pager__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.wiki-pager__thumb-fallback {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 700;
}

.wiki-pager__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.wiki-pager__dir {
  display: none;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.wiki-pager__dex {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.wiki-pager__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(300px, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  align-items: start;
}

@media (max-width: 820px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.viewer-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Match 2D thumb bake (base / --color-bg) */
  background: var(--color-bg, #0c1224);
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
}

.viewer-panel canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.viewer-panel.is-loading canvas {
  opacity: 0;
}

.viewer-loader {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--color-bg, #0c1224);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2;
}

.viewer-panel.is-loading .viewer-loader {
  display: flex;
}

.viewer-loader__spin {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid rgba(155, 135, 196, 0.25);
  border-top-color: var(--color-gold, #c4956a);
  border-radius: 50%;
  animation: viewer-spin 0.7s linear infinite;
}

@keyframes viewer-spin {
  to { transform: rotate(360deg); }
}

.viewer-hint {
  position: absolute;
  left: 0.65rem;
  bottom: 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.viewer-panel.is-loading .viewer-hint {
  opacity: 0;
}

.detail-meta {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.detail-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.detail-title-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.detail-title-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.detail-meta h2 {
  margin: 0;
  font-size: 1.85rem;
}

.detail-compare-btn {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid rgba(155, 135, 196, 0.35);
  background: rgba(155, 135, 196, 0.12);
  color: var(--color-purple-light, #b8a8d8);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.detail-compare-btn:hover {
  background: rgba(155, 135, 196, 0.24);
  border-color: rgba(155, 135, 196, 0.65);
  color: #ddd3f5;
}

.detail-meta .dex {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 600;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: rgba(155, 135, 196, 0.18);
  color: var(--color-text, #e4e2de);
  border: 1px solid rgba(155, 135, 196, 0.35);
}

.tag-pill--accent {
  background: rgba(196, 149, 106, 0.2);
  color: var(--color-gold-light, #d4aa7f);
  border-color: rgba(196, 149, 106, 0.45);
}

.tag-pill--hidden {
  background: rgba(254, 243, 199, 0.18);
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.4);
}

.tag-pill--muted {
  background: var(--color-bg-raised, #121a32);
  color: var(--muted);
  border-color: var(--border);
}

.pokedex-quote {
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--color-bg-raised, #121a32);
  border-left: 3px solid #94a3b8;
  border-radius: 0 6px 6px 0;
  color: var(--color-purple-light, #b8a8d8);
  font-style: italic;
  font-size: 0.94rem;
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.meta-list li {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(155, 135, 196, 0.15);
  padding-bottom: 0.45rem;
  font-size: 0.93rem;
}

.meta-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-list .label {
  color: var(--muted);
  font-weight: 500;
}

.muted-text {
  color: var(--muted);
}

.meta-hint {
  display: inline;
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.meta-hint--block {
  display: block;
  margin: 0.35rem 0 0;
  margin-left: 0;
  line-height: 1.4;
}

.training-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.training-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

@media (max-width: 520px) {
  .training-split {
    grid-template-columns: 1fr;
  }
}

.training-split__col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.training-split__heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.growth-pace {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.growth-pace__meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 1rem;
}

.growth-pace__step {
  width: 6px;
  border-radius: 2px;
  background: #d5dbe5;
}

.growth-pace__step:nth-child(1) { height: 4px; }
.growth-pace__step:nth-child(2) { height: 7px; }
.growth-pace__step:nth-child(3) { height: 10px; }
.growth-pace__step:nth-child(4) { height: 13px; }
.growth-pace__step:nth-child(5) { height: 16px; }

.growth-pace__step.is-active {
  background: #3b82f6;
}

.growth-pace__label {
  font-size: 0.9rem;
  color: var(--text);
}

.gender-male {
  color: #2563eb;
  font-weight: 600;
}

.gender-female {
  color: #db2777;
  font-weight: 600;
}

.gender-sep {
  color: var(--muted);
  margin: 0 0.25rem;
}

/* Abilities */
.abilities-grid {
  display: grid;
  gap: 0.5rem;
}

.abilities-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.ability-card {
  background: var(--color-bg-raised, #121a32);
  border: 1px solid rgba(155, 135, 196, 0.2);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
}

.ability-card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-color: rgba(155, 135, 196, 0.35);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ability-card--link:hover,
.ability-card--link:focus-visible {
  background: rgba(155, 135, 196, 0.12);
  border-color: rgba(155, 135, 196, 0.7);
  box-shadow: 0 0 0 1px rgba(155, 135, 196, 0.25);
  outline: none;
}

.ability-card--link:hover .ability-card__go,
.ability-card--link:focus-visible .ability-card__go {
  opacity: 1;
  transform: translateX(2px);
}

.ability-card__header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
}

.ability-card__header strong {
  color: var(--color-purple-light, #b8a8d8);
}

.ability-card--link .ability-card__header strong {
  text-decoration: underline;
  text-decoration-color: rgba(184, 168, 216, 0.35);
  text-underline-offset: 0.15em;
}

.ability-card__go {
  margin-left: auto;
  color: var(--color-purple-light, #b8a8d8);
  font-weight: 700;
  opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ability-card__desc {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.ability-card__hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-purple-light, #b8a8d8);
  opacity: 0.75;
}

/* Sections */
.wiki-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: var(--space-lg);
}

.wiki-panel h3 {
  margin: 0 0 0.9rem;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.45rem;
}

/* Pixel-Art Item Chips */
.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.55rem 0.2rem 0.35rem;
  background: var(--color-bg-raised, #121a32);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0.1rem 0.2rem 0.1rem 0;
  color: var(--text);
}

.item-chip__icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.item-chip__meta {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Evolution Chain */
.evo-chain-container {
  overflow-x: auto;
  padding: 0.25rem 0;
  display: flex;
  justify-content: center;
}

.evo-chain-container > .evo-tree-node {
  justify-content: center;
}

.evo-tree-node {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.evo-branches {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.evo-branch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.evo-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.8rem;
  background: var(--color-bg-raised, #121a32);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  min-width: 185px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

a.evo-card:hover {
  border-color: #64748b;
  background: rgba(155, 135, 196, 0.1);
}

.evo-card--current {
  border-color: var(--color-gold, #c4956a);
  background: rgba(196, 149, 106, 0.16);
  box-shadow: 0 0 0 1px rgba(196, 149, 106, 0.28);
}

.evo-card__thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: rgba(8, 12, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.2rem;
}

.evo-card__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.evo-card__no-thumb {
  font-size: 0.8rem;
  color: var(--muted);
}

.evo-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.evo-card__name {
  font-weight: 600;
  font-size: 0.95rem;
}

.evo-card__dex {
  font-size: 0.78rem;
  color: var(--muted);
}

.evo-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 110px;
  max-width: 180px;
  text-align: center;
}

.evo-step__arrow {
  font-size: 1.25rem;
  color: var(--muted);
  line-height: 1;
}

.evo-step__req {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(155, 135, 196, 0.1);
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--color-purple-light, #b8a8d8);
}

.evo-step__icons {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

/* Phone: stack stages vertically and keep every card centered */
@media (max-width: 700px) {
  .evo-chain-container {
    display: block;
    overflow-x: visible;
  }

  .evo-chain-container > .evo-tree-node,
  .evo-tree-node,
  .evo-branch {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .evo-branches {
    align-items: center;
    width: 100%;
  }

  .evo-card {
    width: min(100%, 280px);
    min-width: 0;
  }

  .evo-step {
    min-width: 0;
    max-width: 100%;
  }

  .evo-step__arrow {
    transform: rotate(90deg);
  }
}

/* Spawn map (Squaremap + biome overlay) */
.spawn-map-legend {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.spawn-map {
  width: 100%;
  height: min(420px, 55vh);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--color-bg-deep, #080c18);
  margin-bottom: 0.5rem;
  z-index: 0;
}

.spawn-map .spawn-map-overlay,
.spawn-map .leaflet-image-layer {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.spawn-map-status {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.spawns-table tbody tr.is-spawn-selected {
  background: rgba(155, 135, 196, 0.22);
}

.spawns-table tbody tr[data-spawn-index]:hover {
  background: rgba(155, 135, 196, 0.12);
}

/* Tables & Stats */
.table-scroll {
  overflow-x: auto;
}

.stats-table,
.moves-table,
.spawns-table,
.drops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.stats-table th,
.stats-table td,
.moves-table th,
.moves-table td,
.spawns-table th,
.spawns-table td,
.drops-table th,
.drops-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(155, 135, 196, 0.15);
  vertical-align: middle;
}

.moves-table thead th,
.spawns-table thead th,
.drops-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--color-bg-raised, #121a32);
}

.stats-table th {
  width: 8rem;
  color: var(--muted);
}

.stat-val {
  width: 4rem;
  font-variant-numeric: tabular-nums;
}

.stat-val--high {
  color: #4ade80;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.stat-val--low {
  color: #f87171;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.stats-total-row th,
.stats-total-row td {
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.stat-bar {
  display: block;
  height: 0.6rem;
  background: rgba(155, 135, 196, 0.2);
  border-radius: 999px;
  overflow: hidden;
  max-width: 280px;
}

.stat-bar > span {
  display: block;
  height: 100%;
  background: #3b82f6;
  border-radius: 999px;
}

.stat-bar--high > span {
  background: #22c55e;
}

.stat-bar--low > span {
  background: #ef4444;
}

/* Alternate Forms */
.forms-sub {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.forms-sub h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.form-card {
  background: var(--color-bg-raised, #121a32);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.form-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.form-card__desc {
  font-size: 0.83rem;
  color: var(--muted);
  font-style: italic;
  margin: 0.35rem 0;
}

.form-card__meta {
  font-size: 0.84rem;
  margin: 0.35rem 0;
}

.form-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.82rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(155, 135, 196, 0.2);
}

/* Spawns & Buckets */
.bucket-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.bucket-badge--common {
  background: #dcfce7;
  color: #166534;
}

.bucket-badge--uncommon {
  background: #dbeafe;
  color: #1e40af;
}

.bucket-badge--rare {
  background: #fef3c7;
  color: #92400e;
}

.bucket-badge--ultra-rare {
  background: #f3e8ff;
  color: #6b21a8;
}

.spawn-form-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.biome-tag-list,
.cond-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.biome-pill {
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  cursor: help;
}

.excluded-biomes {
  margin-top: 0.25rem;
  color: #b91c1c;
}

.cond-pill {
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  background: rgba(155, 135, 196, 0.1);
  color: var(--color-purple-light, #b8a8d8);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

/* Drops, Interactions & Riding Grid */
.drops-interactions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.sub-panel {
  background: var(--color-bg-raised, #121a32);
  border: 1px solid rgba(155, 135, 196, 0.2);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.sub-panel h4 {
  margin: 0 0 0.65rem;
  font-size: 0.98rem;
}

.riding-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.riding-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
}

.riding-card__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  background: rgba(196, 149, 106, 0.12);
  border-bottom: 1px solid var(--border);
}

.riding-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0.35rem 0.65rem 0.55rem;
}

.riding-stat {
  --stat-lo: 0%;
  --stat-hi: 0%;
  --stat-mid: 0%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.35rem 0.75rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(155, 135, 196, 0.14);
  min-width: 0;
}

.riding-stat:last-child {
  border-bottom: 0;
}

.riding-stat__label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}

.riding-stat__val {
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.riding-stat__bar {
  display: block;
  position: relative;
  grid-column: 1 / -1;
  height: 5px;
  margin-top: 0.05rem;
  border-radius: 999px;
  background: rgba(155, 135, 196, 0.15);
  overflow: hidden;
}

.riding-stat__bar-range {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--stat-lo);
  width: max(2px, calc(var(--stat-hi) - var(--stat-lo)));
  background: rgba(196, 149, 106, 0.45);
  border-radius: 999px;
}

.riding-stat__bar-mid {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: var(--stat-mid);
  width: 2px;
  margin-left: -1px;
  background: var(--color-gold-light, #d4aa7f);
}

/* Moveset Tabs */
.move-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.move-tab-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--color-bg-raised, #121a32);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.move-tab-btn:hover {
  background: rgba(155, 135, 196, 0.18);
  color: var(--text);
}

.move-tab-btn.is-active {
  background: var(--color-gold, #c4956a);
  color: #0c1224;
  border-color: var(--color-gold, #c4956a);
}

.move-tab-count {
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.82rem;
}

.move-tab-pane {
  display: none;
}

.move-tab-pane.is-active {
  display: block;
}

.move-lvl {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.move-desc {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 420px;
}

.cat-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: rgba(155, 135, 196, 0.2);
  color: var(--color-purple-light, #b8a8d8);
}

.cat-badge--physical {
  background: #fee2e2;
  color: #991b1b;
}

.cat-badge--special {
  background: #e0e7ff;
  color: #1e40af;
}

.cat-badge--status {
  background: rgba(155, 135, 196, 0.18);
  color: var(--color-text-muted, #a8a4b8);
}

.move-stab-legend {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.stab-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  vertical-align: middle;
}

.move-stab-legend .stab-badge {
  margin-left: 0;
}

.move-row--stab {
  background: rgba(34, 197, 94, 0.12);
}

.move-pow--stab {
  font-weight: 700;
  color: #4ade80;
}

.error-box {
  border: 1px solid rgba(196, 122, 122, 0.55);
  background: rgba(196, 122, 122, 0.12);
  color: var(--text);
  padding: var(--space);
  border-radius: var(--radius);
}
