/* team-builder.css — custom party builder */

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

:root {
  --red:        #E8B84B;
  --red-dark:   #C8902E;
  --yellow:     #F2C12E;
  --black:      #120C06;
  --surface-1:  #1C150D;
  --surface-2:  #241B11;
  --surface-3:  #2E2317;
  --surface-4:  #3A2D1C;
  --border:     rgba(244,201,122,0.12);
  --border-2:   rgba(244,201,122,0.24);
  --text-1:     #F8F1E2;
  --text-2:     #C9BA9C;
  --text-3:     #8F8268;
  --green:      #3EC46D;
  --font-pixel: 'Press Start 2P', monospace;
  --font-cond:  'Saira Condensed', sans-serif;
  --font-body:  'Saira', 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;
  min-height: 100vh;
  padding-top: 60px;
}

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(14,14,20,0.92);
  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: 24px;
  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: 14px;
  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; }

.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: 20px;
  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;
  color: var(--text-1);
  line-height: 1;
}
.tb-subtitle {
  font-size: 13px;
  color: var(--text-3);
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}
.tb-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.tb-game-label {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
}
.tb-game-select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  min-width: 220px;
}
.tb-btn-secondary {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tb-btn-secondary:hover { background: var(--surface-4); color: var(--text-1); }
.tb-btn-primary {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--red);
  border: 1px solid var(--red-dark);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, filter 0.15s;
}
.tb-btn-primary:hover { filter: brightness(1.08); }

