:root { --ground:#0c0d0f; --line:rgba(255,255,255,.09); --edge:rgba(255,255,255,.14); --text:#ecebe7; --muted:#b4b8bf; --dim:#9aa0a8; --gap: 16px; --panel-w: min(384px, calc(100vw - 2 * var(--gap))); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font-family: 'Instrument Sans', system-ui, sans-serif; overflow: hidden; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); font-size: 13px; }
.dim { color: var(--dim); font-size: 12px; }

/* full-window stage */
.stage { position: fixed; inset: 0; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.stage.dragging canvas { cursor: grabbing; }
.hud-big { position: absolute; left: 32px; top: 28px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; transition: color .4s; }
.eyebrow { font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: .08em; color: var(--muted); }
.name { font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
.corner { position: absolute; left: 32px; bottom: 28px; pointer-events: none; }
.stage.light-bg .hud-big .name { color: #111214; }
.stage.light-bg .hud-big .eyebrow, .stage.light-bg .hud-big .muted, .stage.light-bg .corner { color: #2b2d31; }
.hud { display: none; }
body.fs .hud { display: block; }
body.fs .hud-big, body.fs .corner { display: none; }
.hud { position: absolute; left: 28px; top: 26px; font-size: 12px; letter-spacing: .04em; color: var(--text); opacity: .4; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 56px); transition: color .4s; }
.stage.light-bg .hud { color: #111214; }

/* floating glass control pad */
.panel {
  position: fixed; top: var(--gap); right: var(--gap); bottom: var(--gap); width: var(--panel-w);
  border-radius: 30px; overflow: hidden;
  background: rgba(18, 19, 23, 0.62);
  -webkit-backdrop-filter: blur(28px) saturate(150%); backdrop-filter: blur(28px) saturate(150%);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 24px 60px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
.panel-scroll { height: 100%; overflow-y: auto; padding: 24px 22px 104px; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.panel { transform-origin: calc(100% - 34px) 34px; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s, visibility 0s linear 0s; }
.panel.collapsed { transform: scale(.06); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .35s cubic-bezier(.4,0,.6,1), opacity .25s .05s, visibility 0s linear .35s; }
.panel-head { font-size: 13px; color: var(--muted); min-height: 36px; display: flex; align-items: center; padding-right: 52px; }
.footer { gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }

/* black glass round buttons (collapse toggle, full-screen bar) */
.glass-btn { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--text);
  background: rgba(0,0,0,.62); -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,.14); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.glass-btn:hover { background: rgba(30,30,34,.75); }
.glass-btn:focus-visible { outline: 2px solid #e8e3d9; outline-offset: 2px; }
.pad-toggle { position: fixed; top: calc(var(--gap) + 10px); right: calc(var(--gap) + 10px); z-index: 5; }
.pad-toggle .ic-closed, .pad-toggle.is-collapsed .ic-open { display: none; }
.pad-toggle.is-collapsed .ic-closed { display: block; }
.fsbar { position: fixed; top: 16px; right: 16px; display: flex; gap: 10px; z-index: 6; }
.fsbar[hidden] { display: none; }
body.fs .pad-toggle { display: none; }
body.fs .panel { top: 80px; }

@media (max-width: 760px) {
  .panel { top: auto; left: var(--gap); width: auto; height: 54vh; transform-origin: calc(100% - 34px) 34px; }
  .pad-toggle { top: auto; bottom: calc(54vh + var(--gap) - 58px); }
  .pad-toggle.is-collapsed { bottom: var(--gap); }
  body.fs .panel { top: auto; }
  .hud { left: 18px; top: 18px; }
  .hud-big { left: 20px; top: 18px; } .name { font-size: 34px; } .corner { display: none; }
}

/* black glass dock floating over the pad */
.dock {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 8px; padding: 8px; border-radius: 999px;
  background: rgba(0,0,0,.62);
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.dock-btn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06); color: var(--text); display: grid; place-items: center; cursor: pointer; transition: background .15s, opacity .15s; }
.dock-btn:hover:not(:disabled) { background: rgba(255,255,255,.16); }
.dock-btn:disabled { opacity: .35; cursor: default; }
.dock-btn:focus-visible { outline: 2px solid #e8e3d9; outline-offset: 2px; }

.group { display: flex; flex-direction: column; gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.group.sep { gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
legend { padding: 0; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.val { color: var(--text); }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack[hidden] { display: none; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; }
.range:focus-visible { outline: 2px solid #e8e3d9; outline-offset: 4px; border-radius: 4px; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.16); }
.range::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.16); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--text); margin-top: -8px; border: 3px solid #17181c; box-shadow: 0 0 0 1px var(--text); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--text); border: 3px solid #17181c; box-shadow: 0 0 0 1px var(--text); }
.pill { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--edge); background: rgba(255,255,255,.04); cursor: pointer; font-size: 14px; font-weight: 500; min-width: 0; }
.pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill:hover { border-color: rgba(255,255,255,.3); }
.pill:has(input:checked) { border-color: var(--text); background: rgba(255,255,255,.1); }
.pill:has(input:focus-visible) { outline: 2px solid #e8e3d9; outline-offset: 2px; }
.pill input, .chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pill.user::after { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--text); opacity: .6; }
.swatch { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--edge); background: rgba(255,255,255,.05); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: rgba(255,255,255,.3); }
.btn:focus-visible { outline: 2px solid #e8e3d9; outline-offset: 2px; }
.btn.primary { background: var(--text); color: #121316; border-color: var(--text); font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--text); margin: 0; }
.controls { display: flex; flex-direction: column; }
.sec { border-top: 1px solid var(--line); }
.sec:first-child { border-top: 0; }
.sec summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 48px; font-size: 14px; font-weight: 600; }
.sec summary .badge { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.sec summary .badge:empty { display: none; }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: '+'; font-family: 'JetBrains Mono', monospace; color: var(--muted); }
.sec[open] summary::after { content: '−'; }
.sec summary:focus-visible { outline: 2px solid #e8e3d9; outline-offset: 2px; }
.sec-body { display: flex; flex-direction: column; gap: 12px; padding-bottom: 18px; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.note[hidden] { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--edge); background: rgba(255,255,255,.04); font-size: 13px; cursor: pointer; }
.chip:hover { border-color: rgba(255,255,255,.3); }
.chip:has(input:checked) { border-color: var(--text); background: rgba(255,255,255,.1); }
.chip:has(input:focus-visible) { outline: 2px solid #e8e3d9; outline-offset: 2px; }
.colors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.color { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.color input { width: 100%; height: 36px; border: 1px solid var(--edge); border-radius: 10px; background: none; padding: 2px; cursor: pointer; }

/* dialogs + toast */
.glass-dialog { border: 1px solid rgba(255,255,255,.14); border-radius: 24px; padding: 24px; width: min(380px, calc(100vw - 32px)); color: var(--text);
  background: rgba(18,19,23,.78); -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.glass-dialog::backdrop { background: rgba(0,0,0,.35); }
.glass-dialog h2 { margin: 0 0 12px; font-size: 18px; }
.glass-dialog form { display: flex; flex-direction: column; gap: 8px; }
.text { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--edge); background: rgba(255,255,255,.06); color: var(--text); font: inherit; font-size: 15px; padding: 0 12px; }
.text:focus-visible { outline: 2px solid #e8e3d9; outline-offset: 2px; }
.error { min-height: 18px; margin: 0; font-size: 13px; color: #ffb4a8; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; left: 50%; top: 20px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 999px; background: rgba(0,0,0,.72); color: var(--text); font-size: 14px; transition: opacity .25s, transform .25s; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* auto options / sound */
.sub-head { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.meter { display: grid; grid-template-columns: 14px 1fr; gap: 6px 8px; align-items: center; font-size: 11px; color: var(--muted); }
.meter .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 100%; background: var(--text); transform-origin: left center; transform: scaleX(0); }
.beat-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text); opacity: .15; transition: opacity .08s; }
.beat-dot.on { opacity: 1; }
.btn:disabled { opacity: .4; cursor: default; }
.file-name { font-size: 12px; color: var(--muted); align-self: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* sound-reactive screen-edge glow: fades out ~25% in from every edge */
.edge-glow { position: absolute; inset: 0; pointer-events: none; opacity: 0; --eg: rgba(255,255,255,.3);
  background:
    linear-gradient(to right, var(--eg), transparent 25%),
    linear-gradient(to left, var(--eg), transparent 25%),
    linear-gradient(to bottom, var(--eg), transparent 25%),
    linear-gradient(to top, var(--eg), transparent 25%); }
