/* The teaching-build demo (build.js). Drawn in the site's own look: a white chat card on paper beside the same
   dark studio window the tear sheet uses, with orange notes. Shared by the homepage and /how-it-works/. */
.build { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 16px; align-items: stretch; }
.build button { font: inherit; }

/* ---------- chat ---------- */
.b-chat { display: flex; flex-direction: column; min-width: 0; height: 468px; background: var(--surface); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(27,22,38,.05), 0 24px 50px -36px rgba(27,22,38,.45); overflow: hidden; }
.b-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.b-top b { font-weight: 600; letter-spacing: -.01em; }
.b-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); }
.b-log { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px;
  font-size: 13.5px; line-height: 1.5; scrollbar-width: thin; }
.b-log li { max-width: 92%; padding: 9px 12px; border-radius: 12px; animation: b-in .35s var(--ease) both; }
.b-log b { font-weight: 600; }
.b-ai { align-self: flex-start; background: #f3efe9; border-bottom-left-radius: 4px; }
.b-me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
@keyframes b-in { from { opacity: 0; translate: 0 6px; } }
.b-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.b-go:disabled { opacity: .45; cursor: default; }
.b-link { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--accent-text); font-size: 13px; font-weight: 500; }
.b-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- studio window ---------- */
.b-win { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border-radius: 14px; background: #17121f; color: #fff;
  box-shadow: 0 30px 60px -28px rgba(10,6,20,.75); }
.b-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12px; color: rgba(255,255,255,.7); }
.b-bpm { font-variant-numeric: tabular-nums; }
.b-bpm b { color: #fff; font-weight: 600; font-size: 13px; }
.b-stages { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; flex: 1; }
.b-stages li { padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; color: rgba(255,255,255,.45); background: rgba(255,255,255,.05); transition: background-color .3s ease, color .3s ease; }
.b-stages li.is-done { color: rgba(255,255,255,.8); }
.b-stages li.is-done::before { content: "✓ "; color: #ffb08c; }
.b-stages li.is-now { background: var(--accent); color: var(--ink); }
.b-ctrls { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.b-snd, .b-play { height: 28px; border: 0; border-radius: 99px; cursor: pointer; font-size: 12px; font-weight: 600; }
.b-snd { width: 28px; background: rgba(255,255,255,.08); color: #fff; }
.b-snd[aria-pressed="false"] { color: rgba(255,255,255,.35); text-decoration: line-through; }
.b-play { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--accent); color: var(--ink); }
.b-play[aria-pressed="true"] { box-shadow: 0 0 0 2px currentColor inset; }
.b-play.is-nudge { animation: b-nudge 1.4s ease-in-out infinite; }
@keyframes b-nudge { 50% { box-shadow: 0 0 0 6px rgba(255,90,31,.25); } }
.b-panel { position: relative; padding-top: 16px; }
.b-tag { position: absolute; left: 0; top: 0; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.45); }

/* piano roll: 16 beats (4 bars) across, one row per pitch used */
.b-roll { display: grid; grid-template-columns: 30px 1fr; gap: 6px; --rh: 10px; }
.b-keys { display: grid; grid-template-rows: repeat(var(--rows), var(--rh)); font-size: 8px; line-height: var(--rh); color: rgba(255,255,255,.4); text-align: right; font-variant-numeric: tabular-nums; }
.b-grid { position: relative; height: calc(var(--rows) * var(--rh)); border-radius: 4px; overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 6.25% 100%,
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 100% var(--rh),
    rgba(255,255,255,.03); }
.b-note { position: absolute; left: calc(var(--s) / 16 * 100% + 1px); top: calc(var(--r) * var(--rh) + 1px);
  width: calc(var(--l) / 16 * 100% - 2px); height: calc(var(--rh) - 2px); border-radius: 2px; border: 0; padding: 0; }
.b-note--bass { background: #b9431d; }
.b-note--chords { background: var(--accent); opacity: .78; }
.b-note--melody { background: #ffb08c; }
.b-note--you { background: #fff; box-shadow: 0 0 0 1px var(--accent); }
.b-note.is-new { animation: b-pop .3s var(--ease) both; }
@keyframes b-pop { from { opacity: 0; scale: .4 1; } }
.b-ghost { background: transparent; outline: 1.5px dashed rgba(255,255,255,.7); outline-offset: -1.5px; cursor: pointer; animation: b-ghost 1.6s ease-in-out infinite; }
.b-ghost:hover, .b-ghost:focus-visible { background: rgba(255,255,255,.25); }
.b-ghost:focus-visible { outline: 2px solid #fff; }
@keyframes b-ghost { 50% { outline-color: rgba(255,176,140,.95); } }
/* the ghosts are small, so give them a bigger invisible hit area */
.b-ghost::after { content: ""; position: absolute; inset: -6px -2px; }
.b-line { position: absolute; top: 0; bottom: 0; left: calc(var(--p, 0) * 100%); width: 2px; background: #fff; opacity: 0; pointer-events: none; z-index: 2; }
.b-line.is-on { opacity: .85; }

/* channel rack + playlist rows */
.b-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 6px; }
.b-row > span { font-size: 11px; color: rgba(255,255,255,.6); }
.b-rack, .b-list { display: grid; gap: 4px; }
.b-steps { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }
.b-steps i { height: 12px; border-radius: 3px; background: rgba(255,255,255,.07); }
.b-steps i:nth-child(4n+1) { background: rgba(255,255,255,.13); }
.b-steps i.on { background: var(--accent); animation: b-pop .25s var(--ease) both; }
.b-steps i.now { outline: 2px solid #fff; outline-offset: -1px; }
.b-lane { position: relative; height: 14px; border-radius: 3px; background: linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px) 0 0 / 12.5% 100%, rgba(255,255,255,.04); }
.b-clip { position: absolute; top: 1px; bottom: 1px; left: calc(var(--s) / 8 * 100% + 1px); width: calc(var(--l) / 8 * 100% - 2px); border-radius: 3px; background: linear-gradient(var(--accent), #b9431d); }
.b-clip.is-new { animation: b-drop .4s var(--ease) both; }
@keyframes b-drop { from { opacity: 0; translate: 0 -8px; } }
.b-bars { display: grid; grid-template-columns: repeat(8, 1fr); margin-left: 58px; font-size: 9px; color: rgba(255,255,255,.35); }

@media (max-width: 900px) {
  .build { grid-template-columns: 1fr; }
  .b-chat { height: 330px; }
}
@media (max-width: 700px) {
  .b-win { padding: 12px 10px 12px; }
  .b-stages { order: 3; flex-basis: 100%; }   /* BPM and the buttons share the first row; the stages get their own */
  .b-roll { grid-template-columns: 26px 1fr; gap: 4px; }
  .b-row { grid-template-columns: 44px 1fr; }
  .b-bars { margin-left: 50px; }
  .b-steps { gap: 2px; }
  .b-ghost::after { inset: -8px -3px; }
}
@media (pointer: coarse) { .b-link, .b-snd, .b-play { position: relative; } .b-link::after { content: ""; position: absolute; inset: -10px -8px; }
  .b-snd::after, .b-play::after { content: ""; position: absolute; inset: -8px -4px; } }
