@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

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

html {
  overscroll-behavior-y: contain;
}

:root {
  /* ─── PERFORMANCE DARK MODE ──────────────────────────── */
  /* Fundos */
  --bg-primary:   #0B0E11;   /* Deep dark — fundo geral */
  --bg-secondary: #181A20;   /* Cards, tabelas, sidebar */
  --bg-tertiary:  #21242C;   /* Inputs, células de tabela, áreas internas */
  --bg-hover:     #2A2E37;
  --bg-active:    #353A44;

  /* Texto */
  --text-primary:   #EAECEF;  /* Branco suave */
  --text-secondary: #B7BDC6;
  --text-muted:     #848E9C;

  /* Destaques premium */
  --gold:        #F0B90B;     /* Amarelo âmbar — destaque premium */
  --gold-bright: #FFD700;
  --gold-soft:   rgba(240,185,11,0.12);
  --gold-glow:   rgba(240,185,11,0.35);
  --silver:      #C0C0C0;     /* Prata metálico — destaque sistema */
  --silver-soft: rgba(192,192,192,0.10);

  /* Sinalização */
  --green:        #27AF60;    /* Lucro / Over */
  --green-bright: #2EBD6B;
  --green-soft:   rgba(39,175,96,0.15);
  --red:          #DD3A4A;    /* Prejuízo / Under */
  --red-bright:   #E84A5A;
  --red-soft:     rgba(221,58,74,0.15);

  /* Aliases para compatibilidade com o código já existente */
  --accent:       var(--gold);          /* Cor primária = ouro âmbar */
  --accent-dark:  #C99A09;
  --accent-light: #FFD340;
  --accent-soft:  var(--gold-soft);
  --danger:       var(--red);
  --danger-soft:  var(--red-soft);
  --green-light:  #6BE090;
  --yellow:       var(--gold);
  --orange:       #F97316;
  --blue:         #4FC3F7;

  /* Navy variables (legacy — mantém só para não partir nada) */
  --navy-dark:    #0B0E11;
  --navy-mid:     #181A20;
  --navy-light:   #21242C;

  --border: #2A2E37;
  --border-strong: #3A3E47;

  /* Gradientes premium */
  --grad-premium: linear-gradient(135deg, #C0C0C0 0%, #F0B90B 100%);
  --grad-premium-hover: linear-gradient(135deg, #DCDCDC 0%, #FFCB14 100%);
  --grad-gold: linear-gradient(135deg, #F0B90B 0%, #FFD700 100%);

  /* Glow effects */
  --glow-gold: 0 0 0 1px rgba(240,185,11,0.4), 0 0 16px rgba(240,185,11,0.18);
  --glow-gold-strong: 0 0 0 1px rgba(240,185,11,0.6), 0 0 24px rgba(240,185,11,0.30);
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  overscroll-behavior-y: contain;
  font-feature-settings: "tnum" 1; /* tabular numbers para números alinhados */
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar dark */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-active); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

h1, h2, h3, h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

input, select, textarea {
  font-family: 'Montserrat', sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Mobile scoreboard minimal ─────────────────────────────────── */
body {
  background:
    radial-gradient(circle at 50% -80px, rgba(40,214,139,0.08), transparent 280px),
    #070d18;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.app {
  min-height: 100svh;
  background: transparent;
}

.main {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 12px 28px;
}

.scoreboard-shell {
  display: grid;
  gap: 14px;
}

.pull-refresh {
  --pull-refresh-y: -72px;
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(40,214,139,0.22);
  border-radius: 50%;
  background: rgba(16, 29, 44, 0.94);
  box-shadow: 0 14px 34px rgba(0,0,0,0.28), 0 0 18px rgba(40,214,139,0.08);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, var(--pull-refresh-y));
  transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.pull-refresh.visible {
  opacity: 1;
}

.pull-refresh.ready,
.pull-refresh.refreshing,
.pull-refresh.done {
  border-color: rgba(240,185,11,0.45);
}

.pull-refresh-spinner {
  width: 19px;
  height: 19px;
  border: 2px solid rgba(255,255,255,0.16);
  border-top-color: #28d68b;
  border-radius: 50%;
  transform: rotate(0deg);
}

.pull-refresh.ready .pull-refresh-spinner {
  border-top-color: #f0b90b;
  transform: rotate(135deg);
}

.pull-refresh.refreshing .pull-refresh-spinner {
  animation: spin 0.7s linear infinite;
  border-top-color: #f0b90b;
}

.pull-refresh.done .pull-refresh-spinner {
  border-color: #28d68b;
  position: relative;
}

.pull-refresh.done .pull-refresh-spinner::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #28d68b;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.pull-refresh-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.scoreboard-top {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70px;
}

.scoreboard-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scoreboard-logo img {
  width: auto;
  height: 70px;
  display: block;
  filter: drop-shadow(0 0 18px rgba(40,214,139,0.12));
}

.live-toggle {
  position: absolute;
  right: 0;
  top: calc(50% + 7px);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-width: 116px;
  padding: 0 18px;
  border: 2px solid #f23e68;
  border-radius: 999px;
  background: rgba(242, 62, 104, 0.03);
  color: #ff5d82;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(242,62,104,0.05);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.live-toggle:active {
  transform: translateY(-50%) scale(0.96);
}

.live-toggle.active {
  border-color: #f23e68;
  background: #f23e68;
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(242,62,104,0.18);
}

.live-toggle-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #bd2d52;
  opacity: 0.95;
}

.live-toggle.active .live-toggle-dot {
  background: rgba(255,255,255,0.6);
}

.date-bar {
  margin: 0;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: #17283b;
}

.date-bar-days {
  display: flex;
  gap: 0;
  overflow: visible;
  justify-content: stretch;
}

.date-btn {
  flex: 1;
  flex-shrink: 0;
  height: 44px;
  border-radius: 999px;
  color: #c6d0dd;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
}

.date-btn:hover {
  background: rgba(255,255,255,0.04);
}

.date-btn.active {
  background: #101d2c;
  color: #f0b90b;
  box-shadow:
    inset 0 0 0 1px rgba(240,185,11,0.12),
    0 0 18px rgba(240,185,11,0.08);
}

.date-btn .day-name {
  font-size: inherit;
  opacity: 1;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

.league-block {
  position: relative;
  margin-bottom: 14px;
  overflow: hidden;
  background: #101b2a;
  border: 1px solid rgba(132, 150, 174, 0.16);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.18);
}

.league-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #5d5cff;
}

.league-header {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px 12px 18px;
  background: #132038;
  border-bottom: 1px solid rgba(132, 150, 174, 0.14);
  gap: 8px;
}

.league-header .flag {
  display: inline-block;
  flex-shrink: 0;
  width: 20px;
  height: 15px;
  border-radius: 3px;
  background-size: cover;
}

.league-header .country {
  color: #96a6bb;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

.league-header .league-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e9f0f8;
  font-size: 15px;
  font-weight: 900;
}

.league-count {
  margin-left: auto;
  color: #9fb0c4;
  font-size: 13px;
  font-weight: 900;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
  gap: 8px;
  min-height: 106px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid rgba(132, 150, 174, 0.12);
  background: #101b2a;
  cursor: default;
}

.match-row:hover {
  background: #132033;
}

.match-row:last-child {
  border-bottom: none;
}

.match-row.goal-highlight {
  background:
    linear-gradient(90deg, rgba(40,214,139,0.18), rgba(40,214,139,0.04) 48%, transparent),
    #101b2a;
}

.team-side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-side.home {
  justify-content: flex-end;
  text-align: right;
}

.team-side.away {
  justify-content: flex-start;
  text-align: left;
}

.team-identity {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  width: 126px;
  min-width: 126px;
}

.team-logo-small {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.team-side .team-name {
  width: 126px;
  color: #f2f6fb;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.team-side.loser .team-name {
  color: #8797ab;
}

.team-signals {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 28px;
  align-items: center;
}

.total-signals {
  flex-direction: row;
  min-height: 24px;
  justify-content: center;
}

.match-center {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.scoreline {
  color: #f7fbff;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}

.scoreline.scheduled {
  font-size: 18px;
}

.scoreline.live-score,
.match-row.is-live .scoreline {
  color: #f05a6c;
  text-shadow: 0 0 16px rgba(240,90,108,0.2);
}

.score.flash {
  padding: 0 4px;
  border-radius: 4px;
  background: #28d68b;
  color: #06101a;
}

.match-center .time {
  color: #98a8bb;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.match-center .time.live {
  display: inline-flex;
  justify-content: center;
  color: #28d68b;
  font-size: 12px;
}

.match-center .time.live::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-radius: 50%;
  background: #28d68b;
  box-shadow: 0 0 10px rgba(40,214,139,0.72);
}

.signal-badge {
  width: 26px;
  height: 24px;
  border-radius: 999px;
  color: #06101a;
  border: 0;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
}

.signal-badge.goal {
  background: #28d68b;
  box-shadow: 0 0 12px rgba(40,214,139,0.28);
}

.signal-badge.corner {
  background: #52a9ff;
  box-shadow: 0 0 12px rgba(82,169,255,0.22);
}

.signal-badge.card {
  background: #f3c84b;
  box-shadow: 0 0 12px rgba(243,200,75,0.2);
}

.signal-badge.confirmed-hit {
  color: #06101a;
  background: #a7f3d0;
}

.red-card-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #f05a6c;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  margin-left: 2px;
}

.empty-state,
.loading {
  margin-top: 10px;
  padding: 46px 18px;
  border: 1px dashed rgba(132, 150, 174, 0.18);
  border-radius: 8px;
  background: rgba(16, 27, 42, 0.72);
  color: #98a8bb;
}

.live-only-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 56vh;
  margin-top: 0;
  border: 0;
  background: transparent;
  color: #9fb0c4;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0;
}

.live-empty-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: #9fb0c4;
  font-size: 48px;
  opacity: 0.9;
  filter: grayscale(1);
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: middle;
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  border-color: rgba(255,255,255,0.14);
  border-top-color: #28d68b;
  animation: spin 0.7s linear infinite;
}

