/* ==========================================================================
   Boom Studio
   A quiet, precise console with one loud thing in it: the music.
   Tokens -> base -> chrome -> panels -> stage -> inspector -> responsive
   ========================================================================== */

@font-face {
  font-family: "BoomMusic";
  src: url("/fonts/BoomMusic.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/InterVariable.woff2") format("woff2-variations"),
       url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ink - the chrome, near-black and slightly warm */
  --ink-1000: #06070a;
  --ink-950: #080a0e;
  --ink-900: #0c0e13;
  --ink-850: #101318;
  --ink-800: #14181f;
  --ink-750: #181d25;
  --ink-700: #1e242e;

  /* lines - hairline first, never a heavy border */
  --line: #222833;
  --line-soft: #191e26;
  --line-strong: #2c3441;

  /* text */
  --text: #f3f5f9;
  --text-2: #b9c0cd;
  --muted: #8d97a8;
  --dim: #78839a;

  /* one accent, used sparingly */
  --accent: #ffc63d;
  --accent-hi: #ffd970;
  --accent-lo: #f0a51c;
  --accent-ink: #1b1305;
  --accent-wash: rgba(255, 198, 61, 0.10);

  /* states */
  --ok: #45d6a0;
  --warn: #ffc63d;
  --danger: #ff7b7b;

  /* geometry */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* elevation */
  --e1: 0 1px 2px rgba(0, 0, 0, .4);
  --e2: 0 2px 6px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .03) inset;
  --e3: 0 10px 30px -8px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .04) inset;
  --e-stage: 0 40px 120px -40px rgba(255, 198, 61, .22), 0 24px 60px -30px rgba(0, 0, 0, .9);

  --ease: cubic-bezier(.2, .7, .25, 1);
  --fast: .14s var(--ease);
  --med: .24s var(--ease);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  font-feature-settings: "cv05" 1, "ss03" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  /* one soft light from above, so the page is not a flat slab */
  content: "";
  position: fixed;
  inset: -20% 0 auto 0;
  height: 70vh;
  background: radial-gradient(60% 100% at 50% 0%, rgba(255, 198, 61, .07), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* scrollbars, quietly */
* { scrollbar-width: thin; scrollbar-color: var(--ink-700) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--ink-700); border-radius: 99px;
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: content-box; }

/* --------------------------------------------------------------------------
   micro type
   -------------------------------------------------------------------------- */

.micro {
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
}

/* --------------------------------------------------------------------------
   top bar
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 14, 19, .9);
  background: color-mix(in srgb, var(--ink-900) 88%, transparent);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
  height: 30px;
  flex: 0 0 auto;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}
.brand-mark i {
  display: block;
  width: 5px;
  border-radius: 99px;
  box-shadow: 0 0 12px -2px currentColor;
}
.brand-mark i:nth-child(1) { height: 22px; background: #e11d2e; color: #e11d2e; }
.brand-mark i:nth-child(2) { height: 28px; background: var(--accent); color: var(--accent); }
.brand-mark i:nth-child(3) { height: 17px; background: #0e9bd8; color: #0e9bd8; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -.015em;
  color: var(--text);
}
.brand-sub {
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 550;
}

.title-field { flex: 1 1 auto; min-width: 0; }
.title-field input {
  width: 100%;
  max-width: 460px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: 15.5px;
  font-weight: 560;
  letter-spacing: -.012em;
  color: var(--text);
  text-overflow: ellipsis;
  transition: background var(--fast), border-color var(--fast);
}
.title-field input:hover { background: var(--ink-850); }
.title-field input:focus {
  background: var(--ink-800);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.topbar-meta { display: flex; gap: 10px; align-items: center; }

.mini-field {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  color: var(--dim);
  font-size: 9.5px;
  font-weight: 620;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.mini-field input {
  width: 66px;
  background: var(--ink-850);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 4px 7px;
  font-size: 13px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  transition: border-color var(--fast), background var(--fast);
}
.mini-field input:hover { border-color: var(--line-strong); }
.mini-field input:focus { border-color: var(--accent); background: var(--ink-800); outline: none; }

/* --------------------------------------------------------------------------
   buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--ink-750);
  color: var(--text);
  cursor: pointer;
  font-weight: 560;
  font-size: 13px;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: background var(--fast), border-color var(--fast),
              transform var(--fast), box-shadow var(--fast);
}
.btn:hover { background: var(--ink-700); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; fill: currentColor; flex: 0 0 auto; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  border-color: #b9820f;
  color: var(--accent-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 6px 18px -8px rgba(255, 198, 61, .8);
  font-weight: 640;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #ffdf8c, var(--accent));
  border-color: #c98d10;
}

.btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--ink-800); border-color: var(--line); color: var(--text); }

.btn-wide { width: 100%; }
.btn-icon { padding: 0; width: 34px; }
.btn-icon svg { width: 16px; height: 16px; }

.link-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 11.5px; font-weight: 560; padding: 3px 0;
  transition: color var(--fast);
}
.link-btn:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   shell
   -------------------------------------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr) 312px;
  height: calc(100vh - 64px);
  min-height: 0;
}

.sidebar, .inspector {
  background: var(--ink-900);
  overflow-y: auto;
  padding: 16px 14px 28px;
  min-height: 0;
  overscroll-behavior: contain;
}
.sidebar { border-right: 1px solid var(--line); }
.inspector {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --------------------------------------------------------------------------
   tabs
   -------------------------------------------------------------------------- */

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--ink-1000);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.tabs::before {
  /* covers the sidebar's top padding once the strip sticks */
  content: "";
  position: absolute;
  left: -14px;
  right: -14px;
  top: -16px;
  height: 16px;
  background: var(--ink-900);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 570;
  cursor: pointer;
  transition: background var(--fast), color var(--fast), box-shadow var(--fast);
}
.tab svg { width: 13px; height: 13px; fill: currentColor; opacity: .75; }
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--ink-800);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, var(--e1);
}
.tab.is-active svg { opacity: 1; color: var(--accent); }

