:root {
  --bg: #071724;
  --bg-deep: #04111b;
  --surface: rgba(9, 28, 43, 0.76);
  --surface-strong: rgba(7, 22, 34, 0.92);
  --surface-soft: rgba(215, 236, 247, 0.08);
  --line: rgba(171, 220, 243, 0.18);
  --text: #eef7fb;
  --muted: #9cc2d5;
  --accent: #5ad3c4;
  --accent-warm: #ff9052;
  --gold: #ffd36e;
  --silver: #b7d3ef;
  --bronze: #f0a07c;
  --danger: #ff7d7d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --body-font: "Avenir Next", "Inter", "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display-font: "Avenir Next", "Inter", "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(90, 211, 196, 0.18), transparent 34%),
    radial-gradient(circle at 85% 10%, rgba(255, 144, 82, 0.2), transparent 24%),
    linear-gradient(180deg, #0a1f31 0%, var(--bg-deep) 48%, #030a11 100%);
  color: var(--text);
  font-family: var(--body-font);
}

button,
input,
select {
  font: inherit;
}

button[hidden] {
  display: none;
}

.page-shell {
  position: relative;
  overflow: hidden;
}

.backdrop {
  position: fixed;
  inset: auto;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.45;
}

.backdrop-a {
  top: 9rem;
  right: -6rem;
  width: 20rem;
  height: 20rem;
  background: radial-gradient(circle, rgba(90, 211, 196, 0.35), transparent 65%);
  animation: drift 18s ease-in-out infinite;
}

.backdrop-b {
  bottom: 6rem;
  left: -4rem;
  width: 18rem;
  height: 18rem;
  background: radial-gradient(circle, rgba(255, 144, 82, 0.28), transparent 68%);
  animation: drift 22s ease-in-out infinite reverse;
}

.app-shell {
  position: relative;
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
  display: grid;
  gap: 1rem;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 28%),
    var(--surface);
  box-shadow: var(--shadow);
  border-radius: 1.5rem;
  padding: 1.35rem;
  backdrop-filter: blur(18px);
  animation: rise 500ms ease-out both;
}

.top-bar {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto)) minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem 1.25rem;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 100%),
    rgba(5, 17, 27, 0.82);
}

