/* ============================================================
   PÁLPITO — design tokens
   ============================================================ */
:root {
  --bg:       #EEEEEA;
  --surface:  #FFFFFF;
  --soft:     #F4F4F0;
  --ink:      #111111;
  --lime:     #C7F23C;
  --on-lime:  #3A4A0E;
  --muted:    #8C8C88;
  --line:     #E4E4DF;

  --radius-card: 22px;
  --radius-btn:  14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 0 rgba(0,0,0,.04);
  --shadow-md: 0 6px 24px rgba(0,0,0,.06);

  --gap: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" on, "cv01" on;
}

button { font-family: inherit; }
input, button { font-size: 100%; }

/* ============================================================
   layout
   ============================================================ */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 14px 100px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 22px; letter-spacing: -0.02em;
}
.brand .isotype {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--ink);
  display: grid; place-items: center;
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 999px; background: var(--lime);
}
.profile-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  font-weight: 600; font-size: 13px;
  cursor: pointer;
}
.profile-pill svg { width: 28px; height: 28px; }

/* ============================================================
   bento grid
   ============================================================ */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--gap);
}
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.card.dark { background: var(--ink); color: #fff; }
.card.lime { background: var(--lime); color: var(--on-lime); }

.card.hero       { grid-column: span 6; }
.card.score      { grid-column: span 3; }
.card.pulse      { grid-column: span 3; }
.card.standings  { grid-column: span 6; }
.card.leagues    { grid-column: span 6; }
.card.calendar-shortcut { grid-column: span 6; }

@media (max-width: 480px) {
  .card.score, .card.pulse { grid-column: span 6; }
}

.card-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: lowercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.card.dark .card-label { color: #8a8a86; }
.card.lime .card-label { color: var(--on-lime); opacity: .75; }

/* ============================================================
   hero — próximo partido
   ============================================================ */
.hero-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
}
.hero-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hero-side .team-name { font-weight: 700; font-size: 15px; opacity: .9; }
.avatar { width: 88px; height: 88px; border-radius: 999px; overflow: hidden; }
.avatar svg { width: 100%; height: 100%; display: block; }

.hero-vs {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.score-inputs {
  display: grid; grid-template-columns: 56px 14px 56px;
  align-items: center; gap: 0;
}
.score-box {
  background: #2A2A2A;
  border: none; outline: none;
  height: 64px; border-radius: 14px;
  text-align: center; font-weight: 700; font-size: 32px;
  color: #fff;
  font-family: inherit;
}
.score-box.mine { background: var(--lime); color: var(--ink); }
.score-sep { text-align: center; font-weight: 700; color: var(--muted); }

/* stepper +/− horizontal: [ − ] [ valor ] [ + ] */
.stepper {
  display: inline-flex; flex-direction: row; align-items: center; gap: 6px;
}
.step-btn {
  width: 38px; height: 56px; border-radius: 12px;
  border: none; cursor: pointer;
  background: #2A2A2A; color: #fff;
  font-size: 22px; font-weight: 700;
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  flex-shrink: 0;
}
.step-btn:active { transform: scale(0.92); }
.stepper.mine .step-btn { background: rgba(0,0,0,.55); color: var(--lime); }
.step-val {
  min-width: 52px; height: 56px; border-radius: 12px;
  background: #2A2A2A; color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 28px;
  padding: 0 8px;
}
.stepper.mine .step-val { background: var(--lime); color: var(--ink); }

.stepper.compact .step-btn { width: 32px; height: 40px; font-size: 18px; background: var(--ink); color: #fff; }
.stepper.compact .step-val { min-width: 40px; height: 40px; font-size: 22px; background: var(--soft); color: var(--ink); }

/* dashboard admin */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.stat-cell {
  background: var(--soft); border-radius: 14px; padding: 12px 10px;
  text-align: center;
}
.stat-cell .n { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-cell .l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: lowercase; margin-top: 4px; letter-spacing: 0.04em; }
.stat-cell.alert { background: var(--lime); color: var(--on-lime); }
.stat-cell.alert .l { color: var(--on-lime); opacity: .8; }
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: lowercase; letter-spacing: 0.06em;
  margin: 18px 0 8px;
}

.league-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  background: var(--soft); border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.league-row .l-name { font-weight: 700; }
.league-row .l-code {
  background: var(--ink); color: var(--lime);
  font-family: ui-monospace, SFMono-Regular, monospace;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 13px; cursor: pointer; font-weight: 700;
  letter-spacing: 0.06em;
}
.league-row .l-code.copied { background: var(--lime); color: var(--on-lime); }
.league-row .l-count { color: var(--muted); font-size: 12px; font-weight: 600; }

.hero-meta {
  margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; color: #B5B5B0;
}
.countdown { font-weight: 600; }
.btn-confirm {
  background: var(--lime); color: var(--on-lime);
  border: none; padding: 10px 16px; border-radius: var(--radius-btn);
  font-weight: 700; cursor: pointer;
}
.btn-confirm:disabled { opacity: .5; cursor: not-allowed; }
.locked-badge {
  background: #2A2A2A; color: #fff; font-size: 12px;
  padding: 6px 10px; border-radius: var(--radius-pill); font-weight: 600;
}

/* ============================================================
   score card
   ============================================================ */
.big-number {
  font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -0.03em;
  color: var(--on-lime);
}
.score-sub { margin-top: 6px; font-weight: 600; color: var(--on-lime); opacity: .8; font-size: 13px; }
.score-streak {
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.08); color: var(--on-lime);
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700;
}

.pulse-text {
  font-size: 18px; font-weight: 600; line-height: 1.3;
}

/* ============================================================
   standings table
   ============================================================ */
.table {
  display: flex; flex-direction: column; gap: 6px;
}
.row {
  display: grid; grid-template-columns: 28px 40px 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px;
  background: var(--soft);
  font-weight: 600;
  font-size: 14px;
}
.row.leader { background: var(--lime); color: var(--on-lime); }
.row.me { background: #ECECE6; box-shadow: inset 0 0 0 1.5px var(--ink); }
.row .pos { font-weight: 700; }
.row .pts { font-weight: 700; }
.row .delta { font-size: 12px; color: var(--muted); }
.row .delta.up { color: #2C7A2C; }
.row .delta.down { color: #B23B3B; }
.row .crown { width: 16px; height: 16px; }
.row .av { width: 36px; height: 36px; border-radius: 999px; overflow: hidden; }
.row .av svg { width: 100%; height: 100%; display: block; }

/* ============================================================
   leagues card (admin)
   ============================================================ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--soft); color: var(--ink);
  padding: 8px 12px; border-radius: var(--radius-pill);
  font-weight: 700; font-size: 13px; cursor: pointer;
  border: 1px solid transparent;
}
.chip.dark { background: var(--ink); color: var(--lime); }
.chip .count { background: rgba(0,0,0,.08); padding: 1px 8px; border-radius: var(--radius-pill); font-size: 11px; }
.chip.dark .count { background: rgba(255,255,255,.1); color: #fff; }
.chip:hover { border-color: var(--ink); }

.admin-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: var(--lime);
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
}

/* ============================================================
   modal / sheet
   ============================================================ */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(17,17,17,.4);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 100;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  background: var(--bg); width: 100%; max-width: 720px;
  border-top-left-radius: 28px; border-top-right-radius: 28px;
  padding: 22px 18px 36px;
  max-height: 88vh; overflow-y: auto;
}
.sheet h2 { margin: 0 0 4px; font-weight: 700; letter-spacing: -0.02em; }
.sheet p.muted { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: lowercase; letter-spacing: 0.04em; }
.input, .select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-btn);
  border: 1px solid var(--line); background: var(--surface);
  font-family: inherit; font-size: 16px; font-weight: 500;
  color: var(--ink);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--radius-btn);
  border: none; font-weight: 700; cursor: pointer;
  background: var(--ink); color: #fff;
  width: 100%;
}
.btn.lime { background: var(--lime); color: var(--on-lime); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn + .btn { margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   team picker grid
   ============================================================ */
.team-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-height: 360px; overflow-y: auto;
  padding: 4px 2px;
}
.team-pick {
  background: var(--surface);
  border-radius: 14px;
  border: 2px solid transparent;
  padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  font-size: 11px; font-weight: 600;
}
.team-pick.selected { border-color: var(--ink); background: var(--lime); }
.team-pick .av { width: 48px; height: 48px; border-radius: 999px; overflow: hidden; }
.team-pick .av svg { width: 100%; height: 100%; display: block; }

/* ============================================================
   bottom nav
   ============================================================ */
.bottom-nav {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  border-radius: var(--radius-pill);
  padding: 8px;
  display: flex; gap: 4px;
  box-shadow: var(--shadow-md);
  z-index: 50;
}
.bottom-nav button {
  background: transparent; border: none; color: #fff;
  padding: 8px 14px; border-radius: var(--radius-pill);
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.bottom-nav button.active { background: var(--lime); color: var(--on-lime); }

/* ============================================================
   utilities
   ============================================================ */
.hidden { display: none !important; }
.center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.sp-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ============================================================
   calendar view
   ============================================================ */
.match-card {
  background: var(--surface); border-radius: 16px; padding: 14px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  align-items: center; margin-bottom: 10px;
}
.match-card .side { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; }
.match-card .side .av { width: 44px; height: 44px; border-radius: 999px; overflow: hidden; }
.match-card .side .av svg { width: 100%; height: 100%; display: block; }
.match-card .mid { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.match-card .stage { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: lowercase; letter-spacing: 0.06em; }
.match-card .score-pill {
  display: inline-flex; gap: 6px; align-items: center;
  background: var(--soft); padding: 4px 10px; border-radius: var(--radius-pill);
  font-weight: 700;
}
.match-card .score-pill.live { background: var(--lime); color: var(--on-lime); }
.match-card .mypred { font-size: 11px; color: var(--muted); }
.match-card.locked { opacity: .85; }

/* day header en el calendario */
.day-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 4px 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.day-header:first-child { margin-top: 4px; }
.day-header .day-title {
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
}
.day-header .day-count {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: lowercase; letter-spacing: 0.04em;
}
.day-header.today .day-title {
  color: var(--on-lime);
  background: var(--lime);
  padding: 2px 10px; border-radius: var(--radius-pill);
  display: inline-block;
}
.day-header.today { border-bottom-color: var(--lime); }

.cal-banner {
  background: var(--ink); color: #fff;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.cal-banner .cal-banner-label {
  font-size: 11px; font-weight: 700; color: var(--lime);
  text-transform: lowercase; letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.cal-banner .cal-banner-next { font-size: 15px; font-weight: 600; }

/* Alerts bar (champion missing, recovery, etc.) */
#alerts-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--gap); }
.alert-card {
  background: var(--lime); color: var(--on-lime);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer;
}
.alert-card .alert-title { font-weight: 700; font-size: 14px; }
.alert-card .alert-sub { font-size: 12px; opacity: .8; }
.alert-card .alert-cta { font-size: 13px; font-weight: 700; }
.alert-card.dark { background: var(--ink); color: #fff; }
.alert-card.dark .alert-cta { color: var(--lime); }

/* Bracket view */
.bracket-stage { margin-bottom: 18px; }
.bracket-stage-title {
  font-weight: 700; font-size: 14px; color: var(--muted);
  text-transform: lowercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.bracket-match {
  background: var(--surface); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 6px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px;
  align-items: center;
}
.bracket-match .b-side {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 13px;
}
.bracket-match .b-side.right { justify-content: flex-end; text-align: right; }
.bracket-match .b-av { width: 28px; height: 28px; border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.bracket-match .b-av svg { width: 100%; height: 100%; display: block; }
.bracket-match .b-vs {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--soft); padding: 4px 8px; border-radius: var(--radius-pill);
  text-align: center; min-width: 50px;
}
.bracket-match.finished .b-vs { background: var(--lime); color: var(--on-lime); }
.bracket-match.placeholder .b-side { color: var(--muted); font-weight: 600; }

/* Filas compactas de "partidos de hoy" en la home */
.today-row {
  display: grid; grid-template-columns: 36px 1fr auto 1fr 36px auto;
  align-items: center; gap: 8px;
  padding: 8px 4px;
  border-radius: 12px;
  cursor: pointer;
}
.today-row + .today-row { border-top: 1px solid var(--line); }
.today-row:hover { background: var(--soft); }
.today-row .tr-av { width: 36px; height: 36px; border-radius: 999px; overflow: hidden; }
.today-row .tr-av svg { width: 100%; height: 100%; display: block; }
.today-row .tr-name { font-weight: 700; font-size: 13px; }
.today-row .tr-name.right { text-align: right; }
.today-row .tr-mid {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-weight: 700; font-size: 12px;
  background: var(--soft); padding: 4px 10px; border-radius: var(--radius-pill);
}
.today-row .tr-mid .stage { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; }
.today-row .tr-mid .time { font-size: 13px; font-weight: 700; }
.today-row .tr-cta {
  font-size: 11px; font-weight: 700;
  background: var(--ink); color: #fff;
  padding: 6px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.today-row .tr-cta.saved { background: var(--lime); color: var(--on-lime); }
.today-row.locked { opacity: .7; }
.today-row.locked .tr-cta { background: transparent; color: var(--muted); }
@media (max-width: 480px) {
  .today-row { grid-template-columns: 30px 1fr auto 1fr 30px; gap: 6px; }
  .today-row .tr-av { width: 30px; height: 30px; }
  .today-row .tr-name { font-size: 12px; }
  .today-row .tr-cta { display: none; }
}

/* ============================================================
   admin panel
   ============================================================ */
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-match {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center;
  padding: 10px; background: var(--soft); border-radius: 12px;
}
.admin-match .ids { font-size: 11px; color: var(--muted); }
.admin-match input { width: 50px; }

.offline-banner {
  background: var(--ink); color: #fff;
  text-align: center; padding: 6px; font-size: 12px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: none;
}
.offline .offline-banner { display: block; }

.install-cta {
  position: fixed; bottom: 70px; right: 14px;
  background: var(--lime); color: var(--on-lime);
  border: none; padding: 10px 14px; border-radius: var(--radius-pill);
  font-weight: 700; box-shadow: var(--shadow-md); cursor: pointer;
  display: none;
}
.install-cta.show { display: inline-flex; }
