:root {
  --bg: #04101d;
  --panel: rgba(5, 16, 31, 0.56);
  --panel-strong: rgba(8, 21, 39, 0.82);
  --border: rgba(173, 232, 255, 0.14);
  --text: #edf7ff;
  --muted: #9cb6c8;
  --gold: #ffe5a9;
  --cyan: #7fd8ff;
  --row-height: 2.28rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #020814;
  color: var(--text);
}

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
}

.cosmos,
#starfield,
.vignette {
  position: fixed;
  inset: 0;
}

.cosmos {
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(40, 95, 179, 0.22), transparent 26%),
    radial-gradient(circle at 78% 22%, rgba(255, 152, 82, 0.1), transparent 22%),
    radial-gradient(circle at 52% 70%, rgba(110, 211, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #050c17 0%, #030916 48%, #020611 100%);
}

.nebula {
  position: fixed;
  width: 42rem;
  height: 42rem;
  border-radius: 50%;
  filter: blur(42px);
  mix-blend-mode: screen;
  opacity: 0.28;
  animation: drift 18s ease-in-out infinite alternate;
}

.nebula-a {
  top: -8rem;
  left: -6rem;
  background: radial-gradient(circle, rgba(58, 155, 255, 0.42), transparent 68%);
}

.nebula-b {
  right: -10rem;
  bottom: -14rem;
  background: radial-gradient(circle, rgba(255, 152, 82, 0.26), transparent 64%);
  animation-duration: 22s;
}

.vignette {
  background: radial-gradient(circle, transparent 42%, rgba(1, 6, 14, 0.7) 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1.2rem;
  min-height: 100vh;
  padding: 1.15rem;
}

.stage,
.sidebar {
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8, 16, 30, 0.76), rgba(3, 10, 20, 0.54));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 20px 70px rgba(0, 0, 0, 0.45);
}

.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1.15rem;
  border-radius: 1.8rem;
  overflow: hidden;
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
}

h1,
h2,
h3,
.headline-card strong,
.stat-panel strong,
.pulse-card strong {
  font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif;
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: 0.02em;
}

.deck {
  max-width: 46rem;
  margin: 0.9rem 0 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
}

.headline-metrics {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.headline-card,
.pulse-card,
.stat-panel,
.sidebar-section,
.table-header,
.table-row {
  border: 1px solid rgba(179, 233, 255, 0.1);
  background: linear-gradient(180deg, rgba(12, 24, 44, 0.7), rgba(6, 15, 28, 0.66));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.headline-card {
  min-width: 6.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
  text-align: right;
}

.headline-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.55rem;
  font-weight: 600;
}

.metric-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-panel {
  position: relative;
  min-height: 0;
  border-radius: 1.6rem;
  overflow: hidden;
  border: 1px solid rgba(164, 232, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(7, 17, 32, 0.76), rgba(4, 12, 24, 0.62)),
    radial-gradient(circle at 50% 50%, rgba(67, 125, 255, 0.08), transparent 48%);
}

#trajectoryCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.chart-overlay,
.score-burst-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.competition-bands {
  position: absolute;
  inset: 5rem 1.25rem 4.5rem 4rem;
}

.band {
  position: absolute;
  left: 0;
  right: 0;
  padding-left: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(220, 239, 255, 0.52);
}

.band::before {
  content: "";
  position: absolute;
  left: -0.2rem;
  right: 0;
  top: 0.62rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.32), transparent 72%);
}

.band-top4 {
  top: 12%;
}

.band-europe {
  top: 34%;
}

.band-drop {
  top: 82%;
}

.current-week-card,
.leader-card {
  position: absolute;
  padding: 1rem 1.1rem;
  border-radius: 1.15rem;
  max-width: 18rem;
}

.current-week-card {
  top: 1.15rem;
  left: 1.15rem;
}

.leader-card {
  top: 1.15rem;
  right: 1.15rem;
  text-align: right;
}

.pulse-card strong {
  display: block;
  margin: 0.35rem 0 0.2rem;
  font-size: 1.65rem;
}

.pulse-card span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.score-burst-layer {
  overflow: hidden;
}

.score-pop {
  position: absolute;
  min-width: 13rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(14, 26, 47, 0.95), rgba(7, 15, 31, 0.9));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  animation: burst 5.4s ease forwards;
}

.score-pop .score-pop-teams {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.score-pop .scoreline {
  font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 1.5rem;
}

.score-pop .score-pop-week {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.lower-third {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.stat-panel {
  padding: 1rem 1.05rem;
  border-radius: 1.1rem;
}

.stat-panel strong {
  display: block;
  margin: 0.4rem 0 0.28rem;
  font-size: 1.28rem;
}

.stat-panel span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.8rem;
  border-radius: 1.6rem;
  min-height: 0;
}

.sidebar-section,
.table-header {
  border-radius: 1rem;
}

.sidebar-header {
  padding: 0.95rem;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.sidebar h2,
.sidebar h3 {
  margin: 0;
  font-size: 1.8rem;
}

.sidebar-chip {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(120, 210, 255, 0.12);
  border: 1px solid rgba(120, 210, 255, 0.22);
  font-size: 0.82rem;
  color: var(--cyan);
}

.table-header,
.table-row {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr) 1.55rem 2rem 2rem;
  align-items: center;
  gap: 0.35rem;
}

.table-header {
  padding: 0.55rem 0.65rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-viewport {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 1rem;
  background: rgba(5, 14, 27, 0.42);
  border: 1px solid rgba(168, 231, 255, 0.08);
}

.table-track {
  position: relative;
  height: calc(var(--row-height) * 20 + 0.2rem);
}

.table-row {
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  height: calc(var(--row-height) - 0.08rem);
  padding: 0.25rem 0.45rem;
  border-radius: 0.75rem;
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 420ms ease,
    border-color 420ms ease,
    opacity 420ms ease;
}

.table-row.is-leader {
  background:
    linear-gradient(90deg, rgba(255, 227, 165, 0.12), rgba(11, 23, 42, 0.8)),
    linear-gradient(180deg, rgba(12, 24, 44, 0.7), rgba(6, 15, 28, 0.66));
  border-color: rgba(255, 225, 157, 0.3);
}

.rank-pill {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.68rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.club-cell {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}

.club-name-wrap {
  min-width: 0;
}

.club-name {
  display: block;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.club-sub {
  display: block;
  font-size: 0.56rem;
  color: var(--muted);
}

.badge {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.45rem;
  overflow: hidden;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.16));
}

.badge img {
  width: 100%;
  height: 100%;
  display: block;
}

.cell-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2rem, -1rem, 0) scale(1.08);
  }
}

@keyframes burst {
  0% {
    opacity: 0;
    transform: translate3d(0, 2rem, 0) scale(0.96);
  }
  12%,
  72% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -1.6rem, 0) scale(1.03);
  }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: 72vh;
  }

  .sidebar {
    min-height: 42rem;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 0.8rem;
  }

  .masthead,
  .lower-third {
    grid-template-columns: 1fr;
    display: grid;
  }

  .headline-metrics {
    justify-content: flex-start;
  }

  .lower-third {
    grid-template-columns: 1fr;
  }

  .current-week-card,
  .leader-card {
    position: static;
    margin: 0.9rem;
  }

  .chart-overlay {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .competition-bands {
    inset: 8.2rem 1rem 4.3rem 3.3rem;
  }

  .table-row {
    left: 0.2rem;
    right: 0.2rem;
  }
}
