/* moku · synth — styles */

:root {
  --bg: #050507;
  --panel: #111114;
  --panel-2: #17171c;
  --border: rgba(127, 119, 221, 0.18);
  --purple: #7f77dd;
  --purple-dim: rgba(127, 119, 221, 0.55);
  --red: #e03030;
  --text: #f5f4f0;
  --muted: #8c8a96;
}

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

html, body {
  height: 100%;
}

body.synth-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

/* ── header ── */
.synth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-link img { width: 22px; height: 22px; }
.brand-link span {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 6px;
  color: var(--purple);
}
.synth-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
}
.back-link {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  opacity: 0.8;
  transition: opacity 0.2s, color 0.2s;
}
.back-link:hover { opacity: 1; color: var(--purple); }

/* ── start overlay ── */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(5, 5, 7, 0.92);
  backdrop-filter: blur(6px);
  text-align: center;
  padding: 24px;
  transition: opacity 0.4s ease;
}
.start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.start-overlay p {
  max-width: 420px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.start-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--purple);
  border: none;
  border-radius: 999px;
  padding: 16px 36px;
  cursor: pointer;
  box-shadow: 0 0 32px rgba(127, 119, 221, 0.45);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.start-btn:hover:not(:disabled) { transform: scale(1.04); box-shadow: 0 0 44px rgba(127, 119, 221, 0.65); }
.start-btn:disabled { opacity: 0.5; cursor: wait; }
.boot-status {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--purple-dim);
  min-height: 14px;
}

/* ── layout ── */
.synth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 28px 0;
}
.synth-rack {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 880px) {
  .synth-rack { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px 20px;
}
.panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

/* ── oscillator layers ── */
.layers-panel { display: flex; flex-direction: column; gap: 12px; }
#layersPanel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 620px) { #layersPanel { grid-template-columns: 1fr; } }

.layer-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.layer-head { display: flex; align-items: center; justify-content: space-between; }
.layer-title {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}
.layer-toggle {
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.layer-toggle.is-on {
  color: var(--bg);
  background: var(--purple);
  border-color: var(--purple);
}

.wave-select { display: flex; gap: 6px; }
.wave-btn {
  flex: 1;
  padding: 6px 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.wave-btn svg { width: 100%; height: 16px; display: block; }
.wave-btn path {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wave-btn.is-active { background: rgba(127, 119, 221, 0.16); border-color: var(--purple); }
.wave-btn.is-active path { stroke: var(--purple); }

.layer-knobs { display: flex; gap: 10px; justify-content: center; }

/* ── knob widget ── */
.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 64px;
  cursor: ns-resize;
  user-select: none;
  touch-action: none;
  outline: none;
  border-radius: 8px;
}
.knob:focus-visible { box-shadow: 0 0 0 2px var(--purple-dim); }
.knob-dial { width: 46px; height: 46px; }
.knob-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 5; stroke-linecap: round; }
.knob-fill { fill: none; stroke: var(--purple); stroke-width: 5; stroke-linecap: round; }
.knob-pointer { stroke: var(--text); stroke-width: 2; stroke-linecap: round; transform-origin: 32px 32px; }
.knob-hub { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
.knob-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.knob-value {
  font-size: 10px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--purple-dim);
}

/* ── ADSR panel ── */
.adsr-panel { display: flex; flex-direction: column; gap: 14px; }
.adsr-canvas-wrap {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}
#adsrCanvas { display: block; width: 100%; height: 110px; }
#adsrKnobs { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── fx + master panel ── */
.fx-panel { display: flex; flex-direction: column; gap: 16px; }
#fxKnobs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.master-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#masterKnobs { display: flex; }
.voice-dots { display: flex; gap: 5px; }
.voice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.15s, box-shadow 0.15s;
}
.voice-dot.is-active {
  background: var(--purple);
  box-shadow: 0 0 8px var(--purple);
}

/* ── piano ── */
.piano-wrap {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, var(--bg) 20%);
  padding: 10px 28px 22px;
}
.piano-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.piano-hint kbd {
  font-family: ui-monospace, monospace;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}
#octaveLabel { color: var(--red); font-weight: 600; }

.piano-scroll { overflow-x: auto; }
.piano {
  --bk-w: 30px;
  position: relative;
  display: flex;
  height: 150px;
  min-width: 640px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.key { touch-action: none; }
.key-white {
  flex: 1 0 0;
  background: linear-gradient(to bottom, #efeef7, #dcdaea);
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  transition: background 0.08s;
}
.key-white:last-child { border-right: none; }
.key-white.is-down {
  background: linear-gradient(to bottom, var(--purple), #5c53c4);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
}
.key-black {
  position: absolute;
  top: 0;
  width: var(--bk-w);
  height: 62%;
  background: linear-gradient(to bottom, #232329, #0c0c10);
  border: 1px solid #000;
  border-radius: 0 0 4px 4px;
  z-index: 2;
  transition: background 0.08s;
}
.key-black.is-down {
  background: linear-gradient(to bottom, var(--purple), #4a43a8);
  box-shadow: 0 0 14px rgba(127, 119, 221, 0.7);
}

/* ── footer ── */
.synth-footer {
  text-align: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding: 4px 0 10px;
}
.synth-footer a { color: var(--purple-dim); text-decoration: none; }
.synth-footer a:hover { color: var(--purple); }