.top-bar__item {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

.top-bar__item strong {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.top-bar__item--control {
  justify-self: start;
}

.top-bar__label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-bar select {
  min-width: 4.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
}

.hero-panel {
  gap: 1rem;
  display: grid;
}

.eyebrow-row,
.hero-copy,
.source-form,
.action-row,
.content-grid,
.section-heading,
.stat-strip,
.podium-grid,
.fleet-grid,
.codes-grid {
  display: grid;
  gap: 1rem;
}

.content-grid {
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.74rem;
  color: var(--accent);
}

.hero-panel h1,
.panel h2,
.panel h3 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 700;
}

.hero-panel h1 {
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  line-height: 1;
  max-width: 14ch;
}

.hero-subtitle,
.panel p,
.meta-label,
.source-note,
.helper-note,
.activity-item span,
.notes-copy,
.matrix-table,
.meta-list dt {
  color: var(--muted);
}

.hero-subtitle {
  margin: 0.55rem 0 0;
  max-width: 64ch;
  line-height: 1.5;
}

.status-pill {
  justify-self: end;
  align-self: center;
  margin: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill[data-state="live"] {
  background: rgba(90, 211, 196, 0.16);
  border-color: rgba(90, 211, 196, 0.35);
  color: #aef7ef;
}

.status-pill[data-state="loading"] {
  background: rgba(255, 211, 110, 0.16);
  border-color: rgba(255, 211, 110, 0.34);
  color: #ffe5a2;
}

.status-pill[data-state="error"] {
  background: rgba(255, 125, 125, 0.14);
  border-color: rgba(255, 125, 125, 0.34);
  color: #ffc0c0;
}

.source-form {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: stretch;
}

.source-field {
  display: grid;
  gap: 0.55rem;
}

.source-field span {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(5, 16, 26, 0.88);
  color: var(--text);
  border-radius: 1rem;
  padding: 0.95rem 1rem;
}

input[type="url"]:focus,
select:focus {
  outline: 2px solid rgba(90, 211, 196, 0.4);
  outline-offset: 2px;
}

.action-row {
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: start;
  align-content: end;
}

button {
  border: 0;
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  font-weight: 700;
  color: #06131d;
  background: linear-gradient(135deg, var(--accent), #7ce4d7);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 12px 24px rgba(90, 211, 196, 0.25);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  border: 1px solid var(--line);
}

.stat-strip {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.stat-card,
.activity-item,
.podium-card,
.fleet-card,
.code-card {
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.stat-card {
  padding: 0.95rem 1rem;
  border-radius: 1rem;
}

.stat-card span {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

.source-note,
.helper-note {
  margin: 0;
  line-height: 1.55;
}

.source-note {
  font-size: 0.92rem;
}

.error-banner {
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 125, 125, 0.12);
  border: 1px solid rgba(255, 125, 125, 0.35);
  color: #ffd1d1;
}

.section-heading {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 1rem;
}

.section-heading.compact {
  grid-template-columns: 1fr;
}

.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 1.8rem;
}

.podium-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.podium-card,
.fleet-card,
.code-card {
  border-radius: 1.25rem;
  padding: 1.15rem;
}

.podium-card--1 {
  background:
    linear-gradient(180deg, rgba(255, 211, 110, 0.14), transparent 38%),
    var(--surface-strong);
}

.podium-card--2 {
  background:
    linear-gradient(180deg, rgba(183, 211, 239, 0.14), transparent 38%),
    var(--surface-strong);
}

.podium-card--3 {
  background:
    linear-gradient(180deg, rgba(240, 160, 124, 0.14), transparent 38%),
    var(--surface-strong);
}

.podium-rank,
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 800;
}

.podium-kicker,
.podium-university {
  margin: 0.5rem 0 0;
}

.meta-list {
  margin: 1rem 0 0;
  display: grid;
  gap: 0.8rem;
}

.meta-list.dense {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-list div {
  display: grid;
  gap: 0.25rem;
}

.meta-list dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-list dd {
  margin: 0;
  font-weight: 600;
}

.race-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.race-chip {
  min-width: 4.9rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.race-chip span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.race-chip strong {
  display: block;
  margin-top: 0.2rem;
}

.race-chip--gold {
  background: rgba(255, 211, 110, 0.12);
  border-color: rgba(255, 211, 110, 0.22);
}

.race-chip--silver {
  background: rgba(183, 211, 239, 0.12);
  border-color: rgba(183, 211, 239, 0.22);
}

.race-chip--bronze {
  background: rgba(240, 160, 124, 0.12);
  border-color: rgba(240, 160, 124, 0.22);
}

.fleet-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.fleet-card {
  display: grid;
  gap: 1rem;
}

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

.fleet-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}

.fleet-identity h3 {
  font-size: 1.3rem;
}

.fleet-identity p {
  margin: 0.18rem 0 0;
}

.team-logo {
  width: 3.6rem;
  height: 3.6rem;
  object-fit: contain;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.3rem;
}

.fallback-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--accent);
}

.watch-panel {
  display: grid;
  gap: 1rem;
}

.activity-feed {
  display: grid;
  gap: 0.75rem;
}

.activity-item {
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.3rem;
}

.activity-item strong {
  line-height: 1.45;
}

.notes-panel {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.notes-copy {
  display: grid;
  gap: 0.75rem;
  line-height: 1.65;
}

.notes-copy p {
  margin: 0;
}

.matrix-wrap {
  overflow-x: auto;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.matrix-table th,
.matrix-table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.matrix-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.matrix-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tone-gold {
  color: #ffe298;
}

.tone-silver {
  color: #cbe3fb;
}

.tone-bronze {
  color: #ffc39f;
}

.codes-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.code-card {
  display: grid;
  gap: 0.5rem;
}

.code-card strong {
  font-size: 1.15rem;
}

.code-card p {
  margin: 0;
  line-height: 1.5;
}

.code-card span {
  justify-self: start;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(90, 211, 196, 0.14);
  color: #b3fcf3;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(1.5rem, -1rem, 0);
  }
}

@media (max-width: 980px) {
  .content-grid,
  .source-form,
  .top-bar,
  .podium-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-pill {
    justify-self: start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .panel {
    padding: 1rem;
    border-radius: 1.2rem;
  }

  .top-bar {
    top: 0.5rem;
    padding: 0.75rem 0.9rem;
  }

  .section-heading {
    grid-template-columns: 1fr;
  }

  .fleet-card__head {
    flex-direction: column;
  }

  .meta-list.dense {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: 1fr;
  }
}
