/* Keeble Weil Studio: a small DAW in the browser. Website palette. */
:root {
  --bg: #050508; --bg-2: #0b0c13; --panel: #141623; --panel-2: #1a1d2c; --line: #23263a; --line-2: #2e3250;
  --fg: #f2f3f8; --muted: #8e93aa; --violet: #7b5cff; --cyan: #2ec5ff; --pink: #ff4fd8; --bad: #ff6b81;
  --grad: linear-gradient(100deg, var(--violet), var(--cyan));
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
button, input, select { font: inherit; color: var(--fg); }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---- top bar */
.st-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(5,5,8,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.st-logo { font: 500 13px/1 var(--sans); letter-spacing: .32em; text-decoration: none; white-space: nowrap; }
.st-logo span { font-family: var(--mono); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; color: var(--cyan); margin-left: 6px; }
.st-transport { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--grad); display: grid; place-items: center;
  box-shadow: 0 0 22px rgba(46,197,255,.35); }
.st-play i { width: 0; height: 0; border-left: 13px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 3px; }
.st-play.on i { width: 12px; height: 12px; border: 0; background: #fff; border-radius: 2px; margin: 0; }
.st-field { display: flex; flex-direction: column; gap: 2px; }
.st-field span { font: 500 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.st-field input, .st-field select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; height: 30px; }
.st-field input { width: 64px; }
.st-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.st-ghost { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; }
.st-ghost:hover { border-color: var(--line-2); }
.st-cta { text-decoration: none; background: var(--grad); border-radius: 999px; padding: 8px 16px; font-weight: 500; white-space: nowrap; }
.st-menu { position: relative; }
.st-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; display: grid; gap: 2px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.st-pop button { text-align: left; background: none; border: 0; border-radius: 9px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; }
.st-pop button:hover, .st-pop button:focus-visible { background: rgba(123,92,255,.18); }
.st-pop button i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.st-pop button small { color: var(--muted); margin-left: auto; font-size: 12px; }
.st-pop-up { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }

/* ---- Claude bar */
.st-ai { padding: 16px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); display: grid; gap: 10px; }
.st-ai-form { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 999px;
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, linear-gradient(100deg, rgba(123,92,255,.7), rgba(46,197,255,.7)) border-box;
  border: 1px solid transparent; box-shadow: 0 10px 50px -20px rgba(123,92,255,.7); }
.st-spark { color: var(--cyan); font-size: 18px; }
.st-ai-form input { flex: 1; min-width: 0; background: none; border: 0; padding: 10px 0; font-size: 15px; }
.st-ai-form input:focus { outline: none; }
.st-go { border: 0; border-radius: 999px; padding: 11px 20px; background: var(--grad); font-weight: 600; white-space: nowrap; }
.st-go:disabled { opacity: .55; cursor: progress; }
.st-ideas { display: flex; gap: 8px; flex-wrap: wrap; }
.st-ideas button { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; color: var(--muted); font-size: 13px; }
.st-ideas button:hover { color: var(--fg); border-color: var(--line-2); }
.st-status { margin: 0; min-height: 20px; color: var(--muted); font-size: 13.5px; }
.st-status b { color: var(--fg); font-weight: 500; }
.st-status.busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%;
  background: var(--grad); animation: st-pulse 1s ease-in-out infinite; vertical-align: -1px; }
@keyframes st-pulse { 50% { opacity: .25; transform: scale(.7); } }

