/* Baseball Think Tank -- Light Theme */
/* Toast notification animation */
@keyframes btt-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
/* Brand: electric blue (#1e90ff / #2563eb), purple (#7c3aed), white surfaces */

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

:root {
  --blue:    #2563eb;
  --blue2:   #1d4ed8;
  --blue-lt: #eff6ff;
  --blue-md: #bfdbfe;
  --purple:  #7c3aed;
  --purp-lt: #f5f3ff;
  --purp-md: #ddd6fe;
  --navy:    #0f172a;
  --navy2:   #1e293b;
  --chalk:   #0f172a;
  --chalk2:  #334155;
  --chalk3:  #64748b;
  --chalk4:  #94a3b8;
  --bg:      #f8fafc;
  --bg2:     #f1f5f9;
  --bg3:     #e2e8f0;
  --border:  #e2e8f0;
  --border2: #cbd5e1;
  --green:   #16a34a;
  --red:     #dc2626;
  --gold:    #d97706;
  --white:   #ffffff;
  --shadow:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow2: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--chalk);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

#app { max-width: 1100px; margin: 0 auto; padding: 0 24px 120px; overflow: hidden; }

/* Header */
.site-header {
  text-align: left;
  padding: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 6px;
}
.baseball-icon { width: 52px; height: 52px; }
.site-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.site-title span { color: var(--blue); }
.site-sub {
  font-size: 11px;
  color: var(--chalk3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Status bar */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.score-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--chalk4);
  flex-shrink: 0;
}
.scoreboard.ready .score-dot { background: var(--green); }
.score-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--chalk2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  background: var(--bg);

}
.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--chalk3);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tab:hover { color: var(--blue); }
.nav-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg2);
  font-size: 10px;
  font-weight: 700;
  color: var(--chalk3);
}
.nav-tab.active .tab-num { background: var(--blue); color: white; }

/* Tab panels */
.tab-panel { display: none !important; }
.tab-panel.active { display: block !important; width: 100%; }

/* Panel header */
.panel-header { margin-bottom: 20px; }
.panel-eyebrow {
  font-size: 10px;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.panel-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}
.panel-desc { font-size: 14px; color: var(--chalk3); line-height: 1.6; }

/* Field card */
.field-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.field-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Inputs */
.input-group { margin-bottom: 14px; position: relative; }
.input-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--chalk3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--white);
  font-size: 13px;
  color: var(--chalk);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.suggest-box {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: var(--shadow2);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.suggest-item {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--chalk);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--blue-lt); color: var(--blue2); }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 11px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-gold {
  background: var(--blue);
  color: white;
}
.btn-gold:hover { background: var(--blue2); }

.or-divider {
  text-align: center;
  font-size: 11px;
  color: var(--chalk4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 12px 0;
  position: relative;
}
.or-divider::before, .or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

/* Loading */
#loading {
  display: none;
  text-align: center;
  padding: 48px 0;
}
.spinner {
  width: 48px; height: 48px;
  background: url('spinner.png') center/contain no-repeat;
  animation: spin 1.2s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.load-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--chalk3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Results cards */
.r-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.r-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.r-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  background: var(--blue);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.r-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.r-card-body { padding: 16px; }

/* School name */
.school-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.school-sub {
  font-size: 10px;
  color: var(--chalk3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Stats */
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stat-box {
  flex: 1;
  min-width: 60px;
  text-align: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
}
.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
}
.stat-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--chalk3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Position tabs */
.pos-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pos-tab {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--chalk3);
  cursor: pointer;
  transition: all 0.15s;
}
.pos-tab:hover { border-color: var(--blue); color: var(--blue); }
.pos-tab.active { background: var(--blue); color: white; border-color: var(--blue); }

.avg-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.avg-box {
  background: var(--blue-lt);
  border: 1px solid var(--blue-md);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  min-width: 70px;
}
.avg-val { font-size: 18px; font-weight: 700; color: var(--blue2); }
.avg-lbl { font-size: 9px; font-weight: 600; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* Bar */
.bar-track {
  height: 8px;
  background: var(--bg2);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  font-size: 9px;
  color: white;
  font-weight: 700;
}
.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--chalk3);
}

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
thead tr { border-bottom: 2px solid var(--border2); }
th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--chalk3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 8px;
  white-space: nowrap;
  background: var(--bg2);
}
td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--chalk);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--blue-lt); }
td.nm { color: var(--navy); font-weight: 600; }
td.ps {
  font-size: 10px;
  font-weight: 700;
  color: var(--purple);
  background: var(--purp-lt);
  border-radius: 4px;
  text-align: center;
}
td.mt { text-align: right; font-size: 12px; font-family: monospace; }
td.hi { color: var(--green); font-weight: 700; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Player detail */
.player-detail {
  padding: 12px 16px;
  background: var(--blue-lt);
  border: 1px solid var(--blue-md);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--chalk2);
}
.player-detail-name { font-weight: 700; color: var(--navy); font-size: 15px; }
.player-detail-pos {
  display: inline-block;
  background: var(--purple);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
}
.player-detail-meta { color: var(--chalk3); font-size: 12px; margin-left: 8px; }
.player-detail-date { color: var(--green); font-size: 11px; margin-left: 8px; }

