/* Drum Lab: a compact rhythm-composer workspace inside the light Studio Music Tools shell.
 * Warm off-white machine body, graphite controls, one restrained orange for active steps and the playhead.
 * Active state never relies on colour alone: step levels differ in fill, mark shape and size. */
.dl-intro { padding-top: 22px; padding-bottom: 40px; }
.dl-intro__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.dl-intro h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -0.03em; margin: 6px 0 0; line-height: 1.05; }
.dl-intro__lede { margin: 0; color: #4f545a; font-size: 1rem; max-width: 420px; }
.dl-stage { padding-top: 40px; padding-bottom: 36px; }

.dl {
  --dl-body: #e7e3d9; --dl-body-2: #ddd8cb; --dl-key: #f4f1e9; --dl-key-2: #ebe7dc; --dl-line: #bdb6a6; --dl-line-2: #a9a291;
  --dl-beat: 10px; --dl-ink: #25282c; --dl-ink-2: #3a3e44; --dl-ghost: #686d74; --dl-muted: #515659;
  --dl-led: #e0501e; --dl-hot: #c2410c; --dl-focus: #1f4fbf;
  --dl-label: 214px; --dl-stepw: minmax(34px, 1fr); --dl-rowh: 38px;
  background: var(--dl-body); color: var(--dl-ink); border: 1px solid var(--dl-line-2); border-radius: 6px;
  box-shadow: 0 1px 0 #fff inset, 0 2px 0 var(--dl-line);
  font-family: var(--font-body); font-size: 13px;
}
:where(.dl) button, :where(.dl) select, :where(.dl) input { font: inherit; color: inherit; }
.dl :focus-visible { outline: 3px solid var(--dl-focus); outline-offset: 2px; }
.dl [hidden] { display: none !important; }

/* ---------- top bar ---------- */
.dl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 12px 16px; border-bottom: 1px solid var(--dl-line-2); background: var(--dl-body-2); border-radius: 6px 6px 0 0; }
.dl-brand { display: flex; align-items: center; gap: 12px; padding-right: 22px; border-right: 1px solid var(--dl-line-2); }
.dl-brand__logo { display: block; height: 36px; width: auto; }
.dl-brand__name { display: flex; flex-direction: column; line-height: 1.1; }
.dl-brand__name strong { font-family: var(--font-heading); font-size: 17px; letter-spacing: 0.12em; }
.dl-brand__name span { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dl-muted); margin-top: 3px; }
.dl-transport { display: flex; gap: 8px; }
.dl-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dl-field label, .dl-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dl-muted); display: flex; justify-content: space-between; gap: 8px; }
.dl-field output { color: var(--dl-ink); letter-spacing: 0.04em; }
.dl-field select, .dl-bpm__box { height: 34px; border: 1px solid var(--dl-line-2); border-radius: 3px; background: var(--dl-key); }
.dl-field select { padding: 0 8px; min-width: 96px; }
.dl-bpm { position: relative; }
.dl-bpm__box { min-height: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; grid-template-rows: minmax(0, 1fr); align-items: stretch; overflow: hidden; width: 128px; box-sizing: border-box; }
.dl-bpm input { min-height: 0; display: block; width: 100%; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; color: var(--dl-ink); text-align: center; font-family: var(--font-mono); font-size: 18px; font-weight: 600; line-height: 32px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.dl-bpm input::-webkit-outer-spin-button, .dl-bpm input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dl-nudge { min-height: 0; display: grid; place-items: center; width: 34px; height: 100%; padding: 0; border: 0; background: var(--dl-key-2); cursor: pointer; font-size: 18px; line-height: 1; }
.dl-nudge:hover { background: var(--dl-line); }
.dl-unit { position: absolute; right: 40px; top: 21px; font-size: 9px; letter-spacing: 0.12em; color: var(--dl-ghost); pointer-events: none; display: none; }
.dl input[type="range"] { accent-color: var(--dl-ink); width: 100%; min-width: 96px; margin: 0; height: 22px; }

.dl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid var(--dl-ink); border-radius: 3px; background: var(--dl-key); color: var(--dl-ink); font-family: var(--font-heading); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; text-decoration: none; white-space: nowrap; }
.dl-btn:hover:not(:disabled):not([aria-pressed="true"]) { background: #fff; }
.dl-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.dl-btn--primary { background: var(--dl-ink); color: #f4f1e9; }
.dl-btn--primary:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--dl-ink-2); }
.dl-btn--quiet { border-color: var(--dl-line-2); height: 30px; padding: 0 11px; font-size: 11px; }
.dl-btn--play { min-width: 96px; }
.dl-btn--play[aria-pressed="true"] { background: var(--dl-hot); border-color: #8d2f08; color: #fff; }
.dl-btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.dl-ico { width: 0; height: 0; display: inline-block; }
.dl-ico--play { border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.dl-ico--stop { width: 11px; height: 11px; background: currentColor; }

/* ---------- sequencer ---------- */
.dl-seq { padding: 12px 16px 6px; }
.dl-seq__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin-bottom: 10px; }
.dl-paint, .dl-slots { display: flex; align-items: center; gap: 6px; }
.dl-paint .dl-label, .dl-slots .dl-label { margin-right: 4px; }
.dl-paint button { height: 28px; padding: 0 10px; border: 1px solid var(--dl-line-2); border-radius: 3px; background: var(--dl-key); cursor: pointer; font-size: 12px; }
.dl-paint button[aria-pressed="true"] { background: var(--dl-ink); color: #f4f1e9; border-color: var(--dl-ink); }
.dl-slot { position: relative; width: 38px; height: 30px; border: 1px solid var(--dl-ink); border-radius: 3px; background: var(--dl-key); cursor: pointer; font-family: var(--font-heading); font-weight: 700; }
.dl-slot[aria-pressed="true"] { background: var(--dl-ink); color: #f4f1e9; }
.dl-slot i { position: absolute; right: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.dl-slot.is-queued { outline: 2px dashed var(--dl-hot); outline-offset: 1px; }
.dl-slot.has-data i { background: var(--dl-led); }
.dl-seq__actions { display: flex; gap: 6px; margin-left: auto; }

.dl-gridwrap { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.dl-grid { min-width: 780px; }
.dl-row { display: grid; grid-template-columns: var(--dl-label) repeat(4, var(--dl-stepw)) var(--dl-beat) repeat(4, var(--dl-stepw)) var(--dl-beat) repeat(4, var(--dl-stepw)) var(--dl-beat) repeat(4, var(--dl-stepw)); column-gap: 3px; align-items: center; margin-bottom: 4px; }
.dl-row--head { margin-bottom: 3px; }
/* Four beats of four steps: the label is child 1, steps 1-4 are children 2-5, and steps 5, 9 and 13 (children 6, 10, 14)
 * start after a spacer track, so every step and every number keeps the same width and the beats read as equal groups. */
.dl-row > :nth-child(6) { grid-column: 7; }
.dl-row > :nth-child(10) { grid-column: 12; }
.dl-row > :nth-child(14) { grid-column: 17; }
.dl-rowlabel { position: sticky; left: 0; z-index: 2; display: flex; align-items: center; gap: 6px; height: var(--dl-rowh); padding-right: 8px; background: var(--dl-body); }
.dl-rowlabel--head { height: 22px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dl-muted); }
.dl-rn-short { display: none; }
.dl-rowname { flex: 1; min-width: 0; font-family: var(--font-heading); font-weight: 600; font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-ms { width: 26px; height: 26px; border: 1px solid var(--dl-line-2); border-radius: 3px; background: var(--dl-key); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; }
.dl-ms[aria-pressed="true"] { background: var(--dl-ink); color: #f4f1e9; border-color: var(--dl-ink); }
.dl-ms[data-solo][aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--dl-led); }
.dl-lock { width: 26px; height: 26px; border: 1px solid var(--dl-line-2); border-radius: 3px; background: var(--dl-key); cursor: pointer; padding: 0; display: grid; place-items: center; }
.dl-lock span { display: block; width: 10px; height: 8px; margin-top: 4px; border: 2px solid var(--dl-ink); border-radius: 1px; position: relative; background: transparent; }
.dl-lock span::before { content: ""; position: absolute; left: 0; top: -8px; width: 6px; height: 7px; border: 2px solid var(--dl-ink); border-bottom: 0; border-radius: 4px 4px 0 0; transform: translateX(0); }
.dl-lock[aria-pressed="false"] span::before { left: 3px; top: -9px; transform: rotate(18deg); transform-origin: bottom left; }
.dl-lock[aria-pressed="true"] { background: var(--dl-ink); border-color: var(--dl-ink); }
.dl-lock[aria-pressed="true"] span { border-color: #f4f1e9; background: #f4f1e9; }
.dl-lock[aria-pressed="true"] span::before { border-color: #f4f1e9; }
.dl-row.is-locked .dl-rowname::after { content: " · locked"; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dl-hot); font-size: 11px; }
.dl-row.is-muted .dl-step { opacity: 0.45; }

.dl-num { text-align: center; font-family: var(--font-mono); font-size: 11px; color: var(--dl-muted); height: 22px; line-height: 22px; border-bottom: 3px solid transparent; }
.dl-num--beat { font-weight: 700; color: var(--dl-ink); }
.dl-num.is-play { background: var(--dl-ink); color: #f4f1e9; border-bottom-color: var(--dl-led); }

.dl-step { position: relative; width: 100%; height: var(--dl-rowh); padding: 0; border: 1px solid var(--dl-line-2); border-bottom-width: 3px; border-radius: 3px; background: var(--dl-key); cursor: pointer; touch-action: manipulation; }
.dl-step:is([data-step="4"],[data-step="5"],[data-step="6"],[data-step="7"],[data-step="12"],[data-step="13"],[data-step="14"],[data-step="15"]) { background: var(--dl-key-2); }
.dl-step:hover { border-color: var(--dl-ink); }
.dl-step__mark { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); width: 0; height: 0; }
.dl-step[data-level="1"] { background: var(--dl-ghost); border-color: #55595f; }
.dl-step[data-level="1"] .dl-step__mark { top: 50%; bottom: auto; transform: translate(-50%, -50%); width: 6px; height: 6px; border-radius: 50%; background: var(--dl-led); }
.dl-step[data-level="2"], .dl-step[data-level="3"] { background: var(--dl-ink); border-color: #15171a; }
.dl-step[data-level="2"] .dl-step__mark { width: 54%; height: 4px; background: var(--dl-led); }
.dl-step[data-level="3"] .dl-step__mark { width: 78%; height: 4px; background: var(--dl-led); box-shadow: 0 -9px 0 0 var(--dl-led), 0 -18px 0 -1px #f4f1e9; height: 4px; }
.dl-step.is-play { box-shadow: 0 0 0 2px var(--dl-led); z-index: 1; }
.dl-hint { margin: 4px 0 8px; font-size: 12px; color: var(--dl-muted); }

/* ---------- groove + export ---------- */
.dl-lower { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 0; border-top: 1px solid var(--dl-line-2); }
.dl-panel { padding: 12px 16px 14px; }
.dl-panel + .dl-panel { border-left: 1px solid var(--dl-line-2); }
.dl-panel__title { margin: 0 0 10px; font-family: var(--font-heading); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.dl-groove { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px 16px; }
.dl-field--style select { width: 100%; }
.dl-fieldhint { font-size: 11px; line-height: 1.3; color: var(--dl-muted); }
.dl-field--word .dl-fieldhint { display: none; }
.dl-fieldhint--block { margin: 8px 0 0; display: block; }
.dl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.dl-actions__note { font-size: 11.5px; color: var(--dl-muted); }
.dl-export { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.dl-protag { display: inline-block; padding: 1px 5px; border: 1px solid currentColor; border-radius: 2px; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; line-height: 1.3; opacity: 0.85; }
.dl.is-pro .dl-protag { display: none; }

/* ---------- sound & mix ---------- */
.dl-mixer { border-top: 1px solid var(--dl-line-2); }
.dl-mixer summary { cursor: pointer; padding: 10px 16px; display: flex; gap: 12px; align-items: baseline; font-family: var(--font-heading); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; list-style: none; }
.dl-mixer summary::-webkit-details-marker { display: none; }
.dl-mixer summary::before { content: "▸"; font-size: 11px; }
.dl-mixer[open] summary::before { content: "▾"; }
.dl-mixer__sub { color: var(--dl-muted); text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 11.5px; }
.dl-strips { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 0; background: var(--dl-body); border-top: 1px solid var(--dl-line-2); }
.dl-strip { background: var(--dl-body); box-shadow: 1px 0 0 var(--dl-line-2), 0 1px 0 var(--dl-line-2); padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.dl-strip h3 { margin: 0; font-family: var(--font-heading); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.dl-strip label { display: flex; flex-direction: column; gap: 1px; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dl-muted); }
.dl-strip input[type="range"] { min-width: 0; }

/* ---------- footer: status + the existing producer-tools access flow ---------- */
.dl-foot { border-top: 1px solid var(--dl-line-2); background: var(--dl-body-2); padding: 10px 16px; border-radius: 0 0 6px 6px; display: grid; grid-template-columns: minmax(160px, 0.45fr) minmax(0, 1fr); gap: 8px 24px; align-items: center; }
.dl-status { margin: 0; font-size: 12.5px; min-height: 18px; }
.dl-status.is-error { color: #9a2a0a; font-weight: 600; }
.dl-pro { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; justify-content: flex-end; }
.dl-pro.is-attention { outline: 2px solid var(--dl-hot); outline-offset: 4px; border-radius: 2px; }
.dl-pro__offer { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-pro__price { font-size: 12.5px; color: var(--dl-ink); }
.dl-pro__price strong { font-weight: 700; }
.dl-pro__desc { margin: 0; }
.dl-pro__buy { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dl.is-pro .dl-pro__price, .dl.is-pro .dl-pro__desc { display: none; }
.dl-pro__name { font-family: var(--font-heading); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.dl-pro p { margin: 0; font-size: 12px; color: var(--dl-muted); }
.dl-pro #pro-error { grid-column: 1 / -1; color: #9a2a0a; }
.dl-pro__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- content below the instrument ---------- */
.dl-copy__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; }
.dl-copy h2, .dl-compare h2, .dl-faq h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin-bottom: 10px; }
.dl-copy p { max-width: 62ch; }
.dl-table { border: 1px solid #cfc9bb; border-radius: 4px; overflow: hidden; background: #fff; font-size: 14px; }
.dl-table > div { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 9px 14px; border-top: 1px solid #e3ded1; }
.dl-table > div:first-child { border-top: 0; }
.dl-table__head { font-weight: 700; background: #f4f1e9; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.dl-faq details { border-top: 1px solid #d6d0c2; padding: 10px 0; }
.dl-faq summary { cursor: pointer; font-weight: 600; }
.dl-faq details p { margin: 8px 0 0; }
.dl-related { margin-top: 18px; color: #4f545a; font-size: 14px; }

@media (prefers-reduced-motion: no-preference) {
  .dl-step, .dl-btn, .dl-num { transition: background-color 0.08s linear, border-color 0.08s linear; }
}

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .dl-lower { grid-template-columns: 1fr; }
  .dl-panel + .dl-panel { border-left: 0; border-top: 1px solid var(--dl-line-2); }
  .dl-copy__grid { grid-template-columns: 1fr; gap: 24px; }
  .dl { --dl-label: 156px; --dl-stepw: minmax(28px, 1fr); --dl-beat: 7px; }
  .dl-grid { min-width: 0; }
  .dl-rn-full { display: none; }
  .dl-rn-short { display: inline; }
  .dl-row.is-locked .dl-rowname::after { content: ""; }
}
/* ---------- phone: compact bar, fixed track labels, horizontally scrolling steps ---------- */
@media (max-width: 760px) {
  .dl { --dl-label: 148px; --dl-stepw: 40px; --dl-beat: 10px; --dl-rowh: 42px; font-size: 13px; }
  .dl-bar { padding: 10px 12px; gap: 10px 14px; }
  .dl-brand { width: 100%; border-right: 0; padding-right: 0; padding-bottom: 8px; border-bottom: 1px solid var(--dl-line-2); }
  .dl-transport { order: 1; }
  .dl-bpm { order: 2; }
  .dl-bar .dl-field:not(.dl-bpm) { flex: 1 1 120px; order: 3; }
  .dl-export .dl-field { flex: 1 1 100%; }
  .dl-seq { padding: 10px 0 4px 12px; }
  .dl-seq__tools { padding-right: 12px; gap: 8px 14px; }
  .dl-seq__actions { margin-left: 0; }
  .dl-grid { min-width: 0; width: max-content; padding-right: 12px; }
  .dl-rowlabel { gap: 4px; padding-right: 6px; }
  .dl-rowname { font-size: 11px; letter-spacing: 0.02em; }
  .dl-row.is-locked .dl-rowname::after { content: ""; }
  .dl-ms, .dl-lock { width: 28px; height: 28px; }
  .dl-hint { padding-right: 12px; }
  .dl-panel { padding: 12px; }
  .dl-groove { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-foot { grid-template-columns: 1fr; padding: 10px 12px; }
  .dl-pro { justify-content: flex-start; }
  .dl-pro__buy { align-items: flex-start; }
  .dl-strips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-strips > .dl-strip:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dl-table > div { grid-template-columns: minmax(0, 2fr) 1fr 1fr; padding: 8px 10px; font-size: 13px; gap: 8px; }
  .dl-intro__lede { display: none; }
  .dl-intro { padding-bottom: 30px; }
  .dl-stage { padding-top: 30px; }
}
