/* Flapwave at /tools/flapwave/ (card 10): the whole instrument as one v5 faceplate. face/face.css carries the approved
   materials and controls (card 8); this lays out the chassis, the modules and the keyboard, down to 390 px. */
body { background: var(--onyx); }
.fw { width: min(1200px, calc(100% - 60px)); margin: 0 auto; padding: 40px 0 80px; display: grid; gap: 30px; }
.fw .field-label { display: block; font-size: 11px; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--dusty); }
.fw .field-label.inline { display: inline; }
.fw select, .fw input[type=number] { min-height: 44px; max-width: 100%; }
.fw input[type=number] { width: 90px; }
.fw .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }

/* ---------- the chassis: nameplate, scope, and the strip of keys ---------- */
.chassis { display: grid; gap: 25px; }
.chassis-top { display: grid; grid-template-columns: 1fr minmax(0, 480px); gap: 30px; align-items: center; }
.nameplate { display: grid; gap: 12px; justify-items: start; }
.nameplate h1 { padding: 6px; }
.nameplate h1 .window { padding: 6px 18px; }
.nameplate h1 .cells { font-size: 32px; line-height: 44px; }
.nameplate p { max-width: 520px; }
.scope-box { display: grid; gap: 12px; justify-items: end; }
.scope-box .pocket { width: 100%; }
#scope { display: block; width: 100%; height: 120px; }
#power .lamp { margin-right: 2px; }
.strip { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: 20px 40px; padding-top: 25px; border-top: 1px solid #000000a6; box-shadow: inset 0 1px 0 #c9bab00a; }
.group { display: grid; gap: 10px; align-content: start; min-width: 0; }
.group h2 { font-size: 12px; line-height: 16px; }
.key.file { position: relative; overflow: hidden; }
.key.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.key.file:focus-within { outline: 2px solid var(--oak); outline-offset: 2px; }
.melody .window { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.melody .cells { font-size: 15px; line-height: 24px; white-space: normal; color: var(--done); }
.status { color: var(--rose); min-height: 16px; }
.notice { display: grid; gap: 12px; background: var(--plate-hi); }
.notice ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; line-height: 20px; }
[hidden] { display: none !important; }

/* ---------- the faceplate: every module, in controls.toml's order ---------- */
.faceplate { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; gap: 30px; }
.faceplate > div { grid-column: span 12; min-width: 0; display: grid; }
.faceplate > .slot-drive { grid-column: span 4; }
.faceplate > .slot-mixer { grid-column: span 5; }
.faceplate > .slot-envelopes { grid-column: span 7; }
.faceplate > .slot-fm_pitch { grid-column: span 8; }
.faceplate > .slot-lfo, .faceplate > .slot-lfo2 { grid-column: span 6; }
.faceplate > .slot-delay { grid-column: span 6; }
.faceplate > .slot-reverb, .faceplate > .slot-master { grid-column: span 3; }
.fw .module { container-type: inline-size; align-content: start; }
.fw .module-top { grid-template-columns: minmax(0, 340px) 1fr; }
@container (max-width: 640px) { .module-top { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; } }
.fw .vw .window { min-width: 0; }
.fw .module-row { flex-wrap: wrap; justify-content: flex-start; gap: 22px 26px; }
.module-rows { display: grid; gap: 0; }
.slot-mod_matrix .module-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 30px; }
/* a tooltip waits inside its control (so a hidden one never widens the page) and opens beside it */
.fw .tip { left: 0; top: 0; transform: translateY(3px); }
.fw .ctl:has(> .knob:hover) .tip, .fw .ctl:has(> .fader:hover) .tip, .fw .ctl:has(> .rsw:hover) .tip, .fw .ctl:has(> :focus-visible) .tip, .fw .tip.open { left: calc(100% + 14px); transform: none; }
.fw .ctl:has(> .knob:hover) .tip.left, .fw .ctl:has(> .fader:hover) .tip.left, .fw .ctl:has(> .rsw:hover) .tip.left, .fw .ctl:has(> :focus-visible) .tip.left, .fw .tip.left.open { left: auto; right: calc(100% + 14px); }
.fw .fv { width: 76px; padding: 4px; }
.fw .fv .window { padding: 2px 4px; text-align: right; }
.fw .fv .cells { font-size: 12px; line-height: 18px; }

