:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #111827;
  --panel-2: #172033;
  --text: #f8fafc;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.12);
  --green: #76d36b;
  --lime: #b8f35f;
  --yellow: #ffd166;
  --red: #ff5a67;
  --cyan: #65d9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 10%, #153a48 0, transparent 28%),
    linear-gradient(135deg, #09121f 0%, #111827 48%, #0d1615 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: center;
  padding: 18px 0;
}

.stage-panel,
.control-panel {
  background: rgba(17, 24, 39, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.stage-panel {
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--lime);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
}

.status-pill {
  min-width: 92px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(101, 217, 255, 0.12);
  color: var(--cyan);
  text-align: center;
  font-size: 13px;
  border: 1px solid rgba(101, 217, 255, 0.28);
}

.sky {
  position: relative;
  height: min(66vh, 620px);
  min-height: 430px;
  overflow: hidden;
  background: radial-gradient(circle at 72% 18%, rgba(255, 209, 102, 0.22), transparent 18%),
    linear-gradient(180deg, #07172b 0%, #10243b 58%, #18312a 100%);
}

.stars {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.82) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(184, 243, 95, 0.7) 1px, transparent 1.4px);
  background-size: 78px 84px, 128px 118px;
  background-position: 10px 20px, 40px 4px;
  opacity: 0.7;
}

.moon {
  position: absolute;
  right: clamp(28px, 8vw, 86px);
  top: clamp(28px, 7vw, 74px);
  display: grid;
  place-items: center;
  gap: 4px;
  filter: drop-shadow(0 0 28px rgba(255, 209, 102, 0.45));
}

.moon span {
  font-size: clamp(72px, 9vw, 118px);
}

.moon small {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 800;
}

.flight-path {
  position: absolute;
  left: 12%;
  bottom: 19%;
  width: 70%;
  height: 55%;
  border-top: 3px dashed rgba(184, 243, 95, 0.36);
  border-radius: 55% 80% 0 0;
  transform: rotate(-14deg);
}

.planet {
  position: absolute;
  left: clamp(18px, 6vw, 70px);
  bottom: clamp(18px, 5vw, 52px);
  font-size: clamp(74px, 10vw, 124px);
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.38));
}

.ship {
  position: absolute;
  left: 18%;
  bottom: 20%;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  transition: left 160ms linear, bottom 160ms linear, transform 160ms linear, filter 180ms ease;
  transform: rotate(-18deg);
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.36));
}

.pod {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 33%, #efffb8 0 18%, #80cc52 19% 55%, #2e7a44 56% 100%);
  border: 5px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset -10px -12px 0 rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(101, 217, 255, 0.13);
  font-size: 50px;
}

.flame {
  position: absolute;
  left: -18px;
  bottom: 14px;
  font-size: 34px;
  transform: rotate(72deg);
  opacity: 0;
}

.ship.flying .flame {
  opacity: 1;
  animation: flicker 120ms infinite alternate;
}

.ship.crashed {
  filter: drop-shadow(0 0 24px rgba(255, 90, 103, 0.65));
}

.multiplier {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(64px, 12vw, 150px);
  font-weight: 900;
  color: var(--text);
  text-shadow: 0 6px 26px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.round-state {
  position: absolute;
  left: 20px;
  top: 20px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(8, 17, 31, 0.6);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.history {
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.history span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.history span.win {
  color: var(--lime);
}

.history span.crash {
  color: var(--red);
}

.control-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.balance-card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 13px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.balance-card span,
label {
  color: var(--muted);
  font-size: 13px;
}

.balance-card strong {
  font-size: 22px;
  color: var(--lime);
}

label {
  display: grid;
  gap: 7px;
}

input {
  width: 100%;
  padding: 12px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #243047;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #2f3f5d;
}

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

.cashout {
  background: linear-gradient(180deg, #b8f35f 0%, #62bd4e 100%);
  color: #07120d;
}

.cashout:hover:not(:disabled) {
  background: linear-gradient(180deg, #d7ff7f 0%, #74d65f 100%);
}

.result {
  min-height: 68px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.35;
}

.result.good {
  color: var(--lime);
}

.result.bad {
  color: var(--red);
}

.debug {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

code {
  min-height: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px;
  border-radius: 6px;
  background: #080d16;
  color: var(--cyan);
}

@keyframes flicker {
  from {
    transform: rotate(68deg) scale(0.88);
  }
  to {
    transform: rotate(76deg) scale(1.08);
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .sky {
    height: 55vh;
    min-height: 360px;
  }

  .control-panel {
    margin-bottom: 18px;
  }
}
