:root {
  --bg:         #0d0f14;
  --surface:    #161921;
  --card:       #1e2130;
  --border:     #282c3e;
  --accent:     #f59e0b;
  --accent-dim: rgba(245,158,11,0.12);
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,0.12);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,0.12);
  --orange:     #f97316;
  --orange-dim: rgba(249,115,22,0.12);
  --yellow:     #eab308;
  --yellow-dim: rgba(234,179,8,0.12);
  --blue:       #60a5fa;
  --blue-dim:   rgba(96,165,250,0.12);
  --text:       #e2e8f0;
  --text-muted: #8892a4;
  --text-dim:   #4b5563;
  --nav-w:      210px;
  --r:          8px;
}

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

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

/* ── NAV ───────────────────────────────────────────────────────── */
.nav {
  width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.nav-brand {
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.nav-brand .logo {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nav-brand .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-links {
  flex: 1;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: color .12s;
}

.nav-links a:hover { color: var(--text); }

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-links a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ── MAIN ──────────────────────────────────────────────────────── */
.main {
  margin-left: var(--nav-w);
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
  max-width: calc(100vw - var(--nav-w));
}

/* ── PAGE HEADER ───────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header-left { min-width: 0; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .12s, background .12s;
  white-space: nowrap;
}

.btn:hover { opacity: .88; }

.btn-primary { background: var(--accent); color: #000; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-sm      { padding: 5px 11px; font-size: 12px; }
.btn-icon    { padding: 7px 10px; }
.btn-group   { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── CARDS ─────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}

.card + .card { margin-top: 16px; }
.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── STAT CARDS ────────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
}

.stat-box .label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-box .val {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.stat-box .hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── TABLES ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 9px 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
.clickable { cursor: pointer; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* ── BADGES ────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.badge-win          { background: var(--green-dim);  color: var(--green);  }
.badge-loss         { background: var(--red-dim);    color: var(--red);    }
.badge-home         { background: var(--blue-dim);   color: var(--blue);   }
.badge-away         { background: rgba(130,130,160,.1); color: var(--text-muted); }
.badge-neutral      { background: var(--accent-dim); color: var(--accent); }
.badge-bowl         { background: var(--red-dim);    color: var(--red);    }
.badge-cfp-quarter  { background: var(--orange-dim); color: var(--orange); }
.badge-cfp-semi     { background: var(--yellow-dim); color: var(--yellow); }
.badge-cfp-final    { background: var(--green-dim);  color: var(--green);  }
.badge-ranked       { background: var(--blue-dim);   color: var(--blue);   }

/* ── FORMS ─────────────────────────────────────────────────────── */
.form-section {
  margin-bottom: 28px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full  { grid-column: 1 / -1; }
.form-group.span2 { grid-column: span 2; }

label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 72px; }
select option { background: var(--card); }

/* ── SECTION HEADERS ───────────────────────────────────────────── */
.section { margin-bottom: 28px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
}

/* ── TABS ──────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab-btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── STAT TABLE EDITOR ─────────────────────────────────────────── */
.stat-editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 8px;
}

.stat-editor-table th {
  background: var(--surface);
  font-size: 10px;
  padding: 7px 6px;
}

.stat-editor-table td {
  padding: 3px 3px;
  border-bottom: 1px solid var(--border);
}

.stat-editor-table tr:last-child td { border-bottom: none; }

.stat-editor-table input {
  padding: 5px 7px;
  font-size: 12.5px;
  border-radius: 4px;
}

.player-cell { min-width: 150px; }
.num-cell input { width: 58px; text-align: center; }

.remove-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 15px;
  line-height: 1;
  transition: color .12s;
}
.remove-btn:hover { color: var(--red); }

/* ── AUTOCOMPLETE ──────────────────────────────────────────────── */
.ac-wrap { position: relative; }

.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  z-index: 200;
  max-height: 160px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background .1s;
}

.ac-item:hover { background: var(--accent-dim); }
.ac-item .pos-badge { font-size: 10px; color: var(--text-muted); font-weight: 600; }

