:root {
  color-scheme: dark;
  --bg: #07111f;
  --card: rgba(18, 34, 52, 0.82);
  --line: rgba(159, 184, 208, 0.17);
  --text: #eef6ff;
  --muted: #8ea4b8;
  --cyan: #52e5d4;
  --cyan-dark: #133f46;
  --amber: #ffc857;
  --red: #ff5f67;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 0%, rgba(34, 133, 151, .28), transparent 36rem),
    radial-gradient(circle at 0% 70%, rgba(82, 229, 212, .09), transparent 30rem),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled, .busy button { cursor: wait; opacity: .66; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
header { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px;
  color: #04151a; background: var(--cyan); font-weight: 900; font-size: 24px;
  box-shadow: 0 0 35px rgba(82,229,212,.24);
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(20px, 3vw, 30px); letter-spacing: -.03em; }
h2 { font-size: 20px; letter-spacing: -.02em; }
.eyebrow, .kicker { color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.eyebrow { margin-bottom: 4px; }
.connection { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.connection span { width: 9px; height: 9px; border-radius: 50%; background: #596879; box-shadow: 0 0 0 5px rgba(89,104,121,.12); }
.connection.online { color: var(--cyan); }
.connection.online span { background: var(--cyan); box-shadow: 0 0 0 5px rgba(82,229,212,.12); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 22px 70px rgba(0,0,0,.18); backdrop-filter: blur(14px); }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 28px 30px; }
.hero h2 { margin: 7px 0 8px; font-size: clamp(22px, 4vw, 34px); }
.hero p:last-child { color: var(--muted); }
button {
  border: 1px solid transparent; border-radius: 13px; padding: 13px 17px;
  color: #061317; background: var(--cyan); font-weight: 800; transition: transform .16s, filter .16s, border-color .16s;
}
button:hover { transform: translateY(-1px); filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button.outline { color: var(--text); background: transparent; border-color: var(--line); }
button.stop { min-width: 160px; color: white; background: var(--red); font-size: 16px; box-shadow: 0 10px 30px rgba(255,95,103,.22); }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 14px 0; }
.metric { padding: 18px 20px; }
.metric span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.metric strong { font-size: 18px; }
.workspace { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(420px, 1.15fr); gap: 14px; }
.controls, .telemetry { padding: 26px; }
.section-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 17px; }
.section-title h2 { margin-top: 4px; }
.section-title small { color: var(--muted); }
.section-title.split { margin-top: 30px; }
.button-grid { display: grid; gap: 10px; }
.button-grid.two { grid-template-columns: repeat(2, 1fr); }
.dpad { display: grid; grid-template: repeat(3, 58px) / repeat(3, 1fr); gap: 9px; margin: 4px 0 12px; }
.dpad .up { grid-area: 1 / 2; }
.dpad .left { grid-area: 2 / 1; }
.dpad .center { grid-area: 2 / 2; color: white; background: rgba(255,95,103,.22); border-color: rgba(255,95,103,.55); }
.dpad .right { grid-area: 2 / 3; }
.dpad .down { grid-area: 3 / 2; }
.speed-buttons { margin-top: 14px; }
.velocity { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.velocity div { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(1,11,20,.27); }
.velocity span, .velocity small { display: block; color: var(--muted); font-size: 11px; }
.velocity strong { display: block; margin: 5px 0 2px; color: var(--cyan); font-size: 25px; font-variant-numeric: tabular-nums; }
#textCommand { margin-top: 28px; }
#textCommand label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
#textCommand > p { margin-top: 8px; color: var(--muted); font-size: 12px; }
.command-row { display: flex; gap: 9px; }
input { width: 100%; min-width: 0; padding: 13px 14px; color: var(--text); background: rgba(1,11,20,.5); border: 1px solid var(--line); border-radius: 12px; outline: none; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(82,229,212,.1); }
.log-title { margin-top: 28px; }
.event-log { max-height: 240px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.event-log li { display: grid; grid-template-columns: 78px 1fr; gap: 8px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13px; }
.event-log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-log .empty { color: var(--muted); }
dialog { width: min(420px, calc(100% - 32px)); padding: 28px; color: var(--text); background: #102237; border: 1px solid var(--line); border-radius: 20px; }
dialog::backdrop { background: rgba(2,8,15,.8); backdrop-filter: blur(8px); }
dialog h2 { margin: 8px 0; font-size: 26px; }
dialog p:not(.kicker) { color: var(--muted); line-height: 1.55; }
dialog input { margin: 20px 0 10px; }
dialog button { width: 100%; }
#toast { position: fixed; left: 50%; bottom: 24px; z-index: 9; max-width: calc(100% - 32px); padding: 12px 18px; color: #061317; background: var(--cyan); border-radius: 12px; font-weight: 800; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { color: white; background: var(--red); }
@media (max-width: 800px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .hero { align-items: stretch; flex-direction: column; }
  button.stop { width: 100%; }
}
@media (max-width: 480px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 18px; }
  header { align-items: flex-start; }
  .connection { position: absolute; right: 14px; top: 76px; }
  .hero, .controls, .telemetry { padding: 20px; }
  .velocity { grid-template-columns: 1fr; }
}

