:root {
  --bg: #0b0d12;
  --panel: #151922;
  --panel-2: #1b202b;
  --panel-3: #232a38;
  --ink: #e7edf7;
  --muted: #8892a6;
  --line: #2a3142;
  --accent: #49f1ff;
  --accent-2: #a277ff;
  --glow: 0 0 14px rgba(73, 241, 255, 0.55);
  --glow-soft: 0 0 8px rgba(73, 241, 255, 0.25);
  --shadow-inset: inset 0 2px 6px rgba(0,0,0,0.55), inset 0 -2px 2px rgba(255,255,255,0.04);
  --knob-size: 54px;
  --r: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(162, 119, 255, 0.08), transparent 50%),
    radial-gradient(900px 500px at 110% 10%, rgba(73, 241, 255, 0.07), transparent 60%),
    linear-gradient(180deg, #0a0c11, #0b0d12 30%, #0a0c11);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Start overlay */
.start-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(600px 400px at 50% 40%, rgba(73,241,255,0.12), transparent 70%), rgba(8,9,14,0.9);
  backdrop-filter: blur(6px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.start-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.start-card {
  text-align: center;
  padding: 32px 40px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-radius: 16px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6), var(--glow-soft);
  max-width: 90vw;
}
.start-card .tagline { color: var(--muted); margin: 4px 0 18px; letter-spacing: 0.16em; font-size: 11px; }
.start-card .hint { color: var(--muted); font-size: 12px; margin-top: 14px; }
.start-btn {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #1c2230, #121723);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(73, 241, 255, 0.7);
  box-shadow: var(--glow), inset 0 0 18px rgba(73, 241, 255, 0.12);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.start-btn:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(73,241,255,0.8), inset 0 0 24px rgba(73,241,255,0.2); }
.start-btn:active { transform: translateY(0); }

/* Machine */
.machine {
  max-width: 980px;
  margin: 18px auto;
  padding: 18px;
  background: linear-gradient(180deg, #121722, #0d1019);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.04);
}

.machine-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 4px 4px 14px;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  margin-bottom: 14px;
}
.title-block .brand {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin: 0;
  font-size: 22px;
}
.brand span { color: var(--accent); text-shadow: 0 0 8px rgba(73,241,255,0.6); }
.title-block .model {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: 'Orbitron', sans-serif;
  font-size: 9.5px; letter-spacing: 0.28em;
}

.head-right { display: flex; align-items: center; gap: 18px; }
.power { display: flex; align-items: center; gap: 6px; }
.power-led {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2a3142;
  box-shadow: inset 0 0 2px #000;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.power-led.on {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 2px #fff inset;
  animation: pulse 2.2s ease-in-out infinite;
}
.power-lbl {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px; letter-spacing: 0.24em; color: var(--muted);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.meter .meter-lbl {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px; letter-spacing: 0.24em; color: var(--muted);
  text-align: center; margin-bottom: 4px;
}
.level-meter {
  display: block; width: 160px; height: 18px;
  background: #0a0e17;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
  padding: 2px;
}

/* Module grid */
.modules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 760px) {
  .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .modules { grid-template-columns: 1fr 1fr; }
}

.module {
  position: relative;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.03);
}
.module-head { margin-bottom: 10px; text-align: center; }
.module-head h2 {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; letter-spacing: 0.28em;
  color: var(--muted);
}