.panel { display: none; flex-direction: column; gap: 14px; }
.panel.is-active { display: flex; animation: panel-in .18s var(--ease); }
/* the tube editor is not a tab panel - it lives under the tabs, always open */
.panel.panel-tubes { display: flex; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

/* section headers inside panels */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-head h2 {
  font-size: 10.5px;
  font-weight: 640;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dim);
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  letter-spacing: -.002em;
}
.hint code {
  font-family: var(--mono);
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
  padding: 0 4px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-2);
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-label {
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-width: 46px;
}

/* --------------------------------------------------------------------------
   segmented control
   -------------------------------------------------------------------------- */

.seg {
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  background: var(--ink-1000);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 570;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}
.seg button:hover { color: var(--text); }
.seg button.is-active {
  background: var(--ink-750);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}

/* the note pad: big keys under the staff, the way you actually write */
.beat-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 14px 0;
}
.beat-pad[hidden] { display: none; }
.pad-key {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pad-key svg { width: 19px; height: 32px; }
.pad-key:hover { border-color: var(--line-strong); color: var(--text); }
.pad-key.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 198, 61, .09);
}
.pad-tools { grid-column: 1 / -1; display: flex; gap: 6px; }
.pad-tool {
  flex: 1;
  height: 36px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--ink-850);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.pad-tool:hover { color: var(--text); border-color: var(--line-strong); }
.pad-tool.is-active { color: var(--accent); border-color: var(--accent); }
.pad-back { flex: 0 0 72px; font-size: 16px; }

/* note value picker: one glyph per length, notes or rests */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.seg-values button {
  padding: 5px 9px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.seg-values svg { width: 17px; height: 29px; display: block; color: currentColor; }
.seg-values .ico-rest { display: none; }
.seg-values[data-mode="rest"] .ico-note { display: none; }
.seg-values[data-mode="rest"] .ico-rest { display: block; }

/* the strip that appears when a note is selected */
.sel-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ink-850);
}
.sel-head { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sel-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.sel-pos { font-size: 10.5px; color: var(--dim); letter-spacing: .04em; }
.sel-acc { display: flex; gap: 4px; }
.acc-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--text-2);
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.acc-btn:hover { color: var(--text); border-color: var(--line-strong); }
.acc-btn[disabled] { opacity: .35; cursor: not-allowed; }
.acc-del { color: var(--text-2); }
.acc-del:hover { color: #ff8a8a; border-color: #6b2a2a; }

/* --------------------------------------------------------------------------
   fields
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }

textarea, select, .drop {
  width: 100%;
  background: var(--ink-850);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--fast), background var(--fast);
}
textarea { font-family: var(--mono); resize: vertical; line-height: 1.55; font-size: 12.5px; }
textarea:focus, select:focus { border-color: var(--accent); background: var(--ink-800); outline: none; }

select {
  cursor: pointer;
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238d97a8' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px;
}
select:hover { border-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   drop zone
   -------------------------------------------------------------------------- */

.drop {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 14px;
  border-style: dashed;
  border-color: var(--line-strong);
  cursor: pointer;
  color: var(--muted);
  background: var(--ink-850);
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.drop::before {
  content: "";
  width: 30px; height: 30px;
  margin-bottom: 4px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--accent-wash) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d97a8' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M12 16V4m0 0L7 9m5-5 5 5'/%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E") center/18px no-repeat;
}
.drop:hover, .drop.is-over {
  border-color: var(--accent);
  background: var(--ink-800);
  color: var(--text);
}
.drop:hover strong { color: var(--accent-hi); }
.drop strong { color: var(--text); font-weight: 600; font-size: 13px; }
.drop span { font-size: 11.5px; color: var(--dim); }
.drop-small { padding: 14px 12px; }

/* --------------------------------------------------------------------------
   track rows
   -------------------------------------------------------------------------- */

.track-list { display: flex; flex-direction: column; gap: 6px; }
.track-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  background: var(--ink-850);
  transition: border-color var(--fast), background var(--fast);
}
.track-row:hover { border-color: var(--line); background: var(--ink-800); }
.track-row input { accent-color: var(--accent); }

