/* Lesson practice tools (js/demos.js and the demo-*.js tools). Loaded after site.css; uses its tokens.
   One section per tool. Shared demo-box / dctl / dtog / dscope styles stay in site.css ("Demos"). */

/* ---------- Slot frame: kicker, prompt, tool, soft next step ---------- */
/* The frame classes are prefixed (practice, tool-*) on purpose: site.css already owns .tool (the analyzer's 2-column card) and .plan (pricing cards). */
.demo.practice { display: block; width: 100%; }
.step .prose .tool-k, .tool-k { font: 500 var(--fs-xs)/1.4 var(--mono); color: var(--faint); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 var(--s-2); }
.step .prose .tool-prompt, .tool-prompt { font-size: var(--fs-md); line-height: 1.6; color: var(--body); margin: 0 0 var(--s-4); }
.step .prose .tool-next, .tool-next { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; margin: 1rem 0 0; }
.tool-next[hidden] { display: none; }
.tool-next a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: .95rem; text-underline-offset: 3px; }
.tool-next a.tool-up { color: var(--text); }
.tool-next a.tool-up::after { content: "→"; margin-left: .5rem; font-family: var(--mono); color: var(--accent); }
@media (hover: hover) { .tool-next a:hover { color: var(--text); } }
[data-member] .tool-next .tool-plan { display: none; }

/* ---------- Beat maker (demo-beat.js) ---------- */
.beat { gap: 1.1rem; }
.beat-label { font-size: .9rem; color: var(--muted); margin-right: .25rem; }
.beat-presets, .beat-brush { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.beat-presets .btn { min-height: 44px; padding: 0 .9rem; font-size: .9rem; }
.beat-brush .dseg label::before { content: ""; width: 10px; height: 12px; margin-right: .5rem; border-radius: 2px; background: linear-gradient(to top, var(--accent) var(--fill), var(--surface-3) var(--fill)); }
.beat-brush label[for$="-loud"] { --fill: 100%; }
.beat-brush label[for$="-normal"] { --fill: 66%; }
.beat-brush label[for$="-soft"] { --fill: 33%; }
.beat-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }

