:root {
  --bg: #07080d;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --text: #f0f4f8;
  --text-2: #94a3b8;
  --muted: #3d4f63;
  --accent: #60a5fa;
  --warn: #fbbf24;
}

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

body {
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 55% at 50% -5%,
    rgba(67,100,200,0.18) 0%, transparent 70%);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────── */

header {
  position: relative;
  text-align: center;
  padding: 2.8rem 1.5rem 1.2rem;
  overflow: hidden;
}

/* ambient glow behind the title */
header::before {
  content: '';
  position: absolute;
  top: -20px; left: 50%; transform: translateX(-50%);
  width: 500px; height: 280px;
  background: radial-gradient(circle, rgba(96,165,250,0.12) 0%, transparent 65%);
  pointer-events: none;
}

header h1 {
  position: relative;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -.04em;
  background: linear-gradient(160deg, #fff 25%, rgba(148,163,184,0.75) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .3rem;
}

.day-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -.01em;
  margin-bottom: .7rem;
}

.run-meta {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-bottom: .85rem;
  max-width: min(92vw, 470px);
}

.run-pill {
  min-width: 0;
  padding: .56rem .78rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025)),
    rgba(8,12,22,0.58);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 10px 34px rgba(0,0,0,0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: left;
}

.run-label {
  display: block;
  margin-bottom: .16rem;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
}

.run-pill strong {
  color: var(--text);
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.check-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.22);
  color: var(--warn);
  font-size: .8rem;
  font-weight: 600;
  padding: .38rem 1rem;
  border-radius: 999px;
  letter-spacing: -.01em;
}

/* ── Layout ───────────────────────────────── */

.page { max-width: 680px; margin: 0 auto; padding: 0 1rem 4rem; }
.cards { display: flex; flex-direction: column; gap: 1rem; }

.section-header {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1.8rem 0 .75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

footer {
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}
.updated, .caveat { color: var(--muted); font-size: .75rem; margin: .2rem 0; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem; font-size: .9rem; }

/* ── Card ─────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem 1.2rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  /* top inner highlight + drop shadow */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 8px 40px rgba(0,0,0,0.45);
  /* entrance: start invisible */
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity .45s ease,
    transform .45s ease,
    border-color .2s,
    box-shadow .2s;
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 16px 56px rgba(0,0,0,0.6),
    0 0 0 1px rgba(96,165,250,0.06);
  transform: translateY(-2px);
}

/* ── Card header ──────────────────────────── */

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-meta {
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .24rem .65rem;
  border-radius: 999px;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-upcoming {
  background: rgba(96,165,250,0.09);
  color: #93c5fd;
  border: 1px solid rgba(96,165,250,0.2);
}
.badge-kicked-off {
  background: rgba(251,191,36,0.09);
  color: var(--warn);
  border: 1px solid rgba(251,191,36,0.22);
  animation: pulse-dot 1.8s infinite;
}
.badge-final {
  background: rgba(34,197,94,0.09);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.2);
}

.badge-live {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
  animation: pulse-dot 1.2s infinite;
}
.badge-ht {
  background: rgba(251,191,36,0.09);
  color: var(--warn);
  border: 1px solid rgba(251,191,36,0.22);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

.live-scoreline {
  text-align: center;
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -.04em;
  color: #fff;
  margin: .4rem 0 .7rem;
  line-height: 1;
}

/* ── Teams ────────────────────────────────── */

.teams-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1rem;
}
.team-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.teams-vs {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}

/* ── Outcome bar ──────────────────────────── */

.outcome-bar {
  display: flex;
  height: 70px;
  border-radius: 14px;
  overflow: hidden;
  gap: 3px;
  margin-bottom: .9rem;
  box-shadow: 0 4px 28px rgba(0,0,0,0.55);
}

.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
  position: relative;
  /* flex starts at 0; JS transitions to real value → fill animation */
  flex: 0;
  transition: flex 0.85s cubic-bezier(0.34, 1.1, 0.64, 1);
}

/* top-light shimmer */
.seg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.16) 0%, transparent 55%);
  pointer-events: none;
}

/* moving shine pass */
.seg::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: shine 4s infinite;
}

@keyframes shine {
  0%   { left: -100%; }
  40%, 100% { left: 140%; }
}

.seg-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 .55rem;
  min-width: 0;
  z-index: 1;
  gap: .04rem;
}

