/* ==========================================================================
   DETAIL.CSS - Detail Page Styles, Glassmorphism, Stats
   ========================================================================== */

/* ==========================================================================
   DETAIL PAGE LAYOUT
   ========================================================================== */
.detail-page {
  padding: 18px 20px 60px;
  min-height: calc(100vh - 70px);
  overflow-y: visible;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
  z-index: 1;
}

.detail-container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 2;
  /* Stats / Abilities / Evolution / Moveset — readable width, not full-bleed */
  --detail-card-max: min(492px, 100%);
  --detail-flow-max: min(560px, 100%);
}

.detail-stats.glass-card,
.abilities-section.glass-card {
  width: 100%;
  max-width: var(--detail-card-max);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.evolution-section.glass-card,
.move-library.glass-card {
  width: 100%;
  max-width: var(--detail-flow-max);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Evolution chain: frosted depth aligned with other detail glass cards */
.evolution-section.glass-card {
  box-shadow:
    0 18px 48px -14px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Zygarde Cell Form: stats removed from DOM, eliminate ALL empty gaps - MAXIMUM reduction */
body.zygarde-cell-form .detail-page,
main.zygarde-cell-form {
  padding-bottom: 0 !important;
  padding-top: 24px !important;
}
.detail-container.zygarde-cell-form {
  gap: 0 !important;
}
body.zygarde-cell-form .detail-container .evolution-section {
  margin-top: -12px !important;
  margin-bottom: -12px !important;
  padding: 16px 24px !important;
}
body.zygarde-cell-form .detail-container .detail-top-controls {
  gap: 6px !important;
  margin-bottom: 4px !important;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.detail-hero {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background: radial-gradient(circle, var(--glow-color, rgba(100, 180, 255, 0.2)) 0%, transparent 70%);
}

.detail-image {
  width: 80%;
  height: 80%;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3))
          drop-shadow(0 0 20px var(--glow-color, rgba(100, 180, 255, 0.3)));
  animation: float 4s ease-in-out infinite;
}

/* Open specimen row: bio | hero + identity | Pokédex (no single cramped card) */
.detail-container--specimen-stage {
  --detail-card-max: min(480px, calc(100vw - 36px));
  --detail-flow-max: min(700px, calc(100vw - 36px));
  max-width: min(1180px, calc(100vw - 32px));
  width: 100%;
  align-items: stretch;
}

.detail-specimen-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 2.5vw, 28px);
  width: 100%;
  align-items: start;
  margin: 0 auto;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

/* Specimen split: hero center + fixed bio column (max 380px) */
.detail-specimen-stage--split {
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 380px);
  align-items: start;
}

.specimen-stage-col--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.detail-hero--specimen {
  width: 100%;
  max-width: min(400px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

/* Hero energy silhouette (masked type symbol, rotateEnergy) */
.detail-hero--specimen .detail-hero-energy-shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  background-color: var(--type-color, var(--glow-color, #78c850));
  -webkit-mask-image: var(--energy-url);
  mask-image: var(--energy-url);
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  filter: blur(50px);
  opacity: 0.1;
  z-index: 0;
  pointer-events: none;
  animation: rotateEnergy 20s linear infinite;
}

.detail-hero--specimen .detail-image {
  position: relative;
  z-index: 2;
}

/* Primal Kyogre / Groudon — orb beside artwork (left, slightly raised, neon float) */
.detail-hero-artwork-row--primal {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.detail-hero-artwork-row--primal .detail-image {
  width: 76%;
  height: 76%;
  max-width: 100%;
}

.primal-orb-deco {
  position: absolute;
  left: 0;
  top: 14%;
  width: clamp(40px, 13vw, 58px);
  height: auto;
  object-fit: contain;
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.primal-orb-deco.is-visible {
  opacity: 1;
  visibility: visible;
  animation: primalOrbFloat 2.6s ease-in-out infinite;
}

.primal-orb-deco--kyogre.is-visible {
  filter: drop-shadow(0 0 6px rgba(0, 220, 255, 0.95))
    drop-shadow(0 0 14px rgba(80, 180, 255, 0.65))
    drop-shadow(0 0 22px rgba(120, 200, 255, 0.35));
}

.primal-orb-deco--groudon.is-visible {
  filter: drop-shadow(0 0 6px rgba(255, 90, 60, 0.95))
    drop-shadow(0 0 14px rgba(255, 120, 80, 0.6))
    drop-shadow(0 0 22px rgba(255, 160, 100, 0.3));
}

@keyframes primalOrbFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -7px, 0);
  }
}

/* Mega Evolution — Mega Stone beside artwork (same layout as Primal orbs) */
.detail-hero-artwork-row--mega-stone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.detail-hero-artwork-row--mega-stone .detail-image {
  width: 76%;
  height: 76%;
  max-width: 100%;
}

.mega-stone-deco {
  position: absolute;
  left: 0;
  top: 14%;
  width: clamp(40px, 13vw, 58px);
  height: auto;
  object-fit: contain;
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.mega-stone-deco.is-visible {
  opacity: 1;
  visibility: visible;
  animation: megaStoneFloat 2.7s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(208, 49, 255, 0.92))
    drop-shadow(0 0 12px rgba(0, 224, 255, 0.78))
    drop-shadow(0 0 20px rgba(124, 255, 0, 0.5));
}

@keyframes megaStoneFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-2deg);
  }
  50% {
    transform: translate3d(0, -7px, 0) rotate(2deg);
  }
}

.specimen-identity-below {
  text-align: center;
  width: 100%;
  max-width: 420px;
  margin-top: 0.25rem;
  padding: 0 6px 4px;
}

.specimen-identity-below .specimen-hub-dex {
  display: block;
}

.specimen-identity-below .specimen-hub-types {
  justify-content: center;
}

/* Form switcher is position:absolute below hero (bottom:-20px); clear dex/name */
.specimen-stage-col--center:has(.form-switcher) .specimen-identity-below {
  margin-top: clamp(2.5rem, 6vw, 3.25rem);
}
/* Arceus: switcher sits lower (larger negative bottom) + room for multi-row pill */
.specimen-stage-col--center:has(.form-switcher-arceus) .specimen-identity-below {
  margin-top: clamp(5rem, 14vw, 7.75rem);
}
/* Tauros Paldea: thêm hàng breed dưới switcher (absolute → cần margin lớn hơn cho # / tên) */
.specimen-stage-col--center:has(#paldeaTaurosBreeds:not([hidden])) .specimen-identity-below {
  margin-top: clamp(5.25rem, 16vw, 7.5rem);
}

.detail-container--vivillon:has(.form-switcher) > .detail-info,
.detail-container--unown:has(.form-switcher) > .detail-info {
  margin-top: clamp(2.5rem, 6vw, 3.25rem);
}

.specimen-stage-col--right {
  min-width: 0;
}

.specimen-right-stack {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  width: 100%;
  max-width: 380px;
  margin-left: auto;
}

/* Specimen bio column */
.specimen-bio-below-dex {
  width: 100%;
}