/* ── SCORE ─────────────────────────────────────────────────────── */
.score-block {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.score-us   { font-size: 22px; font-weight: 800; }
.score-them { font-size: 22px; font-weight: 800; color: var(--text-muted); }
.score-sep  { color: var(--text-dim); font-size: 18px; }
.score-win  .score-us { color: var(--green); }
.score-loss .score-us { color: var(--red); }

/* ── GAME RESULT INLINE ─────────────────────────────────────────── */
.result-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ── BACK LINK ─────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 20px;
  transition: color .12s;
}

.back-link:hover { color: var(--text); }

/* ── SEARCH ────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar input { flex: 1; min-width: 200px; }

.global-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  z-index: 300;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background .1s;
}

.search-result-item:hover { background: var(--accent-dim); }
.search-result-item .type-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--accent); width: 42px; }
.search-result-item .title { font-size: 13.5px; font-weight: 600; flex: 1; }
.search-result-item .sub { font-size: 11px; color: var(--text-muted); }

/* ── EMPTY STATE ───────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}

.empty .e-icon { font-size: 44px; margin-bottom: 14px; }
.empty h3 { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p  { font-size: 13px; }

/* ── PLAYER BADGE ──────────────────────────────────────────────── */
.player-linked { color: var(--accent); font-weight: 600; }
.linked-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: middle; }

/* ── MISC ──────────────────────────────────────────────────────── */
.muted { color: var(--text-muted); }
.em    { color: var(--accent); font-weight: 700; }
.danger-zone { border-color: var(--red-dim); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── NAV BRAND AS LINK ─────────────────────────────────────────── */
a.nav-brand {
  text-decoration: none;
  display: block;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
a.nav-brand:hover { background: var(--accent-dim); }

.nav-hub-link {
  display: block;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  border-top: 1px solid var(--border);
  letter-spacing: .04em;
  transition: color .12s;
}
.nav-hub-link:hover { color: var(--text-muted); }

/* ── HUB / LANDING PAGE ────────────────────────────────────────── */
body.hub {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

.hub-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.hub-header {
  text-align: center;
  margin-bottom: 48px;
}

.hub-logo {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 14px;
}

.hub-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
}

.hub-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 360px);
  gap: 20px;
  width: 100%;
  max-width: 760px;
}

.hub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}

.hub-card.inactive {
  opacity: .45;
  pointer-events: none;
}

.hub-card.active {
  border-color: var(--accent);
  cursor: pointer;
}

.hub-card.active:hover {
  background: #222638;
  border-color: #f6b43a;
}

.hub-card-game {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
}

.hub-card.active .hub-card-game { color: var(--accent); }

.hub-card-school {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.hub-arrow {
  font-size: 18px;
  opacity: .5;
  margin: 0 2px;
}

.hub-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.hub-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.hub-badge-active  { background: var(--green-dim);   color: var(--green); }
.hub-badge-soon    { background: rgba(100,100,120,.15); color: var(--text-muted); }
.hub-badge-planned { background: rgba(100,100,120,.1);  color: var(--text-dim); }

.hub-stat {
  font-size: 11px;
  color: var(--text-muted);
}
.hub-stat:empty { display: none; }

.hub-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.hub-enter {
  margin-top: auto;
  padding-top: 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .04em;
}

@media (max-width: 780px) {
  .hub-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }
  .hub-card.inactive { opacity: .35; }
}

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .nav {
    width: 100%;
    height: auto;
    top: auto;
    bottom: 0;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .nav-brand { display: none; }

  .nav-links {
    flex-direction: row;
    padding: 0;
    width: 100%;
  }

  .nav-links a {
    flex: 1;
    flex-direction: column;
    padding: 8px 4px;
    font-size: 10px;
    gap: 3px;
    text-align: center;
    justify-content: center;
  }

  .nav-links a.active::before {
    left: 0; right: 0; bottom: auto; top: 0;
    width: auto; height: 2px;
  }

  .nav-icon { font-size: 18px; width: auto; }

  .main {
    margin-left: 0;
    margin-bottom: 56px;
    padding: 16px;
    max-width: 100vw;
  }

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