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

:root {
  --bg: #07100e;
  --surface: #101719;
  --surface-2: #151f22;
  --surface-3: #0c1315;
  --line: rgba(159, 178, 173, .17);
  --line-strong: rgba(159, 178, 173, .28);
  --text: #f5fbf8;
  --muted: #94a5a1;
  --dim: #60706c;
  --accent: #35d07f;
  --accent-soft: rgba(53, 208, 127, .13);
  --live: #35d07f;
  --live-soft: rgba(53, 208, 127, .14);
  --pending: #f3ba4d;
  --pending-soft: rgba(243, 186, 77, .14);
  --ended: #ff6670;
  --ended-soft: rgba(255, 102, 112, .13);
  --done: #ff98a0;
  --blue: #65a9ff;
  --shadow: 0 16px 34px rgba(0, 0, 0, .36), 0 0 0 1px rgba(255, 255, 255, .035);
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100%;
  height: 100%;
  overflow-y: scroll;
  background:
    linear-gradient(180deg, rgba(12, 31, 26, .95), var(--bg) 240px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: rgba(7, 16, 14, .91);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(53, 208, 127, .45);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: radial-gradient(circle at 35% 28%, rgba(53, 208, 127, .26), rgba(53, 208, 127, .05) 52%, rgba(255, 255, 255, .02));
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.title-row h1 {
  font-size: clamp(16px, 3.8vw, 22px);
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.date-chip {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.subline {
  color: var(--dim);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.live-badge,
.sync-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.live-badge {
  display: none;
  color: #caffdf;
  border-color: rgba(53, 208, 127, .4);
  background: var(--live-soft);
}

.live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--live);
  box-shadow: 0 0 0 4px rgba(53, 208, 127, .12);
  animation: pulse 1.3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.sync-pill {
  color: var(--accent);
  border-color: rgba(53, 208, 127, .27);
  background: var(--accent-soft);
}

.matches-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 12px 42px;
  align-items: start;
}

.match-card {
  min-width: 0;
  min-height: 176px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 11px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 54px),
    linear-gradient(145deg, var(--surface-2), var(--surface-3));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.match-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--pending);
  opacity: .88;
}

.match-card.pending {
  border-color: rgba(243, 186, 77, .36);
  background:
    radial-gradient(circle at 50% 0, rgba(243, 186, 77, .15), transparent 70px),
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 54px),
    linear-gradient(145deg, #171d1c, #0b1212);
}

.match-card.live {
  border-color: rgba(53, 208, 127, .42);
  background:
    radial-gradient(circle at 50% 0, rgba(53, 208, 127, .16), transparent 74px),
    linear-gradient(180deg, rgba(255, 255, 255, .055), transparent 54px),
    linear-gradient(145deg, #14201c, #0b1412);
}

.match-card.live::before {
  background: var(--live);
  opacity: .9;
}

.match-card.ended {
  opacity: .88;
  border-color: rgba(255, 102, 112, .33);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 102, 112, .13), transparent 72px),
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 54px),
    linear-gradient(145deg, #1a1719, #0d1112);
  filter: saturate(.86);
}

.match-card.ended::before {
  background: var(--ended);
  opacity: .78;
}

.match-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 24px;
}

.league-name {
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .04em;
  line-height: 1.15;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  min-width: 52px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 8px;
  color: #ffe2aa;
  background: var(--pending-soft);
  border: 1px solid rgba(243, 186, 77, .25);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.match-card.live .status-pill {
  color: #caffdf;
  background: var(--live-soft);
  border-color: rgba(53, 208, 127, .28);
}

.match-card.ended .status-pill {
  color: #ffd7db;
  background: var(--ended-soft);
  border-color: rgba(255, 102, 112, .24);
}

.match-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(58px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.team {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.logo-wrap {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .08);
}

.team-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .42));
}

.logo-fallback {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(53, 208, 127, .24);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.logo-fallback[hidden] {
  display: none;
}

.team-name {
  width: 100%;
  min-height: 14px;
  color: var(--text);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.match-center {
  min-width: 58px;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.score {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  min-width: 58px;
  color: var(--text);
  font-size: 30px;
  font-weight: 920;
  line-height: .95;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.score-sep {
  color: var(--dim);
  font-size: 18px;
  font-weight: 650;
}

.kickoff {
  min-width: 64px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text);
  background: rgba(243, 186, 77, .09);
  border: 1px solid rgba(243, 186, 77, .18);
  font-size: 22px;
  font-weight: 920;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.center-label {
  color: var(--dim);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.live-minute {
  color: #caffdf;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.channels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
}

.channel {
  max-width: 100%;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ch-globo { color: #9ef0b5; background: rgba(70, 207, 112, .12); border-color: rgba(70, 207, 112, .23); }
.ch-sportv { color: #9dc7ff; background: rgba(101, 169, 255, .12); border-color: rgba(101, 169, 255, .25); }
.ch-premiere { color: #d5b5ff; background: rgba(169, 120, 255, .12); border-color: rgba(169, 120, 255, .24); }
.ch-amazon { color: #ffd38a; background: rgba(243, 186, 77, .13); border-color: rgba(243, 186, 77, .24); }
.ch-sbt { color: #9ef4ff; background: rgba(82, 211, 231, .12); border-color: rgba(82, 211, 231, .23); }
.ch-espn { color: #ffadb2; background: rgba(255, 77, 87, .12); border-color: rgba(255, 77, 87, .23); }
.ch-disney { color: #9dc7ff; background: rgba(101, 169, 255, .12); border-color: rgba(101, 169, 255, .25); }
.ch-tnt { color: #d5b5ff; background: rgba(169, 120, 255, .12); border-color: rgba(169, 120, 255, .24); }
.ch-max { color: #f6b1d2; background: rgba(246, 120, 178, .12); border-color: rgba(246, 120, 178, .24); }
.ch-dazn { color: #9ef0b5; background: rgba(70, 207, 112, .12); border-color: rgba(70, 207, 112, .23); }

.state {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 260px;
  padding: 48px 18px;
  color: var(--muted);
  text-align: center;
}

.state-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

.state p {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.state small {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 650;
}

.state.error .state-icon {
  color: var(--ended);
  border-color: rgba(255, 102, 112, .35);
  background: var(--ended-soft);
}

.spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border: 3px solid rgba(255, 255, 255, .09);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 980px) {
  .matches-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .header-status {
    justify-content: space-between;
  }

  .matches-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 9px 8px 36px;
  }

  .match-card {
    min-height: 166px;
    padding: 9px;
  }

  .logo-wrap {
    width: 38px;
    height: 38px;
  }

  .team-logo {
    width: 30px;
    height: 30px;
  }

  .score {
    font-size: 25px;
  }

  .kickoff {
    min-width: 58px;
    min-height: 38px;
    font-size: 19px;
  }
}

@media (max-width: 360px) {
  .matches-grid {
    grid-template-columns: 1fr;
  }
}