/* Fit card */
.fit-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.fit-elite { border-top: 4px solid #16a34a; }
.fit-strong { border-top: 4px solid #2563eb; }
.fit-good { border-top: 4px solid #7c3aed; }
.fit-stretch { border-top: 4px solid #d97706; }
.fit-reach { border-top: 4px solid #dc2626; }
.fit-none { border-top: 4px solid var(--chalk4); }
.fit-title { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.fit-sub { font-size: 12px; color: var(--chalk3); margin-bottom: 12px; }
.fit-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 14px; }
.fit-metric {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}
.fit-metric-name { font-size: 9px; font-weight: 700; color: var(--chalk3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.fit-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.fit-val { font-size: 16px; font-weight: 700; }
.fit-avg { font-size: 10px; color: var(--chalk4); }
.fm-strong { color: var(--green); }
.fm-good { color: var(--blue); }
.fm-stretch { color: var(--gold); }
.fm-na { color: var(--chalk4); }
.fit-pill { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-top: 4px; }
.pill-strong { background: #dcfce7; color: #16a34a; }
.pill-good { background: var(--blue-lt); color: var(--blue2); }
.pill-stretch { background: #fef9c3; color: #92400e; }

/* Warn / error */
.warn-box {
  padding: 12px 16px;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 12px;
}
.err {
  padding: 12px 16px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 13px;
  color: #991b1b;
  margin-bottom: 12px;
}
.nodata { font-size: 12px; color: var(--chalk4); padding: 16px 0; text-align: center; }

/* Conference table */
.conf-tbl th, .conf-tbl td { padding: 7px 10px; }
.conf-tbl { min-width: 900px; }
.rnk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg2);
  color: var(--chalk3);
}
.rnk-1 { background: #fef9c3; color: #92400e; }
.rnk-2 { background: var(--bg2); color: var(--chalk2); }
.rnk-3 { background: #fde8d8; color: #9a3412; }
.rnk-n { background: var(--bg2); color: var(--chalk4); }
.chip { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; margin-left: 2px; }
.chip-s { background: #dcfce7; color: #16a34a; }
.chip-x { background: #fee2e2; color: #dc2626; }

/* AI Chat */
#awrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; }
#apanel {
  display: none;
  width: 320px;
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  overflow: hidden;
  margin-bottom: 12px;
}
.ahead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--blue);
  color: white;
}
.ahead-l { display: flex; align-items: center; gap: 10px; }
.aavatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.atitle { font-size: 13px; font-weight: 700; color: white; }
.asub { font-size: 10px; color: rgba(255,255,255,0.7); }
#aclose {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
#cmsgs {
  height: 220px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg2);
}
.msg {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  max-width: 85%;
}
.msg.user { background: var(--blue); color: white; margin-left: auto; border-radius: 10px 10px 2px 10px; }
.msg.ai { background: var(--white); border: 1px solid var(--border); color: var(--chalk2); border-radius: 2px 10px 10px 10px; }
.thinking { display: flex; gap: 4px; padding: 10px 12px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: bounce 1.2s infinite; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }
.ainput-row { display: flex; gap: 0; border-top: 1px solid var(--border); }
#ainp { flex: 1; padding: 10px 14px; border: none; font-size: 13px; outline: none; background: var(--white); }
#asend {
  padding: 10px 14px;
  background: var(--blue);
  border: none;
  cursor: pointer;
}
#asend svg { display: block; }
#asend:hover { background: var(--blue2); }
#abtn {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
  transition: background 0.15s, transform 0.1s;
}
#abtn:hover { background: var(--blue2); transform: scale(1.05); }
#abtn svg stroke { stroke: white; }

/* COMMITMENT TRACKING */
.ct-sub-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.ct-sub-tab {
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--chalk3);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
  white-space: nowrap;
}
.ct-sub-tab:hover { color: var(--blue); }
.ct-sub-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.ct-panel { display: none; }
.ct-panel.active { display: block; }

.commit-class-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.commit-class-btn {
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--chalk3);
  cursor: pointer;
  transition: all 0.15s;
}
.commit-class-btn.active { background: var(--blue); color: white; border-color: var(--blue); }
.new-commit-badge {
  display: inline-block;
  background: #dcfce7;
  color: #16a34a;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.upload-selector { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.upload-selector label { font-size: 10px; font-weight: 600; color: var(--chalk3); letter-spacing: 0.08em; text-transform: uppercase; }
.upload-selector select { width: auto; font-size: 12px; padding: 7px 10px; }

/* State breakdown */
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.state-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.state-card-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.state-card-head:hover { background: var(--blue-lt); }
.state-name { font-size: 14px; font-weight: 700; color: var(--navy); letter-spacing: 0.04em; }
.state-count { font-size: 24px; font-weight: 800; color: var(--blue); }
.state-expand-icon { font-size: 11px; color: var(--chalk3); margin-left: 6px; }
.state-card-body { display: none; padding: 12px 14px 14px; border-top: 1px solid var(--border); }
.pos-breakdown { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.pos-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--chalk3);
  cursor: pointer;
  transition: all 0.15s;
}
.pos-pill.active { background: var(--blue); color: white; border-color: var(--blue); }
.state-player-list { max-height: 220px; overflow-y: auto; }
.state-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.state-player-row:last-child { border-bottom: none; }
.state-player-name { color: var(--chalk); flex: 1; }
.state-player-pos { color: var(--purple); font-size: 10px; font-weight: 700; min-width: 30px; }
.state-player-school { color: var(--chalk3); font-size: 10px; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state-player-yr { color: var(--chalk4); font-size: 9px; min-width: 32px; text-align: right; }

/* YoY */
.yoy-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.yoy-card { background: var(--white); border: 1px solid var(--border); border-top: 4px solid var(--blue); border-radius: 0 0 8px 8px; margin-bottom: 14px; box-shadow: var(--shadow); }
.yoy-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.yoy-yr-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; background: var(--blue-lt); color: var(--blue2); border: 1px solid var(--blue-md); border-radius: 6px; }
.yoy-body { padding: 16px; }
.yoy-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-bottom: 14px; }
.yoy-stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; }
.yoy-stat-num { font-size: 20px; font-weight: 700; color: var(--navy); }
.yoy-stat-lbl { font-size: 9px; font-weight: 600; color: var(--chalk3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }
.yoy-pos-row { display: flex; gap: 6px; flex-wrap: wrap; }
.yoy-pos-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; text-align: center; flex: 1; min-width: 60px; }
.yoy-pos-n { font-size: 14px; font-weight: 700; color: var(--navy); }
.yoy-pos-lbl { font-size: 9px; font-weight: 600; color: var(--chalk3); text-transform: uppercase; margin-top: 2px; }
.yoy-delta { font-size: 11px; font-weight: 700; margin-left: 4px; }
.yoy-delta.up { color: var(--green); }
.yoy-delta.dn { color: var(--red); }
.yoy-delta.eq { color: var(--chalk4); }
.ct-spinner { text-align: center; padding: 40px 0; }

