.greenline-page {
  --racer-bg: #030609;
  --racer-bg-2: #071116;
  --racer-panel: rgba(6, 14, 18, 0.92);
  --racer-line: rgba(124, 255, 178, 0.2);
  --racer-line-strong: rgba(124, 255, 178, 0.42);
  --racer-glow: rgba(124, 255, 178, 0.18);
  --racer-glow-2: rgba(62, 194, 124, 0.26);
  background:
    radial-gradient(circle at top left, rgba(124, 255, 178, 0.15), transparent 28%),
    radial-gradient(circle at bottom right, rgba(124, 255, 178, 0.08), transparent 30%),
    linear-gradient(180deg, #061015 0%, #030609 54%, #020304 100%);
}

.greenline-main {
  width: min(1500px, calc(100% - 28px));
}

.greenline-top {
  grid-template-columns: 1fr;
  align-items: start;
}

.greenline-hero,
.greenline-panel,
.greenline-stage-wrap {
  position: relative;
  overflow: hidden;
}

.greenline-hero::before,
.greenline-panel::before,
.greenline-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(124, 255, 178, 0.08), transparent 40%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 20px);
  opacity: 0.7;
}

.greenline-hero > *,
.greenline-panel > *,
.greenline-stage > * {
  position: relative;
  z-index: 1;
}

.greenline-hero {
  background:
    linear-gradient(180deg, rgba(10, 22, 28, 0.96), rgba(5, 10, 14, 0.92)),
    linear-gradient(135deg, rgba(124, 255, 178, 0.08), transparent 48%);
}

.greenline-hero p {
  max-width: 42rem;
}

.greenline-rule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.greenline-rule-row .chip {
  border-color: var(--racer-line);
  background: rgba(124, 255, 178, 0.08);
}

.greenline-panel {
  display: grid;
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(9, 17, 22, 0.96), rgba(4, 8, 11, 0.94)),
    linear-gradient(135deg, rgba(124, 255, 178, 0.06), transparent 48%);
}

.greenline-panel h3,
.greenline-subhead h4 {
  margin: 0;
}

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

