@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/SpaceMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  src: url('fonts/SpaceMono-Bold.woff2') format('woff2');
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --void: #000000;
  --ghost: rgba(255,255,255,0.06);
  --active: rgba(255,255,255,0.18);
  --line: rgba(255,255,255,0.12);
  --glow: rgba(180,200,255,0.15);
}

html, body {
  width: 100%; height: 100%;
  background: #050505;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: crosshair;
  font-family: 'Space Mono', monospace;
  color: rgba(255,255,255,0.6);
}

body::before {
  content: ''; position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px 200px; pointer-events: none; z-index: 200; opacity: 0.4;
}

/* ══ BOARD FRAME ══ */
.board {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: #080808;
  overflow: hidden;
}

/* ══ VOICE STRIP ══ */
.voice-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 10px 0;
  background: #050505;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.voice-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.5s, background 0.5s, box-shadow 0.5s, color 0.5s;
  position: relative; display: flex; align-items: center; justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 8px; letter-spacing: 0.05em;
  color: rgba(255,255,255,0.12);
}
.voice-btn::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.5s;
}
.voice-btn.active {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.45);
  animation: voice-glow 4s ease-in-out infinite;
}
.voice-btn.active::after { opacity: 1; }
.voice-btn.empty { opacity: 0.35; cursor: default; }
@keyframes voice-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(180,200,255,0.06); }
  50%     { box-shadow: 0 0 12px 3px rgba(180,200,255,0.1); }
}

/* ══ KEY PICKER ══ */
.key-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0 10px 0;
  background: #050505;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
}
.key-row {
  display: flex; gap: 4px;
}
.key-cell {
  width: 30px; height: 22px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.015);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  font-family: 'Space Mono', monospace;
  font-size: 9px; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.28);
  border-radius: 3px;
  padding: 0;
}
.key-cell:hover { border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.45); }
.key-cell.active {
  border-color: rgba(180,200,255,0.55);
  background: rgba(180,200,255,0.12);
  color: rgba(255,255,255,0.85);
  box-shadow: 0 0 8px 1px rgba(180,200,255,0.18);
}
.key-natural {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.015);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  font-family: 'Space Mono', monospace;
  font-size: 9px; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.28);
  border-radius: 3px;
  text-transform: uppercase;
}
.key-natural:hover { border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.45); }
.key-natural.active {
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}

/* ══ SLOTS ══ */
.slots {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.slot {
  flex: 0.9;
  border-right: 1px solid rgba(255,255,255,0.05);
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: auto;
  position: relative;
}
.slot:last-child { border-right: none; }
.slot[data-pos="center"] { flex: 0.85; }

/* Bypass strips sit at the inside edges of the center column. Each strip
   mirrors its side's structure: a single centered toggle when the side
   holds a full-panel unit, or a 3-cell stack matching .side-chain when the
   side holds partial-panel units. */
.bypass-strip {
  flex: 0 0 32px;
  background: #000;
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex; flex-direction: column;
  padding: 40px 0;
}
.bypass-strip.full {
  align-items: center; justify-content: center;
}
.bypass-strip.chain {
  align-items: stretch; justify-content: stretch;
}
.bypass-cell {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0 16px 0;
}
.bypass-toggle {
  font-family: 'Space Mono', monospace;
  font-size: 7px; letter-spacing: 0.18em;
  text-transform: uppercase;
  width: 22px; height: 22px; padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.35);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, background 0.25s, color 0.25s, box-shadow 0.25s;
}
.bypass-toggle:hover {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
}
.bypass-toggle.on {
  border-color: rgba(255,200,140,0.55);
  background: rgba(255,200,140,0.18);
  color: rgba(255,235,200,0.95);
  box-shadow: 0 0 10px 1px rgba(255,200,140,0.18);
}

/* center-slot: fixed two half-cells, top + bottom. Each is its own mini-slot.
   Side-slots use the same .chain-cell pattern but stacked into 3 cells via
   .side-chain. */
