:root {
  --bg: #101217;
  --panel: #191d24;
  --panel-2: #222832;
  --panel-3: #2b3340;
  --text: #f3f5f8;
  --muted: #aab2bf;
  --line: #38414f;
  --accent: #f04f3f;
  --accent-2: #21b6a8;
  --gold: #f5c24b;
  --green: #69d17c;
  --blue: #58a6ff;
  --danger: #ff7373;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(240, 79, 63, 0.14), transparent 24rem),
    linear-gradient(135deg, #101217 0%, #171b22 48%, #121923 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 440px);
}

.hero {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 100vh;
  padding: 56px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(16, 18, 23, 0.52) 64%, rgba(16, 18, 23, 0.96) 100%),
    linear-gradient(120deg, rgba(16, 18, 23, 0.4), rgba(16, 18, 23, 0.18));
  z-index: 1;
}

.track-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 780px;
  padding-bottom: 36px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(3.3rem, 8vw, 7rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin-bottom: 26px;
  color: #d9dee7;
  font-size: 1.1rem;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.62);
  color: #eef2f7;
  font-weight: 700;
}

.auth-panel {
  display: flex;
  align-items: center;
  padding: 32px;
  background: rgba(15, 18, 23, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-box {
  width: 100%;
}

.auth-tabs,
.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.auth-tab,
.tab {
  flex: 1;
  min-height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active,
.tab.active {
  background: var(--accent);
  color: white;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  color: #dce2eb;
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #12161d;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(33, 182, 168, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--panel-3);
  color: var(--text);
  font-weight: 900;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.secondary {
  background: var(--accent-2);
  color: #071210;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.btn.danger {
  background: rgba(255, 115, 115, 0.14);
  color: #ffd8d8;
}

.notice {
  min-height: 24px;
  color: var(--gold);
  font-weight: 700;
}

.game {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 18, 23, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
}

.logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 1000;
}

.brand h2 {
  margin: 0;
  font-size: 1.24rem;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.main {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.sidebar,
.panel,
.car-card,
.upgrade-card,
.standing-row,
.feed-item,
.race-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(25, 29, 36, 0.94);
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 92px;
  padding: 16px;
}

.team-block {
  display: grid;
  gap: 11px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.team-name {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.team-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.team-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.metric {
  min-height: 68px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 1.08rem;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.nav button {
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
}

.content {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 5px;
}

.muted {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
}

.track-panel {
  position: relative;
  min-height: 360px;
  overflow: hidden;
}

.track-panel svg {
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.race-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

.strategy-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}

.car-card,
.upgrade-card,
.race-card {
  padding: 14px;
  box-shadow: none;
}

.car-visual {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.12), rgba(240, 79, 63, 0.08)),
    #12161d;
  overflow: hidden;
}

.car-visual svg {
  width: min(100%, 340px);
  height: 132px;
}

.car-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.car-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.car-title p {
  margin: 4px 0 0;
  font-size: 0.86rem;
}

.car-notes {
  display: grid;
  gap: 6px;
  min-height: 70px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.car-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.car-notes strong {
  color: #e7ebf2;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(33, 182, 168, 0.13);
  color: #9ff3e9;
  font-size: 0.78rem;
  font-weight: 900;
}

.bar {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--gold));
}

.stat-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.stat-line {
  display: grid;
  gap: 5px;
}

.stat-line header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.upgrade-card {
  display: grid;
  gap: 10px;
}

.upgrade-card h3 {
  margin-bottom: 0;
}

.upgrade-card.locked {
  opacity: 0.78;
}

.subhead {
  margin: 20px 0 10px;
  color: #f3f5f8;
}

.upgrade-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.price {
  color: var(--gold);
  font-weight: 1000;
}

.standings {
  display: grid;
  gap: 8px;
}

.standings.compact {
  max-height: 430px;
  overflow: auto;
  padding-right: 3px;
}

.standing-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 64px 64px;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 9px 12px;
  box-shadow: none;
}

.standing-row.player {
  border-color: rgba(240, 79, 63, 0.55);
  background: rgba(240, 79, 63, 0.13);
}

.standing-row strong,
.standing-row span {
  overflow-wrap: anywhere;
}

.feed {
  display: grid;
  gap: 8px;
}

.feed-item {
  padding: 11px 12px;
  box-shadow: none;
}

.race-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.race-result {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.race-monitor {
  background:
    linear-gradient(180deg, rgba(33, 182, 168, 0.06), transparent 260px),
    rgba(25, 29, 36, 0.94);
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.monitor-screen {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(33, 182, 168, 0.28);
  border-radius: 8px;
  background: #0d1117;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.track-mini {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border-radius: 7px;
  background: #11151c;
}

.track-mini .track-art,
.race-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.car-dot {
  position: absolute;
  z-index: 2;
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12);
  transition: left 0.32s ease, top 0.32s ease;
}

.player-dot {
  background: var(--accent);
}

.rival-dot {
  background: var(--accent-2);
}

.race-car {
  offset-path: path("M130 492 C90 338 188 150 390 118 C534 96 614 166 694 196 C812 240 1014 192 1080 316 C1152 452 1012 596 792 604 C638 610 570 526 468 516 C330 502 196 602 130 492Z");
  offset-distance: var(--from-distance, 0%);
  offset-rotate: auto;
  animation-name: raceMarkerFlow;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  transition: offset-distance 0.45s ease;
}

.player-car {
  animation-duration: 5.6s;
}

.car-label {
  fill: #f3f5f8;
  font-size: 24px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #090d12;
  stroke-width: 5px;
}

.track-pulse {
  animation: trackPulse 2.4s linear infinite;
}

.race-hud {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid rgba(33, 182, 168, 0.34);
  border-radius: 7px;
  background: rgba(10, 14, 20, 0.76);
  color: #dce7f3;
  font-weight: 900;
}

.race-hud span {
  color: var(--accent-2);
  font-size: 0.78rem;
}

@keyframes raceMarkerFlow {
  from {
    offset-distance: var(--from-distance, 0%);
  }
  to {
    offset-distance: calc(var(--from-distance, 0%) + 100%);
  }
}

@keyframes trackPulse {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -806;
  }
}

.telemetry-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.radio-feed {
  max-height: 300px;
  overflow: auto;
  padding-right: 3px;
}

.sponsor-current {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(245, 194, 75, 0.28);
  border-radius: 8px;
  background: rgba(245, 194, 75, 0.08);
}

.management-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.management-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.compact-card {
  box-shadow: none;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 980px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 58vh;
    padding: 34px 22px;
  }

  .auth-panel {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .main,
  .dashboard-grid,
  .monitor-grid,
  .strategy-grid,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .main {
    padding: 12px;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions .btn {
    flex: 1;
  }

  .section-head,
  .team-name,
  .sponsor-current {
    display: grid;
  }

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

  .track-mini {
    min-height: 260px;
  }

  .standing-row {
    grid-template-columns: 34px minmax(0, 1fr) 52px;
  }

  .standing-row .hide-mobile {
    display: none;
  }

  h1 {
    font-size: 3.3rem;
  }
}