/* Wave 2x2 grid */
.wave-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.wave-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 8px 4px 6px;
  background: linear-gradient(180deg, #161b26, #10141d);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.18s ease;
  box-shadow: var(--shadow-inset);
  min-height: 56px;
}
.wave-btn svg { width: 100%; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wave-lbl {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px; letter-spacing: 0.18em;
}
.wave-btn:hover { color: var(--ink); border-color: #3a4255; }
.wave-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--glow-soft), var(--shadow-inset);
  background: linear-gradient(180deg, #18212e, #101823);
}
.wave-btn.active svg { filter: drop-shadow(0 0 6px rgba(73,241,255,0.6)); }

/* Vertical knob column */
.knob-col {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

/* Knob */
.knob-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 64px;
}
.knob-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px; letter-spacing: 0.22em; color: var(--muted);
  text-transform: uppercase;
  order: 2;
}
.knob-value {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 10px; color: var(--accent);
  text-shadow: 0 0 4px rgba(73,241,255,0.4);
  min-height: 12px;
  order: 3;
}
.knob {
  order: 1;
  --rot: -135deg;
  position: relative;
  width: var(--knob-size); height: var(--knob-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #4a5468 0%, #2a3040 42%, #141925 85%),
    #141925;
  box-shadow:
    0 6px 12px rgba(0,0,0,0.5),
    inset 0 2px 3px rgba(255,255,255,0.08),
    inset 0 -4px 6px rgba(0,0,0,0.5);
  cursor: grab;
  touch-action: none;
  outline: none;
  transition: box-shadow 0.2s ease;
}
.knob:focus-visible {
  box-shadow:
    0 6px 12px rgba(0,0,0,0.5),
    inset 0 2px 3px rgba(255,255,255,0.08),
    inset 0 -4px 6px rgba(0,0,0,0.5),
    0 0 0 2px var(--accent);
}
.knob:active { cursor: grabbing; }
.knob .indicator {
  position: absolute;
  top: 10%; left: 50%;
  width: 3px; height: 34%;
  background: linear-gradient(180deg, var(--accent), rgba(73,241,255,0.15));
  border-radius: 2px;
  transform: translateX(-50%) rotate(var(--rot));
  transform-origin: 50% 140%;
  box-shadow: 0 0 6px rgba(73,241,255,0.7);
  pointer-events: none;
}

/* Keyboard */
.keyboard-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}
.keyboard-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.kbd-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; letter-spacing: 0.28em; color: var(--muted);
}
.oct-ctrl { display: flex; align-items: center; gap: 8px; }
.oct-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: #121722;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 4px rgba(0,0,0,0.3);
}
.oct-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow-soft); }
.oct-btn:active { transform: translateY(1px); }
.oct-readout {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; letter-spacing: 0.18em; color: var(--accent);
  text-shadow: 0 0 4px rgba(73,241,255,0.4);
  min-width: 56px; text-align: center;
}

.keyboard {
  position: relative;
  display: flex;
  height: 150px;
  background: linear-gradient(180deg, #0a0d14, #07090e);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.7), 0 12px 30px rgba(0,0,0,0.4);
  user-select: none;
  touch-action: none;
}
.key {
  position: relative;
  flex: 1;
  margin: 0 1px;
  border-radius: 0 0 6px 6px;
  cursor: pointer;
  transition: transform 0.04s ease, box-shadow 0.1s ease, background 0.1s ease;
}
.key.white {
  background: linear-gradient(180deg, #f4f7fa, #cfd5de 90%, #aab3c1);
  box-shadow:
    inset 0 -6px 8px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 2px 2px rgba(0,0,0,0.4);
}
.key.white.pressed {
  background: linear-gradient(180deg, #a4f3ff, #49f1ff 70%, #1fb0bf);
  box-shadow:
    inset 0 -3px 6px rgba(0,0,0,0.3),
    0 0 14px rgba(73,241,255,0.7);
  transform: translateY(1px);
}
.key.black {
  position: absolute;
  top: 8px;
  width: 4.2%;
  height: 62%;
  background: linear-gradient(180deg, #222836, #0b0f17 90%);
  border: 1px solid #000;
  border-radius: 0 0 4px 4px;
  box-shadow:
    inset 0 -6px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 2px 4px rgba(0,0,0,0.7);
  z-index: 2;
}
.key.black.pressed {
  background: linear-gradient(180deg, #2a91a0, #0d414a 90%);
  box-shadow:
    inset 0 -3px 6px rgba(0,0,0,0.5),
    0 0 14px rgba(73,241,255,0.8);
  transform: translateY(1px);
}
.key .note-label {
  position: absolute;
  bottom: 6px; left: 0; right: 0;
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(0,0,0,0.55);
  pointer-events: none;
}
.key.black .note-label { display: none; }
.key .kbd-letter {
  position: absolute;
  bottom: 18px; left: 0; right: 0;
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(0,0,0,0.4);
  pointer-events: none;
}
.key.black .kbd-letter {
  bottom: 6px;
  color: rgba(255,255,255,0.45);
}

.kbd-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}
.kbd-hint kbd {
  display: inline-block;
  min-width: 16px;
  padding: 1px 4px;
  margin: 0 1px;
  background: #1a2030;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
