.rail-courier-shell {
  position: relative;
  min-height: clamp(430px, 62vw, 720px);
  margin-top: 18px;
  border: 1px solid color-mix(in srgb, var(--rail-color, #62d6ff) 52%, #1d1d1d);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--rail-color, #62d6ff) 22%, transparent), transparent 31%),
    linear-gradient(180deg, #080b0e 0%, #11140f 48%, #070809 100%);
  touch-action: manipulation;
}

.rail-courier-shell[hidden] {
  display: none;
}

.rail-courier-scene {
  position: absolute;
  inset: 0;
  user-select: none;
}

.rail-courier-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(0deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 48px 48px;
  mask-image: radial-gradient(circle at 50% 50%, black 20%, transparent 75%);
  opacity: 0.44;
}

.rail-courier-hud {
  position: absolute;
  inset: 16px 16px auto;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  color: #f7f1df;
  pointer-events: none;
}

.rail-courier-hud strong {
  display: block;
  margin-top: 4px;
  max-width: 44ch;
  color: var(--rail-color, #62d6ff);
  font-size: clamp(1.35rem, 3.6vw, 3rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 0 22px color-mix(in srgb, var(--rail-color, #62d6ff) 42%, transparent);
}

.rail-courier-kicker {
  color: rgba(247, 241, 223, 0.62);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rail-courier-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.rail-courier-controls button {
  min-height: 38px;
  padding: 0 12px;
  border-color: color-mix(in srgb, var(--rail-color, #62d6ff) 44%, #37322b);
  background: rgba(10, 12, 14, 0.86);
  color: #f7f1df;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.rail-courier-svg {
  position: absolute;
  inset: clamp(34px, 8vw, 64px) 0 36px;
  width: 100%;
  height: calc(100% - clamp(70px, 13vw, 112px));
  overflow: visible;
}

.rail-courier-track-shadow,
.rail-courier-track,
.rail-courier-trail {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-courier-track-shadow {
  stroke: rgba(0, 0, 0, 0.72);
  stroke-width: 34;
}

.rail-courier-track {
  stroke: rgba(247, 241, 223, 0.24);
  stroke-width: 12;
}

.rail-courier-trail {
  filter: url(#railCourierGlow);
  stroke: var(--rail-color, #62d6ff);
  stroke-width: 7;
}

.rail-courier-car {
  color: var(--rail-color, #62d6ff);
  filter: url(#railCourierGlow);
}

.rail-courier-car rect {
  fill: currentColor;
  stroke: rgba(255, 255, 255, 0.76);
  stroke-width: 2;
}

.rail-courier-car circle:first-child {
  fill: color-mix(in srgb, currentColor 28%, transparent);
}

.rail-courier-car circle:not(:first-child) {
  fill: #070809;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 2;
}

.rail-courier-station {
  cursor: pointer;
  color: var(--station-color);
}

.rail-courier-station circle {
  fill: color-mix(in srgb, currentColor 22%, #080b0e);
  stroke: currentColor;
  stroke-width: 4;
  filter: url(#railCourierGlow);
  transition: opacity 160ms ease, r 160ms ease;
}

.rail-courier-station text {
  fill: rgba(247, 241, 223, 0.8);
  font-size: 20px;
  font-weight: 900;
  text-anchor: middle;
}

.rail-courier-station[data-enabled="false"] {
  opacity: 0.28;
}

.rail-courier-station[data-current="true"] circle {
  r: 24;
  fill: currentColor;
}

.rail-courier-platform {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  width: min(92%, 760px);
  transform: translateX(-50%);
  color: rgba(247, 241, 223, 0.74);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.rail-courier-shell[data-direction="reverse"] .rail-courier-track {
  stroke-dasharray: 10 14;
}

.rail-courier-shell[data-speed="rush"] {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rail-color, #62d6ff) 24%, transparent), 0 0 44px color-mix(in srgb, var(--rail-color, #62d6ff) 22%, transparent);
}

@media (max-width: 760px) {
  .rail-courier-shell {
    min-height: 500px;
  }

  .rail-courier-hud {
    flex-direction: column;
    gap: 10px;
  }

  .rail-courier-controls {
    justify-content: flex-start;
  }

  .rail-courier-svg {
    inset: 110px -70px 46px;
    width: calc(100% + 140px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail-courier-trail {
    stroke-dasharray: none;
  }
}