/* Fit sub-tabs */
.fit-panel { display: none; }
.fit-panel.active { display: block; }

/* State selector pills for school finder */
.sf-state-pill {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--chalk3);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.sf-state-pill.active { background: var(--blue); color: white; border-color: var(--blue); }

/* Ranking cards */
.rank-section { margin-bottom: 20px; }
.rank-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--blue-md);
}
.rank-metric-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.rank-metric-row:last-child { border-bottom: none; }
.rank-metric-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--chalk3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 70px;
}
.rank-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  min-width: 60px;
}
.rank-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--bg2);
  border-radius: 4px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.rank-badge {
  min-width: 90px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}
.rank-pct-label {
  min-width: 80px;
  text-align: right;
  font-size: 11px;
  color: var(--chalk3);
}

/* School finder results */
.sf-school-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.sf-school-card:hover { background: var(--blue-lt); }
.sf-school-card.tier-elite { border-left-color: #16a34a; }
.sf-school-card.tier-strong { border-left-color: #2563eb; }
.sf-school-card.tier-good { border-left-color: #7c3aed; }
.sf-school-card.tier-stretch { border-left-color: #d97706; }
.sf-rank-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--chalk4);
  min-width: 36px;
  text-align: center;
}
.sf-rank-num.top3 { color: var(--gold); }
.sf-school-info { flex: 1; }
.sf-school-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}
.sf-school-meta {
  font-size: 11px;
  color: var(--chalk3);
  margin-top: 2px;
}
.sf-score-wrap { text-align: right; }
.sf-score-num {
  font-size: 24px;
  font-weight: 800;
}
.sf-score-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--chalk3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sf-tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Tracker field labels */
.field-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--chalk3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

/* Camp/Watch tooltip */
[title] { position: relative; }

/* ============================================================
   MOBILE / IPHONE  —  max-width: 640px
   ============================================================ */
@media (max-width: 640px) {

  /* Safe area insets for notch / home bar */
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Tighten outer wrapper */
  #app {
    padding: 0 12px env(safe-area-inset-bottom, 80px);
  }

  /* ── FIX 1: Banner buttons ──────────────────────────────────
     Both #user-menu-wrap and #admin-btn-wrap use position:absolute
     with inline styles — we need !important to override them.
     Goal: keep buttons small so banner text stays visible.       */

  .btt-banner-img {
    height: 140px !important;
  }

  /* Admin button — shrink font + padding */
  #admin-btn-wrap button {
    font-size: 10px !important;
    padding: 4px 10px !important;
    letter-spacing: 0 !important;
  }

  /* Sign-in button (not logged in) */
  #user-menu-wrap button {
    font-size: 10px !important;
    padding: 4px 10px !important;
  }

  /* Logged-in pill: avatar + name + sign out */
  #user-menu-wrap > div {
    padding: 3px 8px 3px 4px !important;
    gap: 5px !important;
    border-radius: 14px !important;
  }
  /* Avatar circle inside pill */
  #user-menu-wrap > div > div:first-child {
    width: 22px !important;
    height: 22px !important;
    font-size: 10px !important;
  }
  /* Name text inside pill */
  #user-menu-wrap > div > div:nth-child(2) > div:first-child {
    font-size: 10px !important;
  }
  /* Admin badge inside pill */
  #user-menu-wrap > div > div:nth-child(2) > div:last-child {
    font-size: 9px !important;
  }
  /* Sign out button inside pill */
  #user-menu-wrap #signout-btn {
    font-size: 9px !important;
    padding: 2px 6px !important;
  }

  /* ── FIX 2: Donut dashboard grid ───────────────────────────
     The grid is rendered as an inline style on a plain <div>
     inside #tracker-dashboard. CSS can override inline styles
     only with !important + correct parent selector.            */

  #tracker-dashboard > div {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* ── FIX 3: School detail sub-tabs (Recruits/Transfers) ────
     The per-school sub-tab row in tracker.js is a plain
     <div style="display:flex;..."> with no class — it is NOT
     .ct-sub-tabs. We target it via its parent #tdetail-* using
     a descendant selector on the flex row that holds the tab
     buttons. The buttons have white-space:nowrap inline already,
     so we just need overflow+scroll on the container.           */

  /* Any flex tab-bar inside a school detail panel */
  [id^="tdetail-"] > div > div[style*="display:flex"][style*="border-bottom"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
  }
  [id^="tdetail-"] > div > div[style*="display:flex"][style*="border-bottom"]::-webkit-scrollbar {
    display: none;
  }
  /* Shrink individual tab buttons so more fit in view */
  [id^="tdetail-"] > div > div[style*="display:flex"][style*="border-bottom"] > button {
    font-size: 10px !important;
    padding: 6px 8px !important;
    flex-shrink: 0 !important;
  }

  /* ── .ct-sub-tabs (Player Commitment / Player Fit tabs) ─── */
  .ct-sub-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px;
  }
  .ct-sub-tabs::-webkit-scrollbar { display: none; }
  .ct-sub-tab {
    flex-shrink: 0;
    padding: 8px 11px;
    font-size: 10px;
  }

  /* ── Status bar ─────────────────────────────────────────── */
  .scoreboard { padding: 5px 10px; }
  .score-text { font-size: 10px; letter-spacing: 0.04em; }

  /* ── Nav tabs ───────────────────────────────────────────── */
  .nav-tabs {
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px;
    gap: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab {
    padding: 9px 9px;
    font-size: 10px;
    letter-spacing: 0.02em;
    gap: 4px;
    flex-shrink: 0;
  }
  .tab-num { width: 17px; height: 17px; font-size: 9px; }

  /* ── General layout ─────────────────────────────────────── */
  .panel-header { margin-bottom: 14px; }
  .panel-title  { font-size: 19px; }
  .field-card   { padding: 14px 12px; }
  .school-name  { font-size: 17px; }

  /* Inputs — 16px prevents iOS auto-zoom on focus */
  input[type=text],
  input[type=number],
  input[type=date],
  select,
  textarea {
    font-size: 16px;
    padding: 10px 12px;
  }

  .metrics-grid,
  .input-row { grid-template-columns: 1fr; }

  .tbl-wrap { margin: 0 -12px; padding: 0 12px; }
  table { font-size: 11px; }
  th, td { padding: 7px 6px; }

  .stat-num { font-size: 18px; }
  .stat-box { padding: 8px 6px; }

  .fit-metrics { grid-template-columns: repeat(2, 1fr); }

  .tracker-card-header { padding: 12px 10px; }

  #tracker-add-suggest { min-width: 0; left: 0; right: 0; }

  .btn, button.btn { padding: 10px 16px; font-size: 13px; }

  #scout-input-wrap {
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }
}