/* --------------------------------------------------------------------------
   song cards
   -------------------------------------------------------------------------- */

.preset-list { display: flex; flex-direction: column; gap: 7px; }

.preset-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title arrow" "meta arrow" "strip arrow";
  gap: 2px 10px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  cursor: pointer;
  text-align: left;
  width: 100%;
  overflow: hidden;
  transition: border-color var(--fast), transform var(--fast), background var(--fast);
}
.preset-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 0% 0%, rgba(255, 198, 61, .09), transparent 55%);
  opacity: 0;
  transition: opacity var(--med);
  pointer-events: none;
}
.preset-row:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.preset-row:hover::after { opacity: 1; }
.preset-row:active { transform: translateY(0); }

.preset-row .preset-name {
  grid-area: title;
  font-size: 13px;
  font-weight: 590;
  letter-spacing: -.008em;
  color: var(--text);
}
.preset-row small {
  grid-area: meta;
  color: var(--dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.preset-row .preset-arrow {
  grid-area: arrow;
  color: var(--dim);
  transition: color var(--fast), transform var(--fast);
}
.preset-row:hover .preset-arrow { color: var(--accent); transform: translateX(2px); }

.preset-strip {
  grid-area: strip;
  display: flex;
  gap: 2px;
  margin-top: 7px;
  height: 4px;
  width: 100%;
}
.preset-strip i {
  flex: 1;
  border-radius: 99px;
  opacity: .85;
}

/* --------------------------------------------------------------------------
   tubes panel
   -------------------------------------------------------------------------- */

.panel-tubes {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}

.lane-colors { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.lane-color-row {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 7px;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background var(--fast);
}
.lane-color-row:hover { background: var(--ink-850); }
.lane-color-row input[type="color"] {
  width: 24px; height: 24px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 7px; background: none; cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .25);
}
.lane-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.lane-color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.lane-color-name { font-size: 12.5px; font-weight: 620; min-width: 24px; letter-spacing: -.01em; }
.lane-color-hex {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  margin-left: auto; letter-spacing: .02em;
}

/* --------------------------------------------------------------------------
   stage
   -------------------------------------------------------------------------- */

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(255, 198, 61, .045), transparent 70%),
    var(--ink-950);
}

.stage-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.stage-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--ink-850);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 530;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.chip:empty { display: none; }
.chip.warn::before { background: var(--warn); }
.select-inline {
  width: auto;
  padding: 3px 24px 3px 8px;
  font-size: 11.5px;
  background-color: var(--ink-800);
}
.warn { color: var(--warn); }

.canvas-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  position: relative;
}

.canvas-wrap canvas,
.canvas-wrap .live-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: #0b0d12;
  box-shadow: var(--e-stage);
  touch-action: none;
  transition: box-shadow var(--med), border-color var(--med), transform var(--med);
}
.canvas-wrap canvas:hover { border-color: var(--line-strong); }

.canvas-wrap canvas:not([hidden]),
.canvas-wrap .live-video:not([hidden]) {
  animation: stage-in .34s var(--ease) both;
}
@keyframes stage-in {
  from { opacity: 0; transform: scale(.994); }
  to { opacity: 1; transform: none; }
}

