/* ============================================================
   Vector Scope — dark UI, square corners, muted color set
   Palette: green #58C69D · blue #ACCBE1 · pink #F093AF
            orange #FFC07F · cream #FFCF99   (no gradients)
   ============================================================ */

:root {
  --navy:   #05060f;
  --panel:  rgba(18, 22, 48, 0.55);
  --border: rgba(140, 160, 255, 0.18);
  --text:   #e7e9ff;
  --muted:  #8b90c0;
  --green:  #58C69D;
  --blue:   #ACCBE1;
  --pink:   #F093AF;
  --orange: #FFC07F;
  --cream:  #FFCF99;
  --accent: #58C69D;
  /* instrument-readout mono, using whatever the OS ships */
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--navy);
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* The scope canvas fills the whole window */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- Brand card (top left): one click, straight home ---------- */
#brand {
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 30;             /* above the drop overlay, so the link is clickable */
  display: block;
  padding: 10px 16px 12px;
  background: #ececef;
  color: #0d0e12;
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.18s ease;
}
#brand:hover { background: #ffffff; }
#brand span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: #6a6b73;
}

/* ---------- Tool tag (bottom left): name + what it does ---------- */
#tool-tag {
  position: fixed;
  left: 32px;
  bottom: 26px;
  z-index: 5;
  padding: 10px 14px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 2px;
  pointer-events: none;
  user-select: none;
}
#tool-tag strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
#tool-tag span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Drop / upload hint ---------- */
#drop-hint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.4s ease;
}
#drop-hint.dragover .drop-inner {
  border-color: var(--accent);
  background: rgba(88, 198, 157, 0.08);
  transform: scale(1.02);
}
.drop-inner {
  position: relative;
  text-align: center;
  padding: 54px 72px;
  border: 1.5px dashed var(--border);
  border-radius: 2px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.25s ease;
  max-width: 480px;
}
.drop-inner .big {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
}
.drop-inner .small {
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.drop-inner .formats {
  margin: 22px 0 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.upload-btn {
  display: inline-block;
  cursor: pointer;
  padding: 11px 26px;
  border: none;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--navy);
  background: var(--green);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 24px rgba(88, 198, 157, 0.25);
}
.upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(88, 198, 157, 0.35);
}
.upload-btn.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  border: 1px solid var(--border);
}
.upload-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}
.or-divider {
  margin: 20px 0 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Status line ---------- */
#status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  padding: 16px 28px;
  border-radius: 2px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  text-align: center;
}
#status.error { color: #ff8a8a; border-color: rgba(255, 138, 138, 0.4); }

/* ---------- The control deck (one panel for everything) ---------- */
#deck {
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 10;
  width: 320px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 18px 20px;
  border-radius: 2px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
#deck h2 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  border-left: 3px solid var(--green);
  padding-left: 9px;
}
#deck h2:not(:first-of-type) { margin-top: 18px; }
#deck .hint {
  margin: -4px 0 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* knobs sit in a 2-column grid, knob above its label */
.deck-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-bottom: 12px;
}
.deck-grid .ctl.knobified {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px;
}
.deck-grid .ctl.knobified .knob-text span { align-items: center; }

/* selects share the same grid rhythm */
.deck-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
.ctl { display: block; margin-bottom: 12px; }
.ctl > span {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.ctl em { color: var(--text); font-style: normal; }

/* the pattern select inside the knob grid */
.deck-grid .ctl:not(.knobified) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 6px 8px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px;
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px; height: 20px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(88, 198, 157, 0.25);
}
input[type="range"]::-moz-range-thumb {
  width: 9px; height: 20px;
  border: none;
  border-radius: 2px;
  background: #fff;
}

select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: background 0.18s ease;
}
select:hover { background: rgba(255, 255, 255, 0.14); }
select option { background: #12162f; color: var(--text); }

#synth-toggle {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: none;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--navy);
  cursor: pointer;
  background: var(--pink);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 24px rgba(240, 147, 175, 0.25);
}
#synth-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(240, 147, 175, 0.35);
}
#synth-toggle.running {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

/* Small X to dismiss the deck */
.panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  z-index: 2;
}
.panel-close:hover { background: rgba(255, 255, 255, 0.16); color: var(--text); }

/* ---------- Transport bar ---------- */
#transport {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  width: min(680px, calc(100vw - 48px));
  border-radius: 2px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#transport button,
#transport .new-file {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s ease;
}
#transport button:hover,
#transport .new-file:hover { background: rgba(255, 255, 255, 0.14); }

#transport svg { width: 20px; height: 20px; fill: currentColor; }

.icon-pause { display: none; }
#transport.playing .icon-play  { display: none; }
#transport.playing .icon-pause { display: block; }

.time {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--muted);
  width: 38px;
  text-align: center;
}

#seek { flex: 1; }
#seek::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  transition: box-shadow 0.15s ease;
}
#seek::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px rgba(88, 198, 157, 0.35); }

/* ============================================================
   Responsive / mobile
   ============================================================ */

#brand     { top: max(28px, env(safe-area-inset-top)); left: max(32px, env(safe-area-inset-left)); }
#transport { bottom: max(26px, env(safe-area-inset-bottom)); }

@media (max-width: 600px) {
  #brand { top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); padding: 8px 12px 10px; font-size: 13px; }
  #tool-tag { display: none; }

  .drop-inner { padding: 34px 26px; max-width: 86vw; }
  .drop-inner .big { font-size: 17px; }

  #transport {
    width: calc(100vw - 16px);
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 10px 12px;
    gap: 10px;
  }
  .time { width: 32px; }

  #deck {
    top: 64px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 150px);
    padding: 12px 14px;
  }
  #deck .hint { display: none; }
}
