/* ═══ RESET & BASE ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #1B3054;
  --navy-d: #0F1E35;
  --red:    #DC2626;
  --red-d:  #B91C1C;
  --blue:   #2563EB;
  --blue-l: #3B82F6;
  --green:  #16A34A;
  --bg:     #F1F5F9;
  --bg2:    #E2E8F0;
  --white:  #FFFFFF;
  --text:   #1E293B;
  --muted:  #64748B;
  --border: #CBD5E1;
  --hi:     #EFF6FF;
  --err-bg: #FEF2F2;
  --err-bdr:#FECACA;
  --ok-bg:  #F0FDF4;
  --ok-bdr: #BBF7D0;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius: .5rem;
}

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

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-l); text-decoration: underline; }
img { max-width: 100%; }

/* ═══ BUTTONS ════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-red    { background: var(--red);   color: #fff; }
.btn-red:hover { background: var(--red-d); color: #fff; text-decoration: none; }
.btn-blue   { background: var(--blue);  color: #fff; }
.btn-blue:hover { background: var(--blue-l); color: #fff; text-decoration: none; }
.btn-ghost  { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg2); text-decoration: none; }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; text-decoration: none; }
.btn-full   { width: 100%; justify-content: center; padding: .65rem 1rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-sm {
  padding: .2rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  border-radius: .3rem;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text);
  transition: all .15s;
}
.btn-sm:hover { background: var(--bg2); }
.btn-sm-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-sm-active:hover { background: var(--navy-d); }

/* ─── Team filter bar ─────────────────────────────────────────────────────── */
.team-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: 1.25rem;
}
.team-filter-label {
  font-size: .75rem; font-weight: 700; letter-spacing: .05em;
  color: var(--muted); text-transform: uppercase; margin-right: .25rem;
}

/* ─── Sortable table headers ─────────────────────────────────────────────── */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: var(--bg2); }
th.sort-asc  > .sort-arrow::after { content: ' ▲'; }
th.sort-desc > .sort-arrow::after { content: ' ▼'; }
th.sort-asc  > .sort-arrow,
th.sort-desc > .sort-arrow { color: var(--blue); font-size: .65em; vertical-align: middle; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: .3rem;
  border: none;
  cursor: pointer;
  font-size: .8rem;
  background: transparent;
  color: var(--muted);
  transition: all .15s;
}
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--err-bg); }

