/* Kick Generator (tool shell v2): ONLY tool-specific rules; the frame, knobs, scrubber, chips, sheets and tokens come from src/styles/tools.css.
   Every selector sits under .tool-page .bft[data-tf="2"] (or the sheet root, which lives on <body>). Colours: tokens only; green only through the shell classes (D21). */
.tool-page .bft[data-tf="2"] .kk-slot { display: contents; }
.tool-page .bft[data-tf="2"] .kk-ur { display: inline-flex; gap: 8px; }
.tool-page .bft[data-tf="2"] .kk-presetrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tool-page .bft[data-tf="2"] .kk-preset { flex: 1 1 auto; width: 300px; min-width: 0; }
.tool-page .bft[data-tf="2"] .kk-cap { flex: none; }
.tool-page .bft[data-tf="2"] .kk-preset .tf-val { min-width: 0; }
.tool-page .bft[data-tf="2"] .kk-preset .tf-edited { flex: none; margin-right: 4px; }
.tool-page .bft[data-tf="2"] .kk-presetbtn { position: absolute; inset: 0; width: 100%; height: 100%; background: none; border: 0; border-radius: inherit; opacity: 0; }
.tool-page .bft[data-tf="2"] .kk-presetbtn:focus-visible { opacity: 1; box-shadow: var(--shadow-focus); }
.tool-page .bft[data-tf="2"] .kk-tbar { row-gap: 10px; }
.tool-page .bft[data-tf="2"] .tf-btn.is-on-hit, .tool-page .bft[data-tf="2"] #hit.is-hit { border-color: var(--accent-hover-top); }

/* display */
.tool-page .bft[data-tf="2"] .kk-plot canvas { touch-action: pan-y; }
.tool-page .bft[data-tf="2"] .kk-ph { position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--frost); box-shadow: 0 0 6px rgba(212, 228, 240, .35); display: none; pointer-events: none; will-change: transform; }
.tool-page .bft[data-tf="2"] .tf-disp-foot #peak { text-align: right; }
.tool-page .bft[data-tf="2"] .tf-disp-foot #duration { text-align: left; }

/* Advanced (desktop): three small knobs + pitch sweep plot; second section Transient & Tail: four small knobs */
.tool-page .bft[data-tf="2"] .tf-coll + .tf-coll { margin-top: 10px; }
.tool-page .bft[data-tf="2"] .kk-adv2 { grid-template-columns: 1fr; }
.tool-page .bft[data-tf="2"] .tf-coll { margin-top: 16px; }
.tool-page .bft[data-tf="2"] .kk-adv { display: grid; grid-template-columns: auto 1fr; gap: 12px 28px; align-items: start; padding: 18px 16px 16px; }
.tool-page .bft[data-tf="2"] .kk-advknobs { padding-top: 14px; justify-content: flex-start; gap: 4px 12px; }
.tool-page .bft[data-tf="2"] .kk-advknobs .tf-kn { width: 96px; }
.tool-page .bft[data-tf="2"] .kk-sweep { min-width: 0; padding-top: 4px; }
.tool-page .bft[data-tf="2"] .kk-sweepplot, .tool-page .tf-sheetroot .kk-sweepplot { position: relative; height: 96px; margin-top: 8px; border: 1px solid var(--bd-line-soft); border-radius: var(--r-1); background: var(--well); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .7); overflow: hidden; }
.tool-page .bft[data-tf="2"] .kk-sweepplot canvas, .tool-page .tf-sheetroot .kk-sweepplot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tool-page .bft[data-tf="2"] .kk-note { margin: 10px 0 0; font: 400 12px/1.5 var(--font-sans); color: var(--text-3); max-width: 62ch; }

