.cosmic-courier {
  position: fixed;
  inset: 0;
  z-index: 4000;
  overflow: hidden;
  color: #10244a;
  background: #10234b;
  font-family: Inter, ui-rounded, "Avenir Next", system-ui, sans-serif;
}

.courier-scene,
.courier-scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.courier-topbar {
  position: absolute;
  z-index: 4;
  top: max(14px, env(safe-area-inset-top));
  left: 18px;
  right: 18px;
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 14px;
  pointer-events: none;
}

.courier-topbar button,
.courier-package {
  pointer-events: auto;
}

.courier-back,
.courier-package,
.courier-hud,
.courier-status,
.courier-briefing,
.courier-delivered {
  background: rgba(248, 252, 255, 0.96);
  border: 2px solid rgba(151, 206, 244, 0.85);
  box-shadow: 0 14px 35px rgba(5, 19, 48, 0.25);
}

.courier-back {
  justify-self: start;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 18px;
  color: #16335f;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.courier-title {
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 12px rgba(2, 13, 40, 0.8);
}

.courier-title span,
.courier-title strong {
  display: block;
}

.courier-title span {
  color: #a9e8ff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.courier-title strong {
  font-size: clamp(1.2rem, 3vw, 1.85rem);
}

.courier-package {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 6px 14px;
  border-radius: 18px;
}

.courier-package > b {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #fff;
  background: #2f6fe4;
  font-size: 1.25rem;
}

.courier-package small,
.courier-package strong {
  display: block;
}

.courier-package small {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  color: #4d6689;
}

.courier-package strong {
  font-size: 0.88rem;
}