.specimen-bio-below-dex .bio-card.specimen-bio-card--detail {
  width: 100%;
  max-width: 380px;
  margin: 0;
  border-radius: 60px 15px 60px 15px;
  padding: 20px;
  background: rgba(18, 20, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.specimen-dex-column {
  border-left: 3px solid color-mix(in srgb, var(--type-accent, var(--glow-color, #78c850)) 55%, transparent);
  padding-left: 1rem;
  margin-left: 2px;
  min-width: 0;
  padding-top: 0.15rem;
}

.specimen-dex-column .specimen-dex-viewer.dex-entry-viewer {
  margin-top: 0;
}

@media (max-width: 900px) {
  .detail-specimen-stage--split {
    grid-template-columns: 1fr;
  }

  .specimen-stage-col--center {
    order: -1;
  }

  .specimen-right-stack {
    margin-left: 0;
    max-width: none;
  }

  .specimen-bio-below-dex .bio-card.specimen-bio-card--detail {
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }

  .specimen-dex-column {
    border-left: none;
    padding-left: 0;
    border-top: 3px solid color-mix(in srgb, var(--type-accent, var(--glow-color, #78c850)) 45%, transparent);
    padding-top: 1rem;
    margin-left: 0;
  }
}

/* ==========================================================================
   POKEMON INFO
   ========================================================================== */
.detail-info {
  text-align: center;
}

.detail-dex {
  display: block;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.detail-name {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-transform: capitalize;
  margin: 0 0 6px;
}

.detail-species {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  margin: 0 0 12px;
}

.detail-types {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.detail-types .type-badge {
  padding: 6px 16px;
  font-size: 0.8rem;
}

/* ==========================================================================
   GLASSMORPHISM CARD
   ========================================================================== */
.glass-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  position: relative;
  z-index: 2;
  overflow: visible;
}

/* ==========================================================================
   STATS SECTION - Pro-Tier 5-Level Color Coding
   Future-proof: Uses 255 as max stat denominator
   ========================================================================== */

/* Pro-Tier Color Variables */
:root {
  --stat-red: #ff5959;     /* < 50: Weak */
  --stat-orange: #f5ac78;  /* 50-69: Below Average */
  --stat-yellow: #fae078;  /* 70-89: Average */
  --stat-lime: #a7db8d;    /* 90-119: Good (Most evolved starters) */
  --stat-green: #5cd65c;   /* >= 120: Elite */
  --stat-gold: #ffd700;    /* Total stat special */
}

.detail-stats {
  width: 100%;
}

.stats-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 20px;
  text-align: center;
  justify-content: center;
}

.stats-heading::before {
  content: "📊";
  font-size: 1.3rem;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: 70px 1fr 50px;
  align-items: center;
  gap: 14px;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Premium Stat Bar - Fuller & 3D Look */
.stat-bar {
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Animated stat fill bar with 3D cylindrical effect */
.stat-fill {
  height: 100%;
  border-radius: 6px;
  width: 0;
  position: relative;
  /* Smooth slide animation */
  animation: statSlide 1s ease-out forwards;
  animation-delay: 0.15s;
}

@keyframes statSlide {
  from { 
    width: 0; 
    opacity: 0.5;
  }
  to { 
    width: var(--stat-width, 0%); 
    opacity: 1;
  }
}

/* 3D Highlight overlay for cylindrical look */
.stat-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0.35) 0%, 
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  border-radius: 6px 6px 0 0;
  pointer-events: none;
}

/* ==========================================================================
   5-Level Color Classes - Pro-Tier Thresholds
   < 50: red, 50-69: orange, 70-89: yellow, 90-119: lime, >= 120: green
   ========================================================================== */

.stat-fill.stat-red {
  background: linear-gradient(90deg, #e04040, var(--stat-red), #ff7070);
  box-shadow: 0 0 12px rgba(255, 89, 89, 0.6),
              0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-fill.stat-orange {
  background: linear-gradient(90deg, #e89050, var(--stat-orange), #ffc090);
  box-shadow: 0 0 12px rgba(245, 172, 120, 0.6),
              0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-fill.stat-yellow {
  background: linear-gradient(90deg, #e8d050, var(--stat-yellow), #fff0a0);
  box-shadow: 0 0 12px rgba(250, 224, 120, 0.6),
              0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-fill.stat-lime {
  background: linear-gradient(90deg, #70c070, var(--stat-lime), #c0f0a0);
  box-shadow: 0 0 12px rgba(167, 219, 141, 0.6),
              0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Elite tier - 120+ stats */
.stat-fill.stat-green {
  background: linear-gradient(90deg, #40b840, var(--stat-green), #80ff80);
  box-shadow: 0 0 16px rgba(92, 214, 92, 0.7),
              0 0 30px rgba(92, 214, 92, 0.3),
              0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   TOTAL ROW - Premium Gold Styling
   ========================================================================== */
.stat-row.stat-total {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  position: relative;
}

/* Subtle gold glow line */
.stat-row.stat-total::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 215, 0, 0.5), 
    transparent
  );
}

.stat-row.stat-total .stat-label {
  font-size: 0.85rem;
  color: var(--stat-gold);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.stat-row.stat-total .stat-bar {
  height: 14px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 7px;
}

/* Rainbow gradient for Total bar */
.stat-row.stat-total .stat-fill {
  background: linear-gradient(90deg, 
    var(--stat-red) 0%, 
    var(--stat-orange) 20%, 
    var(--stat-yellow) 40%, 
    var(--stat-lime) 60%, 
    var(--stat-green) 80%,
    #40e0d0 100%
  );
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4),
              0 0 40px rgba(255, 215, 0, 0.2),
              0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Extra shine effect for total */
.stat-row.stat-total .stat-fill::after {
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0.45) 0%, 
    rgba(255, 255, 255, 0.15) 40%,
    transparent 100%
  );
}

.stat-row.stat-total .stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--stat-gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5),
               0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   DETAIL MEDIA (Old style - keeping for compatibility)
   ========================================================================== */
.detail {
  display: grid;
  grid-template-columns: 1.05fr 1.45fr;
  gap: 18px;
  padding: 10px 0 12px;
}

@media (max-width: 860px) {
  .detail {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   EVOLUTION CHAIN - Animated Energy Orbs
   ========================================================================== */
.evolution-wrapper,
.stats-wrapper,
.abilities-wrapper {
  width: 100%;
}

.evolution-wrapper {
  margin-bottom: 24px;
}

.evolution-section {
  width: 100%;
  padding: 28px 32px;
  overflow: visible;
  min-height: auto;
}

.evolution-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 24px;
  text-align: center;
  justify-content: center;
}

.evolution-container {
  position: relative;
  width: 100%;
  min-height: 180px;
  padding: 30px 40px 50px;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* ========== EVOLUTION CHEVRON ARROWS (Static Pulse) ========== */
.evo-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.evo-chevron svg {
  width: 100%;
  height: 100%;
  fill: var(--type-accent, #78c850);
  filter: drop-shadow(0 0 8px var(--type-accent, #78c850));
  animation: softPulse 2s ease-in-out infinite;
}

@keyframes softPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ========== STAGE-BASED LAYOUT (Branching Support) ========== */
.evolution-stages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
  z-index: 2;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 920px;
  flex-shrink: 0;
}

/* Each stage column (can have multiple Pokemon stacked vertically) */
.stage-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  position: relative;
  min-width: 140px;
  flex-shrink: 0;
}

/* Wrapper for each Pokemon in a stage */
.evo-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 28px;
  overflow: visible;
}

/* Individual Orb - no circular outline, just the Pokemon image */
.evo-orb {
  position: relative;
  z-index: 5;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  transition: all 0.3s ease;
  overflow: visible;
}

/* Radial Glow - hidden (no circle) */
.evo-glow {
  display: none;
}

.evo-orb:hover {
  box-shadow: none;
}

/* Current Pokemon highlight - subtle only */
.evo-current {
  box-shadow: none;
}

.evo-current .evo-glow {
  display: none;
}

/* Pokemon Image inside Orb */
.evo-image {
  width: 85%;
  height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
}

.evo-orb:hover .evo-image {
  transform: scale(1.1);
}

/* Name/ID Badge below Orb */
.evo-badge {
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.evo-id {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.evo-name {
  font-size: 0.8rem;
  color: #fff;
  font-weight: 700;
  text-transform: capitalize;
}

/* Extra lines under name (Basculin / Basculegion): same # → name order as other routes */
.evo-orb--stacked-label {
  overflow: visible;
}

/*
 * Stacked badges (id + name + subtitle) sit position:absolute under the orb.
 * Reserve enough padding so the box extends past the badge; branch columns need
 * extra gap so two stacked rows never overlap (Basculin → dual Basculegion).
 */
.evo-wrapper:has(.evo-badge--stacked) {
  padding-bottom: 104px;
  margin-bottom: 6px;
}

.stage-branch:has(.evo-badge--stacked) {
  gap: 80px;
}

.evo-badge--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: normal;
  min-width: 200px;
  max-width: min(280px, 94vw);
  bottom: -78px;
  gap: 4px;
}

.evo-name-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.evo-name-sub {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 400;
  font-style: normal;
  text-transform: none;
  line-height: 1.25;
  text-align: center;
}

/* Keep “White-Striped Form” on one line when there is room (matches other evolution name rows) */
.evo-badge--stacked .evo-name-sub {
  white-space: nowrap;
}

@media (max-width: 360px) {
  .evo-badge--stacked .evo-name-sub {
    white-space: normal;
    max-width: 92vw;
  }
}

/* Evolution Trigger Label - ABOVE each orb, very small */
.evo-trigger-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 140px;
  justify-content: center;
}

.evo-trigger-icon {
  width: 25px;
  height: 25px;
  object-fit: contain;
  flex-shrink: 0;
  animation: evo-icon-float 3s ease-in-out infinite;
}

.evo-trigger-icon--water {
  filter: drop-shadow(0 0 4px rgba(100, 200, 255, 0.6)) drop-shadow(0 0 10px rgba(80, 180, 255, 0.35));
}

.evo-trigger-icon--fire {
  filter: drop-shadow(0 0 4px rgba(255, 150, 80, 0.6)) drop-shadow(0 0 10px rgba(255, 120, 50, 0.35));
}

.evo-trigger-icon--thunder {
  filter: drop-shadow(0 0 4px rgba(255, 230, 100, 0.7)) drop-shadow(0 0 10px rgba(255, 200, 50, 0.4));
}

.evo-trigger-icon--leaf {
  filter: drop-shadow(0 0 4px rgba(100, 220, 120, 0.6)) drop-shadow(0 0 10px rgba(80, 200, 100, 0.35));
}

/* Alolan Exeggutor: Leaf Stone in Alola — icon trái (trước chữ trong DOM), lơ lửng + neon lá */
.evo-trigger-icon--leaf-stone-alola {
  filter: drop-shadow(0 0 6px rgba(120, 255, 160, 0.7)) drop-shadow(0 0 14px rgba(40, 220, 100, 0.5));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

.evo-trigger-icon--ice {
  filter: drop-shadow(0 0 4px rgba(180, 230, 255, 0.6)) drop-shadow(0 0 10px rgba(150, 210, 255, 0.35));
}

/* Ice Stone (e.g. Galar Darumaka → Darmanitan): icon trái, lơ lửng + neon băng */
.evo-trigger-icon--ice-stone-float {
  filter: drop-shadow(0 0 6px rgba(160, 230, 255, 0.75)) drop-shadow(0 0 14px rgba(100, 200, 255, 0.5));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

.evo-trigger-icon--dawn {
  filter: drop-shadow(0 0 4px rgba(255, 200, 220, 0.6)) drop-shadow(0 0 10px rgba(255, 160, 200, 0.35));
}

.evo-trigger-icon--dusk {
  filter: drop-shadow(0 0 4px rgba(140, 100, 220, 0.6)) drop-shadow(0 0 10px rgba(120, 80, 200, 0.35));
}

.evo-trigger-icon--shiny {
  filter: drop-shadow(0 0 4px rgba(255, 245, 200, 0.7)) drop-shadow(0 0 10px rgba(255, 230, 150, 0.4));
}

.evo-trigger-icon--moon {
  filter: drop-shadow(0 0 4px rgba(200, 220, 255, 0.6)) drop-shadow(0 0 10px rgba(180, 200, 255, 0.35));
}

.evo-trigger-icon--sun {
  filter: drop-shadow(0 0 4px rgba(255, 255, 180, 0.7)) drop-shadow(0 0 10px rgba(255, 220, 100, 0.4));
}

/* Galarica items: floating + light neon */
.evo-trigger-icon--galarica-cuff,
.evo-trigger-icon--galarica-wreath {
  filter: drop-shadow(0 0 6px rgba(180, 150, 255, 0.5)) drop-shadow(0 0 14px rgba(160, 120, 255, 0.3));
}

/* Applin line: Tart / Sweet / Syrupy Apple — lơ lửng + neon (giống trade items) */
.evo-trigger-icon--tart-apple,
.evo-trigger-icon--tart-apple.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(120, 220, 140, 0.65)) drop-shadow(0 0 14px rgba(60, 180, 100, 0.45));
  animation: evo-icon-float 2.75s ease-in-out infinite;
}

.evo-trigger-icon--sweet-apple,
.evo-trigger-icon--sweet-apple.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(255, 140, 160, 0.7)) drop-shadow(0 0 14px rgba(255, 100, 130, 0.45));
  animation: evo-icon-float 2.85s ease-in-out infinite;
}

.evo-trigger-icon--syrupy-apple,
.evo-trigger-icon--syrupy-apple.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(255, 200, 120, 0.75)) drop-shadow(0 0 14px rgba(220, 150, 60, 0.5));
  animation: evo-icon-float 2.9s ease-in-out infinite;
}

/* Black Augurite: lơ lửng + ánh neon đằng sau (amber/gold) */
.evo-trigger-icon--black-augurite,
.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(255, 180, 80, 0.6)) drop-shadow(0 0 14px rgba(220, 150, 50, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Metal Alloy (Duraludon → Archaludon): neon xanh thép + lơ lửng */
.evo-trigger-icon--metal-alloy,
.evo-trigger-icon--metal-alloy.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(140, 200, 255, 0.65)) drop-shadow(0 0 14px rgba(100, 160, 220, 0.45));
  animation: evo-icon-float 2.85s ease-in-out infinite;
}

/* Unremarkable Teacup (Poltchageist → Sinistcha): matcha / ceramic + lơ lửng */
.evo-trigger-icon--unremarkable-teacup,
.evo-trigger-icon--unremarkable-teacup.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(160, 220, 170, 0.7)) drop-shadow(0 0 14px rgba(100, 180, 130, 0.45));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Petilil / Lilligant: use Sun Stone — neon vàng + lơ lửng (ghi đè --float-neon chung) */
.evo-trigger-icon--sun-stone-petilil,
.evo-trigger-icon--sun-stone-petilil.evo-trigger-icon--float-neon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 235, 160, 0.95)) drop-shadow(0 0 20px rgba(255, 200, 90, 0.65));
  animation: evo-icon-float 2.65s ease-in-out infinite;
}

.evo-trigger-icon--sun-stone-petilil-hisui,
.evo-trigger-icon--sun-stone-petilil-hisui.evo-trigger-icon--float-neon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 220, 150, 0.9)) drop-shadow(0 0 20px rgba(200, 160, 255, 0.5));
  animation: evo-icon-float 2.85s ease-in-out infinite;
}

/* Kings Rock: neon vàng đá */
.evo-trigger-icon--held-kings-rock {
  filter: drop-shadow(0 0 4px rgba(200, 180, 100, 0.7)) drop-shadow(0 0 10px rgba(180, 160, 80, 0.4));
}

/* Metal Coat: neon xanh thép */
.evo-trigger-icon--held-metal-coat {
  filter: drop-shadow(0 0 4px rgba(160, 200, 230, 0.7)) drop-shadow(0 0 10px rgba(120, 170, 210, 0.4));
}

/* Protector: neon cam đất (phù hợp màu đỏ nâu của item) */
.evo-trigger-icon--held-protector {
  filter: drop-shadow(0 0 4px rgba(220, 140, 80, 0.7)) drop-shadow(0 0 10px rgba(200, 120, 60, 0.4));
}

/* Electirizer: lơ lửng + ánh neon vàng điện (electric) */
.evo-trigger-icon--electirizer,
.evo-trigger-icon--electirizer.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(255, 230, 100, 0.6)) drop-shadow(0 0 14px rgba(255, 200, 50, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Magmarizer: lơ lửng + ánh neon đỏ cam (fire) */
.evo-trigger-icon--magmarizer,
.evo-trigger-icon--magmarizer.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(255, 150, 80, 0.6)) drop-shadow(0 0 14px rgba(255, 100, 50, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Oval Stone: neon hồng kem (phù hợp màu trứng) */
.evo-trigger-icon--held-oval-stone {
  filter: drop-shadow(0 0 4px rgba(255, 200, 220, 0.7)) drop-shadow(0 0 10px rgba(255, 180, 200, 0.4));
}

/* Razor Fang: lơ lửng + ánh neon xanh bạc (phù hợp Gligar/Gliscor) */
.evo-trigger-icon--held-razor-fang,
.evo-trigger-icon--held-razor-fang.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(180, 200, 220, 0.6)) drop-shadow(0 0 14px rgba(150, 180, 210, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Razor Claw: lơ lửng + ánh neon bạc xanh (phù hợp Sneasel/Weavile/Sneasler) */
.evo-trigger-icon--held-razor-claw,
.evo-trigger-icon--held-razor-claw.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(200, 210, 230, 0.6)) drop-shadow(0 0 14px rgba(170, 190, 220, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Dragon Scale: neon xanh rồng (phù hợp vảy rồng) */
.evo-trigger-icon--held-dragon-scale {
  filter: drop-shadow(0 0 4px rgba(100, 220, 255, 0.7)) drop-shadow(0 0 10px rgba(80, 200, 240, 0.4));
}

/* Reaper Cloth: lơ lửng + ánh neon tím ma (phù hợp Dusknoir/Ghost) */
.evo-trigger-icon--held-reaper-cloth,
.evo-trigger-icon--held-reaper-cloth.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(140, 100, 200, 0.65)) drop-shadow(0 0 14px rgba(120, 80, 180, 0.45));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Deep Sea Tooth: lơ lửng + ánh neon xanh biển sâu (phù hợp Huntail) */
.evo-trigger-icon--held-deep-sea-tooth,
.evo-trigger-icon--held-deep-sea-tooth.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(80, 180, 220, 0.65)) drop-shadow(0 0 14px rgba(60, 150, 200, 0.45));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Deep Sea Scale: lơ lửng + ánh neon xanh ngọc biển (phù hợp Gorebyss) */
.evo-trigger-icon--held-deep-sea-scale,
.evo-trigger-icon--held-deep-sea-scale.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(100, 200, 230, 0.65)) drop-shadow(0 0 14px rgba(80, 180, 220, 0.45));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Prism Scale: lơ lửng + ánh neon tím hồng (phù hợp Milotic) */
.evo-trigger-icon--held-prism-scale,
.evo-trigger-icon--held-prism-scale.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(205, 160, 255, 0.65)) drop-shadow(0 0 14px rgba(255, 165, 220, 0.45));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Upgrade: lơ lửng + ánh neon xanh công nghệ (Porygon) */
.evo-trigger-icon--held-upgrade,
.evo-trigger-icon--held-upgrade.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(100, 200, 255, 0.6)) drop-shadow(0 0 14px rgba(80, 180, 255, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Dubious Disc: lơ lửng + ánh neon tím ảo (Porygon-Z) */
.evo-trigger-icon--held-dubious-disc,
.evo-trigger-icon--held-dubious-disc.evo-trigger-icon--float-neon {
  filter: drop-shadow(0 0 6px rgba(180, 140, 255, 0.6)) drop-shadow(0 0 14px rgba(160, 120, 240, 0.4));
  animation: evo-icon-float 2.8s ease-in-out infinite;
}

/* Primal route items on single-form slide (same floating vibe as Mega stones) */
.character-frame .mega-stone-img.mega-stone-blue-orb {
  filter: drop-shadow(0 0 10px rgba(90, 190, 255, 0.75))
          drop-shadow(0 0 24px rgba(70, 160, 240, 0.55));
  animation: floatStone 5s ease-in-out infinite;
}

.character-frame .mega-stone-img.mega-stone-red-orb {
  filter: drop-shadow(0 0 10px rgba(255, 120, 90, 0.75))
          drop-shadow(0 0 24px rgba(240, 90, 70, 0.55));
  animation: floatStone 5s ease-in-out infinite;
}

@keyframes evo-icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Trigger text displays exactly as in data (no capitalize) */
.trigger-text-mini {
  display: inline-block;
  padding: 2px 5px;
  background: rgba(10, 15, 25, 0.8);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(160, 210, 255, 0.9);
  white-space: nowrap;
  letter-spacing: 0.2px;
  text-shadow: 0 0 4px rgba(100, 200, 255, 0.4);
}

/* Protector: cho phép xuống dòng "Trade while" / "holding Protector" */
.trigger-text-protector {
  white-space: normal;
  text-align: center;
}

.prism-trigger-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.prism-trigger-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.prism-trigger-line {
  white-space: nowrap;
}

/* ========== BRANCHING EVOLUTION LAYOUT ========== */
.stage-branch {
  gap: 48px;
}

/* Nincada line: align Nincada orb with Ninjask + Shedinja (same row) */
.evolution-stages.has-nincada-plus-branch .stage-column:first-child {
  align-self: center;
  transform: translateY(-30px);
}

/* Nincada line: Ninjask + Shedinja — single branch with "+" between orbs */
.stage-plus-branch {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
}
.stage-plus-branch .evo-plus-sep {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--type-accent, #78c850);
  line-height: 1;
  flex-shrink: 0;
  margin: 0 4px;
}

.stage-branch .branch-item {
  padding-top: 16px;
  padding-bottom: 8px;
}

/* Align asymmetric branches (e.g. Mime Jr.: Kanto ends, Galar line continues to Mr. Rime) */
.evo-branch-spacer .evo-branch-spacer-inner {
  min-height: 200px;
  width: 1px;
  margin: 0 auto;
  pointer-events: none;
}

/* Many branches (e.g. Eevee 8 evolutions): prevent text overlap */
.evo-compact .stage-branch {
  gap: 56px;
}

.evo-compact .stage-branch .branch-item {
  padding-top: 18px;
  padding-bottom: 12px;
}

/* Compact chains: shrink every orb/badge in the row (not only branch column) so columns stay aligned */
.evo-compact .evo-orb {
  width: 72px;
  height: 72px;
}

.evo-compact .evo-badge {
  bottom: -22px;
}

.evo-compact .evo-id {
  font-size: 0.52rem;
}

.evo-compact .evo-name {
  font-size: 0.6rem;
}

.evo-compact .evo-trigger-label {
  max-width: 130px;
  top: -2px;
}

.evo-compact .trigger-text-mini {
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  font-size: 8px;
  padding: 2px 4px;
}

/* Branch-only tweaks when not compact (avoid overriding .evo-compact trigger alignment) */
.evolution-stages:not(.evo-compact) .stage-branch .evo-trigger-label {
  top: -4px;
}

.evolution-stages:not(.evo-compact) .stage-branch .trigger-text-mini {
  font-size: 8px;
  padding: 1px 4px;
}

/* Chevron positioning for branching chains */
.has-branch {
  align-items: center;
}

.has-branch > .evo-chevron {
  align-self: center;
}

/* Applin family: Hydrapple chỉ từ nhánh Dipplin (hàng 3). Cột spacer + căn stretch để
   Hydrapple thẳng hàng Dipplin; mũi tên cuối không nằm giữa Appletun và Dipplin. */
.evolution-stages.evo-applin-hydrapple-chain {
  align-items: stretch;
}

.evolution-stages.evo-applin-hydrapple-chain > .stage-column:first-child {
  align-self: center;
}

.evolution-stages.evo-applin-hydrapple-chain > .stage-branch:first-of-type {
  align-self: stretch;
  justify-content: flex-start;
}

.evolution-stages.evo-applin-hydrapple-chain > .stage-branch:last-of-type {
  align-self: stretch;
  justify-content: flex-end;
  min-height: 0;
}

.evolution-stages.evo-applin-hydrapple-chain .evo-branch-spacer.branch-item {
  flex: 1 1 0;
  min-height: 0;
}

.evolution-stages.evo-applin-hydrapple-chain .evo-branch-spacer .evo-branch-spacer-inner {
  min-height: 0;
  flex: 1 1 auto;
}

.evolution-stages.evo-applin-hydrapple-chain.has-branch > .evo-chevron.evo-chevron--applin-hydrapple {
  align-self: flex-end;
  margin-bottom: calc(55px + (110px / 2));
}

.evolution-stages.evo-applin-hydrapple-chain.evo-compact.has-branch > .evo-chevron.evo-chevron--applin-hydrapple {
  margin-bottom: calc(40px + (72px / 2));
}

/* Mega Evolution Chain — Venusaur → Mega Venusaur */
.mega-evo-stages { gap: 50px; }
.mega-evo-chain .evo-chevron.mega-evo-arrow {
  width: 40px;
  height: 40px;
}
.evo-held-stone .evo-mega-stone-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  animation: evo-icon-float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(120, 200, 80, 0.5));
}

/* Responsive Evolution Chain */
@media (max-width: 800px) {
  .evolution-stages {
    gap: 60px;
    max-width: 100%;
  }
  
  .stage-column {
    gap: 35px;
  }
  
  .stage-branch {
    gap: 48px;
  }
  
  .evo-compact .stage-branch {
    gap: 56px;
  }
  
  .evo-orb {
    width: 90px;
    height: 90px;
  }
  
  .trigger-text-mini {
    font-size: 9px;
  }

  .evo-compact .evo-orb {
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 600px) {
  .evolution-stages {
    gap: 45px;
  }
  
  .stage-column {
    gap: 30px;
  }
  
  .stage-branch {
    gap: 40px;
  }
  
  .evo-compact .stage-branch {
    gap: 48px;
  }
  
  .evo-orb {
    width: 80px;
    height: 80px;
  }

  .evo-compact .evo-orb {
    width: 64px;
    height: 64px;
  }
  
  .evo-badge {
    bottom: -28px;
  }

  .evo-compact .evo-badge {
    bottom: -20px;
  }

  .evo-badge--stacked {
    bottom: -74px;
  }

  .evo-wrapper:has(.evo-badge--stacked) {
    padding-bottom: 96px;
  }

  .stage-branch:has(.evo-badge--stacked) {
    gap: 64px;
  }

  .evo-compact .evo-badge--stacked {
    bottom: -66px;
  }
  
  .evo-id {
    font-size: 0.55rem;
  }
  
  .evo-name {
    font-size: 0.6rem;
  }
  
  .trigger-text-mini {
    font-size: 8px;
    padding: 1px 4px;
  }
  
  .evo-wrapper {
    padding-top: 15px;
  }
}

@media (max-width: 450px) {
  /* Structure refactor cho Component Evolution Chain trên Mobile */
  .evolution-wrapper {
    margin-bottom: 20px;
  }
  
  .evolution-heading {
    margin-bottom: 15px;
  }
  
  .evolution-section.glass-card {
    /* Thu hẹp khung; cùng bề mặt glass + bóng mờ như stats / abilities / moveset */
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .evolution-container {
    padding: 0;
    min-height: auto;
  }
  
  .evolution-stages {
    flex-direction: column;
    gap: 0.35rem; /* Thắt chặt khoảng cách dọc xuống còn khoảng 1.5rem */
  }

  /* Applin → Hydrapple (dọc): 3 tiến hoá căn 3 cột đều; mũi tên + Hydrapple căn phải = nhánh Dipplin */
  .evolution-stages.evo-applin-hydrapple-chain {
    align-items: stretch;
    width: 100%;
  }

  .evolution-stages.evo-applin-hydrapple-chain > .stage-column:first-child {
    align-self: center;
  }

  .evolution-stages.evo-applin-hydrapple-chain > .stage-branch:first-of-type {
    align-self: stretch;
    width: 100%;
    max-width: none;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
    padding: 0 6px;
    box-sizing: border-box;
  }

  .evolution-stages.evo-applin-hydrapple-chain > .stage-branch:last-of-type {
    align-self: flex-end;
    width: auto;
    min-width: 0;
    justify-content: flex-start;
    flex-direction: column !important;
  }

  .evolution-stages.evo-applin-hydrapple-chain > .stage-branch:last-of-type .evo-branch-spacer {
    display: none;
  }

  .evolution-stages.evo-applin-hydrapple-chain.has-branch > .evo-chevron.evo-chevron--applin-hydrapple {
    align-self: flex-end !important;
    margin-bottom: 0;
    margin-right: 0;
  }

  /* Chevrons rotate 90° when chain stacks vertically */
  .evolution-stages .evo-chevron {
    transform: rotate(90deg);
  }
  
  .stage-column {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }
  
  .evo-orb {
    width: 70px;
    height: 70px;
  }

  .evo-compact .evo-orb {
    width: 56px;
    height: 56px;
  }
  
  .evo-trigger-label {
    top: -2px;
  }
  
  .evo-badge {
    bottom: -26px;
  }

  .evo-compact .evo-badge {
    bottom: -18px;
  }

  .evo-badge--stacked {
    bottom: -70px;
    min-width: 180px;
    max-width: min(260px, 92vw);
  }

  .evo-wrapper:has(.evo-badge--stacked) {
    padding-bottom: 90px;
  }

  .stage-branch:has(.evo-badge--stacked) {
    gap: 56px;
  }

  .evo-compact .evo-badge--stacked {
    bottom: -62px;
  }
  
  .evo-wrapper {
    padding-top: 12px;
    margin-bottom: 25px;
  }
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
/*
 * Vách mỏng dưới header site → Previous/Next; cùng khối nội dung với specimen/hero (không vách thêm).
 */
.detail-top-controls {
  align-self: stretch;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vw, 10px);
}

/* Đường phân cách (1px + shadow) */
.detail-toolbar {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.4),
    0 6px 24px -18px rgba(200, 175, 100, 0.12);
}

/* Vách đầu: nhấn mạnh ranh giới header sticky ↔ phần thân trang */
.detail-toolbar--below-site-chrome {
  border-bottom-color: rgba(255, 255, 255, 0.11);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.45),
    0 8px 28px -16px rgba(200, 175, 100, 0.14);
}

/* Trang chi tiết: bớt khoảng trống dưới hàng National Pokédex / search */
body:has(.detail-page) .header-shell {
  padding-bottom: 0;
}

body:has(.detail-page) .header-shell-search {
  padding-top: 6px;
  padding-bottom: 6px;
}

@media (orientation: landscape) and (max-width: 1024px) {
  body:has(.detail-page) .header-shell:has(.header-shell-search) .header-shell-search {
    padding-top: 0;
    padding-bottom: 0;
  }
}

.detail-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.detail-nav--top {
  align-self: stretch;
  justify-content: space-between;
  margin-top: 0;
  margin-bottom: 0;
  gap: clamp(8px, 2vw, 16px);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Pagination đầu trang: nhỏ gọn hơn */
.detail-nav--top .nav-btn {
  padding: 7px 14px;
  gap: 4px;
  font-size: 0.78rem;
  border-radius: 10px;
}

.detail-nav--top .nav-btn:hover {
  transform: translateY(-1px);
}

.nav-loop {
  background: linear-gradient(135deg, rgba(100, 200, 255, 0.15), rgba(100, 180, 255, 0.08));
  border-color: rgba(100, 200, 255, 0.3);
  font-size: 0.8rem;
}

.detail-nav--top .nav-loop {
  font-size: 0.74rem;
}

.nav-loop:hover {
  background: linear-gradient(135deg, rgba(100, 200, 255, 0.25), rgba(100, 180, 255, 0.15));
  border-color: rgba(100, 200, 255, 0.5);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 480px) {
  .detail-name {
    font-size: 1.5rem;
  }
  
  .detail-hero {
    max-width: 250px;
  }
  
  .stat-row {
    grid-template-columns: 60px 1fr 35px;
  }
}

/* ==========================================================================
   FORM SWITCHER (Natural / Mega / G-Max)
   ========================================================================== */
.form-switcher {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  z-index: 10;
  padding: 6px 10px;
  border-radius: 40px;
  background: rgba(18, 20, 28, 0.55);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  /* Shrink-wrap to the inner row instead of stretching against the hero box. */
  width: auto;
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
  /* visible so .form-btn::after labels render outside the pill */
  overflow: visible;
}

/* Inner track: intrinsic width; nav pill wraps this row */
.form-switcher-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: max-content;
}

.form-switcher-row--arceus {
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  gap: 6px 7px;
}

.form-switcher .form-btn {
  flex-shrink: 0;
}

/* Tauros #128: Paldea tab — Combat / Aqua / Blaze fully below form-switcher
   (switcher: bottom -20px, ~44–56px tall + shadow → breed row must sit lower) */
.paldea-breed-switcher {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: clamp(-6.5rem, -24vw, -5.25rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  z-index: 9;
  max-width: calc(100vw - 36px);
  padding-top: 2px;
}
.paldea-breed-switcher[hidden] {
  display: none !important;
}
.paldea-breed-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(22, 24, 34, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.paldea-breed-btn:hover {
  background: rgba(40, 44, 58, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
}
.paldea-breed-btn.is-active {
  background: rgba(90, 120, 200, 0.35);
  border-color: rgba(160, 190, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(160, 190, 255, 0.2);
}

/* Arceus (493): many plate buttons — stay inside hero width, wrap rows (no viewport-wide bar) */
.form-switcher-arceus {
  /* Below default -20px: multi-row pill grows upward; strong offset so pill clears sprite */
  bottom: calc(-1.25rem - clamp(2.75rem, 7.5vw, 4.75rem));
  left: 0;
  right: 0;
  transform: none;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 6px;
  align-content: center;
  overflow-x: visible;
  overflow-y: visible;
  border-radius: clamp(18px, 5vw, 30px);
}
.form-switcher-arceus .form-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
}
.form-switcher-arceus .form-icon {
  width: 18px;
  height: 18px;
}
.form-switcher-arceus .form-btn::after {
  z-index: 100;
}

/*
 * Alcremie (869) / Furfrou (676) / Minior (774):
 * keep the pill tightly wrapped to the icon row and let the tooltip sit above
 * the bar, same behavior as the non-scrolling switchers.
 */
.form-switcher-alcremie,
.form-switcher-furfrou,
.form-switcher-minior {
  display: inline-block;
  width: auto;
  max-width: none;
  padding: 6px 10px;
  margin-top: 0;
  overflow: visible;
}

.form-switcher-alcremie .form-switcher-row,
.form-switcher-furfrou .form-switcher-row,
.form-switcher-minior .form-switcher-row {
  justify-content: center;
}

.form-switcher-alcremie .form-btn,
.form-switcher-furfrou .form-btn,
.form-switcher-minior .form-btn {
  flex-shrink: 0;
}
.form-switcher-alcremie .form-btn::after,
.form-switcher-furfrou .form-btn::after,
.form-switcher-minior .form-btn::after {
  z-index: 100;
}

/* Aegislash (681): Shield Form + Blade Form; 2 buttons */
.form-switcher-aegislash {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-aegislash .form-btn {
  flex-shrink: 0;
}
.form-switcher-aegislash .form-btn::after {
  z-index: 100;
}

/* Genesect (649): Natural + 4 Drive forms; 5 buttons in 1 row */
.form-switcher-genesect {
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-genesect .form-btn {
  flex-shrink: 0;
}

/* Kyurem (646): Natural + White Kyurem + Black Kyurem; 3 buttons in 1 row */
.form-switcher-kyurem {
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-kyurem .form-btn {
  flex-shrink: 0;
}

/* Zygarde (718): 50% + Cell + 10% + 100% Form; 4 buttons on 1 row */
.form-switcher-zygarde {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
  -webkit-overflow-scrolling: touch;
}
.form-switcher-zygarde .form-btn {
  flex-shrink: 0;
}
.form-switcher-zygarde .form-btn::after {
  z-index: 100;
}

/* Dialga/Palkia/Giratina (483/484/487): Natural + Origin Form; 2 buttons */
.form-switcher-origin {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-origin .form-btn {
  flex-shrink: 0;
}
.form-switcher-origin .form-btn::after {
  z-index: 100;
}

/* Calyrex (898): Natural + Ice Rider + Shadow Rider; 3 buttons */
.form-switcher-calyrex {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-calyrex .form-btn {
  flex-shrink: 0;
}
.form-switcher-calyrex .form-btn::after {
  z-index: 100;
}

/* Cherrim (421): Natural + Sunshine Form; 2 buttons */
.form-switcher-cherrim {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-cherrim .form-btn {
  flex-shrink: 0;
}
.form-switcher-cherrim .form-btn::after {
  z-index: 100;
}

/* Deerling/Sawsbuck (585/586): Spring + Summer + Autumn + Winter; 4 buttons */
.form-switcher-deerling {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-deerling .form-btn {
  flex-shrink: 0;
}
.form-switcher-deerling .form-btn::after {
  z-index: 100;
}

/* Tornadus/Thundurus/Landorus/Enamorus (641/642/645/905): Incarnate + Therian; 2 buttons */
.form-switcher-therian {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-therian .form-btn {
  flex-shrink: 0;
}
.form-switcher-therian .form-btn::after {
  z-index: 100;
}

/* Flabebe/Floette/Florges (669/670/671): Red + Blue + Orange + White + Yellow; 5 buttons */
.form-switcher-flabebe {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-flabebe .form-btn {
  flex-shrink: 0;
}
.form-switcher-flabebe .form-btn::after {
  z-index: 100;
}

/* Wormadam (413): 3 cloak buttons on 1 row */
.form-switcher-wormadam {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-wormadam .form-btn {
  flex-shrink: 0;
}
.form-switcher-wormadam .form-btn::after {
  z-index: 100;
}

/* Rotom (479): 6 buttons on 1 row */
.form-switcher-rotom {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-rotom .form-btn {
  flex-shrink: 0;
}
.form-switcher-rotom .form-btn::after {
  z-index: 100;
}

/* Deoxys (386): 4 form buttons on 1 row */
.form-switcher-deoxys {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-deoxys .form-btn {
  flex-shrink: 0;
}
.form-switcher-deoxys .form-btn::after {
  z-index: 100;
}

/* Castform (351): 4 form buttons on 1 row */
.form-switcher-castform {
  padding: 8px 16px;
  flex-wrap: nowrap;
  overflow: visible;
}
.form-switcher-castform .form-btn {
  flex-shrink: 0;
}
.form-switcher-castform .form-btn::after {
  z-index: 100;
}

.form-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  color: rgba(255, 255, 255, 0.5);
  padding: 0;
}

.form-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: scale(1.08);
}

.form-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--type-color, rgba(100, 180, 255, 0.6));
  color: #fff;
  box-shadow:
    0 0 14px color-mix(in srgb, var(--type-color, #64b4ff) 50%, transparent),
    0 0 30px color-mix(in srgb, var(--type-color, #64b4ff) 25%, transparent),
    inset 0 0 6px color-mix(in srgb, var(--type-color, #64b4ff) 15%, transparent);
}

.form-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.form-icon-img {
  object-fit: contain;
  display: block;
}

/* Tooltip (data attr avoids native title tooltip delay + system font) */
.form-btn::after {
  content: attr(data-switcher-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(18, 20, 28, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Cross-fade animation classes (set/removed by JS) */
.detail-image.form-fade-out {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.detail-image.form-fade-in {
  animation: formFadeIn 0.4s ease forwards;
}

@keyframes formFadeIn {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: scale(1); }
}

/* Override stat-fill to allow JS-driven transitions after initial load */
.stat-fill {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.4s ease,
              box-shadow 0.4s ease;
}

/* Hero tint shifts — Mega: Key Stone–style violet → cyan → lime neon */
.detail-hero.form-tint-mega {
  --glow-color: #00e0ff;
  --mega-neon-purple: #d031ff;
  --mega-neon-blue: #00e0ff;
  --mega-neon-green: #7cff00;
  background:
    radial-gradient(circle at 32% 28%, rgba(208, 49, 255, 0.22) 0%, transparent 18%),
    radial-gradient(circle at 68% 42%, rgba(0, 224, 255, 0.2) 0%, transparent 17%),
    radial-gradient(circle at 50% 78%, rgba(124, 255, 0, 0.18) 0%, transparent 16%),
    radial-gradient(circle at 50% 50%, rgba(0, 224, 255, 0.07) 0%, transparent 42%);
}

/* Rotating soft aura behind the sprite (specimen hub) */
.detail-hero--specimen.form-tint-mega::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52%;
  height: 52%;
  max-width: 200px;
  max-height: 200px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
  background: conic-gradient(
    from 200deg,
    var(--mega-neon-purple) 0deg,
    var(--mega-neon-blue) 110deg,
    var(--mega-neon-green) 220deg,
    var(--mega-neon-purple) 360deg
  );
  filter: blur(22px);
  opacity: 0.38;
  animation: megaKeyStoneAuraSpin 12s linear infinite;
}

@keyframes megaKeyStoneAuraSpin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.detail-hero--specimen.form-tint-mega .detail-hero-energy-shadow {
  opacity: 0.07;
}

/* Tri-color neon rim on Mega Pokémon artwork (tighter than background so it hugs the silhouette) */
.detail-hero.form-tint-mega .detail-image {
  filter:
    drop-shadow(0 10px 28px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 8px rgba(208, 49, 255, 0.5))
    drop-shadow(0 0 14px rgba(0, 224, 255, 0.38))
    drop-shadow(0 0 20px rgba(124, 255, 0, 0.28));
}

@media (prefers-reduced-motion: reduce) {
  .detail-hero--specimen.form-tint-mega::before {
    animation: none;
    opacity: 0.4;
  }
}

.detail-hero.form-tint-gmax {
  --glow-color: #ff6f42;
}

.detail-hero.form-tint-alola {
  --glow-color: #f59e0b;
}

.detail-hero.form-tint-galar {
  --glow-color: #6366f1;
}

.detail-hero.form-tint-hisui {
  --glow-color: #d97706;
}

.detail-hero.form-tint-paldea {
  --glow-color: #ef4444;
}

/* Responsive: ensure touch targets meet 44px minimum */
@media (max-width: 480px) {
  .form-switcher {
    padding: 5px 8px;
  }
  .form-switcher-row {
    gap: 8px;
  }
  .form-switcher-row--arceus {
    gap: 6px 7px;
  }
  /* Keep these three aligned with the standard pill on small screens too. */
  .form-switcher-alcremie,
  .form-switcher-furfrou,
  .form-switcher-minior {
    padding: 5px 8px;
    margin-top: 0;
  }
  .form-btn {
    width: 44px;
    height: 44px;
  }
  .paldea-breed-switcher {
    bottom: -6.75rem;
  }
  .specimen-stage-col--center:has(#paldeaTaurosBreeds:not([hidden])) .specimen-identity-below {
    margin-top: clamp(5.75rem, 18vw, 8rem);
  }
}

/*
 * Mobile dọc / máy hẹp: switcher absolute luôn mọc ngược lên sprite (Arceus, Vivillon…).
 * Chuyển specimen hero sang flex column + switcher position:static — luôn nằm dưới ảnh, không đè.
 * Fallback (max-width: 520px): một số trình duyệt / PWA không báo orientation: portrait đúng.
 */
@media (max-width: 768px) and (orientation: portrait),
  (max-width: 520px) {
  .detail-hero--specimen:has(> .form-switcher) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(10px, 3vw, 16px);
    aspect-ratio: unset;
    width: 100%;
    max-width: min(400px, 100%);
    overflow: visible;
  }

  /* Ô vuông sprite — giữ tỷ lệ, không chia sẻ hàng với switcher */
  .detail-hero--specimen:has(> .form-switcher) > .detail-image,
  .detail-hero--specimen:has(> .form-switcher) > .detail-hero-artwork-row--primal,
  .detail-hero--specimen:has(> .form-switcher) > .detail-hero-artwork-row--mega-stone {
    width: 100%;
    max-width: min(360px, 88vw);
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0 auto;
  }

  .detail-hero--specimen:has(> .form-switcher) > .detail-image {
    object-fit: contain;
    max-height: none;
  }

  /* Glow type: neo theo chiều cao ô ảnh (không center cả khối hero cao) */
  .detail-hero--specimen:has(> .form-switcher) .detail-hero-energy-shadow {
    top: calc(min(360px, 88vw) * 0.48);
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
  }

  /* Khung pill co theo số nút (Natural/Mega/G-Max…); không kéo full-width như thanh cố định */
  .detail-hero--specimen:has(> .form-switcher) > .form-switcher {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: auto !important;
    max-width: 100% !important;
    align-self: center;
    box-sizing: border-box;
  }

  /* Arceus: nhiều hàng plate — vẫn cần full width khối hero để wrap */
  .detail-hero--specimen:has(> .form-switcher) > .form-switcher.form-switcher-arceus {
    width: 100% !important;
    max-width: 100% !important;
    align-self: stretch;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .detail-hero--specimen:has(> .form-switcher) > .paldea-breed-switcher {
    position: static !important;
    left: auto !important;
    transform: none !important;
    bottom: auto !important;
    margin-top: 4px;
    margin-bottom: 0;
    max-width: 100%;
    justify-content: center;
  }

  /* Không còn switcher tràn ra ngoài box → bỏ margin “đệm” cỡ lớn cho # / tên */
  .specimen-stage-col--center:has(.form-switcher) .specimen-identity-below,
  .specimen-stage-col--center:has(.form-switcher-arceus) .specimen-identity-below {
    margin-top: 0.35rem;
  }

  .specimen-stage-col--center:has(#paldeaTaurosBreeds:not([hidden])) .specimen-identity-below {
    margin-top: 0.5rem;
  }
}

/* ==========================================================================
   VIVILLON — 20-pattern showcase grid (route #666) — 5 cols × 4 rows
   ========================================================================== */

.detail-container--vivillon {
  max-width: 720px;
}

.detail-image.vivillon-hidden {
  display: none;
}

.detail-hero.vivillon-hero {
  max-width: 100%;
  width: 100%;
  aspect-ratio: unset;
  background: none;
  padding: 24px 0 28px;
}

.vivillon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px 20px;
  width: 100%;
  align-items: start;
}

.vivillon-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.vivillon-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
  will-change: transform;
}

.vivillon-item:hover {
  transform: translateY(-6px) scale(1.02);
}

.vivillon-glow {
  position: absolute;
  inset: -12px -6px -6px;
  background: radial-gradient(ellipse 80% 70% at 50% 55%, var(--v-neon, rgba(120, 200, 255, 0.3)) 0%, transparent 65%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.25s ease;
}

.vivillon-item:hover .vivillon-glow {
  opacity: 0.95;
}

.vivillon-sprite {
  width: 140px;
  height: 140px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 12px var(--v-neon, rgba(120, 200, 255, 0.5)));
  transition: filter 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vivillon-item:hover .vivillon-sprite {
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 20px var(--v-neon, rgba(120, 200, 255, 0.85)));
  transform: scale(1.06);
}

.vivillon-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  line-height: 1.25;
  position: relative;
  z-index: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px var(--v-neon, rgba(120, 200, 255, 0.5));
  text-transform: uppercase;
  max-width: 100%;
  word-break: break-word;
}

@media (max-width: 700px) {
  .detail-container--vivillon {
    max-width: 100%;
  }
  .vivillon-grid {
    gap: 14px 16px;
  }
  .vivillon-sprite {
    width: 110px;
    height: 110px;
  }
  .vivillon-col {
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .vivillon-grid {
    gap: 12px 14px;
  }
  .vivillon-sprite {
    width: 88px;
    height: 88px;
  }
  .vivillon-label {
    font-size: 0.5rem;
  }
}

@media (max-width: 420px) {
  .vivillon-grid {
    gap: 10px 12px;
  }
  .vivillon-sprite {
    width: 72px;
    height: 72px;
  }
}

/* ==========================================================================
   UNOWN — 28-form showcase grid (route #201) — 7 cols × 4 rows (A-Z + ! + ?)
   ========================================================================== */

.detail-container--unown {
  max-width: 720px;
}

.detail-image.unown-hidden {
  display: none;
}

.detail-hero.unown-hero {
  max-width: 100%;
  width: 100%;
  aspect-ratio: unset;
  background: none;
  padding: 24px 0 28px;
}

.unown-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 18px 20px;
  width: 100%;
  align-items: start;
}

.unown-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.unown-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
  will-change: transform;
}

.unown-item:hover {
  transform: translateY(-6px) scale(1.02);
}

.unown-glow {
  position: absolute;
  inset: -12px -6px -6px;
  background: radial-gradient(ellipse 80% 70% at 50% 55%, var(--v-neon, rgba(248, 88, 136, 0.3)) 0%, transparent 65%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.25s ease;
}

.unown-item:hover .unown-glow {
  opacity: 0.95;
}

.unown-sprite {
  width: 140px;
  height: 140px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 12px var(--v-neon, rgba(248, 88, 136, 0.5)));
  transition: filter 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.unown-item:hover .unown-sprite {
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 20px var(--v-neon, rgba(248, 88, 136, 0.85)));
  transform: scale(1.06);
}

.unown-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  line-height: 1.25;
  position: relative;
  z-index: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px var(--v-neon, rgba(248, 88, 136, 0.5));
  text-transform: uppercase;
  max-width: 100%;
  word-break: break-word;
}

@media (max-width: 700px) {
  .detail-container--unown {
    max-width: 100%;
  }
  .unown-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px 16px;
  }
  .unown-sprite {
    width: 110px;
    height: 110px;
  }
  .unown-col {
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .unown-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 14px;
  }
  .unown-sprite {
    width: 88px;
    height: 88px;
  }
  .unown-label {
    font-size: 0.5rem;
  }
}

@media (max-width: 420px) {
  .unown-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 12px;
  }
  .unown-sprite {
    width: 72px;
    height: 72px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   ABILITIES SECTION
   ═══════════════════════════════════════════════════════════════════ */
.abilities-section {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  /* Ability tiles: fixed blue accent (not Pokémon type) */
  --ability-accent: #3b82f6;
  --ability-accent-mix: #38bdf8;
  --ability-accent-glow: rgba(59, 130, 246, 0.35);
}
.abilities-section.abilities-card-blue {
  --type-color: var(--ability-accent);
  --glow-color: var(--ability-accent);
}
.abilities-heading {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 0.65rem;
  text-align: center;
}
.abilities-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  width: 100%;
  justify-content: flex-start;
  align-content: flex-start;
}

/* ── Ability Tile: rgba only (Safari iOS may drop invalid color-mix in shorthand → white buttons) */
.ability-tile {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(96, 155, 235, 0.42);
  /* Nền tối tách riêng; gradient chỉ qua background-image (rgba thuần) */
  background-color: rgba(20, 24, 38, 0.96);
  background-image: linear-gradient(
    135deg,
    rgba(45, 85, 165, 0.28),
    rgba(255, 255, 255, 0.04)
  );
  background-clip: padding-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e8edf5;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
  z-index: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(59, 130, 246, 0.14);
}
.ability-tile::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  padding: 2px;
  background: conic-gradient(
    from var(--pulse-angle, 0deg),
    transparent 60%,
    rgba(147, 197, 253, 0.9) 78%,
    rgba(125, 211, 252, 0.85) 88%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
@media (hover: hover) {
  .ability-tile:hover {
    transform: scale(1.05);
    box-shadow:
      0 0 18px rgba(59, 130, 246, 0.32),
      0 0 40px rgba(59, 130, 246, 0.14);
    border-color: rgba(120, 175, 255, 0.55);
  }
  .ability-tile:hover::before {
    opacity: 1;
    animation: neuralPulse 1.8s linear infinite;
  }
}

@keyframes neuralPulse {
  from { --pulse-angle: 0deg; }
  to   { --pulse-angle: 360deg; }
}
@property --pulse-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.ability-name {
  font-weight: 600;
  pointer-events: none;
}
/* Không dùng background-clip:text + transparent: nếu WebKit lỗi, chữ kế thừa màu sáng từ .ability-tile → không đọc được trên pill sáng. */
.ability-hidden-badge {
  position: relative;
  z-index: 0;
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  isolation: isolate;
  pointer-events: none;
  color: #3730a3;
  -webkit-text-fill-color: #3730a3;
  background: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}
.ability-hidden-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  /* Nền pill: tím nhạt → xanh nhạt (gradient ở khung, chữ solid để luôn đọc được) */
  background: linear-gradient(
    160deg,
    rgba(245, 240, 255, 0.99),
    rgba(230, 232, 255, 0.97),
    rgba(210, 224, 255, 0.96)
  );
  border: 1px solid rgba(99, 102, 241, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ── Ability Modal ─────────────────────────────────────────────── */
.ability-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ability-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.ability-modal {
  position: relative;
  width: 90%;
  max-width: 520px;
  padding: 2rem 1.75rem;
  border-radius: 16px;
  background: rgba(15, 20, 40, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(120, 200, 255, 0.06);
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.ability-modal-overlay.is-open .ability-modal {
  transform: scale(1);
  opacity: 1;
}
.ability-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.ability-modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.ability-modal-name {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.85rem 0;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}
.ability-modal-effect {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(226, 232, 240, 0.85);
  margin: 0;
  user-select: text;
  -webkit-user-select: text;
}
.ability-modal-cover {
  width: 100%;
  border-radius: 16px;
  margin-top: 1.25rem;
  object-fit: cover;
  display: none;
}
.ability-modal-cover[src=""] {
  display: none;
}

/* ==========================================================================
   LEVEL-UP MOVESET — Single column, rings inline
   ========================================================================== */

.move-library {
  margin-top: 24px;
}

.move-library-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.move-library-icon {
  width: 15px;
  height: 15px;
  color: var(--type-color, rgba(120, 200, 255, 0.65));
  flex-shrink: 0;
}

.move-library-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(200, 225, 255, 0.85);
  margin: 0;
}

.move-library-source {
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(100, 155, 235, 0.5);
  background: rgba(80, 120, 255, 0.07);
  border: 1px solid rgba(80, 120, 255, 0.15);
  border-radius: 20px;
  padding: 2px 9px;
}

.move-library-count {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(100, 150, 220, 0.45);
}

.move-library-header-counts {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Một nút đếm đơn (không bọc div): vẫn căn phải */
.move-library-header > .move-library-count:last-of-type {
  margin-left: auto;
}

/* ── Single column list ───────────────────────────────────────────────────── */
.move-moveset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Cross-gen learnset switchers ───────────────────────────────────────── */
.cross-gen-learnset-root {
  margin-top: 4px;
}

.cg-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.cg-gen-rail,
.cg-series-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.cg-gen-rail {
  position: relative;
  z-index: 4;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cg-series-rail {
  padding-left: 2px;
}

.cg-gen-chip,
.cg-series-chip {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(120, 180, 255, 0.2);
  background: rgba(12, 24, 56, 0.55);
  color: rgba(190, 215, 255, 0.72);
  padding: 7px 14px;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s ease,
    color 0.2s ease,
    background 0.2s ease;
}

.cg-series-chip {
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-color: rgba(140, 200, 255, 0.14);
  background: rgba(20, 40, 80, 0.35);
  color: rgba(160, 195, 240, 0.65);
}

.cg-gen-chip:hover:not(:disabled),
.cg-series-chip:hover {
  border-color: rgba(160, 210, 255, 0.45);
  color: rgba(230, 240, 255, 0.95);
  box-shadow: 0 0 14px rgba(100, 180, 255, 0.12);
}

.cg-gen-chip.is-active {
  border-color: color-mix(in srgb, var(--type-color, #6eb0ff) 55%, rgba(255, 255, 255, 0.25));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--type-color, #6eb0ff) 22%, transparent),
    rgba(10, 20, 48, 0.75)
  );
  color: #fff;
  box-shadow:
    0 0 20px color-mix(in srgb, var(--type-color, #6eb0ff) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.cg-series-chip.is-active {
  border-color: rgba(180, 220, 255, 0.5);
  background: rgba(60, 120, 200, 0.22);
  color: rgba(240, 248, 255, 0.95);
  box-shadow: 0 0 12px rgba(100, 170, 255, 0.15);
}

.cg-gen-chip.is-disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.cg-empty {
  font-size: 0.78rem;
  color: rgba(150, 180, 220, 0.5);
  text-align: center;
  padding: 20px 12px;
  margin: 0;
  border-radius: 8px;
  border: 1px dashed rgba(100, 150, 220, 0.15);
  background: rgba(0, 20, 50, 0.2);
}

/* ── One row per move: Lv | Name | Type | Cat | Rings ─────────────────────── */
.move-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--move-type-color) 10%, transparent) 0%, transparent 15%),
    rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.move-row:nth-child(even) {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--move-type-color) 10%, transparent) 0%, transparent 15%),
    rgba(255, 255, 255, 0.05);
}

.move-row-lv {
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(160, 200, 255, 0.75);
}

.move-row-name-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.move-row-name {
  position: relative;
  display: block;
  padding-left: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Data strip accent: 3px vertical bar on far left of move name */
.move-row-name::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  background: var(--move-type-color, rgba(120, 180, 255, 0.8));
  border-radius: 2px;
}

/* Effect popup — HUD-style Research Scanner */
.move-effect-popup {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  background: rgba(8, 16, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(210, 230, 255, 0.9);
  z-index: 100;
  pointer-events: none;
  white-space: normal;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 20px color-mix(in srgb, var(--move-type-color) 25%, transparent);
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.4s cubic-bezier(0.2, 1, 0.3, 1),
    transform 0.4s cubic-bezier(0.2, 1, 0.3, 1),
    visibility 0.4s;
}

.move-row-name-wrap:hover .move-effect-popup {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Corner brackets — 4 L-shaped targeting scanner */
.move-effect-popup::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--move-type-color) 2px, transparent 2px) 8px 8px / 12px 2px no-repeat,
    linear-gradient(180deg, var(--move-type-color) 2px, transparent 2px) 8px 8px / 2px 12px no-repeat,
    linear-gradient(-90deg, var(--move-type-color) 2px, transparent 2px) calc(100% - 8px) 8px / 12px 2px no-repeat,
    linear-gradient(180deg, var(--move-type-color) 2px, transparent 2px) calc(100% - 8px) 8px / 2px 12px no-repeat,
    linear-gradient(90deg, var(--move-type-color) 2px, transparent 2px) 8px calc(100% - 8px) / 12px 2px no-repeat,
    linear-gradient(0deg, var(--move-type-color) 2px, transparent 2px) 8px calc(100% - 8px) / 2px 12px no-repeat,
    linear-gradient(-90deg, var(--move-type-color) 2px, transparent 2px) calc(100% - 8px) calc(100% - 8px) / 12px 2px no-repeat,
    linear-gradient(0deg, var(--move-type-color) 2px, transparent 2px) calc(100% - 8px) calc(100% - 8px) / 2px 12px no-repeat;
}

.popup-label {
  display: block;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(120, 180, 255, 0.6);
  margin: 0 0 8px;
  animation: popupLabelPulse 2s ease-in-out infinite;
}

@keyframes popupLabelPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

.popup-effect-text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(220, 235, 255, 0.92);
}

.move-row .type-badge {
  flex-shrink: 0;
  font-size: 0.54rem;
  padding: 2px 8px;
}

.move-row-cat {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.15));
}

/* ── Rings inline (same row) ─────────────────────────────────────────────── */
.move-row-rings {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.move-ring-wrap {
  position: relative;
  width: 38px;
  height: 38px;
}

.move-ring-svg {
  width: 38px;
  height: 38px;
  transform: rotate(-90deg);
}

.move-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 3;
}

.move-ring-fg {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.move-ring-power {
  filter: drop-shadow(0 0 3px var(--move-type-color, #78c850));
}

.move-ring-accuracy {
  stroke: rgba(80, 215, 255, 0.85);
  filter: drop-shadow(0 0 3px rgba(60, 200, 255, 0.45));
}

.move-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  pointer-events: none;
}

.move-ring-num {
  font-size: 0.6rem;
  font-weight: 900;
  color: rgba(230, 245, 255, 0.95);
  line-height: 1;
}

.move-ring-inf {
  font-size: 0.75rem;
}

.move-ring-dash {
  font-size: 0.7rem;
  color: rgba(180, 200, 230, 0.45);
  line-height: 1;
}

.move-ring-key {
  font-size: 0.38rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(130, 170, 215, 0.5);
}

@media (max-width: 520px) {
  .move-moveset-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    row-gap: 4px;
    column-gap: 8px;
  }

  /*
   * Giống desktop: tên đủ một dòng (không ellipsis), badge hệ ôm sát chữ (max-content).
   * Cột thẳng dọc: subgrid — cột “hệ” rộng = badge dài nhất, không kéo giãn ô.
   */
  @supports (grid-template-columns: subgrid) {
    .move-moveset-list {
      display: grid;
      grid-template-columns:
        28px
        minmax(min-content, max-content)
        max-content
        24px
        76px;
    }
    .move-row {
      display: grid;
      grid-template-columns: subgrid;
      grid-column: 1 / -1;
      align-items: center;
      min-height: 40px;
      padding: 0 8px;
      box-sizing: border-box;
    }
    .move-row-name-wrap {
      overflow: visible;
      min-width: min-content;
    }
    .move-row-name {
      font-size: 0.92rem;
      white-space: nowrap;
      overflow: visible;
      text-overflow: clip;
    }
    /* Cột max-content rộng = badge dài nhất; justify-self mặc định stretch → pill bị kéo ngang */
    .move-row > .type-badge {
      justify-self: end;
      align-self: center;
      width: max-content;
      max-width: 100%;
      box-sizing: border-box;
      font-size: 0.54rem;
      padding: 2px 8px;
      white-space: nowrap;
    }
    .move-row-cat,
    .move-row-rings {
      justify-self: center;
    }
    .move-row-lv {
      justify-self: center;
    }
  }

  /* Không subgrid: layout flex giống desktop + cuộn ngang khi hàng rộng */
  @supports not (grid-template-columns: subgrid) {
    .move-moveset-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .move-row {
      display: flex;
      flex-wrap: nowrap;
      align-items: center;
      gap: 8px;
      width: max-content;
      min-width: 100%;
      box-sizing: border-box;
      min-height: 40px;
      padding: 0 8px;
    }
    .move-row-name-wrap {
      flex: 0 0 auto;
      overflow: visible;
      max-width: none;
    }
    .move-row-name {
      font-size: 0.92rem;
      white-space: nowrap;
      overflow: visible;
      text-overflow: clip;
    }
    .move-row > .type-badge {
      flex: 0 0 auto;
      flex-shrink: 0;
      width: max-content;
      max-width: none;
      font-size: 0.54rem;
      padding: 2px 8px;
      white-space: nowrap;
    }
    .move-row-cat,
    .move-row-rings {
      flex-shrink: 0;
    }
  }

  .move-row-lv {
    width: 26px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.7rem;
  }
  .move-ring-wrap { width: 32px; height: 32px; }
  .move-ring-svg { width: 32px; height: 32px; }
}

/* ==========================================================================
   LEVEL-UP — Game Shelf + Timeline + dynamic accent (concept UI)
   ========================================================================== */

.cg-sticky-sentinel {
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.cg-toolbar {
  position: sticky;
  top: 68px;
  z-index: 30;
  overflow: visible;
  background: rgba(6, 12, 34, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(80, 130, 255, 0.08);
  box-shadow: 0 8px 28px rgba(0, 0, 20, 0.35);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.cg-toolbar.is-sticky {
  box-shadow:
    0 8px 28px rgba(0, 0, 20, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 24px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 12%, transparent);
}

/* Segmented glow rail under shelf = “GEN I / GEN II” cue from concept */
.cg-shelf-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: visible;
}

.cg-shelf-rail {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 14px;
}

.cg-shelf-rail-glow {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--shelf-accent, #6eb0ff) 55%, transparent) 20%,
    color-mix(in srgb, var(--shelf-accent, #6eb0ff) 85%, transparent) 50%,
    color-mix(in srgb, var(--shelf-accent, #6eb0ff) 55%, transparent) 80%,
    transparent
  );
  box-shadow: 0 0 12px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 35%, transparent);
  opacity: 0.85;
  transition: opacity 0.35s ease, box-shadow 0.35s ease;
}

.cg-shelf-rail-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--shelf-accent, #8eb8ff) 70%, rgba(230, 240, 255, 0.95));
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(6, 12, 34, 0.92);
  border: 1px solid color-mix(in srgb, var(--shelf-accent, #6eb0ff) 35%, transparent);
}

.cg-shelf {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 4px 10px;
  margin-top: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 160, 255, 0.18) transparent;
  scroll-snap-type: x proximity;
}

.cg-shelf::-webkit-scrollbar {
  height: 3px;
}

.cg-shelf::-webkit-scrollbar-thumb {
  background: rgba(100, 160, 255, 0.2);
  border-radius: 2px;
}

/* Non-selected box art dimmed ~40% (concept) */
.cg-shelf .cg-shelf-card:not(.is-active) {
  opacity: 0.58;
  filter: brightness(0.92);
}

.cg-shelf .cg-shelf-card:is(:hover, :focus-visible, .is-active) {
  opacity: 1;
  filter: none;
}

.cg-shelf-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: rgba(12, 22, 56, 0.45);
  padding: 4px 4px 5px;
  border-radius: 8px;
  transform-origin: 50% 0;
  transition:
    transform 0.22s cubic-bezier(0.2, 1, 0.3, 1),
    background 0.2s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    opacity 0.2s ease,
    filter 0.2s ease;
  position: relative;
  scroll-snap-align: start;
  min-width: 58px;
}

/* Lift only when not selected — avoids shoving the active cover into the GEN rail */
.cg-shelf-card:hover:not(.is-active) {
  transform: translateY(-4px);
  background: rgba(30, 55, 120, 0.45);
  border-color: rgba(140, 200, 255, 0.2);
}

/* Zoom from top edge: grows downward, does not clip against the line above */
.cg-shelf-card.is-active {
  transform: scale(1.06);
  background: rgba(30, 60, 130, 0.5);
  border-color: var(--shelf-accent, rgba(100, 180, 255, 0.55));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 30%, transparent),
    0 0 8px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 22%, transparent),
    0 0 16px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 20%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.cg-shelf-card.is-active:hover {
  transform: scale(1.06);
}

.cg-shelf-card.is-active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--shelf-accent, rgba(100, 180, 255, 0.65));
  border-radius: 1px;
  box-shadow: 0 0 6px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 38%, transparent);
}

.cg-shelf-covers {
  position: relative;
  width: 50px;
  height: 72px;
  flex-shrink: 0;
}

.cg-shelf-covers--dual {
  width: 62px;
}

.cg-shelf-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 70px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  display: block;
}

.cg-shelf-covers--dual .cg-shelf-cover--back {
  left: 14px;
  top: 3px;
  opacity: 0.58;
  filter: brightness(0.65);
  transform: rotate(2deg);
  z-index: 0;
  transition: left 0.22s ease, filter 0.22s ease, transform 0.22s ease;
}

.cg-shelf-covers--dual .cg-shelf-cover--front {
  left: 0;
  top: 0;
  z-index: 1;
  transform: rotate(-0.5deg);
  transition: transform 0.22s ease;
}

.cg-shelf-card:hover .cg-shelf-cover--back,
.cg-shelf-card.is-active .cg-shelf-cover--back {
  left: 18px;
  filter: brightness(0.78);
  transform: rotate(2.5deg);
}

.cg-shelf-card:hover .cg-shelf-cover--front,
.cg-shelf-card.is-active .cg-shelf-cover--front {
  transform: rotate(0deg);
}

.cg-shelf-card.is-active .cg-shelf-cover--front {
  box-shadow:
    0 0 6px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 30%, transparent),
    0 0 14px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 26%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.5);
}

.cg-shelf-covers--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 36, 80, 0.55);
  border: 1px solid rgba(80, 130, 255, 0.18);
  border-radius: 3px;
  width: 50px;
  height: 72px;
}

.cg-shelf-no-cover {
  font-size: 0.44rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(100, 150, 220, 0.55);
  text-align: center;
  padding: 4px;
}

.cg-shelf-no-cover--centered {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4px;
  text-transform: uppercase;
  line-height: 1.15;
  word-break: break-word;
}

.cg-shelf-no-cover--slash {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 2px 3px;
  font-size: 0.36rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.12;
  word-break: break-word;
  color: rgba(100, 150, 220, 0.55);
}

.cg-shelf-no-cover--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px 2px;
  line-height: 1.1;
  width: 100%;
  height: 100%;
}

.cg-shelf-no-cover-line {
  font-size: 0.38rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(100, 150, 220, 0.55);
  text-align: center;
  max-width: 52px;
  word-break: break-word;
}

.cg-shelf-no-cover--colon .cg-shelf-no-cover-line {
  text-transform: none;
}

.cg-filter-bar {
  display: flex;
  gap: 6px;
  padding: 5px 0 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cg-filter-btn {
  font-family: var(--font-sans);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(90, 140, 255, 0.16);
  background: rgba(10, 20, 52, 0.45);
  color: rgba(130, 170, 225, 0.55);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.2s ease;
}

.cg-filter-btn:hover {
  border-color: rgba(140, 200, 255, 0.35);
  color: rgba(200, 228, 255, 0.88);
  background: rgba(30, 55, 110, 0.35);
}

.cg-filter-btn.is-active {
  border-color: var(--shelf-accent, rgba(100, 180, 255, 0.55));
  background: color-mix(in srgb, var(--shelf-accent, #6eb0ff) 14%, rgba(10, 20, 52, 0.6));
  color: rgba(230, 245, 255, 0.95);
  box-shadow: 0 0 12px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 22%, transparent);
}

.cg-timeline-wrap {
  position: relative;
  padding-left: 46px;
  margin-top: 2px;
}

.cg-timeline-wrap::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--shelf-accent, rgba(100, 180, 255, 0.45)) 8%,
    var(--shelf-accent, rgba(100, 180, 255, 0.3)) 92%,
    transparent 100%
  );
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}

.cg-timeline {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cg-tl-row {
  position: relative;
  display: flex;
  align-items: center;
}

.cg-tl-row::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 1px;
  background: var(--shelf-accent, rgba(100, 180, 255, 0.35));
  opacity: 0.55;
  pointer-events: none;
  transition: background 0.4s ease;
}

.cg-tl-node {
  position: absolute;
  left: -46px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--shelf-accent, rgba(100, 180, 255, 0.55));
  background: rgba(6, 12, 34, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow:
    0 0 10px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 22%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.cg-tl-lv {
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  color: var(--shelf-accent, rgba(160, 200, 255, 0.92));
  transition: color 0.4s ease;
}

.cg-tl-lv--za {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.05;
}

.cg-tl-lv-learn {
  font-size: 0.56rem;
}

.cg-tl-lv-master {
  font-size: 0.48rem;
  font-weight: 600;
  opacity: 0.78;
  color: color-mix(in srgb, var(--shelf-accent, #8ec5ff) 75%, #a8e6cf);
}

.cg-tl-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--move-type-color) 10%, transparent) 0%, transparent 15%),
    rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  transition: background 0.15s ease, box-shadow 0.35s ease;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--shelf-accent, #6eb0ff) 0%, transparent);
}

.cg-tl-row:nth-child(even) .cg-tl-card {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--move-type-color) 10%, transparent) 0%, transparent 15%),
    rgba(255, 255, 255, 0.05);
}

.cg-tl-card .move-row-name-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.cg-tl-card .move-row-name {
  position: relative;
  display: block;
  padding-left: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cg-tl-card .move-row-name::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  background: var(--move-type-color, rgba(120, 180, 255, 0.8));
  border-radius: 2px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--shelf-accent, #6eb0ff) 25%, transparent);
}

.cg-tl-card .move-row-name-wrap:hover .move-effect-popup {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 520px) {
  .cg-toolbar {
    top: 56px;
    padding: 6px 8px;
  }

  .cg-shelf {
    padding: 6px 3px 8px;
  }

  .cg-shelf-covers {
    width: 44px;
    height: 63px;
  }

  .cg-shelf-covers--dual {
    width: 54px;
  }

  .cg-shelf-cover {
    width: 42px;
    height: 61px;
  }

  .cg-shelf-covers--dual .cg-shelf-cover--back {
    left: 12px;
    top: 2px;
  }

  .cg-shelf-covers--empty {
    width: 44px;
    height: 63px;
  }

  .cg-shelf-card {
    padding: 3px 3px 4px;
    min-width: 50px;
  }

  .cg-shelf-card:hover .cg-shelf-cover--back,
  .cg-shelf-card.is-active .cg-shelf-cover--back {
    left: 16px;
  }

  .cg-tl-row {
    width: 100%;
  }

  /*
   * Cross-gen mobile: cột thẳng như desktop — subgrid trên .cg-timeline,
   * .cg-tl-card display:contents (nền chuyển lên .cg-tl-row). Badge: end + max-content (không stretch).
   */
  @supports (grid-template-columns: subgrid) {
    .cg-timeline {
      display: grid;
      grid-template-columns:
        32px
        minmax(min-content, max-content)
        max-content
        24px
        76px;
      column-gap: 8px;
      row-gap: 5px;
      align-items: center;
      width: max-content;
      min-width: 100%;
    }

    .cg-tl-row {
      display: grid;
      grid-template-columns: subgrid;
      grid-column: 1 / -1;
      align-items: center;
      width: auto;
      min-height: 40px;
      padding: 0 8px;
      box-sizing: border-box;
      border-radius: 6px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      background:
        linear-gradient(90deg, color-mix(in srgb, var(--move-type-color) 10%, transparent) 0%, transparent 15%),
        rgba(255, 255, 255, 0.03);
      transition: background 0.15s ease, box-shadow 0.35s ease;
      box-shadow: 0 0 0 0 color-mix(in srgb, var(--shelf-accent, #6eb0ff) 0%, transparent);
    }

    .cg-tl-row:nth-child(even) {
      background:
        linear-gradient(90deg, color-mix(in srgb, var(--move-type-color) 10%, transparent) 0%, transparent 15%),
        rgba(255, 255, 255, 0.05);
    }

    .cg-tl-card {
      display: contents;
    }

    .cg-tl-node {
      position: relative;
      left: auto;
      top: auto;
      transform: none;
      justify-self: center;
      align-self: center;
      width: 26px;
      height: 26px;
    }

    .cg-tl-card .move-row-name-wrap {
      overflow: visible;
      max-width: none;
      min-width: min-content;
    }

    .cg-tl-card .move-row-name {
      font-size: 0.92rem;
      white-space: nowrap;
      overflow: visible;
      text-overflow: clip;
    }

    .cg-tl-card > .type-badge {
      justify-self: end;
      align-self: center;
      width: max-content;
      max-width: 100%;
      box-sizing: border-box;
      font-size: 0.54rem;
      padding: 2px 8px;
      white-space: nowrap;
    }

    .cg-tl-card > .move-row-cat,
    .cg-tl-card > .move-row-rings {
      justify-self: center;
    }

    .cg-tl-card .move-ring-wrap {
      width: 32px;
      height: 32px;
    }

    .cg-tl-card .move-ring-svg {
      width: 32px;
      height: 32px;
    }

    .cg-timeline-wrap {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding-left: 10px;
    }

    .cg-tl-row::before {
      left: 0;
      width: 10px;
    }
  }

  @supports not (grid-template-columns: subgrid) {
    .cg-timeline {
      width: 100%;
      min-width: 0;
    }

    .cg-tl-card {
      flex: 1 1 auto;
      display: flex;
      flex-wrap: nowrap;
      align-items: center;
      gap: 8px;
      width: max-content;
      min-width: 100%;
      box-sizing: border-box;
      height: auto;
      min-height: 40px;
      padding: 0 8px;
    }

    .cg-tl-card .move-row-name-wrap {
      flex: 0 0 auto;
      min-width: 0;
      overflow: visible;
      max-width: none;
    }

    .cg-tl-card .move-row-name {
      font-size: 0.92rem;
      white-space: nowrap;
      overflow: visible;
      text-overflow: clip;
    }

    .cg-tl-card > .type-badge {
      flex: 0 0 auto;
      flex-shrink: 0;
      width: max-content;
      max-width: none;
      box-sizing: border-box;
      font-size: 0.54rem;
      padding: 2px 8px;
      white-space: nowrap;
    }

    .cg-tl-card > .move-row-cat,
    .cg-tl-card > .move-row-rings {
      flex-shrink: 0;
    }

    .cg-tl-card .move-ring-wrap {
      width: 32px;
      height: 32px;
    }

    .cg-tl-card .move-ring-svg {
      width: 32px;
      height: 32px;
    }

    .cg-timeline-wrap {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding-left: 38px;
    }

    .cg-tl-node {
      left: -38px;
      width: 26px;
      height: 26px;
    }

    .cg-tl-row::before {
      left: -12px;
      width: 12px;
    }
  }

  .cg-tl-lv {
    font-size: 0.52rem;
  }
}

/* --- Specimen hub: bio card + Pokédex viewer (formerly storyline.css) --- */
@keyframes rotateEnergy {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.bio-card {
  width: 35%;
  max-width: 380px;
  flex: 0 0 35%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-radius: 60px 15px 60px 15px;
  padding: 20px;
  background: rgba(18, 20, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 2;
}

.bio-card-top {
  border-radius: 44px 8px 44px 8px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  background: var(--bio-top-bg, #5ca935);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.bio-card-genus {
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.98);
  text-align: center;
  margin: 0;
}

.bio-card-bottom {
  border-radius: 44px 8px 44px 8px;
  background: rgba(28, 32, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.bio-card-zone {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bio-zone-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.5);
}

.defense-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.defense-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.defense-tag-x2 {
  background: rgba(255, 75, 75, 0.25);
  color: #ff4b4b;
  border: 1px solid rgba(255, 75, 75, 0.5);
}

.defense-tag-half {
  background: rgba(76, 175, 80, 0.25);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.5);
}

.defense-icons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.specimen-bio-below-dex .type-icon,
.bio-card .type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.2);
  line-height: 1;
}

.defense-none {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

.bio-card-gender {
  align-items: flex-start;
}

.gender-bar {
  display: flex;
  width: 100%;
  max-width: 200px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.gender-fill.male {
  background: #5b9bd5;
}

.gender-fill.female {
  background: #ed7d9a;
}

.gender-label,
.gender-pct {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.type-card-grass .bio-card-top { --bio-top-bg: #5ca935; }
.type-card-fire .bio-card-top { --bio-top-bg: #c05020; }
.type-card-water .bio-card-top { --bio-top-bg: #3b6fbf; }
.type-card-poison .bio-card-top { --bio-top-bg: #783878; }
.type-card-bug .bio-card-top { --bio-top-bg: #8a9a18; }
.type-card-normal .bio-card-top { --bio-top-bg: #8a8a5c; }
.type-card-electric .bio-card-top { --bio-top-bg: #d4b020; }
.type-card-ground .bio-card-top { --bio-top-bg: #c0a050; }
.type-card-fairy .bio-card-top { --bio-top-bg: #d87a8c; }
.type-card-flying .bio-card-top { --bio-top-bg: #8070c0; }
.type-card-fighting .bio-card-top { --bio-top-bg: #9a2420; }
.type-card-psychic .bio-card-top { --bio-top-bg: #d04068; }
.type-card-rock .bio-card-top { --bio-top-bg: #908020; }
.type-card-ice .bio-card-top { --bio-top-bg: #78b8b8; }
.type-card-ghost .bio-card-top { --bio-top-bg: #504070; }
.type-card-dragon .bio-card-top { --bio-top-bg: #5020c8; }
.type-card-steel .bio-card-top { --bio-top-bg: #9090a8; }
.type-card-dark .bio-card-top { --bio-top-bg: #504030; }

.dex-entry-viewer {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dex-entry-viewer-head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.05rem;
}

.dex-entry-viewer-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.dex-entry-viewer--mega {
  margin-top: 0.65rem;
}

.dex-gen-frame {
  position: relative;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(90, 160, 255, 0.24);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(22, 34, 54, 0.62), rgba(9, 18, 34, 0.7));
  box-shadow: inset 0 0 0 1px rgba(70, 130, 220, 0.08);
  padding: 8px 10px 8px 15px;
}

.dex-gen-frame::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  width: 2px;
  height: calc(100% - 16px);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(65, 180, 255, 0.95) 35%, rgba(0, 0, 0, 0) 70%)
    0 0 / 100% 42px repeat-y;
  animation: dexRailRun 1.9s linear infinite;
  pointer-events: none;
}

.dex-gen-scroll {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 190, 255, 0.4) transparent;
}

.dex-gen-scroll::-webkit-scrollbar {
  height: 4px;
}

.dex-gen-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dex-gen-scroll::-webkit-scrollbar-thumb {
  background: rgba(120, 190, 255, 0.35);
  border-radius: 999px;
}

.dex-gen-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 205, 255, 0.55);
}

/* Chromium / Safari: scrollbar nhẹ hơn khi không hover khung */
.dex-gen-frame:not(:hover) .dex-gen-scroll::-webkit-scrollbar-thumb {
  background: rgba(120, 190, 255, 0.15);
}

.dex-gen-btn {
  padding: 5px 10px;
  min-width: 60px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.17);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(235, 243, 255, 0.86);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.dex-gen-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(130, 200, 255, 0.48);
  background: rgba(80, 140, 235, 0.17);
}

.dex-gen-btn.active {
  border-color: rgba(130, 220, 255, 0.82);
  box-shadow: 0 0 0 1px rgba(40, 150, 240, 0.28), 0 4px 12px rgba(30, 110, 210, 0.2);
  background: linear-gradient(135deg, rgba(60, 150, 255, 0.27), rgba(40, 85, 190, 0.22));
  color: #e9f6ff;
}

.dex-ver-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dex-ver-chip {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: var(--bg-grad, rgba(255, 255, 255, 0.07));
  color: rgba(230, 238, 252, 0.72);
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
  user-select: none;
  flex-shrink: 0;
}

.dex-ver-chip:hover {
  background: var(--bg-grad-hover, rgba(255, 255, 255, 0.13));
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.dex-ver-chip.active {
  background: var(--bg-grad-active, rgba(255, 255, 255, 0.16));
  color: #fff;
  border-color: var(--br-color-active, rgba(255, 255, 255, 0.55));
}

/* Legends: Z-A — leaf green → muted black chip (detail.html VERSION_META series lza) */
.dex-ver-chip.dex-ver-chip--lza {
  color: rgba(214, 245, 222, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  border-color: rgba(72, 168, 88, 0.35);
}

.dex-ver-chip.dex-ver-chip--lza:hover {
  color: #f0fff4;
  border-color: rgba(100, 200, 120, 0.55);
}

.dex-ver-chip.dex-ver-chip--lza.active {
  color: #f6fff8;
  border-color: rgba(120, 220, 140, 0.75);
  box-shadow: 0 0 12px rgba(56, 160, 80, 0.25);
}

.dex-entry-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 100%);
  margin: 0.6rem 0 0;
}

.dex-entry-text {
  font-size: 0.85rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  transition: opacity 0.2s;
}

.dex-entry-text.fading {
  opacity: 0;
}

@keyframes dexRailRun {
  from { background-position-y: 0; }
  to { background-position-y: 42px; }
}

@media (max-width: 768px) {
  .dex-gen-btn { font-size: 0.6rem; min-width: 56px; padding: 4px 8px; }
  .dex-ver-chip { font-size: 0.6rem; padding: 4px 8px; }
  .dex-entry-text { font-size: 0.8rem; }
}

.detail-specimen-hub.detail-specimen-stage {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  position: relative;
}

.detail-specimen-hub.detail-specimen-stage::before {
  display: none;
}

.specimen-dex-viewer.dex-entry-viewer {
  margin-top: 0;
}