.chain, .side-chain {
  display: flex; flex-direction: column;
  align-self: stretch;
  width: 100%; height: 100%;
  padding: 0 12px;
}
.chain-cell {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0 16px 0;
}
.chain-cell + .chain-cell { border-top: 1px solid rgba(255,255,255,0.05); }
.chain-cell .slot-eject {
  position: absolute; top: 8px; right: 10px;
  width: 14px; height: 14px; font-size: 9px; line-height: 12px;
  opacity: 0;
}
.chain-cell:hover .slot-eject { opacity: 1; }

/* Shared master-bypass power button (every center effect uses this) */
.fx-power {
  position: absolute;
  top: 8px; left: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.03);
  cursor: pointer; outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.35s, background 0.35s, box-shadow 0.35s;
  z-index: 4;
}
.fx-power::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.35s;
  pointer-events: none;
}
.fx-power:hover { border-color: rgba(255,255,255,0.28); }
.fx-power.on {
  border-color: rgba(180,200,255,0.45);
  background: rgba(180,200,255,0.12);
  animation: fx-power-pulse 2.4s ease-in-out infinite;
}
.fx-power.on::after { opacity: 1; }
@keyframes fx-power-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(180,200,255,0.05); }
  50%     { box-shadow: 0 0 10px 2px rgba(180,200,255,0.14); }
}

.slot-label {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.07);
  pointer-events: none; user-select: none; white-space: nowrap;
}

.slot-empty {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(255,255,255,0.2);
  font-size: 22px; font-family: 'Space Mono', monospace;
  cursor: pointer; outline: none;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}
.slot-empty:hover {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.03);
}

.slot-eject {
  position: absolute;
  top: 10px; right: 10px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.3);
  cursor: pointer; outline: none;
  font-size: 10px; line-height: 14px; text-align: center;
  opacity: 0;
  transition: opacity 0.25s, border-color 0.25s, color 0.25s;
  z-index: 5;
}
.slot:hover .slot-eject { opacity: 1; }
.slot-eject:hover { border-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.7); }

/* ══ CHOPPER ══ */
/* Lanes live inside .master-row alongside the master knobs + rec. */
.chopper-lane {
  display: flex; align-items: center; justify-content: center;
}

/* Lane internals — one vertical stack per lane (tag / toggle / levers / auto-rand). */
.chop-unit { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.chop-tag { font-size: 7px; letter-spacing: 0.25em; color: rgba(255,255,255,0.18); text-transform: uppercase; }
.chop-toggle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.4s, background 0.4s; position: relative;
}
.chop-toggle::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.4s;
}
.chop-toggle.on {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.1);
  animation: chop-pulse 2s ease-in-out infinite;
}
.chop-toggle.on::after { opacity: 1; }
@keyframes chop-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(180,200,255,0.08); }
  50%     { box-shadow: 0 0 12px 3px rgba(180,200,255,0.13); }
}
.chop-levers { display: flex; gap: 14px; align-items: flex-end; justify-content: center; }
.chop-lever-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chop-lever-label { font-size: 7px; letter-spacing: 0.12em; color: rgba(255,255,255,0.18); text-transform: uppercase; text-align: center; }
.chop-lever {
  width: 24px; height: 88px;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 3px;
  background: rgba(255,255,255,0.02);
  position: relative; cursor: pointer; user-select: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 4px 0;
}
.chop-lever-notch { width: 100%; height: 3px; display: flex; align-items: center; justify-content: center; position: relative; }
.chop-lever-notch::before { content: ''; display: block; width: 8px; height: 1px; background: rgba(255,255,255,0.12); border-radius: 1px; }
.chop-lever-thumb {
  position: absolute; left: -1px; right: -1px;
  height: 20px; border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  transition: top 0.1s cubic-bezier(0.25,0.46,0.45,0.94), background 0.2s;
  cursor: grab;
}
.chop-lever-thumb:active { cursor: grabbing; }
.chop-lever.active .chop-lever-thumb { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.15); }
.chop-rand {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s;
}
.chop-rand.on { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.1); }
.chop-rand:hover { border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.07); }

/* ══ MASTER STRIP ══ */
.master {
  border-top: 1px solid rgba(255,255,255,0.07);
  background: #060606;
}
/* Three-column layout mirrors .slots flex ratios so each chopper lane
   centers under its instrument panel. */
