/* ============================================================================
   Body Orchestra — interface
   A dark instrument panel: hairlines, mono telemetry, neon that only lights up
   where something is happening. The stage is the star; the chrome stays quiet.
   ========================================================================== */

:root {
  --bg: #04060d;
  --bg-2: #070b16;
  --panel: rgba(11, 17, 31, 0.72);
  --panel-solid: #0a101d;
  --line: rgba(126, 196, 255, 0.14);
  --line-strong: rgba(126, 196, 255, 0.28);

  --cyan: #38f2ff;
  --magenta: #ff4de0;
  --lime: #a6ff3d;
  --amber: #ffb03d;
  --red: #ff5470;

  --text: #e8f2ff;
  --dim: #90a8c6;
  --faint: #5d7492;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;

  --deck-w: 372px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Two slow-drifting light sources so the black never looks flat. */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 18% 12%, rgba(56, 242, 255, 0.14), transparent 70%),
    radial-gradient(34% 38% at 84% 82%, rgba(255, 77, 224, 0.12), transparent 70%),
    radial-gradient(50% 50% at 50% 50%, rgba(10, 20, 40, 0.6), transparent 75%);
  animation: drift 26s ease-in-out infinite alternate;
}

@keyframes drift {
  to {
    transform: translate3d(2%, -2%, 0) scale(1.06);
  }
}

#app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

/* ============================ header / HUD ============================== */

.hud {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 13, 25, 0.9), rgba(6, 10, 20, 0.6));
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  gap: 3px;
  flex: none;
}

.mark span {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--cyan);
  animation: markPulse 1.8s ease-in-out infinite;
}

.mark span:nth-child(2) {
  background: var(--magenta);
  animation-delay: 0.25s;
}
.mark span:nth-child(3) {
  background: var(--lime);
  animation-delay: 0.5s;
}
.mark span:nth-child(4) {
  background: var(--amber);
  animation-delay: 0.75s;
}

@keyframes markPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.86); }
  50% { opacity: 1; transform: scale(1.08); }
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-text h1 em {
  font-style: normal;
  font-weight: 300;
  color: var(--cyan);
}

.brand-text p {
  margin: 1px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

.transport {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(12, 20, 36, 0.7);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, color 0.16s;
}

.chip b {
  font-weight: 600;
}

.chip:hover:not(:disabled) {
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(56, 242, 255, 0.2), 0 0 22px rgba(56, 242, 255, 0.18);
}

.chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.chip.ghost {
  padding: 8px 12px;
  min-width: 36px;
  justify-content: center;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.chip.recording {
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 24px rgba(255, 84, 112, 0.3);
}

.chip.recording .rec-dot {
  background: var(--red);
  animation: recBlink 1s steps(2) infinite;
}

@keyframes recBlink {
  50% { opacity: 0.15; }
}

.telemetry {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.stat span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat b {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.energy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 96px;
}

.energy > span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.energy-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(126, 196, 255, 0.12);
  overflow: hidden;
}

.energy-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lime) 55%, var(--magenta));
  transition: width 0.1s linear;
}

/* =============================== layout ================================ */

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--deck-w);
  gap: 18px;
  padding: 18px 20px 20px;
  min-height: 0;
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

/* ================================ stage ================================= */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: #03050b;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 24px 70px rgba(0, 0, 0, 0.6);
}

/* The feed is drawn into the canvas, but the element must stay live and on
   screen or some browsers throttle frame delivery. */
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

#stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.frame-chrome {
  position: absolute;
  inset: 12px;
  pointer-events: none;
}

.frame-chrome .c {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(56, 242, 255, 0.45);
}

.frame-chrome .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.frame-chrome .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.frame-chrome .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.frame-chrome .br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.chord-badge {
  position: absolute;
  left: 20px;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 16px 10px;
  border: 1px solid rgba(56, 242, 255, 0.35);
  border-radius: var(--r-md);
  background: rgba(5, 9, 18, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.chord-badge[hidden] {
  display: none;
}

.chord-badge .chord-label,
.chord-badge em {
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

.chord-badge b {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--cyan);
}

.chord-badge.pulse {
  animation: chordFlash 0.5s ease-out;
}

@keyframes chordFlash {
  0% {
    border-color: var(--cyan);
    box-shadow: 0 0 30px rgba(56, 242, 255, 0.45);
  }
  100% {
    border-color: rgba(56, 242, 255, 0.35);
    box-shadow: none;
  }
}

.readout {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(5, 9, 18, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

/* The class sets `display: flex`, which would otherwise beat the hidden attribute. */
.readout[hidden] {
  display: none;
}

.readout-note {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  min-width: 62px;
}

.readout-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.readout-meta b {
  font-size: 12px;
  font-weight: 600;
}

.readout-meta em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, 84%);
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(5, 9, 18, 0.85);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--cyan);
}

.banner.warn {
  border-color: rgba(255, 176, 61, 0.5);
  color: var(--amber);
}

.stage-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.stage-foot .spacer {
  flex: 1;
}

.stage-foot b {
  color: var(--dim);
}

/* =============================== the gate =============================== */

.gate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(70% 70% at 50% 40%, rgba(6, 12, 26, 0.82), rgba(2, 4, 10, 0.96));
  backdrop-filter: blur(6px);
  overflow: auto;
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(620px, 100%);
  padding: 34px 36px 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(13, 21, 38, 0.9), rgba(7, 11, 22, 0.92));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
}