/* export bar (desktop): output knob + peak meter | status | file name | download */
.tool-page .bft[data-tf="2"] .kk-out { display: flex; align-items: center; gap: 22px; }
.tool-page .bft[data-tf="2"] .kk-outknob.tf-kn { width: auto; display: grid; grid-template-columns: auto auto; grid-template-areas: "k lab" "k lcd"; column-gap: 12px; row-gap: 4px; align-items: center; }
.tool-page .bft[data-tf="2"] .kk-outknob.tf-kn .tf-knob { grid-area: k; }
.tool-page .bft[data-tf="2"] .kk-outknob.tf-kn .tf-lab { grid-area: lab; text-align: left; align-self: end; }
.tool-page .bft[data-tf="2"] .kk-outknob.tf-kn .tf-lcd { grid-area: lcd; align-self: start; }
.tool-page .bft[data-tf="2"] .kk-peak { display: flex; flex-direction: column; gap: 8px; }
.tool-page .bft[data-tf="2"] .kk-statusblock { min-width: 0; }
.tool-page .bft[data-tf="2"] .kk-wavinfo { display: block; margin-top: 2px; font: 500 11px/1.4 var(--font-mono); color: var(--text-3); }
.tool-page .bft[data-tf="2"] .kk-file { flex: 1 1 200px; min-width: 150px; max-width: 420px; margin-left: auto; padding-right: 0; }
.tool-page .bft[data-tf="2"] .kk-file input { flex: 1; min-width: 0; height: 42px; background: none; border: 0; padding: 0 12px 0 0; font: 500 14px var(--font-mono); color: var(--text); text-overflow: ellipsis; }
.tool-page .bft[data-tf="2"] .kk-file input:focus-visible { box-shadow: none; }
.tool-page .bft[data-tf="2"] .kk-file:has(input:focus-visible) { box-shadow: var(--shadow-focus); }
.tool-page .bft[data-tf="2"] .tf-xbar { column-gap: 20px; flex-wrap: nowrap; }
.tool-page .bft[data-tf="2"] .kk-out { flex: none; }
.tool-page .bft[data-tf="2"] #slotExpD #export { flex: none; }
.tool-page .bft[data-tf="2"] .kk-foot { margin-top: 28px; }
.tool-page .bft[data-tf="2"] .kk-foot kbd { font: 500 12px var(--font-mono); border: 1px solid var(--ctrl-edge); border-radius: var(--r-1); padding: 1px 6px; }