/* ═══ ALERTS ═════════════════════════════════════════════════════════════════ */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
}
.alert-err { background: var(--err-bg); border: 1px solid var(--err-bdr); color: #991B1B; }
.alert-ok  { background: var(--ok-bg);  border: 1px solid var(--ok-bdr);  color: #15803D; }
.hidden { display: none !important; }

/* ═══ FORMS ══════════════════════════════════════════════════════════════════ */
label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .35rem;
}
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  background: var(--white);
  color: var(--text);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea {
  min-height: 280px;
  font-family: 'Courier New', monospace;
  font-size: .8rem;
  resize: vertical;
  line-height: 1.4;
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-col { flex: 1; min-width: 180px; }

/* ═══ APP HEADER ═════════════════════════════════════════════════════════════ */
.app-header {
  background: var(--navy);
  padding: .5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.app-logo  { height: 40px; width: auto; }
.app-nav   { display: flex; gap: .25rem; flex: 1; }
.nav-link  {
  color: rgba(255,255,255,.75);
  font-size: .875rem;
  font-weight: 500;
  padding: .4rem .75rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all .15s;
}
.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  text-decoration: none;
}
.header-right { display: flex; align-items: center; gap: .75rem; }
.credit-badge {
  display: flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.9);
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}
.app-main   { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.app-footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: .8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ═══ PAGE LAYOUT ════════════════════════════════════════════════════════════ */
.page-hd {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-hd h1 { font-size: 1.5rem; font-weight: 700; color: var(--navy); flex: 1; }
.back-link  { color: var(--muted); font-size: .875rem; text-decoration: none; }
.back-link:hover { color: var(--text); }

/* ═══ PANEL ══════════════════════════════════════════════════════════════════ */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.panel-hd h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.credit-note { font-size: .8rem; color: var(--muted); }

/* ═══ GAME LIST ══════════════════════════════════════════════════════════════ */
.game-list  { display: flex; flex-direction: column; gap: .5rem; }
.game-card  {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.game-card:hover { box-shadow: var(--shadow-md); }
.game-card-main {
  flex: 1;
  padding: .85rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}
.game-card-main:hover { text-decoration: none; }
.game-label { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-meta  { font-size: .775rem; color: var(--muted); white-space: nowrap; }
.game-score {
  display: flex; align-items: center; gap: .5rem;
  margin-left: auto;
  font-size: .875rem;
  white-space: nowrap;
}
.tm { font-weight: 500; color: var(--muted); }
.tm.win { font-weight: 700; color: var(--navy); }
.vs { color: var(--muted); }
.game-actions { padding: .5rem .75rem; display: flex; align-items: center; gap: .5rem; border-left: 1px solid var(--border); }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.25rem; color: var(--text); margin-bottom: .5rem; }

/* ═══ SCORE BANNER ═══════════════════════════════════════════════════════════ */
.score-banner {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.score-box  { text-align: center; }
.score-team { font-size: .85rem; color: rgba(255,255,255,.7); margin-bottom: .25rem; }
.score-num  { font-size: 3rem; font-weight: 800; line-height: 1; }
.score-box.win .score-num { color: #FCD34D; }
.score-sep  { font-size: 2rem; color: rgba(255,255,255,.4); }
.score-meta { font-size: .8rem; color: rgba(255,255,255,.5); width: 100%; text-align: center; margin-top: .5rem; }

/* ═══ STATS TABLES ═══════════════════════════════════════════════════════════ */
.stats-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--navy);
}
.section-hd h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.stat-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .5rem;
}
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; white-space: nowrap; }
thead tr { background: var(--navy); color: #fff; }
th {
  padding: .5rem .55rem;
  text-align: right;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .04em;
}
th.l { text-align: left; }
td {
  padding: .4rem .55rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
td.l { text-align: left; }
td.hi { color: var(--blue); font-weight: 600; }
td.err { color: var(--red); font-weight: 600; }
td.pos { font-family: 'Courier New', monospace; font-size: .75rem; color: var(--muted); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--hi); }

/* ═══ PLAYER CARDS ═══════════════════════════════════════════════════════════ */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.player-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .1s;
}
.player-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.player-name { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; }
.player-team { font-size: .75rem; color: var(--muted); margin-bottom: .75rem; }
.player-stats { display: flex; gap: .5rem; flex-wrap: wrap; }
.ps { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.ps-val { font-size: 1rem; font-weight: 700; color: var(--navy); }
.ps-lbl { font-size: .65rem; color: var(--muted); text-transform: uppercase; }
.ps.ml { margin-left: auto; }

/* ═══ ADMIN ══════════════════════════════════════════════════════════════════ */
.admin-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.summary-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 140px;
  text-align: center;
}
.sum-val { font-size: 2rem; font-weight: 800; color: var(--navy); }
.sum-lbl { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

/* ═══ LANDING PAGE ═══════════════════════════════════════════════════════════ */
.landing-page { background: var(--navy-d); color: #fff; }
.landing-page footer { border-top: 1px solid rgba(255,255,255,.1); }
.landing-page footer p { color: rgba(255,255,255,.5); }
.landing-page footer a { color: rgba(255,255,255,.7); }

.hero {
  background: linear-gradient(135deg, #0a1628 0%, #1B3054 60%, #0d2040 100%);
  padding: 5rem 1.5rem;
  text-align: center;
}
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero-logo  { max-width: 420px; height: auto; margin-bottom: 1.5rem; }
.hero-sub   {
  font-size: 1.15rem;
  color: rgba(255,255,255,.8);
  line-height: 1.7;
  margin-bottom: 2rem;
}
.hero-sub strong { color: #fff; }
.hero-cta   { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }

.how {
  background: var(--bg);
  padding: 4rem 1.5rem;
}
.how h2 {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 2.5rem;
}
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}
.step {
  text-align: center;
  padding: 1.5rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.step-num {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.step h3 { font-size: 1.05rem; font-weight: 700; color: var(--navy); margin-bottom: .5rem; }
.step p  { font-size: .875rem; color: var(--muted); line-height: 1.6; }

.stats-show {
  background: var(--navy);
  padding: 4rem 1.5rem;
  text-align: center;
}
.stats-show h2 { font-size: 1.75rem; font-weight: 800; color: #fff; margin-bottom: 1.5rem; }
.stat-pills { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.pill {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.9);
  padding: .35rem .85rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .05em;
}

.pricing {
  background: var(--bg);
  padding: 4rem 1.5rem;
}
.pricing h2 { text-align: center; font-size: 1.75rem; font-weight: 800; color: var(--navy); margin-bottom: 2rem; }
.price-cards {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.price-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 260px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
}
.price-card.featured {
  border-color: var(--red);
  box-shadow: 0 4px 20px rgba(220,38,38,.2);
}
.price-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .75rem;
  border-radius: 999px;
  letter-spacing: .05em;
}
.price-top { font-size: .9rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .5rem; }
.price-amt { font-size: 3rem; font-weight: 900; color: var(--navy); line-height: 1; margin-bottom: .25rem; }
.price-sub { font-size: .85rem; color: var(--muted); margin-bottom: 1.25rem; }
.price-card ul { list-style: none; text-align: left; margin-bottom: 1.5rem; }
.price-card li { padding: .3rem 0; font-size: .875rem; color: var(--text); }

.auth-section {
  background: var(--navy-d);
  padding: 4rem 1.5rem;
  display: flex;
  justify-content: center;
}
.auth-box {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 1rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--bg);
  color: var(--muted);
  transition: all .15s;
}
.auth-tab.active {
  background: var(--white);
  color: var(--navy);
  border-bottom: 2px solid var(--red);
}
.auth-form { padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }

footer {
  padding: 2.5rem 1.5rem;
  text-align: center;
}
footer p { color: var(--muted); font-size: .875rem; }
footer a { color: var(--blue-l); }

/* ─── Page header action row ─────────────────────────────────────────────── */
.page-hd-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.page-hd-actions input[type=text] {
  width: 200px;
}

/* ═══ TEST ENVIRONMENT BANNER ════════════════════════════════════════════════ */
.test-banner {
  background: #FEF3C7;
  border-bottom: 2px solid #F59E0B;
  color: #92400E;
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
  padding: .5rem 1rem;
  margin: -1.5rem -1.5rem 1.5rem;   /* bleed to edges of app-main */
}
.test-banner a { color: #92400E; text-decoration: underline; }
@media (max-width: 640px) {
  .test-banner { margin: -1rem -.85rem 1rem; font-size: .75rem; }
}

/* ═══ RESPONSIVE ═════════════════════════════════════════════════════════════ */

/* ── Bottom tab bar (mobile nav) ──────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy);
  z-index: 200;
  border-top: 1px solid rgba(255,255,255,.12);
  padding-bottom: env(safe-area-inset-bottom); /* iPhone notch/home-bar */
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .55rem .25rem .4rem;
  color: rgba(255,255,255,.55);
  font-size: .6rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .04em;
  gap: .2rem;
  transition: color .15s;
}
.bottom-nav a .tab-icon { font-size: 1.2rem; line-height: 1; }
.bottom-nav a.active, .bottom-nav a:hover { color: #fff; text-decoration: none; }

@media (max-width: 640px) {
  /* ── Navigation ── */
  .app-nav { display: none; }           /* hide header nav; bottom bar takes over */
  .bottom-nav { display: flex; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

  /* ── Header ── */
  .app-header { padding: .4rem .85rem; gap: .75rem; }
  .app-logo   { height: 32px; }
  .header-right { gap: .4rem; }
  .credit-badge { padding: .2rem .5rem; font-size: .75rem; }
  .credit-badge .credit-icon { display: none; } /* hide icon, keep number */

  /* ── Main content area ── */
  .app-main { padding: 1rem .85rem; }

  /* ── Page headers ── */
  .page-hd { flex-direction: column; align-items: flex-start; gap: .6rem; margin-bottom: 1rem; }
  .page-hd h1 { font-size: 1.25rem; }
  .page-hd > div,
  .page-hd > a.btn { width: 100%; }
  /* Action row stretches full width, input grows to fill */
  .page-hd-actions { width: 100%; }
  .page-hd-actions input[type=text] { flex: 1; width: auto; min-width: 0; }
  .page-hd-actions .btn { white-space: nowrap; }

  /* ── Panels ── */
  .panel { padding: 1rem; }

  /* ── Game cards ── */
  .game-card-main {
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    padding: .7rem .85rem;
  }
  .game-label {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: .875rem;
  }
  .game-meta  { white-space: normal; font-size: .7rem; }
  .game-score { margin-left: 0; font-size: .8rem; gap: .3rem; flex-wrap: wrap; }
  .tm         { font-size: .75rem; }

  /* ── Score banner ── */
  .score-banner { padding: 1rem; gap: .75rem; }
  .score-num    { font-size: 2rem; }
  .score-team   { font-size: .75rem; max-width: 110px; white-space: normal; text-align: center; }

  /* ── Stats sections ── */
  .stats-section { padding: .85rem; }
  .section-hd h2 { font-size: .95rem; }

  /* ── Summary cards ── */
  .summary-stats { gap: .5rem; }
  .summary-card  { padding: .85rem 1rem; min-width: 100px; }
  .sum-val { font-size: 1.5rem; }

  /* ── Player grid ── */
  .player-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .player-card { padding: .75rem; }
  .player-name { font-size: .875rem; }

  /* ── Team filter ── */
  .team-filter { gap: .3rem; }

  /* ── Landing page ── */
  .hero-logo  { max-width: 240px; }
  .hero h1    { font-size: 2rem; }
  .hero p     { font-size: 1rem; }
}

/* ═══ STATS KEY ══════════════════════════════════════════════════════════════ */
.stats-key {
  margin: 2rem 0 1rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .7rem;
  color: var(--muted);
  line-height: 1.5;
}
.key-hd {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: .6rem 0 .3rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}
.key-hd:first-child { margin-top: 0; }
.key-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: .25rem;
}
.key-table .ka {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  padding: .1rem .4rem .1rem 0;
  vertical-align: top;
  width: 3.5rem;
}
.key-table .kd {
  color: var(--muted);
  padding: .1rem 1.25rem .1rem 0;
  vertical-align: top;
}

/* ═══ ANALYSIS ID ════════════════════════════════════════════════════════════ */
.analysis-id {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .2rem .55rem;
  cursor: pointer;
  user-select: all;
  transition: background .15s;
}
.analysis-id:hover { background: var(--border); }

/* ═══ BILLING PAGE ══════════════════════════════════════════════════════════ */
.billing-balance-row {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.billing-balance-card {
  background: var(--navy); color: #fff;
  border-radius: var(--radius); padding: 1.5rem 2rem;
  text-align: center; min-width: 160px;
  box-shadow: var(--shadow-md);
}
.bb-val  { font-size: 3rem; font-weight: 900; line-height: 1; color: #FCD34D; }
.bb-lbl  { font-size: .9rem; font-weight: 700; margin-top: .25rem; }
.bb-sub  { font-size: .75rem; color: rgba(255,255,255,.55); margin-top: .2rem; }

.billing-sub-card {
  flex: 1; min-width: 220px;
  background: var(--white); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; box-shadow: var(--shadow-md);
  border: 2px solid var(--border);
}
.billing-sub-card.sub-active   { border-color: var(--green); }
.billing-sub-card.sub-canceling { border-color: #F59E0B; }

.bs-badge  { font-size: .7rem; font-weight: 700; text-transform: uppercase;
             letter-spacing: .06em; color: var(--green); margin-bottom: .25rem; }
.billing-sub-card.sub-canceling .bs-badge { color: #D97706; }
.bs-name   { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.bs-detail { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.bs-renew  { font-size: .8rem; color: var(--muted); margin-top: .5rem; }

.billing-section {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.billing-section h2   { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: .35rem; }
.billing-desc { font-size: .875rem; color: var(--muted); margin-bottom: 1.25rem; }

/* ── Monthly plan card (single featured card) ── */
.plan-card {
  max-width: 360px; border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  position: relative;
}
.featured-plan { border-color: var(--red); }
.plan-badge {
  position: absolute; top: -1px; right: 1rem;
  background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .2rem .6rem;
  border-radius: 0 0 .4rem .4rem;
}
.plan-name  { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: .25rem; }
.plan-price { font-size: 2.25rem; font-weight: 900; color: var(--navy); line-height: 1; margin-bottom: .75rem; }
.plan-per   { font-size: 1rem; font-weight: 500; color: var(--muted); }
.plan-features { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.plan-features li { font-size: .875rem; color: var(--text); padding: .2rem 0; }

/* ── Credit pack grid ── */
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.pack-card {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1rem; text-align: center;
}
.pack-credits { font-size: 2rem; font-weight: 900; color: var(--navy); line-height: 1; }
.pack-lbl     { font-size: .75rem; color: var(--muted); text-transform: uppercase;
                letter-spacing: .05em; margin-bottom: .5rem; }
.pack-price   { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.pack-cpp     { font-size: .72rem; color: var(--muted); margin-top: .1rem; }

/* ── Credit history table tweaks ── */
.credit-pos { color: var(--green); font-weight: 700; }
.credit-neg { color: var(--muted); }

@media (max-width: 640px) {
  .billing-balance-card { padding: 1rem 1.5rem; }
  .bb-val  { font-size: 2.25rem; }
  .billing-sub-card { min-width: 0; }
  .billing-section  { padding: 1rem; }
  .plan-card { max-width: 100%; }
  .pack-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
}

/* ═══ HELP BUTTON ════════════════════════════════════════════════════════════ */
.help-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  font-size: .85rem; font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.help-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.6); color: #fff; }

.footer-help-link {
  background: none; border: none; cursor: pointer;
  color: var(--blue-l); font-size: inherit;
  text-decoration: underline; padding: 0;
}
.footer-help-link:hover { color: var(--blue); }

/* ═══ HELP MODAL ════════════════════════════════════════════════════════════ */
.help-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,30,53,.65);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.help-overlay.open { opacity: 1; pointer-events: all; }

.help-modal {
  background: var(--white);
  border-radius: 1rem;
  width: 100%; max-width: 720px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  transform: translateY(12px);
  transition: transform .2s;
  overflow: hidden;
}
.help-overlay.open .help-modal { transform: translateY(0); }

.help-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1.5rem 1.75rem 0;
  flex-shrink: 0;
}
.help-title    { font-size: 1.35rem; font-weight: 800; color: var(--navy); margin: 0; }
.help-subtitle { font-size: .8rem; color: var(--muted); margin: .15rem 0 0; }
.help-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--bg2);
  color: var(--muted); font-size: .85rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: 1rem;
  transition: background .15s, color .15s;
}
.help-close:hover { background: var(--border); color: var(--text); }

.help-tabs {
  display: flex; gap: .25rem; flex-wrap: wrap;
  padding: 1rem 1.75rem .75rem;
  flex-shrink: 0;
  border-bottom: 2px solid var(--bg2);
}
.help-tab {
  padding: .35rem .85rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent; color: var(--muted);
  font-size: .78rem; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.help-tab:hover  { background: var(--bg2); color: var(--text); }
.help-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.help-body {
  flex: 1; overflow-y: auto;
  padding: 1.5rem 1.75rem 2rem;
}
.help-section { display: none; }
.help-section.active { display: block; }

/* Help typography */
.help-section h3 {
  font-size: 1.05rem; font-weight: 700; color: var(--navy);
  margin: 0 0 1rem;
}
.help-section h4 {
  font-size: .85rem; font-weight: 700; color: var(--text);
  margin: 1.25rem 0 .4rem; text-transform: uppercase;
  letter-spacing: .05em;
}
.help-section p {
  font-size: .875rem; color: var(--text); line-height: 1.6;
  margin: 0 0 .75rem;
}
.help-list {
  font-size: .875rem; line-height: 1.6; color: var(--text);
  padding-left: 1.25rem; margin: .4rem 0 .75rem;
}
.help-list li { margin-bottom: .3rem; }

/* Steps */
.help-steps { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.help-step {
  display: flex; gap: 1rem; align-items: flex-start;
}
.help-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff;
  font-size: .8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: .1rem;
}
.help-step strong { display: block; font-size: .9rem; color: var(--navy); margin-bottom: .2rem; }
.help-step p { font-size: .83rem; color: var(--muted); line-height: 1.55; margin: 0; }

/* Note box */
.help-note {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: .85rem 1rem;
  font-size: .83rem; color: #1E40AF;
  line-height: 1.55; margin-top: 1.25rem;
}

/* Stats table */
.help-stats-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
.help-stats-table td {
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--bg2);
  vertical-align: top;
}
.help-stats-table td:first-child {
  font-weight: 700; color: var(--navy);
  white-space: nowrap; width: 8rem;
}
.help-stats-table tr:last-child td { border-bottom: none; }

/* Code inline */
.help-code {
  font-family: 'Courier New', monospace;
  background: var(--bg2); color: var(--navy);
  padding: .1rem .4rem; border-radius: .25rem;
  font-size: .85em;
}

/* FAQ */
.help-faq { display: flex; flex-direction: column; gap: .5rem; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.faq-q {
  font-size: .875rem; font-weight: 600; color: var(--navy);
  padding: .85rem 1rem; cursor: pointer; background: var(--white);
  user-select: none;
  transition: background .12s;
  position: relative;
}
.faq-q::after {
  content: '+'; position: absolute; right: 1rem; top: 50%;
  transform: translateY(-50%); font-size: 1.1rem; color: var(--muted);
  transition: transform .2s;
}
.faq-item.open .faq-q::after { transform: translateY(-50%) rotate(45deg); }
.faq-q:hover { background: var(--bg); }
.faq-a {
  font-size: .845rem; color: var(--muted); line-height: 1.6;
  padding: 0 1rem;
  max-height: 0; overflow: hidden;
  transition: max-height .25s ease, padding .25s;
}
.faq-item.open .faq-a { max-height: 200px; padding: 0 1rem .85rem; }

/* Mobile help */
@media (max-width: 640px) {
  .help-modal  { max-height: 92vh; border-radius: .75rem; }
  .help-header { padding: 1.1rem 1.1rem 0; }
  .help-tabs   { padding: .75rem 1.1rem .6rem; gap: .2rem; }
  .help-tab    { padding: .28rem .65rem; font-size: .73rem; }
  .help-body   { padding: 1.1rem 1.1rem 1.5rem; }
}

/* ═══ LANDING GUIDE TEASER ══════════════════════════════════════════════════ */
.guide-teaser {
  background: var(--bg);
  padding: 4rem 0;
  border-top: 1px solid var(--bg2);
}
.guide-teaser h2 {
  text-align: center;
  font-size: 1.75rem; font-weight: 800;
  color: var(--navy); margin-bottom: .5rem;
}
.guide-teaser-sub {
  text-align: center;
  color: var(--muted); font-size: .95rem;
  margin-bottom: 2.5rem;
}
.guide-teaser-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.guide-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  box-shadow: var(--shadow);
}
.guide-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.guide-card-icon  { font-size: 1.6rem; margin-bottom: .6rem; }
.guide-card-title {
  font-size: .95rem; font-weight: 700;
  color: var(--navy); margin-bottom: .3rem;
}
.guide-card-desc  { font-size: .8rem; color: var(--muted); line-height: 1.5; }

@media (max-width: 640px) {
  .guide-teaser { padding: 2.5rem 0; }
  .guide-teaser h2 { font-size: 1.35rem; }
  .guide-teaser-cards { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .guide-card { padding: 1rem; }
  .guide-card-icon { font-size: 1.3rem; }
}

/* ═══ MERGE PLAYERS ══════════════════════════════════════════════════════════ */
.merge-checklist {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
  margin-top: .4rem;
}
.merge-checklist-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--bg2);
  cursor: pointer;
  transition: background .1s;
}
.merge-checklist-row:last-child { border-bottom: none; }
.merge-checklist-row:hover { background: var(--bg); }
.merge-checklist-row input[type=checkbox] {
  width: 16px; height: 16px; flex-shrink: 0;
  accent-color: var(--navy); cursor: pointer;
}
.merge-checklist-name {
  font-size: .875rem; font-weight: 600;
  color: var(--text); flex: 1;
}
.merge-checklist-meta {
  font-size: .75rem; color: var(--muted); white-space: nowrap;
}
