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

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c26;
  --surface3: #22222e;
  --border: #2a2a3a;
  --border2: #353548;
  --red: #e8193c;
  --red-dim: #3a0710;
  --gold: #c9a84c;
  --gold-dim: #2a1f08;
  --text: #f0f0f5;
  --text2: #9090a8;
  --text3: #55556a;
  --green: #1db874;
  --green-dim: #071a10;
  --blue: #378ADD;
  --blue-dim: #0a1e35;
  --purple: #7F77DD;
  --purple-dim: #1a1835;
  --orange: #D85A30;
  --orange-dim: #2e1008;
  --yt: #FF0000;
  --yt-dim: #2a0000;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

/* ── LOADING OVERLAY ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#loading-overlay.hidden { display: none; }
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.loading-logo {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: var(--red);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar > :last-child {
  display: flex;
  justify-content: flex-end;
}
.logo-group { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: .08em;
}
.logo-name { font-size: 13px; font-weight: 500; color: var(--text); }
.logo-season {
  font-size: 10px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: .08em;
}

/* ── NAV ── */
.nav, #desktop-nav { display: flex; gap: 2px; }
.nav-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.nav-btn:hover { color: var(--text); background: var(--surface2); }
.nav-btn.active { color: var(--text); background: var(--surface2); }

/* ── USER PILL ── */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .12s;
}
.user-pill:hover { border-color: var(--border2); }
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--red-dim);
  border: 1px solid var(--red-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--red);
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-name { font-size: 12px; color: var(--text); }
.login-btn {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, color .12s;
}
.login-btn:hover { color: var(--text); border-color: var(--border); }

/* ── PAGE WRAPPER ── */
.page { max-width: 1100px; margin: 0 auto; padding: 20px 24px; }
.page-wide { max-width: 1300px; margin: 0 auto; padding: 20px 24px; }