/* the many-position switch: a lamp per position round the cap, the chosen word in a window under it */
.rsw.many { width: 150px; height: 170px; }
.rsw.many .pk { top: 44px; }
.rsw.many .cap, .rsw.many .ind { left: calc(50% - 26px); top: 50px; }
.rsw.many .lamp { position: absolute; }
.rsw.many .sw-win { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; text-align: center; }
.rsw.many .sw-win .cells { font-size: 11px; line-height: 18px; letter-spacing: 0; }

/* ---------- the keyboard ---------- */
.keys-panel { display: grid; gap: 15px; }
.keys-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 15px; }
.keys-head h2 { margin-right: auto; }
.kb-pocket { padding: 8px; }
.keyboard { --whites: 15; position: relative; display: flex; height: 170px; }
.k { all: unset; box-sizing: border-box; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.k.white { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; margin: 0 1px; border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #2a2d2d 0%, #222525 70%, #1b1e1e 100%); box-shadow: inset 0 1px 0 #c9bab01a, inset 0 -3px 0 #000, 0 2px 0 #000;
  font-size: 11px; line-height: 14px; color: var(--dusty); }
.k.black { position: absolute; top: 0; z-index: 2; height: 60%; width: calc(100% / var(--whites) * .66); left: calc(100% / var(--whites) * var(--at) - 100% / var(--whites) * .33);
  border-radius: 0 0 4px 4px; background: linear-gradient(180deg, #0b0c0c, #121414 85%, #1b1e1e); box-shadow: 0 3px 0 #000, 0 5px 9px #000000c0, inset 0 -2px 0 #c9bab014; }
.k:hover { box-shadow: inset 0 0 0 1.5px var(--rose); }
.k:focus-visible { outline: 2px solid var(--oak); outline-offset: -2px; }
.k.held { transform: translateY(2px); }
.k.white.held { background: linear-gradient(180deg, #2a2d2d, #3a2c2a); color: var(--oak); }
.k.black.held { background: linear-gradient(180deg, #0b0c0c, #3a2826); }
.k.held::after { content: ""; position: absolute; }

/* ---------- smaller screens ---------- */
@media (max-width: 1239px) {
  .faceplate { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; }
  .faceplate > div { grid-column: span 2 !important; }
  .faceplate > .slot-mixer, .faceplate > .slot-lfo2, .faceplate > .slot-drive, .faceplate > .slot-reverb, .faceplate > .slot-master, .faceplate > .slot-delay { grid-column: span 1 !important; }
  .slot-mod_matrix .module-rows { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 1fr 1fr; }
  .strip .group:last-child { grid-column: span 2; }
}
@media (max-width: 760px) {
  .faceplate { grid-template-columns: minmax(0, 1fr); }
  .faceplate > div[class] { grid-column: 1 / -1 !important; }
  .chassis-top, .strip { grid-template-columns: minmax(0, 1fr); }
  .strip .group:last-child { grid-column: auto; }
  .scope-box { justify-items: stretch; }
}
@media (max-width: 600px) {
  .fw { width: calc(100% - 32px); padding: 20px 0 50px; gap: 20px; }
  .faceplate { gap: 20px; }
  .fw .module-row { justify-content: center; gap: 18px 12px; }
  .fw .ctl .tip { left: 0 !important; right: 0 !important; top: 100%; transform: none; }
  .nameplate h1 .cells { font-size: 26px; }
  .keyboard { height: 150px; --whites: 8 !important; }
  .k.hi { display: none; }
  #scope { height: 90px; }
}

/* ---------- card 27: the step strip in the sequencer module (the v5 example's step lamps and keys) ---------- */
.faceplate > .slot-sequencer { grid-column: 1 / -1 !important; }
.seq-strip { display: grid; gap: 18px; margin-top: 22px; padding-top: 22px; border-top: 1px solid #000000a6; box-shadow: inset 0 1px 0 #c9bab00a; min-width: 0; }
.seq-head, .seq-sets { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 24px; min-width: 0; }
.seq-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.seq-keys .key { min-height: 44px; padding: 0 12px; gap: 8px; }
.seq-keys .pat { width: 52px; padding: 0; }
.seq-keys .pg { min-width: 68px; padding: 0 10px; font-size: 12px; letter-spacing: 0; }
.seq-strip .key[aria-pressed=true] { --c: var(--rose); --f: #b7958c1f; }
.seq-now { margin-left: auto; padding: 5px; }
.seq-now .window { padding: 4px 10px; }
.seq-now .cells { display: block; font-size: 13px; line-height: 18px; }
.seq-now .cells.sub { color: var(--dusty); }
.sf { display: grid; gap: 6px; align-content: end; min-width: 0; }
.sf.end { margin-left: auto; }
.sf input[type=number] { width: 86px; }
.sf .row { gap: 8px; }
.sf.chain .pocket { padding: 4px; min-width: 120px; }
.sf.chain .window { padding: 3px 10px; min-height: 24px; }
.sf.chain .cells { font-size: 14px; line-height: 20px; white-space: normal; color: var(--rose); }
.sf.chain .cells .now { color: var(--done); }
.seq-pocket { padding: 14px 16px 10px; min-width: 0; }
.seq-row { display: flex; flex-wrap: wrap; gap: 14px 0; }
.seq-row .grp { display: flex; gap: 6px; }
.seq-row .grp + .grp { margin-left: 12px; padding-left: 13px; box-shadow: inset 1px 0 0 #000000a6, inset 2px 0 0 #c9bab00a; }
.step { display: grid; justify-items: center; gap: 7px; width: 56px; }
.step .ph { margin-bottom: 2px; }
.step .stack { display: grid; grid-template-columns: 5px; grid-template-rows: repeat(4, 5px); gap: 5px; height: 35px; }
.step .stack.two { grid-template-columns: 5px 5px; }
.step .stack .l0 { grid-area: 4 / 1; } .step .stack .l1 { grid-area: 3 / 1; } .step .stack .l2 { grid-area: 2 / 1; } .step .stack .l3 { grid-area: 1 / 1; }
.step .stack .l4 { grid-area: 4 / 2; } .step .stack .l5 { grid-area: 3 / 2; } .step .stack .l6 { grid-area: 2 / 2; } .step .stack .l7 { grid-area: 1 / 2; }
.step .stack .off { visibility: hidden; }
.step .stack:not(.two) .l4, .step .stack:not(.two) .l5, .step .stack:not(.two) .l6, .step .stack:not(.two) .l7 { display: none; }
.step .acc { margin: 1px 0 2px; }
.sk { width: 56px; min-height: 48px; padding: 0; font-size: 12px; letter-spacing: 0; }
.sk.beat { color: var(--rose); }
.sk[aria-pressed=true] { --c: var(--rose); --f: #b7958c1f; }
.sk.sel { box-shadow: 0 0 0 1px var(--oak), 0 2px 0 #000; }
.step .sx { font-size: 10px; line-height: 12px; height: 12px; letter-spacing: 0; color: var(--dusty); white-space: nowrap; }
.seq-edit { display: grid; gap: 14px; padding: 18px 20px; border-radius: 12px; background: var(--plate-hi); }
.seq-edit h3 { margin: 0; color: var(--rose); }
.seq-notes { display: grid; gap: 10px; }
.seq-notes > p { margin: 0; }
.nrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; }
.nrow .nname { padding: 4px; min-width: 64px; }
.nrow .nname .window { padding: 4px 8px; }
.nrow .nname .cells { font-size: 15px; line-height: 22px; }
.nrow .key { min-height: 44px; }
@container (max-width: 1100px) { .seq-row { gap: 14px 0; } .seq-row .grp:nth-child(3) { margin-left: 0; padding-left: 0; box-shadow: none; } }
@container (max-width: 560px) { .seq-row .grp + .grp { margin-left: 0; padding-left: 0; box-shadow: none; } .seq-row { justify-content: center; } .seq-now { margin-left: 0; } .sf.end { margin-left: 0; } }
@media (max-width: 600px) { .seq-edit { padding: 14px 12px; } .seq-pocket { padding: 12px 8px 8px; } .seq-head, .seq-sets { gap: 12px 16px; } }