.seg-label {
  font-size: .57rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.seg-pct {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  letter-spacing: -.03em;
}

.seg-hint {
  font-size: .57rem;
  font-weight: 600;
  color: rgba(255,255,255,.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.seg.win-seg  { background: linear-gradient(155deg, #22c55e 0%, #15803d 100%); }
.seg.draw-seg { background: linear-gradient(155deg, #f59e0b 0%, #92400e 100%); }
.seg.loss-seg { background: linear-gradient(155deg, #ef4444 0%, #991b1b 100%); }

/* ── Card footer ──────────────────────────── */

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: .8rem;
  color: var(--text-2);
  gap: .75rem;
  flex-wrap: wrap;
}
.xg-label strong { color: var(--text); font-weight: 600; }
.score-item + .score-item::before { content: "  ·  "; color: var(--muted); }
.score-item strong { color: var(--text); font-weight: 600; }
.score-prob { color: var(--text-2); }
.score-note { display: block; font-size: .68rem; color: var(--muted); margin-top: .2rem; }

/* ── Final card ───────────────────────────── */

.final-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
  margin-bottom: .9rem;
}
.final-home { text-align: right; font-size: .95rem; font-weight: 700; }
.final-away { text-align: left;  font-size: .95rem; font-weight: 700; }
.final-scoreline {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -.04em;
  white-space: nowrap;
  text-align: center;
}

.final-bar-label {
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}

.final-verdict-line {
  margin-top: .5rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -.01em;
}

/* legacy styles kept for graceful fallback */
.final-verdict {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem 1rem;
  font-size: .8rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.verdict-row { display: flex; align-items: baseline; gap: .4rem; color: var(--text-2); }
.verdict-row strong { color: var(--text); font-weight: 600; }

/* ── Side banners ─────────────────────────── */

.side-banner {
  position: fixed;
  top: 50%;
  writing-mode: vertical-rl;
  padding: 1.15rem .76rem;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #fff;
  -webkit-text-fill-color: #fff;
  border-radius: 999px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
  isolation: isolate;
  pointer-events: none;
  user-select: none;
  z-index: 20;
  white-space: nowrap;
}

.side-banner::before,
.side-banner::after {
  content: '';
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.side-banner::before {
  inset: -.52rem -.34rem;
  border: 1px solid rgba(147,197,253,0.34);
  border-radius: inherit;
  background:
    linear-gradient(180deg, #60a5fa, #fbbf24) left / 3px 100% no-repeat,
    linear-gradient(180deg, #fbbf24, #60a5fa) right / 3px 100% no-repeat,
    linear-gradient(180deg, rgba(96,165,250,.42), rgba(251,191,36,.24)),
    rgba(5,8,16,.92);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 0 0 1px rgba(251,191,36,0.12),
    0 0 38px rgba(96,165,250,0.24),
    0 14px 42px rgba(0,0,0,0.44);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.side-banner::after {
  inset: 10% -70%;
  z-index: 1;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    transparent 36%,
    rgba(255,255,255,0.1) 45%,
    rgba(255,255,255,0.5) 50%,
    rgba(255,255,255,0.1) 55%,
    transparent 64%
  );
  opacity: .7;
  transform: translateY(-105%);
  animation: bannerShineDown 5.2s ease-in-out infinite;
}

.side-banner-left {
  left: 1.35rem;
  transform: translateY(-50%) rotate(180deg);
}

.side-banner-right {
  right: 1.35rem;
  transform: translateY(-50%);
}

@media (max-width: 860px) {
  .run-meta {
    display: grid;
    width: min(92vw, 360px);
  }

  .run-pill {
    text-align: center;
  }

  .teams-row {
    flex-wrap: wrap;
    gap: .35rem .55rem;
  }

  .team-name {
    min-width: 0;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .outcome-bar {
    display: grid;
    height: auto;
    gap: .45rem;
    overflow: visible;
    box-shadow: none;
  }

  .seg {
    min-height: 58px;
    border-radius: 12px;
    flex: none !important;
  }

  .seg-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    padding: .62rem .78rem;
    column-gap: .75rem;
    row-gap: .12rem;
  }

  .seg-label {
    font-size: .66rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-align: left;
  }

  .seg-pct {
    grid-row: 1 / span 2;
    grid-column: 2;
    font-size: 1.55rem;
    text-align: right;
  }

  .seg-hint {
    grid-column: 1;
    font-size: .68rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-align: left;
  }

  .final-teams {
    grid-template-columns: 1fr;
    gap: .25rem;
  }

  .final-home,
  .final-away {
    text-align: center;
    overflow-wrap: anywhere;
  }

  .side-banner {
    top: 50%;
    bottom: auto;
    left: 50%;
    writing-mode: horizontal-tb;
    font-size: clamp(1.32rem, 7vw, 2.05rem);
    letter-spacing: .04em;
    line-height: 1.18;
    width: min(88vw, 420px);
    padding: 1.25rem 1.35rem;
    border-radius: 22px;
    color: #fff;
    -webkit-text-fill-color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
    filter: none;
    text-align: center;
    white-space: normal;
    animation: loveSplash 2s cubic-bezier(.2,.9,.2,1) forwards;
  }

  .side-banner::before {
    inset: 0;
    border: 1px solid rgba(147,197,253,0.34);
    border-radius: inherit;
    background:
      linear-gradient(90deg, #60a5fa 0, #60a5fa 6px, transparent 6px calc(100% - 6px), #fbbf24 calc(100% - 6px)),
      linear-gradient(90deg, #60a5fa, #fbbf24) left bottom / 100% 3px no-repeat,
      linear-gradient(90deg, rgba(96,165,250,.34), rgba(251,191,36,.2)),
      rgba(5,8,16,.94);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.18),
      inset 0 0 0 1px rgba(251,191,36,0.12),
      0 0 38px rgba(96,165,250,0.24),
      0 18px 48px rgba(0,0,0,0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .side-banner::after {
    inset: -35% -60%;
    width: auto;
    height: auto;
    border: 0;
    border-radius: inherit;
    background: linear-gradient(100deg, transparent 34%, rgba(255,255,255,0.08) 44%, rgba(255,255,255,0.56) 50%, rgba(255,255,255,0.08) 56%, transparent 66%);
    opacity: .72;
    transform: translateX(-95%);
    animation: bannerShineAcross 3.2s ease-in-out infinite;
  }

  .side-banner-left {
    transform: translate(-50%, -50%);
  }

  .side-banner-right {
    display: none;
  }
}

@media (max-width: 380px) {
  .run-meta {
    grid-template-columns: 1fr;
  }
}

@keyframes bannerShineDown {
  0%, 25% { transform: translateY(-105%); }
  60%, 100% { transform: translateY(105%); }
}

@keyframes bannerShineAcross {
  0%, 18% { transform: translateX(-95%); }
  72%, 100% { transform: translateX(95%); }
}

@keyframes loveSplash {
  0% {
    opacity: 0;
    visibility: visible;
    transform: translate(-50%, -42%) scale(.9);
  }
  16%, 74% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -58%) scale(.96);
  }
}
