/* =============================================
   teambuilder.css — Team Builder Tool
   ============================================= */

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

:root {
  --red:        #D42B1E;
  --red-dark:   #8C1C12;
  --red-mid:    #B02418;
  --yellow:     #F2C12E;
  --black:      #0E0E14;
  --surface-1:  #14141C;
  --surface-2:  #1C1C28;
  --surface-3:  #242433;
  --surface-4:  #2E2E42;
  --border:     rgba(141, 50, 168, 0.10);
  --border-2:   rgba(141, 50, 168, 0.16);
  --text-1:     #F2ECFF;
  --text-2:     #A89BC4;
  --text-3:     #6B6284;
  --green:      #3EC46D;

  --font-pixel: 'Press Start 2P', monospace;
  --font-cond:  'Barlow Condensed', sans-serif;
  --font-body:  'Barlow', sans-serif;

  --t-normal:   #9A9A78; --t-fire:     #E8722A; --t-water:    #5A8EE8;
  --t-electric: #D4A81A; --t-grass:    #5AB840; --t-ice:      #7ACECE;
  --t-fighting: #B82820; --t-poison:   #8830A0; --t-ground:   #C8A840;
  --t-flying:   #8878E0; --t-psychic:  #E04060; --t-bug:      #90A010;
  --t-rock:     #A89028; --t-ghost:    #584880; --t-dragon:   #5018E0;
  --t-dark:     #504030; --t-steel:    #9898B8; --t-fairy:    #D070A8;
}

html { scroll-behavior: smooth; }
body {
  background: var(--black); color: var(--text-1);
  font-family: var(--font-body); font-size: 15px;
  line-height: 1.5; overflow-x: hidden; min-height: 100vh;
  padding-top: 60px;
}

/* ─── NAV ─── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(14,14,20,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 48px;
}
.wordmark {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--text-1);
  text-decoration: none;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.wordmark span { color: var(--red); }
.nav-links {
  list-style: none;
  display: flex;
  gap: 32px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-2);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-links a:hover { color: var(--text-1); }
.nav-links a.active { color: var(--red); }
.nav-open {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--red);
  color: white;
  padding: 8px 22px;
  border: none;
  border-radius: 3px;
  flex-shrink: 0;
  transition: background 0.15s;
  box-shadow: 0 3px 0 var(--red-dark);
  cursor: pointer;
}
.nav-open:hover { background: #E03020; }

/* ─── PAGE HEADER ─── */
.list-header {
  position: sticky;
  top: 60px;
  z-index: 100;
  background: rgba(14,14,20,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.list-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px 14px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.list-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.page-kicker {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--red);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.page-title {
  font-family: var(--font-cond);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--text-1);
}
.cl-subtitle {
  font-size: 13px;
  color: var(--text-3);
  max-width: 520px;
  line-height: 1.5;
  flex: 1;
}

/* ─── MAIN ─── */
.cl-main { max-width: 1280px; margin: 0 auto; padding: 32px 24px 80px; }

/* ─── LOADING ─── */
.tb-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 20px; padding: 80px 0; color: var(--text-2);
}
.tb-loading.hidden { display: none; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--red);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TABS ─── */
.tb-tabs {
  display: flex; gap: 4px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 28px;
}
.tb-tab {
  flex: 1; background: transparent; border: none; cursor: pointer;
  color: var(--text-2); font-family: var(--font-cond); font-size: 15px; font-weight: 700;
  letter-spacing: .5px; padding: 10px 12px; border-radius: 7px;
  transition: all .18s; white-space: nowrap;
}
.tb-tab:hover { background: var(--surface-3); color: var(--text-1); }
.tb-tab.active { background: var(--red); color: #fff; box-shadow: 0 0 16px rgba(141, 50, 168, 0.35); }
.tab-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 10px;
  background: rgba(255,255,255,0.15); margin-right: 7px;
}
.tb-tab.active .tab-num { background: rgba(255,255,255,0.25); }

/* ─── PANELS ─── */
.tb-panel { animation: fadeIn .2s ease; }
.tb-panel.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ─── SEARCH ─── */
.search-wrap { position: relative; max-width: 460px; margin-bottom: 20px; }
.search-wrap input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 8px; color: var(--text-1); font-family: var(--font-body);
  font-size: 15px; padding: 12px 16px; outline: none; transition: border-color .18s;
}
.search-wrap input:focus { border-color: var(--red); }
.search-wrap input::placeholder { color: var(--text-3); }
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 8px;
  max-height: 260px; overflow-y: auto; z-index: 100; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.search-dropdown.hidden { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  cursor: pointer; transition: background .12s;
}
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-sprite { width: 32px; height: 32px; image-rendering: pixelated; flex-shrink: 0; }
.dropdown-name { font-weight: 600; font-size: 14px; flex: 1; text-transform: capitalize; }
.dropdown-types { display: flex; gap: 4px; }

