:root {
  color-scheme: dark;
  --bg: #101210;
  --panel: #171a17;
  --panel-raised: #1d211d;
  --line: #343b34;
  --muted: #929d92;
  --text: #f2f5ec;
  --acid: #c6f432;
  --acid-dark: #819f20;
  --orange: #ff7849;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 72% 2%, rgba(198, 244, 50, 0.09), transparent 28rem),
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 24px 24px, 24px 24px, auto;
}

button, input { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 28px;
}

.topbar, .connect-panel, .actions, .bank-heading, .servo-title,
.control > span, .button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--acid);
  font: 700 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.lede, .bank-heading p, .connect-panel p, .mix-note p, .actions p {
  color: var(--muted);
}

.lede { margin-bottom: 0; font-size: 1.05rem; }

.connection {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(23, 26, 23, 0.85);
  font: 600 0.82rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5e675e;
  box-shadow: 0 0 0 4px rgba(94, 103, 94, 0.13);
}

.connected .status-dot {
  background: var(--acid);
  box-shadow: 0 0 0 4px rgba(198, 244, 50, 0.13);
}

.connect-panel {
  margin: 34px 0 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--acid);
  border-radius: var(--radius);
  background: linear-gradient(105deg, rgba(198, 244, 50, 0.065), transparent 55%), var(--panel);
}

.connect-panel h2, .mix-note h2 { margin-bottom: 5px; font-size: 1rem; }
.connect-panel p, .mix-note p { margin-bottom: 0; font-size: 0.9rem; }
.mix-note .scale-note { margin-top: 7px; color: #c0c8bd; font-size: 0.78rem; }

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel-raised);
  font-weight: 750;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); border-color: #657065; }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: 0.38; cursor: not-allowed; }
.button-primary { border-color: var(--acid); color: #11150a; background: var(--acid); }
.button-primary:hover:not(:disabled) { background: #d5ff4a; border-color: #d5ff4a; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.bank {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 26, 23, 0.92);
}

.bank-heading { margin-bottom: 14px; }
.bank-heading h2 { margin-bottom: 3px; font-size: 1.15rem; }
.bank-heading p { margin-bottom: 0; font-size: 0.82rem; }
.bank-heading-right { text-align: right; }

.bank-number {
  color: var(--acid);
  font: 800 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.14em;
}

.servo-grid { display: grid; gap: 12px; }

.servo-card {
  padding: 16px;
  border: 1px solid #2c322c;
  border-radius: 13px;
  background: var(--panel-raised);
}

.servo-title { margin-bottom: 15px; }
.servo-title h3 { margin: 0; font-size: 0.95rem; }
.servo-channel { color: #6f796f; font: 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.control { display: block; }
.control + .control { margin-top: 14px; }
.control > span { margin-bottom: 7px; font-size: 0.78rem; }
.control b { font-weight: 650; }
.control output { color: var(--acid); font: 700 0.78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 7px 0;
  accent-color: var(--acid);
  cursor: pointer;
}

input[type="range"]:disabled { cursor: not-allowed; opacity: 0.45; }

.drive-pad { display: grid; gap: 9px; align-items: stretch; }

.drive-middle {
  display: grid;
  grid-template-columns: 62px minmax(100px, 1fr) 62px;
  gap: 9px;
  align-items: stretch;
}

.drive-button, .drive-stop {
  border: 1px solid #465046;
  border-radius: 13px;
  color: #cad2c7;
  background: linear-gradient(180deg, #242924, #191d19);
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, color 120ms ease,
    background 120ms ease, box-shadow 120ms ease;
}

.drive-button {
  min-height: 52px;
  padding: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.72rem;
}

.drive-button span[aria-hidden="true"] { color: var(--acid); font-size: 1rem; }
.drive-left, .drive-right { min-height: 156px; display: grid; place-content: center; gap: 7px; }
.drive-button:hover:not(:disabled), .drive-stop:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--acid-dark);
}
.drive-button:disabled, .drive-stop:disabled { opacity: 0.34; cursor: not-allowed; }
.drive-button.is-active {
  border-color: var(--acid);
  color: #11150a;
  background: var(--acid);
  box-shadow: 0 0 0 4px rgba(198, 244, 50, 0.11);
}
.drive-button.is-active span[aria-hidden="true"] { color: #11150a; }

.chassis-stage {
  position: relative;
  display: grid;
  min-height: 156px;
  place-items: center;
}

.chassis { display: grid; place-items: center; }

.chassis-body {
  display: grid;
  grid-template-columns: repeat(2, 20px);
  gap: 25px 15px;
  padding: 18px 10px;
  border: 2px solid #414a41;
  border-radius: 20px;
}

.drive-stop {
  position: absolute;
  z-index: 1;
  min-width: 74px;
  min-height: 46px;
  padding: 0 12px;
  border-color: #7a4637;
  color: #ffd8cb;
  background: #3a2019;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.drive-stop.is-active {
  border-color: var(--orange);
  color: #1b0c08;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 120, 73, 0.13);
}

.preview-state {
  min-height: 2.5em;
  margin: 2px 4px 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
}

.chassis-body span {
  width: 20px;
  height: 46px;
  border: 2px solid #596359;
  border-radius: 8px;
  background: repeating-linear-gradient(0deg, #2c322c 0 5px, #171a17 5px 9px);
}

.mix-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  padding: 17px 20px;
  border: 1px dashed #465046;
  border-radius: var(--radius);
}

.mix-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--acid);
  background: rgba(198, 244, 50, 0.1);
  font-size: 1.3rem;
}

.actions {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.actions p { margin: 0; font-size: 0.86rem; }
.button-row { justify-content: flex-end; }
.safety { margin: 14px 3px 0; color: #707970; font-size: 0.76rem; text-align: center; }

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 560px); padding-top: 24px; }
  .topbar { align-items: flex-start; }
  .connection { padding: 9px 10px; }
  .connection span:last-child { display: none; }
  .layout { grid-template-columns: 1fr; }
  .drive-pad { grid-row: 2; width: min(100%, 350px); margin: 2px auto; }
  .connect-panel, .actions { align-items: stretch; flex-direction: column; }
  .connect-panel .button { width: 100%; }
  .button-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .button-row .button-primary { grid-column: 1 / -1; grid-row: 1; }
  .button { padding-inline: 12px; }
}

@media (max-width: 420px) {
  h1 { font-size: 2.2rem; }
  .bank { padding: 14px; }
  .servo-card { padding: 14px; }
}
