/* F8 Sounds — "Try it Yourself" demo cards, controls, canvases, meters, piano, step sequencer. */
.demo { margin: 26px 0; overflow: hidden; border-radius: var(--radius-lg); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.demo.is-playing { box-shadow: inset 0 0 0 1.5px var(--accent); }
.demo-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 0; }
.demo-head h3 { flex: 1; min-width: 0; margin: 0; font: 700 16px var(--font); }
.demo-head a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.demo-body { padding: 8px 18px 18px; }
.demo-desc { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }
.controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 24px; margin: 14px 0; }
.ctl { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.ctl span { display: flex; justify-content: space-between; }
.ctl output { color: var(--text); font: 500 13px var(--mono); }
.ctl input[type="range"] { --p: 50%; width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
.ctl input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p)); }
.ctl input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); -webkit-appearance: none; transition: transform var(--dur-base) var(--ease-spring); }
.ctl input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.ctl input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
.ctl input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.ctl input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--text); }
.ctl select { min-height: 40px; padding: 0 12px; border: 0; border-radius: 99px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: 500 14px var(--font); }
.demo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.play-btn { min-width: 116px; }
.play-btn[aria-pressed="true"] { background: var(--text); color: var(--bg) !important; }
.chip { min-height: 40px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: 600 13.5px var(--font); cursor: pointer; transition: transform var(--dur-base) var(--ease-spring); }
.chip:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--accent); box-shadow: none; color: var(--on-accent); }
.demo canvas { display: block; width: 100%; height: 140px; margin-top: 10px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.meter { flex: 1; min-width: 120px; height: 10px; overflow: hidden; border-radius: 6px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.meter > div { width: 0; height: 100%; background: var(--accent); }
.meter.gr > div { margin-left: auto; background: var(--note); }
.demo-status { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.demo-status.blocked { color: var(--bad); font-weight: 600; }

/* Piano: physical keys, coral when pressed, band wash for highlighted notes */
.piano { position: relative; display: flex; height: 150px; margin-top: 10px; overflow: hidden; border-radius: 10px; user-select: none; touch-action: none; }
.piano .wk { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; border-right: 1px solid #D9D9DE; background: #F7F7F9; color: #5E5E63; font: 500 11px var(--mono); cursor: pointer; }
.piano .bk { position: absolute; top: 0; z-index: 2; display: flex; align-items: flex-end; justify-content: center; height: 60%; padding-bottom: 4px; border-radius: 0 0 6px 6px; background: #1D1D1F; color: #A1A1AA; font-size: 10px; cursor: pointer; }
.piano .wk.hl { background: color-mix(in srgb, var(--band, var(--accent)) 28%, #F7F7F9); }
.piano .bk.hl { background: color-mix(in srgb, var(--band, var(--accent)) 55%, #1D1D1F); }
.piano .wk.root { box-shadow: inset 0 -4px 0 var(--band, var(--accent)); }
.piano .wk.down, .piano .bk.down { background: var(--accent) !important; color: var(--on-accent); }

/* Step sequencer */
.seq { display: grid; grid-template-columns: 76px repeat(16, minmax(18px, 1fr)); gap: 4px; margin-top: 12px; overflow-x: auto; }
.seq .lbl { padding: 4px 2px; border: 0; background: none; color: var(--text); font: 600 13px var(--font); text-align: left; cursor: pointer; }
.seq .lbl.muted { color: var(--muted); text-decoration: line-through; }
.seq button:not(.lbl) { min-height: 22px; padding: 0; aspect-ratio: 1; border: 0; border-radius: 5px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: transform var(--dur-base) var(--ease-spring); }
.seq button:not(.lbl):nth-of-type(17n+2), .seq button:not(.lbl):nth-of-type(17n+6), .seq button:not(.lbl):nth-of-type(17n+10), .seq button:not(.lbl):nth-of-type(17n+14) { background: color-mix(in srgb, var(--text) 7%, var(--bg)); }
.seq button.on:not(.lbl):nth-of-type(n) { background: var(--accent); box-shadow: none; }
.seq button:not(.lbl):active { transform: scale(.9); }
.seq button.now { outline: 2px solid var(--text); outline-offset: -2px; }
@media (max-width: 860px) { .demo-head { padding: 12px 14px 0; } .demo-body { padding: 8px 14px 14px; } }