.tb-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tb-modal.hidden { display: none; }
.tb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}
.tb-modal-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.tb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tb-modal-header h2 {
  font-family: var(--font-cond);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.tb-modal-close {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.tb-modal-close:hover { color: var(--text-1); }
.tb-modal-hint {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.45;
}
.tb-modal-textarea {
  width: 100%;
  min-height: 280px;
  flex: 1;
  resize: vertical;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text-1);
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 14px;
}
.tb-modal-textarea:focus {
  outline: none;
  border-color: rgba(141, 50, 168, 0.55);
}
.tb-modal-message {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
  max-height: 120px;
  overflow-y: auto;
}
.tb-modal-message.error { color: #f08080; }
.tb-modal-message.success { color: var(--green); }
.tb-modal-message.hidden { display: none; }
.tb-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tb-main { max-width: 1280px; margin: 0 auto; padding: 24px 24px 80px; }
.tb-loading {
  display: flex;
  flex-direction: column;
  align-items: 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 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.tb-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 24px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .tb-layout { grid-template-columns: 1fr; }
}

.tb-search-wrap { position: relative; margin-bottom: 16px; }
.search-wrap { position: relative; }
.search-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
}
.search-input:focus { border-color: var(--red); }
.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: 320px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-sprite { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; }
.dropdown-name {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 15px;
  flex: 1;
}
.dropdown-types { display: flex; gap: 4px; }

.tb-view-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}
.tb-view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.tb-view-btn {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  padding: 8px 22px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tb-view-btn:hover { color: var(--text-1); }
.tb-view-btn.active {
  background: var(--gold-2, #E8B84B);
  color: #1c1306;
}

.tb-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.tb-slot {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  min-height: 118px;
  background: linear-gradient(180deg, #3d3018 0%, #2a2012 52%, #1e170d 100%);
  border: 1.5px solid var(--border-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 26px -14px rgba(0,0,0,0.55);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.tb-slot:hover { border-color: var(--gold-2, #E8B84B); transform: translateY(-1px); }
.tb-slot.selected {
  border-color: var(--gold, #F4C97A);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 0 0 2px rgba(244,201,122,0.35), 0 12px 28px -12px rgba(0,0,0,0.65);
}
.tb-slot.empty {
  background: none;
  border: 1.5px dashed var(--border-2);
  box-shadow: none;
  align-items: center;
  justify-content: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 16px;
  min-height: 118px;
}
.tb-slot.empty:hover { border-color: rgba(244,201,122,0.45); background: rgba(244,201,122,0.06); transform: none; }
.tb-slot-num {
  position: absolute;
  right: 10px;
  bottom: 2px;
  font-family: var(--font-cond);
  font-weight: 900;
  font-size: 72px;
  line-height: 1;
  color: rgba(244,201,122,0.1);
  pointer-events: none;
  z-index: 0;
}
.tb-slot.empty .tb-slot-num { position: static; font-size: 34px; }
.tb-slot-summary { position: relative; z-index: 1; }
.tb-slot-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 118px;
}
.tb-slot-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 10px 12px;
  min-width: 0;
}
.tb-slot-identity {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.tb-slot-sprite {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.45));
}
.tb-slot-info { flex: 1; min-width: 0; }
.tb-slot-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tb-slot-name {
  font-family: var(--font-cond);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.2px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-slot-types {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.tb-slot-ability {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-slot-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-top: auto;
}
.tb-slot-item-sprite,
.tb-slot-item-fallback {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  object-fit: contain;
  image-rendering: pixelated;
}
.tb-slot-item-fallback {
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px dashed rgba(255,255,255,0.12);
}
.tb-slot-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-slot-moves {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 10px 34px 10px 10px;
  min-width: 0;
  border-left: 1px solid rgba(255,255,255,0.07);
  background:
    repeating-linear-gradient(180deg, transparent, transparent 3px, rgba(0,0,0,0.07) 3px, rgba(0,0,0,0.07) 4px),
    linear-gradient(180deg, rgba(0,0,0,0.1), rgba(0,0,0,0.22));
}
.tb-slot-move {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  min-width: 0;
}
.tb-slot-move.empty { color: var(--text-3); }
.tb-mtag {
  font-size: 9.5px;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 5px;
  flex: 0 0 auto;
}
.tb-mtag.empty { background: var(--surface-4); color: var(--text-3); }
.tb-mname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.tb-slot-empty-label {
  font-family: var(--font-cond);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.5px;
}
.tb-slot-actions {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tb-slot-remove,
.tb-slot-collapse {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--text-3);
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  white-space: nowrap;
}
.tb-slot-action-icon {
  font-size: 14px;
  line-height: 1;
}
.tb-slot-remove:hover { color: var(--red); border-color: rgba(244,201,122,0.35); }
.tb-slot-collapse:hover { color: var(--gold); border-color: rgba(244,201,122,0.35); }
.tb-slot.expanded {
  grid-column: 1 / -1;
  overflow: visible;
  cursor: default;
}
.tb-slot.expanded .tb-slot-summary {
  padding-top: 34px;
  border-bottom: 1px solid var(--border-2);
}
.tb-slot.expanded:hover { transform: none; }
.tb-slot-detail {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding: 16px 14px 0;
}
/* stats view cards */
.tb-slot-grid.stats-view .tb-slot:not(.empty) { min-height: 148px; }
.tb-slot-summary-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  position: relative;
  z-index: 1;
}
.tb-slot-stats-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tb-slot-stats-head .tb-slot-sprite {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.tb-slot-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  padding-right: 28px;
}
.tb-slot-stats-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.tb-stat-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(48px, 1.2fr) auto;
  align-items: center;
  gap: 5px;
  font-family: var(--font-cond);
  font-size: 11.5px;
}
.tb-stat-label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--text-2);
}
.tb-stat-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  opacity: 0.9;
}
.tb-stat-icon[data-stat="hp"]::before { content: '♥'; color: #f0748a; }
.tb-stat-icon[data-stat="attack"]::before { content: '✦'; color: #f5ac78; }
.tb-stat-icon[data-stat="defense"]::before { content: '⛨'; color: #fae078; }
.tb-stat-icon[data-stat="special-attack"]::before { content: '◆'; color: #9db7f5; }
.tb-stat-icon[data-stat="special-defense"]::before { content: '◇'; color: #a7db8d; }
.tb-stat-icon[data-stat="speed"]::before { content: '»'; color: #fa92b2; }
.tb-stat-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.tb-stat-value {
  font-weight: 800;
  font-size: 13px;
  color: var(--text-1);
  min-width: 2.5ch;
  text-align: right;
}
.tb-stat-bar-track {
  height: 7px;
  background: rgba(0,0,0,0.38);
  border-radius: 4px;
  overflow: hidden;
}
.tb-stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep, #C8902E), var(--gold-2, #E8B84B));
  border-radius: 4px;
  transition: width 0.15s;
}
.tb-stat-spread {
  font-weight: 800;
  font-size: 12px;
  color: var(--text-1);
  min-width: 2ch;
  text-align: right;
}
.tb-stat-nature {
  font-size: 9px;
  line-height: 1;
  flex-shrink: 0;
}
.tb-stat-label.up,
.tb-stat-nature.up {
  color: #E05050;
}
.tb-stat-label.down,
.tb-stat-nature.down {
  color: #62b8f0;
}

.tb-coverage-panel {
  margin-top: 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.tb-coverage-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tb-coverage-header h3,
.tb-coverage-section h4 {
  font-family: var(--font-cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.tb-coverage-header h3 {
  font-size: 15px;
}
.tb-coverage-header p,
.tb-coverage-note,
.tb-coverage-empty,
.tb-coverage-empty-text,
.tb-defense-note {
  color: var(--text-3);
  font-size: 12px;
}
.tb-coverage-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.tb-coverage-section h4 {
  font-size: 12px;
  margin-bottom: 6px;
}
.tb-coverage-note {
  margin-bottom: 10px;
}
.tb-coverage-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tb-coverage-row {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 10px;
}
.tb-coverage-label,
.tb-coverage-subhead {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
}
.tb-coverage-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tb-defense-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tb-defense-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.tb-defense-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .tb-coverage-row,
  .tb-defense-columns {
    grid-template-columns: 1fr;
  }
}

.tb-threat-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.tb-detail-col .tb-threat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tb-detail-col .tb-threat-list {
  flex: 1;
  min-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
}
.tb-detail-col .tb-threat-panel > .tb-coverage-header,
.tb-detail-col .tb-threat-panel > .tb-coverage-note,
.tb-detail-col .tb-threat-panel > .tb-coverage-empty {
  flex-shrink: 0;
}
.tb-threat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.tb-threat-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.tb-threat-sprite {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}
.tb-threat-body {
  min-width: 0;
}
.tb-threat-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
}
.tb-threat-types {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.tb-threat-reason {
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 4px;
}
.tb-threat-score {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}
.tb-threat-bar-wrap {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.tb-threat-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  border-radius: 2px;
}
.tb-threat-type-gaps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tb-type-gap-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tb-type-gap-count {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 800;
  color: var(--weak, #F0748A);
  line-height: 1;
}

.type-tag {
  display: inline-block;
  font-family: var(--font-cond);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 3px;
  color: #fff;
}
.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); }
.type-tag.grass    { background: var(--t-grass); }
.type-tag.ice      { background: var(--t-ice); }
.type-tag.fighting { background: var(--t-fighting); }
.type-tag.poison   { background: var(--t-poison); }
.type-tag.ground   { background: var(--t-ground); }
.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); }
.type-tag.fairy    { background: var(--t-fairy); }
.type-tag.small {
  font-size: 9px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.type-tag.ice,
.type-tag.ground,
.type-tag.steel { color: #0E0E14; }

.tb-move-picker { position: relative; }
.tb-move-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  padding: 8px 10px;
  border-radius: 6px;
}
.tb-move-search:focus-within {
  border-color: var(--red);
}
.tb-move-search-type {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex-shrink: 0;
}
.tb-move-cat {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  font-size: 11px;
  line-height: 1;
}
.tb-move-cat[data-cat="physical"]::before { content: '⚔'; color: #E06040; }
.tb-move-cat[data-cat="special"]::before { content: '✦'; color: #8090D8; }
.tb-move-cat[data-cat="status"]::before { content: '◎'; color: #9898B0; }
.tb-move-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}
.tb-move-input::placeholder {
  color: var(--text-3);
}
.tb-move-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-family: var(--font-body);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.tb-move-trigger:hover { border-color: rgba(255,255,255,.25); }
.tb-move-trigger:focus {
  outline: none;
  border-color: var(--red);
}
.tb-move-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.tb-move-placeholder {
  color: var(--text-3);
  font-size: 14px;
}
.tb-move-dropdown {
  display: none;
  max-height: 280px;
}
.tb-move-picker.open .tb-move-dropdown { display: block; }
.tb-move-option.hidden-by-search,
.tb-move-group.hidden-by-search {
  display: none;
}
.tb-move-group-label {
  font-family: var(--font-cond);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
}
.tb-move-group-label:first-of-type { border-top: none; }
.tb-move-option.selected { background: var(--surface-3); }
.tb-move-empty {
  display: none;
  padding: 10px 12px;
  color: var(--text-3);
  font-size: 13px;
}
.tb-move-empty.show { display: block; }
.tb-move-lv {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
  flex-shrink: 0;
}
.tb-move-option .dropdown-name { font-size: 14px; }

.tb-nature-picker { position: relative; }
.tb-nature-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-family: var(--font-body);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.tb-nature-trigger:hover { border-color: rgba(255,255,255,.25); }
.tb-nature-trigger:focus {
  outline: none;
  border-color: var(--red);
}
.tb-nature-name {
  font-weight: 600;
  font-size: 14px;
}
.tb-nature-effect {
  font-size: 12px;
  color: var(--text-3);
}
.tb-nature-effect.neutral {
  font-style: italic;
}
.tb-nature-placeholder {
  color: var(--text-3);
  font-size: 14px;
}
.tb-nature-dropdown {
  display: none;
  left: 0;
  right: auto;
  min-width: min(100%, 520px);
  max-width: 95vw;
  padding: 8px;
  overflow-x: auto;
}
.tb-nature-picker.open .tb-nature-dropdown { display: block; }
.tb-nature-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.tb-nature-grid th,
.tb-nature-grid td {
  border: 1px solid var(--border);
  padding: 0;
  text-align: center;
  vertical-align: middle;
}
.tb-nature-corner {
  background: transparent;
  border-color: transparent;
}
.tb-nature-axis-title {
  font-family: var(--font-cond);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 8px;
  background: var(--surface-1);
}
.tb-nature-axis-side {
  font-family: var(--font-cond);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  padding: 4px;
  width: 28px;
  background: var(--surface-1);
}
.tb-nature-stat-head {
  font-family: var(--font-cond);
  font-size: 10px;
  font-weight: 700;
  padding: 6px 4px;
  background: var(--stat-col);
  color: #111;
  white-space: nowrap;
}
.tb-nature-stat-head.row { min-width: 64px; }
.tb-nature-cell {
  background: var(--surface-2);
  padding: 0;
}
.tb-nature-cell.selected {
  background: var(--surface-3);
  box-shadow: inset 0 0 0 2px var(--red);
}
.tb-nature-cell-btn {
  display: block;
  width: 100%;
  padding: 7px 6px;
  border: none;
  background: transparent;
  color: var(--text-1);
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tb-nature-cell-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.tb-detail-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 400px;
}
.tb-detail-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  flex-shrink: 0;
}
.tb-detail-empty {
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
  padding: 48px 16px;
}
.tb-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.tb-detail-sprite {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  object-fit: contain;
}
.tb-detail-title {
  font-family: var(--font-cond);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}
.tb-detail-types { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.tb-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 600px) {
  .tb-field-grid { grid-template-columns: 1fr; }
}
.tb-field { display: flex; flex-direction: column; gap: 4px; }
.tb-field.full { grid-column: 1 / -1; }
.tb-field label {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
}
.tb-field input,
.tb-field select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
  width: 100%;
}
.tb-field input:focus,
.tb-field select:focus {
  outline: none;
  border-color: var(--red);
}
.tb-moves-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.tb-stat-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
@media (max-width: 720px) {
  .tb-stat-panels { grid-template-columns: 1fr; }
}
.tb-stat-block {
  min-width: 0;
}
.tb-stat-block h3 {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.tb-stat-header,
.tb-stat-row {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}
.tb-stat-header {
  font-family: var(--font-cond);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.tb-stat-header span:not(:first-child) {
  text-align: center;
}
.tb-stat-rows { display: flex; flex-direction: column; gap: 6px; }
.tb-stat-label {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.tb-stat-num {
  width: 100%;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text-1);
  font-family: var(--font-cond);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  padding: 8px 4px;
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.tb-stat-num::-webkit-outer-spin-button,
.tb-stat-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tb-stat-num:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--surface-3);
}
.tb-stat-num:focus {
  outline: none;
  border-color: var(--red);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px rgba(141, 50, 168, 0.35);
}
.tb-stat-num-ev:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px rgba(242, 193, 46, 0.35);
}
.tb-ev-total {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
}
.tb-ev-total.over { color: var(--red); }

.tb-stat-block.champions-mode .tb-stat-header,
.tb-stat-block.champions-mode .tb-stat-row {
  grid-template-columns: 2.4em minmax(0, 1fr);
}
.tb-stat-spacer { display: none; }
.tb-stat-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.4;
}

.tb-computed-stats { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tb-computed-stat-header,
.tb-computed-stat-row {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr) minmax(0, 1fr) minmax(2.5em, 3em) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.tb-computed-stat-header {
  font-family: var(--font-cond);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--text-3);
  margin-bottom: 2px;
}
.tb-computed-stat-header span:not(:first-child) {
  text-align: right;
}
.tb-computed-stat-row .tb-stat-label {
  font-size: 13px;
}
.tb-base-stat-val,
.tb-computed-stat-val {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  min-width: 0;
}
.tb-base-stat-val {
  color: var(--text-3);
  font-weight: 600;
}
.tb-computed-stat-val {
  color: var(--text-1);
}
.tb-stat-stage-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 0;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
}
.tb-stat-stage-select:hover:not(:disabled) {
  border-color: var(--border-2);
}
.tb-stat-stage-select:focus {
  outline: none;
  border-color: var(--red);
}
.tb-stat-stage-select:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.tb-effective-stat-val {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  color: var(--text-1);
  min-width: 0;
}
.tb-effective-stat-val.up {
  color: var(--green);
}
.tb-effective-stat-val.down {
  color: var(--red);
}
.tb-computed-stats-level {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}
.footer-wordmark { font-size: 10px; }
.footer-note { font-size: 12px; color: var(--text-3); flex: 1; min-width: 200px; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  text-transform: uppercase;
}
.footer-links a:hover { color: var(--text-1); }


/* ════ SMART FILL ════ */
/* Smart Fill — append to team-builder.css */

.tb-sf-styles {
  display: flex;
  gap: 6px;
  margin: 4px 0 12px;
}
.tb-sf-style {
  flex: 1;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  color: var(--text-3);
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  padding: 6px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
}
.tb-sf-style.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.tb-sf-picks { display: flex; flex-direction: column; gap: 8px; }

.tb-sf-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--surface-2);
}
.tb-sf-sprite {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 44px;
  image-rendering: auto;
}
.tb-sf-body { flex: 1; min-width: 0; }
.tb-sf-name {
  font-family: var(--font-cond);
  font-weight: 700;
  color: var(--text-1);
  font-size: 14px;
}
.tb-sf-types { display: flex; gap: 4px; margin: 3px 0; }
.tb-sf-reason {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
}
.tb-sf-add {
  flex: 0 0 auto;
  border: none;
  background: var(--red);
  color: #fff;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: filter .15s;
}
.tb-sf-add:hover { filter: brightness(1.1); }


/* ============ GOLD CHAMPIONS THEME (appended) ============ */
:root{
  --gold:#F4C97A; --gold-2:#E8B84B; --gold-deep:#C8902E; --gold-soft:rgba(232,184,75,.14);
  --weak:#F0748A; --weak-bg:#3A1620; --res:#62D6A0; --res-bg:#16301F;
}
body{ background:
  radial-gradient(1100px 460px at 80% -8%,#4a3514 0%,transparent 56%),
  radial-gradient(820px 400px at 6% 2%,#36280f 0%,transparent 50%),
  var(--black); }
.wordmark span{ color:#D42B1E; }

.tb-page{max-width:1140px;margin:0 auto;}
.tb-pagehead{margin-bottom:18px}
.tb-kick{font-family:var(--font-cond);font-weight:700;letter-spacing:3px;font-size:12px;text-transform:uppercase;color:var(--gold)}
.tb-h1{font-family:var(--font-cond);font-weight:800;font-size:38px;letter-spacing:.5px;line-height:1;text-transform:uppercase;color:var(--text-1);margin:0}
.tb-search-wrap{margin-bottom:24px}
.search-input{border-radius:999px}
.search-input:focus{border-color:var(--gold-2);box-shadow:0 0 0 4px var(--gold-soft)}

.tb-view-toggle-wrap{margin-bottom:16px}
.tb-view-toggle{background:var(--surface-1);border:1px solid var(--border-2);border-radius:999px;padding:4px}
.tb-view-btn{font-family:var(--font-cond);font-weight:700;font-size:14px;padding:8px 22px;border:none;border-radius:999px;background:transparent;color:var(--text-3);cursor:pointer}
.tb-view-btn.active{background:var(--gold-2);color:#1c1306}

/* move type labels (mirror moves.js type-tag) — used in detail editor */
.tb-mtag{font-size:9.5px;letter-spacing:.4px;padding:1px 6px;border-radius:5px;flex:0 0 auto}
.tb-mtag.empty{background:var(--surface-4);color:var(--text-3)}

/* slot cards — gold champions layout */
.tb-slot{background:linear-gradient(180deg,#3d3018 0%,#2a2012 52%,#1e170d 100%);border:1.5px solid var(--border-2);box-shadow:inset 0 1px 0 rgba(255,255,255,.04),0 14px 30px -18px rgba(0,0,0,.7)}
.tb-slot:hover{border-color:var(--gold-2)}
.tb-slot.selected{border-color:var(--gold);box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 0 0 2px rgba(244,201,122,.4),0 16px 32px -16px rgba(0,0,0,.8)}
.tb-slot-num{color:rgba(244,201,122,.10)}
.tb-slot.empty{background:none;border:1.6px dashed var(--border-2)}
.tb-slot.empty:hover{border-color:var(--gold-2);background:var(--gold-soft)}
.tb-slot-moves{background:repeating-linear-gradient(180deg,transparent,transparent 3px,rgba(0,0,0,.07) 3px,rgba(0,0,0,.07) 4px),linear-gradient(180deg,rgba(0,0,0,.1),rgba(0,0,0,.22))}

/* Smart Fill — big gold hero */
.tb-sf-panel{position:relative;overflow:hidden;background:linear-gradient(160deg,#2a2012,#1b140c);border:1px solid var(--border-2);border-radius:24px;padding:24px;margin-bottom:14px}
.tb-sf-panel::before{content:"";position:absolute;inset:0 0 auto 0;height:3px;background:linear-gradient(90deg,var(--gold),var(--gold-deep))}
.tb-sf-panel .tb-coverage-header h3{font-size:28px;text-transform:uppercase;letter-spacing:.5px}
.tb-sf-styles{display:inline-flex;background:var(--surface-1);border:1px solid var(--border-2);border-radius:999px;padding:4px;margin:14px 0 18px;gap:0}
.tb-sf-style{font-family:var(--font-cond);font-weight:700;font-size:13.5px;letter-spacing:.5px;color:var(--text-3);background:none;border:none;padding:8px 18px;border-radius:999px;cursor:pointer}
.tb-sf-style.active{background:var(--gold-2);color:#1c1306}
.tb-sf-picks{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}
.tb-sf-pick{flex-direction:column;align-items:stretch;background:var(--surface-1);border:1px solid var(--border);border-radius:18px;padding:16px;gap:10px;display:flex}
.tb-sf-pick:hover{border-color:var(--border-2)}
.tb-sf-sprite{width:54px;height:54px}
.tb-sf-name{font-family:var(--font-cond);font-weight:800;font-size:19px}
.tb-sf-reason{font-size:12.5px;color:var(--text-2);line-height:1.4}
.tb-sf-archetype{font-size:13px;color:var(--gold);margin:8px 0 0;line-height:1.4}
.tb-sf-archetype strong{font-weight:800}
.tb-sf-source{font-size:12px;color:var(--text-3);margin:6px 0 0;line-height:1.4}
.tb-sf-teams{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}
.tb-sf-team{display:flex;flex-direction:column;background:var(--surface-1);border:1px solid var(--border);border-radius:18px;padding:16px;gap:12px}
.tb-sf-team-header{min-height:0}
.tb-sf-team-title{font-family:var(--font-cond);font-weight:800;font-size:18px;margin:0 0 4px;color:var(--text-1)}
.tb-sf-team-summary{font-size:12.5px;color:var(--text-2);line-height:1.4;margin:0}
.tb-sf-roster{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.tb-sf-roster-mon{display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 4px;border-radius:12px;background:var(--surface-2);border:1px solid transparent}
.tb-sf-roster-mon.is-core{border-color:var(--gold-2);background:rgba(212,175,55,.08)}
.tb-sf-roster-mon.is-anchor{border-color:#6eb5ff;background:rgba(110,181,255,.08)}
.tb-sf-roster-sprite{width:40px;height:40px;image-rendering:pixelated;object-fit:contain}
.tb-sf-roster-name{font-size:11px;font-weight:700;text-align:center;line-height:1.2;color:var(--text-2)}
.tb-sf-add{width:100%;border:none;background:var(--gold-2);color:#1c1306;font-family:var(--font-cond);font-weight:800;font-size:14px;letter-spacing:.5px;padding:11px;border-radius:12px;cursor:pointer;margin-top:auto}
.tb-sf-add:hover{background:var(--gold)}

/* analysis row */
.tb-analysis{display:grid;grid-template-columns:1.05fr .95fr;gap:14px;align-items:stretch}
.tb-coverage-panel,.tb-threat-panel{background:var(--surface-1);border:1px solid var(--border);border-radius:20px}

/* type matchup grid (Showdown-style) */
.tb-matrix{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:8px}
.tb-tcell{border-radius:12px;padding:10px 8px;text-align:center;border:1px solid transparent;background:var(--surface-2);display:flex;flex-direction:column;align-items:center;gap:6px;min-width:0}
.tb-tcell .type-tag{font-size:12px;padding:3px 8px}
.tb-tval{font-family:var(--font-cond);font-weight:800;font-size:20px;line-height:1;color:var(--text-3)}
.tb-tcell.weak{background:var(--weak-bg);border-color:rgba(240,116,138,.35)} .tb-tcell.weak .tb-tval{color:var(--weak)}
.tb-tcell.res{background:var(--res-bg);border-color:rgba(98,214,160,.28)} .tb-tcell.res .tb-tval{color:var(--res)}
.tb-tcell.neu{opacity:.72}
.tb-tcell-members{width:100%;display:flex;flex-direction:column;gap:6px;text-align:left;padding-top:2px}
.tb-tcell-group{display:flex;flex-direction:column;gap:3px}
.tb-tcell-group-label{font-family:var(--font-cond);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;line-height:1.1}
.tb-tcell-weak .tb-tcell-group-label{color:var(--weak)}
.tb-tcell-res .tb-tcell-group-label{color:var(--res)}
.tb-tcell-mons{display:flex;flex-direction:column;gap:3px}
.tb-tcell-mon{display:block;font-family:var(--font-cond);font-size:12px;font-weight:600;color:var(--text-1);line-height:1.3;word-break:break-word}
.tb-tmult{font-size:11px;font-weight:800;margin-left:3px}
.tb-tcell-weak .tb-tmult{color:var(--weak)}
.tb-tcell-res .tb-tmult{color:var(--res)}
.tb-legend{display:flex;gap:14px;margin-top:12px;font-size:11px;color:var(--text-3);font-family:var(--font-cond);font-weight:600}
.tb-legend span{display:inline-flex;align-items:center;gap:5px}
.tb-legend i{width:9px;height:9px;border-radius:3px;display:inline-block}
.tb-legend i.w{background:var(--weak)} .tb-legend i.r{background:var(--res)} .tb-legend i.n{background:var(--surface-4)}
.tb-cov-strip{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}
.tb-cov-lab{font-family:var(--font-cond);font-weight:700;font-size:11px;letter-spacing:1px;text-transform:uppercase;color:var(--text-3)}

@media(max-width:880px){.tb-analysis{grid-template-columns:1fr}}
@media(max-width:680px){
  .tb-h1{font-size:30px}
  .tb-slot-grid{grid-template-columns:1fr}
  .tb-slot-body{grid-template-columns:1fr}
  .tb-slot-moves{
    border-left:none;
    border-top:1px solid rgba(255,255,255,.07);
    padding-right:34px;
  }
  .tb-slot-stats-grid{grid-template-columns:1fr;padding-right:28px}
  .tb-sf-panel{padding:18px;border-radius:18px}
  .tb-sf-styles{display:flex;width:100%}.tb-sf-style{flex:1;text-align:center}
  .tb-sf-picks{grid-template-columns:1fr}
  .tb-sf-teams{grid-template-columns:1fr}
}

.tb-threat-more[hidden]{display:none}
.tb-threat-toggle{display:block;width:100%;margin-top:10px;background:var(--surface-2);border:1px solid var(--border-2);color:var(--gold);font-family:var(--font-cond);font-weight:700;font-size:12.5px;letter-spacing:.6px;text-transform:uppercase;padding:9px;border-radius:10px;cursor:pointer}
.tb-threat-toggle:hover{border-color:var(--gold-2);background:var(--surface-3)}

/* === 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(--red); }
.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(--red); background: rgba(232,184,75,0.12);
  border: 1px solid rgba(232,184,75,0.28); 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; }
}