.master-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  width: 100%;
}
.master-row > .chopper-lane { flex: 0.9; }
.master-row > .master-center { flex: 0.85; }
.master-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.master-knobs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
}
.bh-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 20px;
}
.bh-row:empty { display: none; }

.bh-pill {
  min-width: 34px; height: 18px; padding: 0 8px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.45);
  font-family: 'Space Mono', monospace; font-size: 8px; letter-spacing: 0.18em;
  text-transform: uppercase; cursor: pointer; outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.3s, background 0.3s, color 0.3s, box-shadow 0.3s;
  display: inline-flex; align-items: center; justify-content: center;
}
.bh-pill:hover { border-color: rgba(255,255,255,0.24); color: rgba(255,255,255,0.7); }
.bh-pill.on {
  border-color: rgba(180,200,255,0.4);
  background: rgba(180,200,255,0.12);
  color: rgba(255,255,255,0.85);
  box-shadow: 0 0 10px 1px rgba(180,200,255,0.14);
}
.bh-pill.empty { opacity: 0.3; cursor: not-allowed; }
.bh-pill.empty:hover { border-color: rgba(255,255,255,0.12); color: rgba(255,255,255,0.45); }

.m-knob-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.m-knob {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  cursor: ns-resize; position: relative; touch-action: none;
  transition: border-color 0.3s;
}
.m-knob:hover { border-color: rgba(255,255,255,0.2); }
.m-knob-dot {
  position: absolute; width: 2px; height: 8px;
  background: rgba(255,255,255,0.45); border-radius: 2px;
  left: 50%; top: 5px; transform-origin: 50% 15px;
  transform: translateX(-50%) rotate(0deg); transition: background 0.3s;
}
.m-knob:hover .m-knob-dot { background: rgba(255,255,255,0.8); }
.m-knob.panic {
  border-color: rgba(200,60,60,0.6);
  background: rgba(200,60,60,0.12);
  animation: panic-pulse 0.8s ease-in-out infinite;
}
.m-knob.panic .m-knob-dot { background: rgba(200,60,60,0.8); }
@keyframes panic-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(200,60,60,0.1); }
  50%     { box-shadow: 0 0 14px 4px rgba(200,60,60,0.2); }
}
.m-label {
  font-size: 7px; letter-spacing: 0.2em;
  color: rgba(255,255,255,0.14);
  text-transform: uppercase; text-align: center;
}

/* ══ RECORD ══ */
.rec-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rec-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.rec-btn:hover { border-color: rgba(255,255,255,0.2); }
.rec-pip {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  transition: background 0.4s, box-shadow 0.4s;
}
.rec-btn.armed .rec-pip {
  background: rgba(200,60,60,0.9);
  box-shadow: 0 0 8px 2px rgba(200,60,60,0.4);
  animation: rec-blink 1.2s ease-in-out infinite;
}
.rec-btn.armed { border-color: rgba(200,60,60,0.4); }
@keyframes rec-blink { 0%,100%{opacity:1;} 50%{opacity:0.35;} }
.rec-time {
  font-size: 9px; letter-spacing: 0.08em;
  color: rgba(255,255,255,0); font-variant-numeric: tabular-nums;
  transition: color 0.4s; height: 12px;
}
.rec-time.visible { color: rgba(200,60,60,0.6); }

/* ══ PICKER ══ */
.picker {
  position: fixed; z-index: 500;
  background: #0c0c0c; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  min-width: 180px; padding: 10px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.picker-title {
  font-size: 8px; letter-spacing: 0.18em;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase; text-align: center;
  padding: 4px 12px 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 6px;
}
.picker-item {
  display: block; width: 100%;
  padding: 10px 16px;
  background: transparent; border: none;
  color: rgba(255,255,255,0.55);
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; text-align: left;
  cursor: pointer; outline: none;
  transition: background 0.15s, color 0.15s;
}
.picker-item:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.9); }
.picker-item:disabled { opacity: 0.3; cursor: default; }
.picker-empty {
  padding: 10px 16px;
  font-size: 9px; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25); text-align: center;
}