body[data-playing="true"] .canvas-wrap canvas,
body[data-playing="true"] .canvas-wrap .live-video {
  border-color: rgba(255, 198, 61, .32);
  box-shadow: 0 0 0 1px rgba(255, 198, 61, .12),
              0 30px 90px -30px rgba(255, 198, 61, .35),
              0 20px 50px -24px rgba(0, 0, 0, .9);
}

.live-video { max-height: calc(100vh - 240px); background: #000; }

/* empty state */
.empty-hint {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
  text-align: center;
  max-width: 340px;
  line-height: 1.55;
  padding: 26px 28px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-strong);
  background: rgba(8, 10, 14, .55);
}
.empty-hint strong {
  font-size: 15px;
  font-weight: 620;
  color: var(--text);
  letter-spacing: -.012em;
}
.empty-hint .btn {
  pointer-events: auto;
  margin-top: 6px;
}
.empty-tubes {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 46px;
  margin-bottom: 2px;
}
.empty-tubes i {
  display: block;
  width: 11px;
  border-radius: 99px;
  animation: bob 2.4s var(--ease) infinite;
}
.empty-tubes i:nth-child(1) { height: 34px; background: #e11d2e; animation-delay: 0s; }
.empty-tubes i:nth-child(2) { height: 46px; background: #f7c312; animation-delay: .18s; }
.empty-tubes i:nth-child(3) { height: 28px; background: #0e9bd8; animation-delay: .36s; }
.empty-tubes i:nth-child(4) { height: 40px; background: #22a64b; animation-delay: .54s; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* --------------------------------------------------------------------------
   transport
   -------------------------------------------------------------------------- */

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 18px 18px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  box-shadow: var(--e2);
}

.play-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #c98d10;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(255, 255, 255, .35) inset, 0 8px 20px -10px rgba(255, 198, 61, .9);
  transition: transform var(--fast), filter var(--fast);
}
.play-btn:hover { filter: brightness(1.06); }
.play-btn:active { transform: scale(.96); }
.play-btn svg { width: 18px; height: 18px; fill: currentColor; }

.scrub {
  flex: 1;
  height: 22px;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

.clock {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  min-width: 96px;
  letter-spacing: .01em;
}
.clock b { color: var(--dim); font-weight: 500; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 520;
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: var(--accent); }

/* --------------------------------------------------------------------------
   inspector cards
   -------------------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
}
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.card-head h2 {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-2);
}

.render-box { display: flex; flex-direction: column; gap: 10px; }

.progress {
  position: relative;
  height: 6px;
  background: var(--ink-1000);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-lo), var(--accent-hi));
  box-shadow: 0 0 14px rgba(255, 198, 61, .6);
  transition: width .3s var(--ease);
  position: relative;
}
.progress .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.render-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.render-status::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  transition: background var(--med), box-shadow var(--med);
}
body[data-rendering="true"] .render-status::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* switches */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 2px;
  cursor: pointer;
  user-select: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: color var(--fast);
}
.switch:hover { color: var(--text); }
.switch input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 30px;
  height: 18px;
  border-radius: 99px;
  background: var(--ink-1000);
  border: 1px solid var(--line-strong);
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background var(--fast), border-color var(--fast);
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dim);
  transition: transform var(--fast), background var(--fast);
}
.switch input:checked {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  border-color: #c98d10;
}
.switch input:checked::after {
  transform: translateX(14px);
  background: var(--accent-ink);
}
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--ink-750);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 11px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 520;
  box-shadow: var(--e3);
  z-index: 60;
  max-width: min(90vw, 480px);
  opacity: 0;
  transition: opacity var(--med), transform var(--med);
}
.toast:not([hidden]) { opacity: 1; transform: translate(-50%, 0); }
.toast::before {
  content: "";
  width: 16px; height: 16px; flex: 0 0 auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2345d6a0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/16px no-repeat;
}
.toast.is-error { border-color: rgba(255, 123, 123, .5); color: #ffdcdc; }
.toast.is-error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff7b7b' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 8v5M12 16.5v.5'/%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .shell {
    grid-template-columns: 290px minmax(0, 1fr);
    height: auto;
    min-height: calc(100vh - 64px);
  }
  /* the page scrolls at this width, so a sticky strip would slide under the
     top bar; leave it in the flow */
  .tabs { position: static; }
  .tabs::before { display: none; }
  .inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    align-items: start;
    padding-bottom: 24px;
  }
  /* the music rides along as the settings scroll under it, so the score never
     leaves the screen */
  .stage {
    min-height: 64vh;
    position: sticky;
    top: 64px;
    align-self: start;
    z-index: 6;
    max-height: calc(100vh - 64px);
    box-shadow: 0 28px 60px -44px rgba(0, 0, 0, .95);
  }
}