.courier-briefing,
.courier-delivered {
  position: absolute;
  z-index: 5;
  top: 52%;
  left: 50%;
  width: min(680px, calc(100vw - 32px));
  padding: clamp(22px, 4vw, 38px);
  border-radius: 32px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.courier-kicker,
.courier-delivered > small {
  color: #2964c6;
  font-weight: 950;
  font-size: 0.72rem;
  letter-spacing: 0.17em;
}

.courier-briefing h1,
.courier-delivered h1 {
  margin: 8px 0 20px;
  font-size: clamp(1.55rem, 5vw, 2.6rem);
  line-height: 1.05;
}

.courier-route-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.courier-route-cards button {
  min-height: 112px;
  padding: 12px 8px;
  border: 3px solid #d5e6f7;
  border-radius: 20px;
  color: #18345e;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.courier-route-cards button.selected {
  border-color: #3478ed;
  background: #edf5ff;
  box-shadow: 0 0 0 4px rgba(52, 120, 237, 0.13);
}

.courier-route-cards strong,
.courier-route-cards small {
  display: block;
}

.courier-route-cards strong {
  margin-top: 7px;
  font-size: 1rem;
}

.courier-route-cards small {
  margin-top: 3px;
  color: #4c6689;
}

.courier-planet-dot {
  display: block;
  width: 38px;
  height: 38px;
  margin: auto;
  border-radius: 50%;
  box-shadow: inset -8px -5px 0 rgba(50, 35, 35, 0.14);
}

.courier-mars { background: #e66b43; }
.courier-jupiter { background: linear-gradient(#d89a64 0 25%, #f0d0a0 25% 45%, #aa6650 45% 58%, #e4b47a 58%); }
.courier-saturn { background: #e8cc82; box-shadow: 0 0 0 7px rgba(222, 204, 149, 0.55), inset -8px -5px 0 rgba(50, 35, 35, 0.1); }

.courier-briefing > p,
.courier-delivered > p {
  max-width: 520px;
  margin: 18px auto;
  color: #435f83;
  font-weight: 650;
}

.courier-launch,
.courier-secondary,
.courier-land {
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.courier-launch {
  padding: 0 28px;
  color: #fff;
  background: linear-gradient(135deg, #2464db, #4b92ff);
  box-shadow: 0 8px 0 #174ba8, 0 13px 24px rgba(21, 73, 164, 0.25);
}

.courier-secondary {
  margin-left: 10px;
  padding: 0 22px;
  color: #24466f;
  background: #e9f2fb;
}

.courier-help {
  display: block;
  margin-top: 17px;
  color: #617692;
}

.courier-hud {
  position: absolute;
  z-index: 4;
  top: 92px;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 0;
  border-radius: 18px;
  transform: translateX(-50%);
  overflow: hidden;
}

.courier-hud > div {
  min-width: 110px;
  padding: 8px 16px;
  border-right: 1px solid #d6e5f2;
  text-align: center;
}

.courier-hud > div:last-child { border-right: 0; }
.courier-hud small,
.courier-hud strong { display: block; }
.courier-hud small { color: #58708f; font-size: 0.56rem; font-weight: 900; letter-spacing: 0.12em; }
.courier-hud strong { color: #173a68; font-size: 0.92rem; }

.courier-status {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 112px;
  max-width: min(540px, calc(100vw - 220px));
  padding: 10px 18px;
  border-radius: 16px;
  color: #24466d;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
}

.courier-controls {
  position: absolute;
  z-index: 5;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: end;
  justify-content: space-between;
  pointer-events: none;
}

.courier-dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(2, 52px);
  gap: 6px;
  pointer-events: auto;
}

.courier-dpad button {
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 17px;
  color: #173b69;
  background: rgba(246, 251, 255, 0.94);
  box-shadow: 0 7px 18px rgba(5, 21, 50, 0.25);
  font: 900 1.25rem/1 system-ui;
  touch-action: none;
}

.courier-dpad button:nth-child(1) { grid-column: 2; }
.courier-dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.courier-dpad button:nth-child(3) { grid-column: 2; grid-row: 2; }
.courier-dpad button:nth-child(4) { grid-column: 3; grid-row: 2; }

.courier-flight-note {
  margin-right: 92px;
  padding: 12px 17px;
  border-radius: 16px;
  color: #163861;
  background: rgba(246, 251, 255, 0.94);
  font-weight: 850;
  pointer-events: auto;
}

.courier-land {
  position: relative;
  width: 168px;
  margin-right: 92px;
  overflow: hidden;
  color: #104638;
  background: #d8fff1;
  border: 3px solid #86e6c4;
  pointer-events: auto;
  touch-action: none;
}

.courier-land span { position: relative; z-index: 2; }
.courier-land i {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  height: var(--land-progress);
  background: #70dab4;
  transition: height 100ms linear;
}

.courier-delivery-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 13px;
  border-radius: 50%;
  color: #fff;
  background: #31b984;
  box-shadow: 0 8px 0 #1d825c;
  font-size: 2.4rem;
  font-weight: 950;
}

@media (max-width: 680px) {
  .courier-topbar {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    grid-template-columns: auto 1fr auto;
    gap: 7px;
  }
  .courier-back { min-width: 48px; width: 48px; padding: 0; font-size: 0; }
  .courier-back::before { content: "←"; font-size: 1.35rem; }
  .courier-title span { display: none; }
  .courier-title strong { font-size: 1rem; }
  .courier-package { min-height: 46px; padding: 4px 8px; }
  .courier-package > b { width: 32px; height: 32px; }
  .courier-package span { display: none; }
  .courier-briefing,
  .courier-delivered { top: 51%; padding: 20px 16px; border-radius: 24px; }
  .courier-briefing h1,
  .courier-delivered h1 { margin-bottom: 15px; }
  .courier-route-cards { gap: 7px; }
  .courier-route-cards button { min-height: 98px; padding: 8px 4px; }
  .courier-route-cards small { font-size: 0.68rem; }
  .courier-planet-dot { width: 32px; height: 32px; }
  .courier-help { margin-top: 14px; font-size: 0.73rem; }
  .courier-hud { top: 66px; width: calc(100vw - 16px); grid-template-columns: repeat(4, 1fr); }
  .courier-hud > div { min-width: 0; padding: 7px 3px; }
  .courier-hud small { font-size: 0.47rem; }
  .courier-hud strong { font-size: 0.76rem; }
  .courier-status { bottom: 176px; max-width: calc(100vw - 24px); width: max-content; font-size: 0.78rem; padding: 8px 11px; }
  .courier-controls { right: 10px; left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
  .courier-dpad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); gap: 4px; }
  .courier-dpad button { border-radius: 15px; }
  .courier-flight-note { max-width: 142px; font-size: 0.76rem; text-align: center; transform: translateY(-60px); }
  .courier-land { width: 145px; min-height: 52px; font-size: 0.79rem; transform: translateY(-60px); }
}

@media (prefers-reduced-motion: reduce) {
  .cosmic-courier *,
  .cosmic-courier *::before,
  .cosmic-courier *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
