* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--tg-theme-bg-color, #1c1c1e);
  color: var(--tg-theme-text-color, #ffffff);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── Full-page loading overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tg-theme-bg-color, #1c1c1e);
  transition: opacity 0.35s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Splash card */
.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 32px;
  text-align: center;
}

/* Logo row: spinning pokeball + brand name */
.splash-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.splash-pokeball {
  width: 52px;
  height: 52px;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

.splash-brand {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
}

.splash-name {
  color: var(--tg-theme-text-color, #ffffff);
}

.splash-dex {
  color: #e53935;
}

/* Subtitle */
.splash-sub {
  font-size: 13px;
  color: var(--tg-theme-hint-color, #8e8e93);
  max-width: 260px;
  line-height: 1.4;
}

/* Red divider */
.splash-divider {
  width: 100%;
  max-width: 260px;
  height: 2px;
  background: #e53935;
  border-radius: 1px;
  margin: 4px 0;
}

/* Large title */
.splash-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--tg-theme-text-color, #ffffff);
  line-height: 1;
}

/* Loading status under title */
.splash-loading {
  font-size: 12px;
  color: var(--tg-theme-hint-color, #8e8e93);
  letter-spacing: 0.5px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Progress bar */
.splash-progress-track {
  width: 220px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.splash-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e53935, #ff6f60);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 8px rgba(229, 57, 53, 0.6);
}

/* ── Top bar ── */
.top-bar {
  background: var(--tg-theme-secondary-bg-color, #2c2c2e);
  padding: 10px 16px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  background: none;
  border: none;
  color: #e53935;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.status {
  font-size: 13px;
  color: var(--tg-theme-hint-color, #8e8e93);
  min-height: 18px;
  flex: 1;
  text-align: center;
}

/* ── Screen container (holds both screens for transition) ── */
#screen-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── Region selection screen ── */
.region-screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}

.region-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  padding: 16px 18px;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.region-card:active {
  transform: scale(0.97);
}

/* Diagonal darker overlay on right */
.region-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  clip-path: polygon(58% 0%, 100% 0%, 100% 100%, 46% 100%);
  pointer-events: none;
}

/* Pixel grid pattern on far right */
.region-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 10px 10px;
  clip-path: polygon(66% 0%, 100% 0%, 100% 100%, 54% 100%);
  pointer-events: none;
}

.region-card-name {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1;
  position: relative;
  z-index: 1;
  /* fit long names */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.region-progress-bar {
  width: 52%;
  height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.region-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.region-count {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  position: relative;
  z-index: 1;
}

/* ── National Pokédex card ── */
.national-card {
  min-height: 96px;
  border: 1.5px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 12px rgba(198,40,40,0.35);
}

.national-card .region-card-name {
  font-size: 19px;
  max-width: 70%;
}

/* ── Filter bar ── */
.filter-bar {
  flex-shrink: 0;
  background: var(--tg-theme-bg-color, #1c1c1e);
  padding: 8px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.search-wrap {
  display: flex;
  align-items: center;
  background: var(--tg-theme-secondary-bg-color, #2c2c2e);
  border-radius: 10px;
  padding: 0 10px;
  gap: 6px;
}

.search-icon {
  font-size: 14px;
  opacity: 0.5;
  flex-shrink: 0;
}

.name-search {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--tg-theme-text-color, #fff);
  font-size: 13px;
  padding: 8px 0;
}

.name-search::placeholder {
  color: var(--tg-theme-hint-color, #8e8e93);
}

/* Type filter scroll row */
.type-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.type-filter::-webkit-scrollbar { display: none; }

.type-btn {
  flex-shrink: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  align-self: center;
}

.type-btn img {
  display: block;
  height: 18px;       /* small image default */
  width: auto;
  border-radius: 4px;
  transition: height 0.15s ease, border-radius 0.15s ease;
}

/* Expanded state: hover (desktop) or .expanded class (JS-driven) */
.type-btn:hover img,
.type-btn.expanded img {
  height: 26px;
  border-radius: 5px;
}

.type-btn:hover,
.type-btn.expanded {
  opacity: 0.85;
  transform: scale(1.05);
}

.type-btn.active {
  opacity: 1;
  border-color: #fff;
  transform: scale(1.1);
}

/* ── Grid view (shown after region selected) ── */
.grid-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.grid-view.hidden {
  display: none;
}

/* ── Screen transition animations ── */
@keyframes slideInFromRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutToLeft {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(-30%); opacity: 0; }
}
@keyframes slideInFromLeft {
  from { transform: translateX(-30%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutToRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

.slide-in-right  { animation: slideInFromRight 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.slide-out-left  { animation: slideOutToLeft   0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.slide-in-left   { animation: slideInFromLeft  0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.slide-out-right { animation: slideOutToRight  0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }

.hidden {
  display: none !important;
}

/* ── Top bar ── */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding: 8px;
  width: 100%;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  will-change: transform;
}

/* ── Cell ── */
.cell {
  background: var(--tg-theme-secondary-bg-color, #2c2c2e);
  border-radius: 8px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cell:active {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 2;
}

@media (hover: hover) {
  .cell:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2;
  }
  .cell:hover .num { display: none; }
  .cell:hover::after {
    content: attr(data-name);
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
  }
}

.cell.caught {
  background: var(--tg-theme-bg-color, #1c1c1e);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.06);
}

.cell.prev-caught {
  background: var(--tg-theme-bg-color, #1c1c1e);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.03);
}

.cell.prev-caught img.poke-gif.loaded {
  opacity: 0.45;
  filter: grayscale(40%);
}

.cell.prev-caught .num {
  color: var(--tg-theme-hint-color, #8e8e93);
  opacity: 0.55;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* Pokeball loader */
.cell .pokeball-loader {
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
  position: absolute;
  opacity: 0.5;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Pokemon image */
.cell img.poke-gif {
  max-width: 72%;
  max-height: 72%;
  width: auto;
  height: auto;
  image-rendering: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cell img.poke-gif.loaded {
  opacity: 1;
}

/* Silhouette for uncaught Pokémon */
.cell.empty img.poke-silhouette {
  max-width: 72%;
  max-height: 72%;
  width: auto;
  height: auto;
  filter: brightness(0);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cell.empty img.poke-silhouette.loaded {
  opacity: 0.4;
}

/* Number label */
.cell .num {
  font-size: 9px;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-weight: 600;
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
}

.cell.caught .num {
  color: var(--tg-theme-hint-color, #8e8e93);
}

.cell.empty .num {
  font-size: 9px;
  color: var(--tg-theme-hint-color, #8e8e93);
  opacity: 0.35;
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
}

/* ════════════════════════════════════════════
   DETAIL VIEW
   ════════════════════════════════════════════ */
.detail-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--tg-theme-bg-color, #1c1c1e);
  overflow: hidden;
}

/* ── Header ── */
.detail-header {
  position: relative;
  min-height: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 18px;
}

.detail-top-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.detail-back-btn {
  background: rgba(0,0,0,0.22);
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px 0 0;   /* nudge ← glyph to true center */
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.detail-sprite-wrap {
  position: absolute;
  inset: 0 0 52px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.detail-sprite {
  height: 130px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
  transition: opacity 0.2s ease;
}

.detail-info {
  text-align: center;
  position: relative;
  z-index: 1;
}

.detail-num {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.detail-name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  text-transform: capitalize;
  letter-spacing: 0.5px;
  margin: 0 0 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  line-height: 1.2;
}

.detail-badges {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.detail-type-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

.detail-type-badge img {
  height: 16px;
  width: auto;
}

/* ── Tab bar ── */
.detail-tabs {
  display: flex;
  background: var(--tg-theme-secondary-bg-color, #2c2c2e);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dtab {
  flex: 1;
  background: none;
  border: none;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 0;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.dtab.active {
  color: var(--tg-theme-text-color, #fff);
}

.dtab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: #e53935;
  border-radius: 1px;
}

/* ── Body ── */
.detail-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coming-soon {
  text-align: center;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-size: 13px;
  padding: 40px 0;
}

/* ── Section card ── */
.detail-section {
  background: var(--tg-theme-secondary-bg-color, #2c2c2e);
  border-radius: 14px;
  padding: 14px 12px 12px;
}

.section-pill-wrap {
  text-align: center;
  margin-bottom: 14px;
}

.section-pill {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  color: var(--tg-theme-text-color, #fff);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 22px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
}

/* ── Stats table ── */
.stat-col-heads {
  display: grid;
  grid-template-columns: 80px 1fr 36px 42px 42px;
  gap: 0 4px;
  padding: 0 2px 4px;
}

.stat-col-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--tg-theme-hint-color, #8e8e93);
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-row {
  display: grid;
  grid-template-columns: 80px 1fr 36px 42px 42px;
  gap: 0 4px;
  align-items: center;
  padding: 4px 2px;
}

.stat-label {
  font-size: 12px;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-weight: 500;
  white-space: nowrap;
}

.stat-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.65s cubic-bezier(0.25, 1, 0.5, 1);
}

.stat-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #fff);
  text-align: right;
}

.stat-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.stat-total-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-theme-hint-color, #8e8e93);
}

.stat-total-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--tg-theme-text-color, #fff);
}

.stat-caption {
  font-size: 10px;
  color: var(--tg-theme-hint-color, #8e8e93);
  line-height: 1.5;
  margin-top: 10px;
  text-align: center;
}

/* ── Type defenses ── */
.type-group {
  margin-bottom: 12px;
}
.type-group:last-child { margin-bottom: 0; }

.type-group-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--tg-theme-text-color, #fff);
  margin-bottom: 1px;
}

.type-group-mult {
  font-size: 11px;
  color: var(--tg-theme-hint-color, #8e8e93);
  margin-bottom: 7px;
}

.type-badges-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-def-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 6px;
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.type-def-badge img {
  height: 18px;
  width: auto;
}

/* ── Moves pane ── */
.moves-section {
  padding: 12px 10px 10px;
}

.moves-subtabs {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 14px;
}

.moves-subtab {
  flex: 1;
  background: none;
  border: none;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.moves-subtab.active {
  background: var(--tg-theme-bg-color, #1c1c1e);
  color: var(--tg-theme-text-color, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.moves-empty {
  text-align: center;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-size: 12px;
  padding: 24px 0;
}

.moves-table {
  width: 100%;
  border-collapse: collapse;
}

.moves-table thead th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--tg-theme-hint-color, #8e8e93);
  padding: 0 4px 8px;
  text-align: left;
}

.moves-table thead th:not(.col-name) {
  text-align: right;
}

.moves-table tbody tr {
  border-top: 1px solid rgba(255,255,255,0.06);
}

.moves-table tbody td {
  padding: 8px 4px;
  vertical-align: middle;
}

.move-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.moves-table th.col-name {
  width: 50%;
}

.move-name-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.move-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  align-self: flex-start;
}

/* ── Location pane ── */
.location-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.location-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.location-row:first-child {
  border-top: none;
}

.location-region-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.location-region-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #fff);
  flex: 1;
}

.location-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.location-wild-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  background: #1565C0;
  padding: 3px 8px;
  border-radius: 10px;
}

.location-safari-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  background: #2E7D32;
  padding: 3px 8px;
  border-radius: 10px;
}

/* ── Stats Calculator ── */
.calc-col-heads,
.calc-row {
  grid-template-columns: 68px 1fr 50px 50px 46px !important;
  gap: 8px !important;
}

.calc-bar-wrap {
  padding-right: 6px;
}

.calc-bar-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.calc-bar-wrap .stat-bar-track {
  flex: 1;
  min-width: 0;
}

.calc-base-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--tg-theme-text-color, #fff);
  min-width: 26px;
  text-align: right;
  flex-shrink: 0;
}

.calc-ev-input,
.calc-iv-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--tg-theme-text-color, #fff);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 3px 2px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.calc-ev-input::-webkit-outer-spin-button,
.calc-ev-input::-webkit-inner-spin-button,
.calc-iv-input::-webkit-outer-spin-button,
.calc-iv-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.calc-result {
  font-size: 13px;
  font-weight: 700;
  color: var(--tg-theme-text-color, #fff);
  text-align: right;
  min-width: 36px;
}

.calc-remaining-row {
  text-align: center;
  font-size: 12px;
  color: var(--tg-theme-hint-color, #888);
  margin-top: 4px;
  padding: 4px 0;
}

.calc-remaining-val {
  font-weight: 700;
  color: var(--tg-theme-text-color, #000);
  transition: color 0.2s;
}

.calc-nat-up   { color: #66BB6A !important; }
.calc-nat-down { color: #EF5350 !important; }

.calc-nature-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.calc-nature-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-theme-hint-color, #888);
  flex-shrink: 0;
}

.calc-nature-label::after {
  content: ' :';
}

.calc-nature-select {
  background: #2c2c2e;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  outline: none;
  cursor: pointer;
}

.calc-nature-select option {
  background: #2c2c2e;
  color: #ffffff;
}

.moves-table td.col-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #fff);
  text-align: right;
  white-space: nowrap;
}

/* ── About pane ── */
.about-category {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: var(--tg-theme-text-color, #fff);
  margin-bottom: 8px;
}

.about-flavor {
  font-size: 13px;
  line-height: 1.55;
  color: var(--tg-theme-hint-color, #8e8e93);
  text-align: center;
  margin-bottom: 12px;
}

.about-types {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.about-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 2px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.about-row:first-of-type {
  border-top: none;
}

.about-row-label {
  font-size: 13px;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-weight: 500;
}

.about-row-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-theme-text-color, #fff);
  text-align: right;
}

/* ── Evolution chain ── */
.evo-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.evo-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
}

.evo-node-active .evo-name {
  color: var(--tg-theme-text-color, #fff);
  font-weight: 700;
}

.evo-node-link {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.evo-node-link:active .evo-sprite {
  opacity: 0.7;
}

.evo-sprite {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.evo-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--tg-theme-hint-color, #8e8e93);
  text-align: center;
}

.evo-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 2px;
  margin-bottom: 20px;
}

.evo-level {
  font-size: 9px;
  font-weight: 600;
  color: var(--tg-theme-hint-color, #8e8e93);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.evo-arrow-icon {
  font-size: 18px;
  color: var(--tg-theme-hint-color, #8e8e93);
  line-height: 1;
}

/* ── Branching evolutions (Eevee, Pikachu forms, etc.) ── */
.evo-chain-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.evo-fork-bridge {
  width: 20px;
  height: 2px;
  background: rgba(142,142,147,0.35);
  align-self: center;
  flex-shrink: 0;
}

.evo-fork {
  padding-left: 28px;
  border-left: 2px solid rgba(142,142,147,0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.evo-fork-branch {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  padding: 4px 0;
}

/* Horizontal connector from the fork bar to the label */
.evo-fork-branch::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 50%;
  width: 26px;
  height: 2px;
  background: rgba(142,142,147,0.35);
}

.evo-fork-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 28px;
  flex-shrink: 0;
}

.evo-fork-info .evo-level {
  font-size: 9px;
  font-weight: 600;
  color: var(--tg-theme-hint-color, #8e8e93);
  white-space: nowrap;
}

.evo-fork-info .evo-arrow-icon {
  font-size: 15px;
  color: var(--tg-theme-hint-color, #8e8e93);
  line-height: 1;
}