@media (max-width: 820px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 10px;
    /* a 160px sticky header eats the phone screen; let it scroll away */
    position: static;
  }
  .brand { border-right: 0; padding-right: 0; }
  .brand-sub { display: none; }
  .title-field { order: 3; flex: 1 1 100%; }
  .title-field input { max-width: none; font-size: 15px; }
  .topbar-meta { order: 4; width: 100%; justify-content: space-between; }
  .mini-field { flex: 1; }
  .mini-field input { width: 100%; }
  #render-btn { order: 2; margin-left: auto; }

  .shell { grid-template-columns: 1fr; }
  /* the picture comes first on a phone; the tools follow */
  .stage { order: 1; }
  .sidebar { order: 2; }
  .inspector { order: 3; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
    padding-bottom: 20px;
  }
  .tabs { position: static; }
  /* the top bar scrolls away on a phone, so the music pins to the very top
     and keeps a thumb-sized strip of page below it */
  .stage { min-height: 0; max-height: 72vh; top: 0; }
  .canvas-wrap { padding: 12px; }
  .transport {
    margin: 0 12px 12px;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    bottom: 10px;
    backdrop-filter: blur(12px);
  }
  .clock { min-width: 84px; font-size: 11.5px; }
  .inspector { grid-template-columns: 1fr; padding: 14px 12px 28px; }

  .btn, .tab, .seg button, .switch { min-height: 38px; }
  .play-btn { width: 46px; height: 46px; }
}

@media (max-width: 420px) {
  .topbar-meta { gap: 8px; }
  .stage-meta { display: none; }
  .empty-hint { padding: 20px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* fingers, not cursors: the notation palette gets proper targets */
@media (pointer: coarse) {
  /* the staff gets its own scroll box on a phone so the pad is always in
     reach under the thumb */
  .canvas-wrap { max-height: 46vh; overflow-y: auto; }
  .beat-pad { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .seg-values button { min-width: 46px; min-height: 46px; padding: 6px 10px; }
  .seg-values svg { width: 20px; height: 34px; }
  .acc-btn { width: 40px; height: 40px; font-size: 17px; }
  .sel-strip { padding: 10px 12px; }
}


/* keyboard hints and the note input toggle */
kbd {
  font: inherit;
  font-size: 0.78em;
  padding: 0.05em 0.34em;
  border: 1px solid var(--line-2, rgba(255, 255, 255, 0.18));
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-100, #e8edf6);
  white-space: nowrap;
}
.pad-input-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-color: rgba(255, 198, 61, 0.45);
}
.pad-input-btn.is-active {
  background: rgba(255, 198, 61, 0.22);
  border-color: rgba(255, 198, 61, 0.85);
  color: #ffd76a;
}
.pad-input-btn kbd {
  font-size: 0.72em;
  opacity: 0.8;
}

/* the staff answers the pointer */
.canvas-wrap canvas:not([hidden]) { cursor: crosshair; }
.pad-input-btn:hover {
  border-color: rgba(255, 198, 61, 0.8);
  color: #ffd76a;
  background: rgba(255, 198, 61, 0.1);
}

/* on-screen piano, C4 to G5 */
.piano {
  position: relative;
  display: flex;
  gap: 3px;
  margin-bottom: 10px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.pk-w {
  flex: 1 1 0;
  min-width: 0;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  padding-bottom: 5px;
  background: #f2eee3;
  color: #3a3f4a;
  border-radius: 0 0 5px 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.pk-w:active { background: #ffd76a; }
.pk-note { font-size: 8.5px; font-weight: 500; color: #8a8fa0; }
.pk-b {
  position: absolute;
  top: 0;
  width: 26px;
  max-width: 5.5%;
  height: 36px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  background: #171a21;
  color: #cfd5e1;
  border: 1px solid #000;
  border-radius: 0 0 4px 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
}
.pk-b:active { background: #c8932a; color: #111; }

/* right-click duration menu */
.note-menu {
  position: fixed;
  z-index: 90;
  min-width: 120px;
  background: #151a24;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.note-menu-title {
  font-size: 10.5px;
  font-weight: 640;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #9aa1b5;
  padding: 4px 8px 6px;
}
.note-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: #e8edf6;
  font: inherit;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.note-menu-item:hover { background: rgba(255, 198, 61, 0.16); }
