:root {
  --bg: #0b0f17;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #253044;
  --accent: #60a5fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  margin: 10px 0 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

/* ---------- Controls ---------- */
.controls {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input[type="search"],
select,
button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  outline: none;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

/* ---------- Status ---------- */
.status {
  margin-top: 10px;
  min-height: 1.2em;
  color: var(--muted);
}

/* ---------- Table Wrapper ---------- */
.tableWrap {
  max-height: 75vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.5);
}

/* ---------- Table ---------- */
table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

/* ---------- Sticky Header ---------- */
thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0f172a;
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}

/* ---------- Body Cells ---------- */
tbody td {
  border-top: 1px solid var(--line);
  padding: 10px;
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(96, 165, 250, 0.08);
}

tbody tr {
  cursor: pointer;
}

/* ---------- Sprites ---------- */
.sprite {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
}

/* ---------- Type Badges ---------- */
/* Type name + icon stacked vertically */
.typeStack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.typeItem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.typeIconImg {
  width: 22px;
  height: 22px;
  display: block;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.4));
}

.badgeRow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- Sorting ---------- */
.sortable {
  cursor: pointer;
}

.sortable::after {
  content: " ↕";
  color: var(--muted);
}

th.sortedAsc::after {
  content: " ↑";
  color: var(--accent);
}

th.sortedDesc::after {
  content: " ↓";
  color: var(--accent);
}

/* ---------- Pager ---------- */
.pager {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Gen Tabs ---------- */
.tabs {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tabBtn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.tabBtn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15) inset;
}

/* =========================
   MODAL
   ========================= */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modalOverlay.open {
  display: flex;
}

.modal {
  width: min(1100px, 100%);
  max-height: 90vh;
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
}

.modalHeader {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

.modalTypes {
  margin-top: 8px;
}

.modalTabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
}

.modalGenSelect {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 160px;
}

.modalGenSelect select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}


.tabPill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,0.7);
}

.tabPill.active {
  border-color: var(--accent);
}

.modalBody {
  padding: 14px;
}

/* =========================
   Evolutions row
   ========================= */
.evoBar {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.evoPath {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.evoChip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
}

.evoChip:hover {
  border-color: var(--accent);
}

.evoChip img {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
}

.evoArrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.evoArrow .evoLabel {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 0.82rem;
}


/* =========================
   MOVES TAB
   ========================= */
.genBlock {
  border: 1px solid var(--line);
  background: rgba(17,24,39,0.65);
  border-radius: 14px;
  overflow: hidden;
}

.genHeader {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

.moveList {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.moveChip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}

.movesTableWrap {
  overflow: auto;
  padding: 10px 12px 14px;
}

.movesTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
}

.movesTable th,
.movesTable td {
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.movesTable thead th {
  position: sticky;
  top: 0;
  background: #0f172a;
  border-top: none;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.moveName {
  font-weight: 800;
}

.moveTypeCell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}


/* =========================
   STATS TAB – FINAL LAYOUT
   ========================= */

.statsStackRoot {
  display: grid;
  gap: 20px;
}

/* Level container */
.levelBlock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(17,24,39,0.55);
}

/* Level header spans full width */
.levelBlock > .statsHeader {
  grid-column: 1 / -1;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* Section cards (Base / Hindering / Neutral / Max) */
.statsBlock {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17,24,39,0.7);
  display: flex;
  flex-direction: column;
}

/* Section header */
.statsBlock .statsHeader {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

/* Stats list */
.statsBody {
  padding: 10px;
}

/* Individual stat rows */
.statsInnerGrid {
  display: grid;
  gap: 8px;
}

.statCard {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
}

.statLabel {
  font-size: 0.75rem;
  color: var(--muted);
}

.statValue {
  font-weight: 800;
}

/* --- Modal tab panels: make sure only the active tab shows --- */
.hidden { display: none !important; }

.tabPanel { display: block; } /* default */
#panelStats.hidden,
#panelMoves.hidden { display: none !important; }


/* =========================
   Stats colors (your current markup uses .statsSection.minus/.plus)
   ========================= */

/* Hindering = RED */
.statsSection.minus .statsSectionTitle,
.statsSection.minus .statValue {
  color: #f87171 !important;
}

/* Max = BLUE */
.statsSection.plus .statsSectionTitle,
.statsSection.plus .statValue {
  color: #60a5fa !important; /* blue */
}

/* Fix close (X) button stretching in modal header */
#modalClose,
.iconBtn {
  flex: 0 0 auto;          /* do not stretch */
  align-self: flex-start;  /* keep it tight at the top */
  width: 36px;
  height: 36px;
  padding: 0 !important;   /* override global button padding */
  line-height: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

/* Weakness tab chips */
.weakGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.weakChip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}

.weakChip img {
  width: 20px;
  height: 20px;
  display: block;
}

.weakMult {
  font-weight: 900;
  color: var(--accent);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.locBlock {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.locTitle {
  font-weight: 900;
  margin-bottom: 6px;
}

.locMeta {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