@media (min-width: 721px) {
  .match-row {
    grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
    min-height: 116px;
  }

  .team-logo-small {
    width: 52px;
    height: 52px;
  }

  .team-side .team-name,
  .team-identity {
    width: 180px;
    min-width: 180px;
  }
}

@media (max-width: 420px) {
  .main {
    padding-left: 8px;
    padding-right: 8px;
  }

  .scoreboard-top {
    min-height: 58px;
  }

  .scoreboard-logo img {
    height: 58px;
  }

  .live-toggle {
    height: 38px;
    min-width: 100px;
    padding: 0 13px;
    gap: 6px;
    font-size: 11px;
    border-width: 2px;
  }

  .live-toggle-dot {
    width: 8px;
    height: 8px;
  }

  .match-row {
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
    gap: 5px;
    min-height: 100px;
    padding: 11px 8px 11px 12px;
  }

  .team-logo-small {
    width: 38px;
    height: 38px;
  }

  .team-side .team-name {
    width: 104px;
    font-size: 12px;
  }

  .team-identity {
    width: 104px;
    min-width: 104px;
  }

  .scoreline {
    font-size: 19px;
  }

  .scoreline.scheduled {
    font-size: 16px;
  }

  .signal-badge {
    width: 23px;
    height: 22px;
    font-size: 9px;
  }
}