/* phone / tablet */
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-presetrow { flex: 1; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-preset { width: auto; padding-left: 0; justify-content: center; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-preset .tf-val { text-align: center; font-size: 16px; flex: 0 1 auto; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-preset .tf-edited { margin-left: 8px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-preset::after { content: ''; width: 8px; height: 8px; margin-left: 12px; border-right: 1.6px solid var(--text-2); border-bottom: 1.6px solid var(--text-2); transform: translateY(-2px) rotate(45deg); flex: none; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-presetbtn { opacity: 0; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-head { min-height: 56px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-head .tf-btn.icon { width: 48px; min-height: 48px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-ur .tf-btn { width: 48px; min-height: 48px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-plot canvas { touch-action: pan-y; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-statusM { padding: 8px 4px 4px; min-height: 28px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-statusM .tf-status { font-size: 12px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-wavinfo { display: none; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-statusM .tf-status::before { display: inline-block; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-foot { padding: 0 14px calc(var(--sp-4, 16px) + 12px); }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-mbar #loop { width: 52px; padding: 0; position: relative; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-mbar #loop .kk-led { position: absolute; top: 9px; right: 9px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-mbar #export { flex: 1; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-mbar #hit { flex: 1.3; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-mbar #loop svg { width: 20px; height: 20px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-mbar .tf-btn { min-height: 52px; }

/* tablet landscape / wide phone UI (>= 900): two columns, thumb column on the right (BREAKPOINTS.md "expanded") */
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .tf-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-areas: "disp focus" "rail more" "stat stat"; column-gap: 16px; align-items: start; }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .kk-disp { grid-area: disp; }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .tf-rail { grid-area: rail; }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .tf-focus { grid-area: focus; margin-top: 18px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .tf-more { grid-area: more; margin-top: 8px; align-self: start; }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .kk-statusM { grid-area: stat; }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .tf-plot { height: clamp(150px, 26vh, 260px); }
html[data-ui="phone"][data-pclass="expanded"] .tool-page .bft[data-tf="2"] .tf-plate { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
html[data-ui="phone"][data-pclass="medium"] .tool-page .bft[data-tf="2"] .tf-plot { height: clamp(150px, 24vh, 240px); }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-note { font-size: 12px; }

/* sheets (live on <body>) */
.tool-page .tf-sheetroot .kk-sheetadv .kk-miniwrap { position: relative; height: 56px; margin: 4px 0 14px; border: 1px solid var(--bd-line-soft); border-radius: var(--r-1); background: var(--well); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .7); overflow: hidden; }
.tool-page .tf-sheetroot .kk-mini { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tool-page .tf-sheetroot .kk-lrname { display: flex; flex-direction: column; gap: 3px; }
.tool-page .tf-sheetroot .kk-lrname b { font: 700 12px var(--font-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.tool-page .tf-sheetroot .kk-lrname small { font: 500 12px var(--font-mono); color: var(--text-3); }
.tool-page .tf-sheetroot .kk-subh { margin: 18px 0 10px; font: 700 12px var(--font-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.tool-page .tf-sheetroot .tf-cap { display: block; margin-top: 4px; }
.tool-page .tf-sheetroot .tf-lcd.accent { color: var(--accent); }
.tf-sheetroot input.tf-lcd { width: 110px; }
.tool-page .tf-sheetroot .kk-prow { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #26292D; }
.tool-page .tf-sheetroot .kk-prow .tf-li { border-bottom: 0; flex: 1; min-width: 0; }
.tool-page .tf-sheetroot .kk-prow .kk-aud { width: 44px; min-height: 44px; flex: none; margin-right: 6px; }
.tool-page .tf-sheetroot .kk-presetlist { margin: 0 -4px; }
.tool-page .tf-sheetroot .kk-keys { margin: 0; display: grid; gap: 10px; }
.tool-page .tf-sheetroot .kk-keys > div { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 12px; align-items: center; }
.tool-page .tf-sheetroot .kk-keys dt, .tool-page .tf-sheetroot .kk-keys dd { margin: 0; }
.tool-page .tf-sheetroot .kk-keys dd { font: 400 14px var(--font-sans); color: var(--text-2); }
.tool-page .tf-sheetroot .tf-kbd { white-space: nowrap; }

/* desktop narrow (900..1100): panels stay 3 columns, bars wrap */
@media (max-width: 1060px) { html[data-ui="desktop"] .tool-page .bft[data-tf="2"] .kk-adv { grid-template-columns: 1fr; } }

/* footer note + "clear saved settings" (the shell has no styles for them) */
.tool-page .bft[data-tf="2"] .bft-foot.tf-local { margin-top: 20px; padding: 12px 4px 0; display: block; color: var(--text-2); font: 400 12px/1.6 var(--font-sans); }
.tool-page .bft[data-tf="2"] .bft-foot.tf-local p { margin: 0; }
.tool-page .bft[data-tf="2"] .bft-foot kbd { color: var(--text-2); }
.tool-page .bft[data-tf="2"] .bft-clear-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 0; }
.tool-page .bft[data-tf="2"] .bft-clear { min-height: 44px; padding: 0 14px; border: 1px solid var(--ctrl-edge); border-radius: var(--r-2); background: none; color: var(--text-2); font: 600 12px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; }
.tool-page .bft[data-tf="2"] .bft-clear:hover { border-color: var(--bd-step-on); color: var(--text); }
.tool-page .bft[data-tf="2"] .bft-clear-msg { color: var(--text-2); font: 400 12px/1.4 var(--font-mono); }

/* phone: nothing may push the page wider than the viewport */
html[data-ui="phone"] .tool-page .bft[data-tf="2"] { overflow-x: clip; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-head { flex-wrap: nowrap; gap: 10px; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-head .tf-kind { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-head .tf-sp { display: none; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .kk-ur { margin-left: auto; flex: none; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-sel { min-width: 0; }
html[data-ui="phone"] .tool-page .bft[data-tf="2"] .tf-tbar > * { min-width: 0; }

html[data-ui="phone"][data-pclass="compact"] .tool-page .bft[data-tf="2"] .kk-k2 { display: none; }
@media (max-width: 1100px) { html[data-ui="desktop"] .tool-page .bft[data-tf="2"] .tf-xbar { flex-wrap: wrap; } }

/* Kick: a transient/tail laboratory, using the common instrument finish. */
.tool-page .bft[data-tool="kick"] .kk-desk { display:grid; grid-template-columns:1fr 1fr 1.35fr; gap:1px; margin-bottom:18px; border:1px solid var(--line); border-radius:7px; overflow:hidden; background:var(--line); }
.tool-page .bft[data-tool="kick"] .kk-desk-group { min-width:0; background:#141b1f; padding:15px; }
.tool-page .bft[data-tool="kick"] .kk-desk h3 { font:600 11px/1.4 var(--font-mono,monospace); letter-spacing:.13em; color:var(--text-2); margin:0 0 6px; }
.tool-page .bft[data-tool="kick"] .kk-desk p { font:400 11px/1.5 var(--font-sans,sans-serif); color:var(--text-3); margin:0 0 12px; min-height:33px; }
.tool-page .bft[data-tool="kick"] .kk-desk-controls { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.tool-page .bft[data-tool="kick"] .kk-desk select { min-height:40px; max-width:100%; padding:6px 9px; background:#0c1216; border:1px solid #49565f; border-radius:4px; color:var(--text); font:12px var(--font-mono,monospace); }
.tool-page .bft[data-tool="kick"] .kk-memory { display:flex; gap:5px; }
.tool-page .bft[data-tool="kick"] .kk-memory .tf-btn { min-height:40px; padding-inline:10px; }
.tool-page .bft[data-tool="kick"] .kk-disp { border-left:3px solid var(--accent); }
.tool-page .bft[data-tool="kick"] .kk-plot { background:linear-gradient(90deg,#93d85f06,transparent 65%); }
@media(max-width:900px){.tool-page .bft[data-tool="kick"] .kk-desk{grid-template-columns:1fr 1fr}.tool-page .bft[data-tool="kick"] .kk-desk-group:last-child{grid-column:1/-1}.tool-page .bft[data-tool="kick"] .kk-desk p{min-height:0}}
@media(max-width:520px){.tool-page .bft[data-tool="kick"] .kk-desk{grid-template-columns:1fr}.tool-page .bft[data-tool="kick"] .kk-desk-group{padding:12px}.tool-page .bft[data-tool="kick"] .kk-desk-controls{gap:8px}.tool-page .bft[data-tool="kick"] .kk-desk p{margin-bottom:8px}}

/* Transient desk: cool steel readouts and a dark, quiet waveform surface. */
.tool-page .bft[data-tool="kick"] { --tool-tone:#b7cbd9; --tool-tint:#b7cbd90b; }
.tool-page .bft[data-tool="kick"] .kk-desk { border-color:#3b4750; background:#354149; box-shadow:0 8px 24px #0002; }
.tool-page .bft[data-tool="kick"] .kk-desk-group { background:linear-gradient(160deg,#202a31,#181f24); }
.tool-page .bft[data-tool="kick"] .kk-desk h3 { color:var(--tool-tone); }
.tool-page .bft[data-tool="kick"] .kk-desk p { color:#a7b2bb; }
.tool-page .bft[data-tool="kick"] .kk-desk select { background:#10171c; border-color:#50606b; box-shadow:inset 0 1px 3px #0004; }
.tool-page .bft[data-tool="kick"] .kk-disp { border-left-color:var(--tool-tone); border-top-color:#46555f; }
.tool-page .bft[data-tool="kick"] .kk-plot { background:linear-gradient(180deg,#10191e,#0b1014); }
.tool-page .bft[data-tool="kick"] .kk-sweepplot { border-color:#35444e; background:#0a1116; box-shadow:inset 0 2px 8px #0006; }
.tool-page .bft[data-tool="kick"] .kk-disp .tf-disp-foot { background:#131c22; color:var(--tool-tone); border-top-color:#2e3b44; font-variant-numeric:tabular-nums; }
.tool-page .bft[data-tool="kick"] .kk-file { border-color:#3b4852; background:#11181d; }
.tool-page .bft[data-tool="kick"] .kk-wavinfo { color:#a4b6c3; letter-spacing:.03em; }
.tool-page .bft[data-tool="kick"] .kk-memory .tf-btn:not(:disabled):not(:focus-visible):hover { background:#293943; border-color:var(--tool-tone); }

/* phone rail: 7 core chips (Root, Start, Attack, Decay, Punch, Click, Drive) in 3 columns – the lone last chip spans the row */
.tool-page .bft[data-tool="kick"] .tf-rail > :last-child:nth-child(3n+1) { grid-column: 1 / -1; }
/* desktop: Body holds 3 knobs (Attack, Body Decay, Punch) – panel widths follow the knob count (2 : 3 : 2), knob columns 100 px so all fit from 1000 px up */
html[data-ui="desktop"] .tool-page .bft[data-tool="kick"] .tf-panels { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(0, 2fr); }
html[data-ui="desktop"] .tool-page .bft[data-tool="kick"] .tf-panels .tf-knobs { gap: 8px; }
html[data-ui="desktop"] .tool-page .bft[data-tool="kick"] .tf-panels .tf-kn { width: 100px; }