.gate-card h2 {
  margin: 0 0 12px;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.intro {
  margin: 0 0 20px;
  color: var(--dim);
  max-width: 52ch;
}

.steps {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 10px;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--dim);
  font-size: 13.5px;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  border: 1px solid rgba(56, 242, 255, 0.35);
  border-radius: 4px;
  padding: 2px 5px;
  flex: none;
}

.steps li b {
  color: var(--text);
  font-weight: 600;
}

.fineprint {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--faint);
  max-width: 56ch;
}

/* ============================== buttons ================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: rgba(14, 22, 40, 0.8);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s, color 0.16s;
}

.btn:hover:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(56, 242, 255, 0.16);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.small {
  padding: 6px 11px;
  font-size: 10px;
}

.btn.primary {
  border-color: rgba(56, 242, 255, 0.6);
  background: linear-gradient(180deg, rgba(56, 242, 255, 0.16), rgba(56, 242, 255, 0.05));
  color: #eaffff;
}

.btn.primary:hover:not(:disabled) {
  box-shadow: 0 0 28px rgba(56, 242, 255, 0.32);
}

.btn.danger:hover:not(:disabled) {
  border-color: var(--red);
  box-shadow: 0 0 20px rgba(255, 84, 112, 0.2);
}

.btn.big {
  position: relative;
  flex-direction: column;
  gap: 2px;
  padding: 16px 40px;
  font-size: 14px;
  letter-spacing: 0.3em;
}

.btn.big em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(234, 255, 255, 0.6);
}

.btn.big::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(56, 242, 255, 0.3);
  border-radius: 12px;
  animation: halo 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes halo {
  0% { opacity: 0.7; transform: scale(0.98); }
  70%, 100% { opacity: 0; transform: scale(1.06); }
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row.wrap {
  flex-wrap: wrap;
}

.row.tight {
  gap: 6px;
}

/* ============================ error panel =============================== */

.gate-error {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid rgba(255, 84, 112, 0.4);
  border-radius: var(--r-md);
  background: rgba(255, 84, 112, 0.06);
}

.gate-error h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #ffb3c0;
}

.gate-error p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--dim);
}

.gate-error pre {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.4);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow: auto;
}

/* ============================== loading ================================= */

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 16px;
  align-content: center;
  background: rgba(3, 6, 14, 0.78);
  backdrop-filter: blur(4px);
  z-index: 3;
}

.loading[hidden] {
  display: none;
}

.loading p {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 242, 255, 0.18);
  border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================ deck ================================== */