.greenline-subpanel {
  border: 1px solid var(--racer-line);
  border-radius: 14px;
  padding: 12px;
  background: var(--racer-panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.greenline-subhead {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.greenline-subhead p {
  margin: 0;
  max-width: 21rem;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.greenline-race-list,
.greenline-parts-list {
  display: grid;
  gap: 10px;
}

.greenline-race-btn {
  border: 1px solid var(--racer-line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(10, 18, 22, 0.95);
  color: #f0f7f2;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.greenline-race-btn:hover {
  transform: translateY(-1px);
  border-color: var(--racer-line-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.greenline-race-btn.is-selected {
  border-color: rgba(124, 255, 178, 0.55);
  background: rgba(9, 24, 17, 0.98);
  box-shadow: 0 0 0 1px rgba(124, 255, 178, 0.18), 0 18px 36px rgba(0, 0, 0, 0.22);
}

.greenline-race-btn.is-locked,
.greenline-race-btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.greenline-race-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 15px;
}

.greenline-race-meta,
.greenline-race-blurb {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.greenline-stat-list {
  display: grid;
  gap: 10px;
}

.greenline-stat-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.greenline-stat-row strong {
  text-align: right;
  color: var(--accent);
}

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

.greenline-stat-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(78, 212, 137, 0.48), rgba(124, 255, 178, 0.95));
  box-shadow: 0 0 18px rgba(124, 255, 178, 0.24);
}

.greenline-part-card {
  border: 1px solid var(--racer-line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(10, 17, 22, 0.95);
  display: grid;
  gap: 10px;
}

.greenline-part-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.greenline-part-head h5,
.greenline-part-head p {
  margin: 0;
}

.greenline-part-head h5 {
  font-size: 15px;
}

.greenline-part-head p,
.greenline-part-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.greenline-part-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.greenline-part-card button {
  width: 100%;
  justify-content: center;
}

.greenline-part-card.is-max {
  border-color: rgba(124, 255, 178, 0.36);
  background: rgba(9, 24, 17, 0.98);
}

.greenline-stage-wrap {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    linear-gradient(135deg, rgba(124, 255, 178, 0.1), rgba(8, 26, 16, 0.22));
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.34);
}

.greenline-stage {
  isolation: isolate;
  background:
    radial-gradient(circle at top, rgba(124, 255, 178, 0.08), transparent 34%),
    linear-gradient(180deg, #04090c 0%, #020406 100%);
}

.greenline-stage canvas {
  position: relative;
  z-index: 0;
  backface-visibility: hidden;
  background: linear-gradient(180deg, #050a0d, #020304);
  transform: translateZ(0);
}

.greenline-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(124, 255, 178, 0.08), rgba(124, 255, 178, 0.02) 34%, transparent 72%);
  opacity: 0.22;
}

.greenline-stage-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.greenline-stage-console,
.greenline-garage-shell {
  pointer-events: auto;
}

.greenline-stage-console {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.greenline-stage-console-copy {
  display: grid;
  gap: 8px;
  max-width: min(520px, 48vw);
}

.greenline-stage-status {
  margin: 0;
  min-height: 44px;
  border-color: rgba(124, 255, 178, 0.2);
  background: rgba(3, 8, 10, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.greenline-stage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
  margin: 0;
  max-width: min(520px, 54vw);
}

.greenline-stage-controls .btn {
  min-height: 42px;
  backdrop-filter: blur(10px);
}

.greenline-garage-shell {
  position: absolute;
  top: 112px;
  right: 16px;
  bottom: 16px;
  width: min(430px, calc(100% - 32px));
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 17, 22, 0.92), rgba(4, 8, 11, 0.9)),
    linear-gradient(135deg, rgba(124, 255, 178, 0.08), transparent 48%);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateX(28px);
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.greenline-stage[data-garage-open="true"] .greenline-garage-shell {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.greenline-garage-shell-bar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 0;
}

.greenline-garage-shell-title {
  display: grid;
  gap: 4px;
}

.greenline-garage-shell-title strong {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.greenline-garage-shell-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.greenline-garage-shell-scroll {
  height: calc(100% - 64px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.greenline-garage-shell-scroll::-webkit-scrollbar {
  width: 10px;
}

.greenline-garage-shell-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(124, 255, 178, 0.18);
}

.greenline-stage[data-mode="running"] .greenline-garage-shell,
.greenline-stage[data-mode="finish"] .greenline-garage-shell {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
}

.greenline-canvas-hud {
  position: absolute;
  top: 118px;
  left: 14px;
  right: auto;
  display: flex;
  width: min(250px, calc(100% - 32px));
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 2;
}

.greenline-canvas-chip {
  min-width: 120px;
  border: 1px solid rgba(124, 255, 178, 0.18);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(3, 8, 10, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.greenline-canvas-chip span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.greenline-canvas-chip strong {
  font-size: 15px;
  color: #ebfff1;
}

.greenline-overlay-card {
  max-width: 560px;
  background:
    radial-gradient(circle at top, rgba(124, 255, 178, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(8, 16, 20, 0.98), rgba(3, 6, 8, 0.98));
  pointer-events: auto;
}

.greenline-overlay-stats {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.greenline-overlay-stats article {
  border: 1px solid var(--racer-line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.greenline-overlay-stats span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.greenline-overlay-stats strong {
  font-size: 15px;
  color: #ebfff1;
}

.greenline-overlay-tools {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.greenline-touch {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.greenline-touch button {
  background: rgba(10, 19, 24, 0.96);
}

.greenline-stage .stage-overlay {
  z-index: 4;
}

.greenline-stage[data-mode="garage"] .stage-overlay {
  place-items: start;
  justify-items: start;
  padding: 112px min(462px, 34vw) 16px 16px;
  background: linear-gradient(90deg, rgba(5, 10, 12, 0.64) 0%, rgba(5, 10, 12, 0.44) 26%, rgba(5, 10, 12, 0.12) 48%, transparent 66%);
  pointer-events: none;
}

.greenline-stage[data-mode="garage"] .greenline-overlay-card {
  width: min(420px, calc(100vw - 64px));
}

.greenline-stage[data-mode="paused"] .stage-overlay,
.greenline-stage[data-mode="results"] .stage-overlay,
.greenline-stage[data-mode="finish"] .stage-overlay {
  pointer-events: auto;
}

@media (max-width: 1280px) {
  .greenline-hud-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .greenline-stage-console {
    flex-direction: column;
  }

  .greenline-stage-console-copy,
  .greenline-stage-controls {
    max-width: none;
  }

  .greenline-stage-controls {
    justify-content: start;
  }
}

@media (max-width: 820px) {
  .greenline-stage[data-mode="garage"] .stage-overlay {
    padding: 146px 12px 12px 12px;
    background: linear-gradient(180deg, rgba(5, 10, 12, 0.72) 0%, rgba(5, 10, 12, 0.44) 24%, rgba(5, 10, 12, 0.08) 44%, transparent 60%);
  }

  .greenline-stage[data-mode="garage"] .greenline-overlay-card {
    width: min(360px, calc(100vw - 24px));
  }

  .greenline-stage-console {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .greenline-stage-status {
    min-height: 0;
  }

  .greenline-garage-shell {
    top: 146px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  .greenline-canvas-hud {
    top: auto;
    bottom: 98px;
    left: 12px;
    width: min(280px, calc(100% - 24px));
  }

  .greenline-canvas-chip {
    min-width: calc(50% - 6px);
  }

  .greenline-overlay-stats {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .greenline-stage[data-mode="garage"] .stage-overlay {
    padding-top: 188px;
  }

  .greenline-stage[data-mode="garage"] .greenline-overlay-card {
    width: min(100%, calc(100vw - 24px));
  }

  .greenline-main {
    display: flex;
    flex-direction: column;
  }

  .greenline-stage-wrap {
    order: 1;
  }

  .greenline-top {
    order: 2;
  }

  .greenline-main {
    width: min(100%, calc(100% - 20px));
  }

  .greenline-hud-list {
    grid-template-columns: 1fr 1fr;
  }

  .greenline-stat-row {
    grid-template-columns: 66px minmax(0, 1fr) 38px;
    gap: 8px;
  }

  .greenline-canvas-chip {
    min-width: calc(50% - 4px);
    padding: 7px 8px;
  }

  .greenline-stage-controls .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .greenline-garage-shell {
    top: 188px;
  }

  .greenline-garage-shell-scroll {
    padding: 12px;
  }

  .greenline-canvas-hud {
    bottom: 114px;
    gap: 8px;
  }
}