/* ---- layers */
.st-main { flex: 1; display: grid; grid-template-rows: auto minmax(320px, 1fr); gap: 14px; padding: 6px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); min-height: 0; }
.st-arrange { border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); overflow: hidden; }
.st-ruler { display: grid; grid-template-columns: 300px 1fr; height: 26px; border-bottom: 1px solid var(--line); font: 500 10px/26px var(--mono); color: var(--muted); }
.st-ruler .bars { position: relative; }
.st-ruler .bars span { position: absolute; top: 0; padding-left: 6px; border-left: 1px solid var(--line); height: 100%; }
.st-track { display: grid; grid-template-columns: 300px 1fr; border-bottom: 1px solid var(--line); min-height: 56px; }
.st-track.sel { background: rgba(123,92,255,.08); }
.st-track.muted .st-lane canvas { opacity: .3; }
.st-head { display: grid; grid-template-columns: 6px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px 8px 0; border-right: 1px solid var(--line); cursor: pointer; }
.st-head > i { align-self: stretch; border-radius: 0 4px 4px 0; }
.st-name { display: grid; gap: 4px; min-width: 0; }
.st-name b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-name select { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; font-size: 12.5px; color: var(--muted); max-width: 100%; }
.st-btns { display: flex; align-items: center; gap: 4px; }
.st-btns button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font: 600 11px/1 var(--mono); color: var(--muted); padding: 0; }
.st-btns button.on { color: #fff; background: var(--violet); border-color: var(--violet); }
.st-btns button.solo.on { background: #e6b422; border-color: #e6b422; color: #111; }
.st-btns button.ai { color: var(--cyan); font-size: 14px; }
.st-btns button.ai.busy { animation: st-pulse 1s ease-in-out infinite; }
.st-btns input[type=range] { width: 64px; accent-color: var(--cyan); }
.st-lane { position: relative; cursor: pointer; }
.st-lane canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.st-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 10px var(--cyan); pointer-events: none; left: 0; opacity: 0; }
.st-add { display: flex; align-items: center; gap: 14px; padding: 10px 12px; flex-wrap: wrap; }
.st-add-btn { background: var(--panel); border: 1px dashed var(--line-2); border-radius: 999px; padding: 8px 16px; }
.st-add-btn:hover { border-color: var(--cyan); }
.st-hint { color: var(--muted); font-size: 12.5px; }
.st-empty { padding: 26px 16px; color: var(--muted); text-align: center; }

/* ---- editor */
.st-editor { border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); display: flex; flex-direction: column; min-height: 320px; overflow: hidden; }
.st-ed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.st-ed-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-ed-title i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.st-ed-title span { color: var(--muted); font-size: 13px; }
.st-ed-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.st-ed-tools button { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--muted); }
.st-ed-tools button.on { color: var(--fg); border-color: var(--cyan); }
.st-ed-scroll { flex: 1; overflow: auto; position: relative; min-height: 260px; max-height: 62vh; overscroll-behavior: contain; }
.st-ed-inner { display: flex; width: max-content; position: relative; }
.st-ed-scroll canvas { display: block; touch-action: none; }
#keys { position: sticky; left: 0; z-index: 2; box-shadow: 1px 0 0 var(--line); }
.st-ed-inner .st-playhead { top: 0; }
.st-ed-help { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.st-ed-help kbd { font: 500 11px var(--mono); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--fg); }

.st-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px max(16px, env(safe-area-inset-right)) 22px max(16px, env(safe-area-inset-left)); color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.st-foot a { color: var(--fg); }
.st-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-width: min(92vw, 520px); }

@media (max-width: 860px) {
  .st-top { gap: 10px; }
  .st-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .st-head { grid-template-columns: 6px minmax(0, 1fr); grid-template-rows: auto auto; row-gap: 6px; }
  .st-head .st-btns { grid-column: 2; flex-wrap: wrap; }
  .st-btns input[type=range] { width: 90px; }
  .st-ai-form { border-radius: 18px; flex-wrap: wrap; padding: 8px 8px 8px 14px; }
  .st-ai-form input { flex-basis: calc(100% - 40px); }
  .st-go { width: 100%; }
  .st-actions .st-cta { margin-left: auto; }
  .st-ruler, .st-track { grid-template-columns: 1fr; }
  .st-ruler { display: none; }
  .st-head { border-right: 0; padding: 8px 10px 4px 0; }
  .st-lane { height: 40px; border-top: 1px solid var(--line); }
  .st-go { padding: 10px 14px; }
  .st-ai-form input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .st-status.busy::before, .st-btns button.ai.busy { animation: none; } }
