:root {
  color-scheme: dark;
  --ink: #eef4f1;
  --muted: #9fb0ae;
  --panel: rgba(8, 13, 15, 0.76);
  --panel-strong: rgba(9, 15, 18, 0.92);
  --line: rgba(255, 255, 255, 0.15);
  --accent: #6ee7d8;
  --accent-2: #ffb454;
  --accent-3: #ff6b6b;
  --ok: #9be564;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell,
.stage {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #081012;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

button {
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
}

button.primary {
  color: #071111;
  border-color: rgba(255, 255, 255, 0.46);
  background: linear-gradient(135deg, #eafffb, #6ee7d8 56%, #ffb454);
}

select {
  min-width: 112px;
  appearance: none;
}

input[type="range"] {
  accent-color: var(--accent);
}

.stage {
  position: relative;
  isolation: isolate;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud,
.camera-switch,
.drop-zone,
.timeline-panel,
.legend,
.status-toast {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(120%);
}

.top-left {
  top: 18px;
  left: 18px;
  width: min(620px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 16px 18px;
}

.playground-title-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.playground-title-button:hover {
  transform: none;
  background: transparent;
}

.playground-caret {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #f8fffd, #6ee7d8 58%, #ffb454);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  filter: drop-shadow(0 0 12px rgba(110, 231, 216, 0.4));
}

.playground-title-main,
.playground-title-suffix {
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.playground-title-main {
  color: #9df4e9;
}

.playground-title-suffix {
  color: var(--ink);
}

.scenario-title {
  margin-top: 8px;
  font-size: 1.35rem;
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: 0;
  color: rgba(238, 244, 241, 0.92);
}

.mode-tabs,
.camera-switch {
  display: grid;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
}

.mode-tabs {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.mode-tabs button,
.camera-switch button {
  min-height: 32px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.mode-tabs button:hover,
.camera-switch button:hover {
  transform: none;
}

.mode-tabs button.active,
.camera-switch button.active {
  color: #071111;
  background: linear-gradient(135deg, #f0fffc, #6ee7d8 58%, #ffb454);
}

.file-line {
  display: none;
}

.camera-switch {
  top: 18px;
  right: 18px;
  grid-template-columns: repeat(4, minmax(66px, 1fr));
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  background: var(--panel);
}

.top-right {
  top: 76px;
  right: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
}

.metric {
  min-width: 86px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.045);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
  line-height: 1.1;
  white-space: nowrap;
}

.drop-zone {
  left: 18px;
  bottom: 124px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(560px, calc(100vw - 36px));
  min-height: 52px;
  border-radius: 8px;
  padding: 8px;
}

.drop-zone input {
  display: none;
}

.drop-zone.dragging {
  border-color: rgba(110, 231, 216, 0.8);
  background: rgba(11, 40, 40, 0.84);
}

#dropLabel {
  min-width: 112px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.timeline-panel {
  left: 18px;
  right: 18px;
  bottom: 18px;
  min-height: 72px;
  border-radius: 8px;
  padding: 12px 14px;
}

.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.transport label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.transport label strong {
  min-width: 34px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 760;
}

.transport input[type="range"] {
  width: 150px;
}

.mission-strip {
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.mission-strip span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.mission-strip strong {
  font-size: 0.82rem;
  font-weight: 720;
}

.toggle {
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
}

.toggle input {
  width: 16px;
  height: 16px;
}

.frame-slider {
  width: 100%;
  margin-top: 10px;
}

.controller-controls {
  display: none;
}

.stage[data-mode="controller"] .trajectory-controls,
.stage[data-mode="controller"] .drop-zone {
  display: none;
}

.stage[data-mode="controller"] .controller-controls {
  display: block;
}

.controller-readout {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.controller-readout span {
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

#targetReadout {
  display: none;
}

.legend {
  right: 18px;
  bottom: 124px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 170px;
  max-width: min(260px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.status-toast {
  left: 50%;
  bottom: 194px;
  max-width: min(620px, calc(100vw - 36px));
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-strong);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.status-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 880px) {
  .top-left {
    padding: 14px;
  }

  .playground-title-main,
  .playground-title-suffix {
    font-size: 1.45rem;
  }

  .scenario-title {
    font-size: 1.02rem;
  }

  .camera-switch {
    top: auto;
    right: 18px;
    bottom: 182px;
  }

  .top-right {
    top: auto;
    right: 18px;
    bottom: 236px;
  }

  .legend {
    display: none;
  }
}

@media (max-width: 620px) {
  .drop-zone {
    bottom: 126px;
  }

  .timeline-panel {
    min-height: 96px;
  }

  .camera-switch {
    left: 18px;
    right: auto;
    bottom: 232px;
    width: calc(100vw - 36px);
  }

  .top-right {
    display: none;
  }

  #dropLabel {
    display: none;
  }
}
