/* ── Season banner (persistent, below the app header) ── */
.season-banner {
  background: var(--navy);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 6px 12px;
}

/* ── Section header inside page ── */
.section-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 0 0 10px 0;
}

/* ── Loading pulse ── */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.loading { animation: pulse 1.5s ease-in-out infinite; font-size: 0.82rem; color: var(--muted); padding: 16px 0; text-align: center; }

/* ── Data credit ── */
.data-credit { font-size: 0.78rem; color: var(--muted); text-align: center; padding: 8px 0 4px; }

/* ── Status / progress ── */
.status { font-size: 0.8rem; color: var(--muted); padding: 6px 0; min-height: 20px; }
.status.err { color: #c0392b; }
.status.ok { color: #1e8449; }
.progress { font-size: 0.78rem; color: var(--muted); margin-top: 8px; min-height: 20px; }

/* ── Search panel (setup screen) ── */
.search-panel {
  background: var(--card);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  padding: 16px;
  margin-bottom: 10px;
}
.search-panel label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 6px;
}

/* ── Predictive search + dropdown ── */
.search-wrap { position: relative; }
.search-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,111,165,0.1);
}
.dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--accent);
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.dropdown-item {
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover, .dropdown-item:active { background: #f0f4ff; }
.dropdown-item .meta { font-size: 0.72rem; color: var(--muted); }

/* ── Selected team chip ── */
.selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #eef4ff;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  font-size: 0.88rem;
  margin-top: 8px;
}
.chip-actions { display: flex; align-items: center; gap: 12px; }
.chip-star, .chip-clear {
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.chip-clear { color: #aaa; }
.chip-clear:hover { color: #c0392b; }

/* ── Favorites (setup screen) ── */
.favorites-empty {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 2px 2px 6px;
}
.favorite-card {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  border: 1.5px solid var(--border);
  padding: 14px 40px 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.favorite-card:active { transform: scale(0.98); }
.favorite-name { font-size: 0.9rem; font-weight: 700; color: var(--navy); }
.favorite-meta { font-size: 0.76rem; color: var(--muted); margin-top: 3px; }
.favorite-rank { font-size: 0.72rem; color: var(--accent); font-weight: 600; margin-top: 2px; }
.favorite-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #f0f2f5;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.favorite-remove:active { background: #e2e5ea; }

/* ── Add to Favorites button (My Team summary) ── */
.favorite-toggle-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.favorite-toggle-btn:active { background: rgba(74,111,165,0.1); }
.favorite-toggle-btn.is-fav {
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
  background: #f5f5f5;
}

/* ── Team ribbon ── */
.team-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
}
.team-ribbon-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.team-ribbon-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-ribbon-change {
  font-size: 0.75rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ── Team summary card ── */
.summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.summary-school-name { font-size: 1.05rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.summary-school-meta { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: #f8f9fa;
  border-radius: 10px;
  overflow: hidden;
}
.summary-stat {
  text-align: center;
  padding: 12px 4px;
  border-right: 1px solid var(--border);
}
.summary-stat:last-child { border-right: none; }
.summary-stat-val { font-size: 1.1rem; font-weight: 800; color: var(--navy); line-height: 1; }
.summary-stat-lbl { font-size: 0.62rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Sub-tab bar (My Team: My Season/Best Wins/My Roster · Rankings: Look-up/National) ── */
.subtab-bar { display: flex; border-bottom: 2px solid var(--border); }
.subtab-btn {
  flex: 1;
  padding: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: #f8f9fa;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.subtab-btn:first-child { border-radius: 14px 0 0 0; }
.subtab-btn:last-child  { border-radius: 0 14px 0 0; border-left: 1px solid var(--border); }
.subtab-btn.active { color: var(--navy); background: var(--white); border-bottom-color: var(--orange); }
.subtab-content { padding: 16px; display: none; }
.subtab-content.active { display: block; }

/* ── Data tables (match history, roster, rankings, common opponents) ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table thead th {
  font-size: 0.68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 8px; text-align: left;
  border-bottom: 2px solid #e0e8f0; background: #f8f9fa;
  white-space: nowrap;
}
.data-table tbody td { padding: 8px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.win-cell  { color: #1e8449; font-weight: 600; }
.loss-cell { color: #c0392b; font-weight: 600; }
.position-summary { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }

/* ── Match history (My Season / Their History) ── */
.event-group { margin-bottom: 16px; }
.event-label {
  font-size: 0.74rem; font-weight: 600; color: var(--navy);
  margin-bottom: 6px; padding-bottom: 4px;
  border-bottom: 1px solid #e8f0fe;
}
.match-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f8f8f8;
  font-size: 0.8rem;
}
.match-card:last-child { border-bottom: none; }
.match-opp { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-score { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.match-date { color: #bbb; font-size: 0.72rem; white-space: nowrap; }

/* ── Best wins ── */
.best-win {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}
.best-win:last-child { border-bottom: none; }
.best-win-rank { font-size: 1.1rem; font-weight: 800; color: var(--orange); width: 28px; flex-shrink: 0; }
.best-win-body { flex: 1; min-width: 0; }
.best-win-opp { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.best-win-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.best-win-right { text-align: right; flex-shrink: 0; }
.best-win-state-rank { font-size: 0.72rem; color: var(--navy); font-weight: 600; }
.best-win-score { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* ── Under-construction banner ── */
.uc-banner {
  background: #fff8e1;
  border: 1px solid #f0c040;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #7a6000;
}

/* ── Schedule tab: tournament groups ── */
.sched-empty, .sched-no-team {
  padding: 32px 16px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.tourney-group {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 10px;
  overflow: hidden;
}
.tourney-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tourney-header-body { flex: 1; min-width: 0; }
.tourney-name { font-size: 0.88rem; font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tourney-date { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.tourney-record { font-size: 0.85rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.tourney-chevron { font-size: 0.7rem; color: var(--muted); }
.tourney-matches { border-top: 1px solid var(--border); }
.tourney-match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f5f5f5;
}
.tourney-match-row:last-child { border-bottom: none; }
.tourney-match-body { flex: 1; min-width: 0; }
.tourney-match-opp { font-size: 0.83rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tourney-match-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.sched-scout-btn {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ── "Coming soon" stub (Schedule: upcoming tournaments) ── */
.upcoming-stub {
  margin-bottom: 16px;
  padding: 20px 16px;
  border-radius: 12px;
  background: #f0f2f5;
  border: 1.5px dashed var(--border);
  text-align: center;
  opacity: 0.65;
}
.upcoming-stub-title { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.upcoming-stub-note { font-size: 0.72rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Scout tab: team compare ── */
.team-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.team-box {
  text-align: center;
  padding: 14px 10px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.team-box .tname { font-size: 0.8rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; line-height: 1.3; }
.team-box .trecord { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.team-box .tmeta { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }
.vs-badge { font-size: 1rem; font-weight: 800; color: var(--muted); }

/* ── Scout tab: prediction box ── */
.prediction-box {
  text-align: center;
  padding: 20px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.prediction-box.favor  { background: #eafaf1; border: 2px solid #27ae60; }
.prediction-box.against{ background: #fdedec; border: 2px solid #e74c3c; }
.prediction-box.tossup { background: #fef9e7; border: 2px solid #f39c12; }
.pred-label { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.pred-pct { font-size: 2.6rem; font-weight: 800; margin: 6px 0; }
.pred-note { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.pred-confidence { font-size: 0.82rem; font-weight: 600; margin-top: 10px; }
.pred-conf-note { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.favor .pred-label, .favor .pred-pct { color: #1e8449; }
.against .pred-label, .against .pred-pct { color: #c0392b; }
.tossup .pred-label, .tossup .pred-pct { color: #d68910; }
.calc-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--navy);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Scout tab: head-to-head box ── */
.h2h-box {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.h2h-title { font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.h2h-match {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.8rem;
}
.h2h-match:last-child { border-bottom: none; }
.h2h-detail { flex: 1; font-weight: 500; }
.h2h-scores { color: var(--muted); font-size: 0.75rem; }
.h2h-date { color: #bbb; font-size: 0.72rem; white-space: nowrap; }

/* ── Scout tab: result tabs (Opponents / Their History / Their Roster) ── */
.result-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 14px; }
.result-tab {
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  border: none;
  background: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.result-tab.active { color: var(--navy); border-bottom-color: var(--orange); }
.result-section { display: none; }
.result-section.active { display: block; }

/* ── Analyze button ── */
.btn-analyze {
  width: 100%;
  padding: 14px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background 0.15s;
  min-height: 48px;
}
.btn-analyze:hover { background: #2a2a4a; }
.btn-analyze:disabled { background: #aaa; cursor: not-allowed; }

/* ── Prediction breakdown modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
}
.modal-sheet {
  background: var(--white);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  padding: 0 0 24px 0;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
  .modal-sheet { border-radius: 16px; max-height: 80vh; }
}
.modal-header {
  position: sticky;
  top: 0;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--navy); }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: #f0f0f0;
  border-radius: 50%; cursor: pointer;
  font-size: 1rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.modal-body { padding: 16px 20px; }
.modal-section { margin-bottom: 20px; }
.modal-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--orange);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.modal-section-weight { font-size: 0.72rem; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.modal-section-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.5; margin: -2px 0 10px; }
.modal-row-note { font-size: 0.72rem; color: var(--muted); line-height: 1.4; padding: 0 0 6px; }
.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.82rem;
  gap: 8px;
}
.modal-row:last-child { border-bottom: none; }
.modal-row-label { flex: 1; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-row-detail { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.modal-row-score { font-weight: 700; white-space: nowrap; min-width: 40px; text-align: right; }
.modal-final { background: #f8f9fa; border-radius: 10px; padding: 14px 16px; margin-top: 4px; }
.modal-final-row { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 4px 0; color: var(--muted); }
.modal-final-row.total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}
.modal-final-note { font-size: 0.72rem; color: var(--muted); line-height: 1.4; padding-top: 2px; }