.deck {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.tab {
  padding: 13px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.tab:hover {
  color: var(--dim);
  background: rgba(126, 196, 255, 0.04);
}

.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: rgba(56, 242, 255, 0.06);
}

.page {
  display: none;
  padding: 18px;
  overflow-y: auto;
  min-height: 0;
}

.page.active {
  display: block;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 22px 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.section-title:first-child {
  margin-top: 0;
}

.section-title small {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: rgba(93, 116, 146, 0.8);
  margin-left: auto;
}

.note {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.5;
}

/* ============================== kit cards =============================== */

.kit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.kit {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(9, 15, 28, 0.7);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.kit b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.kit span {
  display: block;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--faint);
}

.kit:hover {
  border-color: var(--line-strong);
  background: rgba(16, 26, 46, 0.8);
}

.kit.active {
  border-color: var(--cyan);
  background: rgba(56, 242, 255, 0.08);
  box-shadow: 0 0 20px rgba(56, 242, 255, 0.14);
}

.kit.active b {
  color: var(--cyan);
}

/* ============================== zone rows =============================== */

.zone-list {
  display: grid;
  gap: 5px;
}

.zone-group {
  margin: 10px 0 2px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(93, 116, 146, 0.75);
}

.zone-group:first-child {
  margin-top: 0;
}

.zone {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  grid-template-areas:
    "badge name  tools"
    "badge inst  inst";
  align-items: center;
  gap: 4px 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(8, 13, 25, 0.6);
  transition: border-color 0.16s, background 0.16s;
}

.zone:hover {
  border-color: var(--line-strong);
  background: rgba(14, 22, 40, 0.75);
}

.zone.muted {
  opacity: 0.5;
}

.zone .badge {
  grid-area: badge;
  align-self: stretch;
  display: grid;
  place-items: center;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #04060d;
  background: var(--cyan);
}

.zone .zname {
  grid-area: name;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone .tools {
  grid-area: tools;
  display: flex;
  align-items: center;
  gap: 4px;
}

.zone .instrument {
  grid-area: inst;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(12, 20, 36, 0.8);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.icon-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

.icon-btn.on {
  color: var(--red);
  border-color: rgba(255, 84, 112, 0.5);
  background: rgba(255, 84, 112, 0.1);
}

.mode-select {
  width: 74px;
  flex: none;
}

/* ============================== controls ================================ */

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.field > span small {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

select,
input[type="file"] {
  width: 100%;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: rgba(8, 13, 25, 0.9);
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s;
}

select:hover {
  border-color: var(--line-strong);
}

select:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
.tab:focus-visible,
.kit:focus-visible,
.icon-btn:focus-visible,
input:focus-visible {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(56, 242, 255, 0.28);
}

select.mode-select {
  padding: 5px 22px 5px 7px;
  background-position: calc(100% - 12px) 52%, calc(100% - 7px) 52%;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

select.instrument {
  padding: 6px 26px 6px 8px;
  font-size: 11.5px;
}

optgroup {
  background: var(--panel-solid);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

option {
  background: var(--panel-solid);
  color: var(--text);
  font-family: var(--sans);
}

input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(56, 242, 255, 0.55), rgba(126, 196, 255, 0.12));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #0a1220;
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 12px rgba(56, 242, 255, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(126, 196, 255, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #0a1220;
  border: 1.5px solid var(--cyan);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 11px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--dim);
}

.check input {
  appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(8, 13, 25, 0.9);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

.check input:checked {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(56, 242, 255, 0.35);
}

.check input:checked::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  margin: 2px auto 0;
  border: solid #04060d;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

.check:hover {
  color: var(--text);
}

/* =============================== modal ================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 10, 0.8);
  backdrop-filter: blur(8px);
  overflow: auto;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(680px, 100%);
  padding: 30px 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(13, 21, 38, 0.96), rgba(7, 11, 22, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.modal-card h2 {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-card ul {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.modal-card li {
  padding-left: 16px;
  border-left: 1px solid rgba(56, 242, 255, 0.3);
  font-size: 13px;
  color: var(--dim);
  line-height: 1.6;
}

.modal-card li b {
  color: var(--text);
}

/* ============================= scrollbars =============================== */

.page::-webkit-scrollbar,
.gate::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.gate-error pre::-webkit-scrollbar {
  width: 8px;
}

.page::-webkit-scrollbar-thumb,
.gate::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.gate-error pre::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  background-color: rgba(126, 196, 255, 0.22);
}

.page::-webkit-scrollbar-track,
.gate::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================= responsive =============================== */

@media (max-width: 1180px) {
  :root {
    --deck-w: 330px;
  }

  .telemetry {
    gap: 12px;
  }

  .energy {
    display: none;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  #app {
    height: auto;
    min-height: 100%;
  }

  .hud {
    flex-wrap: wrap;
    gap: 12px;
  }

  .transport {
    order: 3;
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .telemetry {
    padding-left: 0;
    border-left: 0;
    margin-left: auto;
  }

  main {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
  }

  .stage {
    aspect-ratio: 16 / 9;
    flex: none;
  }

  .deck {
    max-height: none;
  }

  .page {
    overflow: visible;
  }

  .energy {
    display: flex;
  }
}

@media (max-width: 560px) {
  .brand-text p,
  .stage-foot .kit-now {
    display: none;
  }

  .gate-card {
    padding: 22px 20px;
  }

  .btn.big {
    width: 100%;
    padding: 15px 20px;
  }

  .kit-grid {
    grid-template-columns: 1fr;
  }

  .readout {
    left: 12px;
    bottom: 12px;
    padding: 8px 12px;
  }

  .chord-badge {
    left: 12px;
    top: 12px;
    padding: 6px 12px 7px;
  }

  .chord-badge b {
    font-size: 17px;
  }

  .readout-note {
    font-size: 18px;
    min-width: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .mark span,
  .btn.big::after,
  .spinner,
  .chip.recording .rec-dot {
    animation: none;
  }
}