.seq { display: grid; gap: 8px; }
.seq-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; gap: .75rem; }
.seq-name { font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-steps { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 4px; }
/* A cell shows its velocity as a filled bar (loud full, normal 2/3, soft 1/3), so level is readable without colour alone.
   Beats 2 and 4 sit on a slightly lighter ground, like the step buttons on a drum machine. */
.seq-cell { --fill: 0%; aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; cursor: pointer; background: linear-gradient(to top, var(--accent) var(--fill), var(--surface-2) var(--fill)); transition: transform var(--fast) var(--ease-out); }
.seq-cell:nth-child(8n+5), .seq-cell:nth-child(8n+6), .seq-cell:nth-child(8n+7), .seq-cell:nth-child(8n+8) { background: linear-gradient(to top, var(--accent) var(--fill), var(--surface-3) var(--fill)); }
.seq-cell[data-v="loud"] { --fill: 100%; border-color: var(--accent); }
.seq-cell[data-v="normal"] { --fill: 66%; border-color: rgb(255 106 43 / .6); }
.seq-cell[data-v="soft"] { --fill: 33%; border-color: rgb(255 106 43 / .45); }
.seq-cell:active { transform: scale(0.94); }
.seq-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seq-cell.ph { box-shadow: inset 0 0 0 2px var(--text); }
.seq-cell.ph:not([data-v="off"]) { filter: brightness(1.3); }

@media (max-width: 560px) {
  .seq { gap: 12px; }
  .seq-row { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
  .seq-steps { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
  .beat-sliders { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .seq-cell { transition: none; } .seq-cell:active { transform: none; } }

/* ---------- Arrangement builder (demo-arrange.js, B6) ---------- */
.arrange .dtop { justify-content: space-between; }
.step .prose .arr-pos, .arr-pos { margin: 0; font-size: .9rem; color: var(--muted); }
.arr { display: grid; grid-template-columns: 5.5rem repeat(6, minmax(0, 1fr)); gap: 6px; align-items: center; }
.arr-sec { padding: .35rem .15rem; border-radius: 4px; font: 500 var(--fs-xs)/1.25 var(--mono); color: var(--muted); text-align: center; overflow-wrap: anywhere; transition: color var(--fast) ease, background-color var(--fast) ease; }
.arr-sec.now { color: var(--bg); background: var(--accent); }
.arr-layer { font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A switched-on layer is a filled bar with a mark, so on/off is readable without colour alone. */
.arr-cell { min-width: 0; min-height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); cursor: pointer; transition: transform var(--fast) var(--ease-out), background-color var(--fast) ease; }
.arr-cell[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.arr-cell[aria-pressed="true"]::after { content: "●"; font-size: .6rem; color: var(--bg); }
.arr-cell.now { box-shadow: inset 0 0 0 2px var(--text); }
.arr-cell:active { transform: scale(0.94); }
.arr-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.arr-review { padding-top: 1rem; border-top: 1px solid var(--line); }
.step .prose .arr-head, .arr-head { margin: 0 0 .5rem; font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.step .prose .arr-checks, .arr-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.step .prose .arr-checks li, .arr-checks li { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); font-size: .95rem; line-height: 1.5; color: var(--muted); }
.arr-checks li.ok { color: var(--text); }
.arr-mark { color: var(--muted); }
.arr-checks li.ok .arr-mark { color: var(--ok); }
.step .prose .arr-score, .arr-score { margin: .75rem 0 0; font-size: .9rem; color: var(--text); }
@media (max-width: 560px) {
  .arr { grid-template-columns: 3.75rem repeat(6, minmax(0, 1fr)); gap: 4px; }
  .arr-sec { font-size: .625rem; padding: .3rem 0; }
  .arr-layer { font-size: .8rem; }
}

/* ---------- Blind A/B level test (demo-ear.js, G1) ---------- */
.ab-listen { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ab-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.ab-picks .topt { text-align: center; }
.ab-picks .topt:disabled { cursor: default; opacity: .7; }
.ab-picks .topt.chosen { opacity: 1; border-color: var(--text); }
.step .prose .ab-reveal, .ab-reveal { margin: 0; padding: .9rem 1.1rem; border-left: 2px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; font-size: 1rem; line-height: 1.55; color: var(--text); }
.ab-reveal[hidden], .abtest .btn[hidden] { display: none; }
.abtest > .btn { justify-self: start; }

/* ---------- Ear quiz (demo-ear.js, G2) ---------- */
.earquiz .dtop { justify-content: space-between; }
.step .prose .quiz-round, .quiz-round { margin: 0; font-size: .9rem; color: var(--muted); }
.quiz-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.quiz-opts .topt:disabled { cursor: default; }
.quiz-opts .topt:disabled:not(.right):not(.wrong) { opacity: .6; }
.step .prose .quiz-fb, .quiz-fb { margin: 0; font-size: 1rem; line-height: 1.55; color: var(--body); }
.quiz-fb:empty { display: none; }
.quiz-fb b { color: var(--text); }
.quiz-done { display: block; margin-top: .6rem; font: 500 1rem var(--mono); color: var(--accent); }
.earquiz > .btn { justify-self: start; }
.earquiz > .btn[hidden] { display: none; }
@media (max-width: 400px) { .quiz-opts, .ab-picks { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .arr-cell, .arr-sec { transition: none; } .arr-cell:active { transform: none; } }

/* ---------- Mix tools (demo-mix.js): gain B2, duck I2, sweep I3, comp I5, space I6 ---------- */
.dgrid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
/* Meter: a bar on a fixed scale, the lesson's target zone in orange, a peak-hold tick. The bar turns orange inside the zone. */
.mtr { display: grid; gap: .4rem; }
.mtr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .95rem; color: var(--muted); }
.mtr-head .mono { color: var(--text); font-size: 1.05rem; }
.mtr-track { position: relative; height: 14px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.mtr-zone { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); box-shadow: inset 1px 0 0 rgb(255 106 43 / .55), inset -1px 0 0 rgb(255 106 43 / .55); }
.mtr-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--faint); }
.mtr.in-zone .mtr-fill { background: var(--accent); }
.mtr-hold { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); }
.mtr-hold[hidden] { display: none; }
.mtr-scale { position: relative; height: 1rem; font: 500 var(--fs-xs) var(--mono); color: var(--faint); }
.mtr-scale span { position: absolute; top: 0; transform: translateX(-50%); }
.mtr-scale span:first-child { transform: none; }
.mtr-scale span:last-child { transform: translateX(-100%); }
.clipled { display: inline-flex; align-items: center; min-height: 32px; padding: 0 .7rem; border: 1px solid var(--control-border); border-radius: var(--radius); font: 500 var(--fs-sm) var(--mono); letter-spacing: .06em; color: var(--faint); }
.clipled.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.dstatus { margin: 0; font-size: 1rem !important; color: var(--text); }
.dstatus[data-state="clip"], .dstatus[data-state="heavy"], .dstatus[data-state="pump"] { color: var(--accent); }
.dstatus[data-state="zone"], .dstatus[data-state="fixed"] { color: var(--ok); }
.dmakeup { margin: 0; font-size: .95rem !important; color: var(--muted); }
.dtrace { width: 100%; height: auto; display: block; border-radius: var(--radius); background: var(--bg); }
/* Sweep: the learner's band drawn over the spectrum (same 30 Hz-8 kHz log scale; the bottom strip holds the Hz labels). */
.sweep-scope { position: relative; }
.sweep-band { position: absolute; top: 0; bottom: 10.7%; background: rgb(236 238 240 / .08); box-shadow: inset 1px 0 0 var(--muted), inset -1px 0 0 var(--muted); pointer-events: none; transition: left 60ms linear, width 60ms linear; }
.sweep-band[data-dir="up"] { background: rgb(255 106 43 / .18); }
.sweep-band[data-dir="down"] { background: rgb(76 195 138 / .14); }
@media (max-width: 560px) { .dgrid2 { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .sweep-band { transition: none; } }

/* ---------- Action step and mission (js/action-step.js, js/mission-runner.js) ----------
   First screen of every lesson: kicker, title, one mission sentence, a reserved status row (hint, then the success badge), the control.
   Accent budget here: the primary control, the progress segment, the check mark. */
.step.is-action .pmeta .ptitle { display: none; }
.step .prose .action-step { display: block; }
.step .prose .action-step > h1 { font-size: var(--fs-lg); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 var(--s-3); }
.step .prose .action-step > .tool-k { margin: 0 0 var(--s-2); }
.step .prose .mission-goal { font-size: var(--fs-md); line-height: 1.5; color: var(--body); margin: 0; max-width: 62ch; }
.step .prose .mission-goal.done { color: var(--text); }
.mission-status { min-height: 1.6rem; margin: var(--s-2) 0 var(--s-4); font-size: var(--fs-sm); line-height: 1.45; }
.step .prose .mission-hint { margin: 0; font-size: var(--fs-sm); line-height: 1.45; color: var(--muted); animation: hintIn 240ms var(--ease-enter); }
.mission-badge { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem var(--s-3); }
.mb-check { flex: none; width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mb-check path { stroke-dasharray: 1; stroke-dashoffset: 0; animation: checkDraw 300ms var(--ease-enter) both; }
.mb-label { font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.mb-line { color: var(--muted); }
.mb-points { font: 500 var(--fs-xs)/1.4 var(--mono); color: var(--text); animation: pointsRise 400ms var(--ease-enter) both; }
.mb-tier { flex-basis: 100%; padding-left: 1.85rem; font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.step.preview { display: block; }
.pgate { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.pgate .pgate-lead { color: var(--muted); margin: 0 0 var(--s-3); }
.pgate .btn:disabled { cursor: not-allowed; }
.pgate .sub { margin: var(--s-3) 0 0; font-size: var(--fs-sm); color: var(--muted); }
.step .prose .guess .tq { margin: 0 0 var(--s-3); font-size: var(--fs-md); font-weight: 600; }
.guess .topts { display: grid; gap: var(--s-2); }
.guess .tfb { margin-top: var(--s-4); min-height: 1.5rem; color: var(--body); }
.topt.miss { opacity: .55; border-style: dashed; }
.tpoints { margin: var(--s-3) 0 0; font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
@keyframes hintIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes checkDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pointsRise { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes nextNudge { 0% { box-shadow: 0 0 0 0 rgb(255 106 43 / .55); } 100% { box-shadow: 0 0 0 10px rgb(255 106 43 / 0); } }
.pnav .btn.nudge { animation: nextNudge 900ms var(--ease-out) 1; }
@media (max-width: 560px) { .mission-status { min-height: 2.6rem; } .step .prose .mission-goal { font-size: var(--fs-base); } }
@media (prefers-reduced-motion: reduce) { .mission-hint, .mb-check path, .mb-points, .pnav .btn.nudge { animation: none; } }