/* ── CARDS & SURFACES ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 500; color: var(--text); }
.card-link { font-size: 11px; color: var(--text3); cursor: pointer; text-decoration: none; }
.card-link:hover { color: var(--text2); }

/* ── SECTION LABELS ── */
.section-eye {
  font-size: 10px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.section-title {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: .09em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── TAGS & PILLS ── */
.tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: .04em;
}
.tag-red { background: var(--red-dim); color: var(--red); }
.tag-gold { background: var(--gold-dim); color: var(--gold); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-blue { background: var(--blue-dim); color: var(--blue); }
.tag-purple { background: var(--purple-dim); color: var(--purple); }
.tag-neutral { background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }

/* ── FIGHT TERM PILLS ── */
.term {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  color: var(--text3);
  letter-spacing: .03em;
}
.term-title { background: var(--gold-dim); border-color: var(--gold-dim); color: var(--gold); }
.term-contract { background: var(--purple-dim); border-color: var(--purple-dim); color: var(--purple); }
.term-ic { background: var(--blue-dim); border-color: var(--blue-dim); color: var(--blue); }

/* ── RESULT BADGES ── */
.result-w { background: var(--green-dim); color: var(--green); }
.result-l { background: var(--red-dim); color: var(--red); }
.result-d { background: var(--surface2); color: var(--text3); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface2); border-color: var(--border); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.btn-primary:hover { background: #4a0d18; }
.btn-gold { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }
.btn-gold:hover { background: #3d2e08; }
.btn-green { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.btn-green:hover { background: #0d2e1a; }
.btn-danger { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.btn-full { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── INPUTS ── */
input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color .12s;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--border2); }
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--surface2); color: var(--text); }
label { font-size: 11px; color: var(--text2); display: block; margin-bottom: 5px; }

/* ── LIVE DOT ── */
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }

/* ── CASH STRIP ── */
.cash-strip {
  background: var(--gold-dim);
  border: 1px solid #3d2e0a;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cash-strip-left { display: flex; align-items: center; gap: 12px; }
.cash-icon {
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .08em;
  background: #3d2e0a;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.cash-amount { font-size: 22px; font-weight: 600; color: var(--gold); }
.cash-label { font-size: 11px; color: #8a6e30; margin-top: 2px; }
.cash-strip-right { display: flex; gap: 8px; flex-wrap: wrap; }
.cash-btn {
  background: #3d2e0a;
  border: 1px solid #5a4415;
  color: var(--gold);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.cash-btn:hover { background: #4d3a0f; }

/* ── COUNTDOWN ── */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cd-unit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
}
.cd-num { font-size: 18px; font-weight: 600; color: var(--gold); }
.cd-lbl {
  font-size: 8px;
  color: var(--text3);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── POOL BAR ── */
.pool-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  display: flex;
}
.pool-seg1 { height: 100%; background: var(--blue); }
.pool-seg2 { height: 100%; background: var(--red); flex: 1; }

/* ── JUDGE BARS ── */
.judge-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.judge-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.judge-label { font-size: 11px; color: var(--text2); width: 72px; flex-shrink: 0; }
.judge-track { flex: 1; height: 3px; background: var(--border2); border-radius: 99px; overflow: hidden; }
.judge-fill { height: 100%; border-radius: 99px; }
.judge-score { font-size: 11px; font-weight: 500; color: var(--text); width: 28px; text-align: right; }

/* ── SCORE COLOR CODING ── */
.score-hi { background: #0a2e1a; color: var(--green); }
.score-md { background: #1e1a0a; color: var(--gold); }
.score-lo { background: #200812; color: var(--red); }

/* ── TOAST ── */
.ufl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text);
  z-index: 99998;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.ufl-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.ufl-toast-success { border-color: var(--green); color: var(--green); }
.ufl-toast-error { border-color: var(--red); color: var(--red); }
.ufl-toast-info { border-color: var(--border2); color: var(--text); }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-family: inherit;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close:hover { color: var(--text); }
.modal-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  padding-right: 30px;
}

/* ── BOTTOM SHEET (mobile) ── */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--border2);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  z-index: 500;
  max-height: 85vh;
  overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
  width: 36px;
  height: 3px;
  background: var(--border2);
  border-radius: 99px;
  margin: 10px auto 0;
}
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 499;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.bottom-sheet-overlay.open { opacity: 1; pointer-events: all; }

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── FEATURED EVENT GRID ── */
.featured-event-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; }
  .logo-name { display: none; }
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .page, .page-wide { padding: 12px; }

  .rankings-desktop-header { display: none !important; }

  .featured-event-grid {
    display: flex;
    flex-direction: column; 
  } 
  .featured-event-grid > div:last-child {
    border-left: none !important;
    border-top: 1px solid var(--border);
  }
  
  .topbar {
    grid-template-columns: 1fr auto 1fr;
  }
  .hamburger-btn {
    grid-column: 2;
    justify-self: center;
  }

  /* Featured event — stack vertically */
  #tab-home .page > div > .card > div[style*="grid-template-columns:1fr 340px"],
  #tab-home .page > div > .card > div[style*="grid-template-columns: 1fr 340px"] {
    display: flex !important;
    flex-direction: column !important;
  }
  #tab-home .page > div > .card > div > div:last-child {
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
  }

  /* Three panels — stack vertically */
  #home-panels {
    grid-template-columns: 1fr !important;
  }

  /* Cash strip */
  .cash-strip { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cash-strip-right { width: 100%; }
  .cash-btn { flex: 1; text-align: center; }

  /* Countdown grid */
  .countdown-grid { gap: 4px; }
  .cd-num { font-size: 16px; }
}

@media (max-width: 480px) {
  .nav { overflow-x: auto; }
  .nav::-webkit-scrollbar { display: none; }
}

/* ── PROFILE TABS ── */
.ptab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  font-size: 12px;
  padding: 12px 18px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.ptab:hover { color: var(--text); }
.ptab.active {
  color: var(--text);
  border-bottom-color: var(--red);
}

/* ── HAMBURGER ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text2);
  border-radius: 99px;
}
.mobile-menu {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  padding: 8px;
  z-index: 99;
  gap: 2px;
}
.mobile-menu .nav-btn {
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  #desktop-nav { display: none; }
}

/* ── RANKINGS TABLE — MOBILE ── */
@media (max-width: 768px) {
  /* Hide the wide table header and rows */
  .rankings-table-header { display: none !important; }

  /* Each fighter row becomes a card */
  .rankings-table-row {
    display: flex !important;
    flex-direction: column !important;
    padding: 12px 14px !important;
    gap: 8px;
  }

  .rankings-row-scores {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4px;
  }

  .rankings-score-cell {
    text-align: center;
    font-size: 10px !important;
  }
}

/* Score badges consistent width */
.tag.score-hi, .tag.score-md, .tag.score-lo {
  min-width: 36px;
  text-align: center;
  display: inline-block;
}

@media (max-width: 768px) {
  .modal-close {
    position: sticky;
    top: 0;
    float: right;
    z-index: 10;
    background: var(--surface);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 20px;
  }
  .modal {
    max-height: none;
    margin: auto;
  }
}