/* ─── TYPE TAGS ─── */
.type-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-family: var(--font-cond); font-size: 12px; font-weight: 700;
  letter-spacing: .3px; text-transform: capitalize; color: rgba(255,255,255,0.92);
}
.type-tag.normal   { background: var(--t-normal); }   .type-tag.fire     { background: var(--t-fire); }
.type-tag.water    { background: var(--t-water); }    .type-tag.electric { background: var(--t-electric); color: #1a1000; }
.type-tag.grass    { background: var(--t-grass); }    .type-tag.ice      { background: var(--t-ice); color: #1a2222; }
.type-tag.fighting { background: var(--t-fighting); } .type-tag.poison   { background: var(--t-poison); }
.type-tag.ground   { background: var(--t-ground); color: #1a1200; }
.type-tag.flying   { background: var(--t-flying); }   .type-tag.psychic  { background: var(--t-psychic); }
.type-tag.bug      { background: var(--t-bug); }      .type-tag.rock     { background: var(--t-rock); }
.type-tag.ghost    { background: var(--t-ghost); }    .type-tag.dragon   { background: var(--t-dragon); }
.type-tag.dark     { background: var(--t-dark); }     .type-tag.steel    { background: var(--t-steel); color: #111; }
.type-tag.fairy    { background: var(--t-fairy); }

/* ─── SECTION LABEL ─── */
.section-label {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px;
}
hr.divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ─── STEP 1: TARGET CARD ─── */
.target-card {
  display: flex; align-items: center; gap: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 24px; margin-bottom: 24px;
}
.target-sprite { width: 80px; height: 80px; image-rendering: pixelated; flex-shrink: 0; }
.target-info { flex: 1; }
.target-num { font-size: 12px; color: var(--text-3); margin-bottom: 2px; font-family: var(--font-cond); }
.target-name {
  font-family: var(--font-cond); font-size: 28px; font-weight: 900;
  text-transform: capitalize; margin-bottom: 6px;
}
.target-types { display: flex; gap: 6px; }

/* ─── COUNTER TYPE CHIPS ─── */
.counter-types { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.counter-type-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
}
.mult-badge {
  font-family: var(--font-cond); font-size: 12px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px; min-width: 34px; text-align: center;
}
.mult-4x { background: #B71C1C; color: #fff; }
.mult-2x { background: #E64A19; color: #fff; }
.mult-half { background: #1565C0; color: #fff; }
.mult-0x { background: var(--surface-3); color: var(--text-3); }

/* ─── POKEMON CARDS ─── */
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.poke-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; transition: border-color .18s, transform .15s;
}
.poke-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.poke-card-num { font-size: 11px; color: var(--text-3); font-family: var(--font-cond); text-align: right; margin-bottom: 4px; }
.poke-sprite { display: block; width: 52px; height: 52px; image-rendering: pixelated; margin: 0 auto 6px; }
.poke-name {
  font-family: var(--font-cond); font-weight: 700; font-size: 14px;
  text-align: center; text-transform: capitalize; margin-bottom: 6px;
}
.poke-types { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.poke-matchup {
  font-size: 11px; color: var(--text-2); text-align: center;
  border-top: 1px solid var(--border); padding-top: 7px;
}
.poke-matchup .hits { color: #FF6060; font-weight: 600; }
.poke-matchup .weak { color: #6090D0; font-weight: 600; }

/* ─── STEP 2: ENEMY TEAM ─── */
.enemy-slots {
  display: flex; gap: 10px; flex-wrap: wrap; min-height: 68px;
  padding: 12px; background: var(--surface-1);
  border: 1px dashed var(--border-2); border-radius: 10px;
  align-items: center; margin-bottom: 16px;
}
.enemy-slot {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 10px; animation: fadeIn .15s ease;
}
.enemy-slot img { width: 34px; height: 34px; image-rendering: pixelated; }
.enemy-slot-name { font-weight: 600; font-size: 12px; text-transform: capitalize; }
.enemy-slot-types { display: flex; gap: 3px; }
.enemy-slot-remove {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 15px; line-height: 1; padding: 0 2px; transition: color .12s; margin-left: 2px;
}
.enemy-slot-remove:hover { color: var(--red); }
.empty-team-msg { color: var(--text-3); font-size: 13px; width: 100%; text-align: center; padding: 8px 0; }

.btn-analyze {
  background: var(--red); color: #fff; border: none; border-radius: 8px;
  font-family: var(--font-cond); font-size: 16px; font-weight: 700; letter-spacing: .5px;
  padding: 12px 28px; cursor: pointer; transition: all .2s; margin-bottom: 28px;
}
.btn-analyze:hover:not(:disabled) { background: #B82418; transform: translateY(-1px); }
.btn-analyze:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }

/* ─── RESULT TEAM GRID ─── */
.result-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; margin-bottom: 28px; }
.result-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; text-align: center;
}
.result-sprite { width: 52px; height: 52px; image-rendering: pixelated; margin: 0 auto 5px; display: block; }
.result-name {
  font-family: var(--font-cond); font-weight: 700; font-size: 13px;
  text-transform: capitalize; margin-bottom: 5px;
}
.result-types { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.result-coverage { font-size: 10px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 6px; }
.coverage-row { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 3px; }
.cov-eff {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  padding: 1px 5px; border-radius: 3px;
}
.cov-4x { background: #B71C1C; color: #fff; }
.cov-2x { background: #E64A19; color: #fff; }
.cov-half { background: #1565C0; color: #fff; }
.cov-0x { color: var(--text-3); }
.cov-neutral { color: var(--text-3); }
.evolved-tag { font-size: 10px; color: var(--text-3); margin-bottom: 4px; }

/* ─── COVERAGE MATRIX ─── */
.matrix-section { margin-bottom: 28px; }
.matrix-wrap { overflow-x: auto; }
.coverage-matrix {
  border-collapse: collapse; width: 100%; font-size: 12px;
  background: var(--surface-1);
}
.coverage-matrix th, .coverage-matrix td {
  padding: 8px 10px; text-align: center; border: 1px solid var(--border); white-space: nowrap;
}
.coverage-matrix th { background: var(--surface-2); font-family: var(--font-cond); font-weight: 700; }
.coverage-matrix td.row-header { text-align: left; font-weight: 600; text-transform: capitalize; background: var(--surface-2); }
.cell-4x { background: rgba(183,28,28,0.3); color: #FF7070; font-weight: 700; }
.cell-2x { background: rgba(230,74,25,0.2); color: #FF9060; font-weight: 600; }
.cell-neutral { color: var(--text-3); }
.cell-half { background: rgba(21,101,192,0.2); color: #6090D0; }
.cell-0x { color: var(--text-3); font-style: italic; }

/* ─── GYM SELECTOR ─── */
.gym-selectors { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.gym-select-group { display: flex; flex-direction: column; gap: 6px; }
.gym-select-group label {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--text-3);
}
.gym-select-group select {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 8px; color: var(--text-1); font-family: var(--font-body);
  font-size: 14px; padding: 10px 14px; outline: none; cursor: pointer; min-width: 200px;
  transition: border-color .18s;
}
.gym-select-group select:focus { border-color: var(--red); }
.gym-select-group select option { background: var(--surface-2); }

/* ─── GYM LEADER CARD ─── */
.gym-leader-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.gym-leader-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.gym-leader-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.gym-leader-name { font-family: var(--font-cond); font-weight: 900; font-size: 22px; margin-bottom: 2px; }
.gym-leader-meta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.gym-team { display: flex; gap: 10px; flex-wrap: wrap; }
.gym-poke {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-3); border-radius: 8px; padding: 8px 12px;
}
.gym-poke img { width: 40px; height: 40px; image-rendering: pixelated; }
.gym-poke-name { font-weight: 700; text-transform: capitalize; font-size: 13px; }
.gym-poke-lvl { font-size: 11px; color: var(--text-3); }
.gym-poke-types { display: flex; gap: 3px; margin-top: 2px; }

/* ─── POOL INFO ─── */
.pool-info {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; margin-bottom: 20px; font-size: 13px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.pool-count { font-weight: 700; color: var(--yellow); }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-1); }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

/* ─── FOOTER ─── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 32px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-wordmark {
  font-size: 8px;
  opacity: 0.6;
}
.footer-note {
  font-size: 11px;
  color: var(--text-3);
  flex: 1;
  min-width: 200px;
}
.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text-1); }

/* === Portal nav additions === */
.nav-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-back {
  font-family: var(--font-pixel); font-size: 6px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-3); text-decoration: none;
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; transition: color 0.15s;
}
.nav-back:hover { color: var(--yellow); }
.nav-divider { width: 1px; height: 16px; background: var(--border); flex-shrink: 0; }
.nav-tag {
  font-family: var(--font-pixel); font-size: 6px; letter-spacing: 1px;
  color: var(--yellow); background: rgba(242,193,46,0.1);
  border: 1px solid rgba(242,193,46,0.2); padding: 4px 9px; border-radius: 2px; flex-shrink: 0;
}
.nav-inner { gap: 28px !important; }
@media (max-width: 640px) {
  .nav-inner { gap: 16px !important; }
  .nav-tag { display: none; }
}