/* MD|442 usability layer (Nov 2026): mute group, connect guide, phone menu, bigger touch targets. Loaded after md442.css and md442-dark.css. */
/* mute group: drums being picked blink amber; drums in the saved group carry a small amber dot */
.md .key.inst.arm { box-shadow: 0 0 0 2px #ffb020, 0 0 12px rgba(255,176,32,.7); animation: mdarm .6s steps(2) infinite; }
@keyframes mdarm { 50% { box-shadow: 0 0 0 2px rgba(255,176,32,.35); } }
.md .key.inst.ingrp::after { content: ''; position: absolute; left: 5px; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: #ffb020; box-shadow: 0 0 5px rgba(255,176,32,.9); }
.md .key.grp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md .key.grp.on { box-shadow: 0 0 0 2px #ffb020, 0 0 12px rgba(255,176,32,.6); border-color: #b87400; }
.md .key.grp.on::before { background: #ffb020; box-shadow: 0 0 6px #ffb020; }
.md .key.arm { animation: mdarm .6s steps(2) infinite; box-shadow: 0 0 0 2px #ffb020; }
.md.desk .tools .key.grp { min-width: 118px; max-width: 190px; }
@media (prefers-reduced-motion: reduce) { .md .key.inst.arm, .md .key.arm { animation: none; } }

/* connect guide (MIDI panel and MIDI sheet) */
.md .guide { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.md .gtabs { flex-wrap: wrap; }
.md .gtabs .key { min-height: 40px; min-width: 0; }
.md .gsteps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; max-width: 900px; -webkit-user-select: text; user-select: text; }
.md .gsteps li { font-size: 11px; line-height: 1.65; color: var(--ink); text-transform: none; letter-spacing: .01em; }
.md .gsteps a { color: #0a8f3c; font-weight: 600; }
.md[data-theme="dark"] .gsteps a { color: var(--g); }
.md.desk .midp .keyb { gap: 10px; }

/* phone: the logo is the menu button; links in the menu look like keys */
.md.phone .key.menu { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 50px; min-height: 44px; padding: 2px 6px; }
.md.phone .key.menu .mi { font-style: normal; font-size: 15px; line-height: 1; }
.md.phone .key.menu .logo { display: block; font-size: 10px; line-height: 1; }
@media (max-width: 340px) { .md.phone .key.menu .logo { display: none; } }
.md .sheet .keys .navk, .md .sheet .keys .key.next { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 6px 12px; text-align: center; white-space: normal; line-height: 1.4; text-decoration: none; color: inherit; }
.md .sheet .keys .navk { border-style: solid; }

/* touch targets: nothing a finger has to hit is smaller than 40 px on the phone */
.md.phone .key.x, .md .sheet .key.x { min-width: 44px; min-height: 44px; }
.md .sheet .key.sw { min-height: 40px; min-width: 56px; }
.md .sheet .mlist .key, .md .sheet .kctl .key { min-height: 44px; }
@media (min-height: 800px) { .md.phone .pmid { min-height: 200px; } }
@media (min-height: 736px) and (max-height: 799px) { .md.phone .pside { display: grid; grid-template-columns: 1fr 1fr; width: 150px; gap: 5px; } .md.phone .pside .key { max-height: none; } }
.md.phone .pside .key { min-height: 44px; font-size: 8.5px; white-space: normal; line-height: 1.15; }
@media (max-height: 735px) and (min-height: 600px) { .md.phone .pmid { min-height: 0; } .md.phone .pside .key { font-size: 8px; } }
@media (max-height: 735px) { .md.phone .pmid { min-height: 0; } }

/* phone held sideways (Nov 2026): one screen, no scrolling. Header, knobs, view + scenes + CHAIN/LAST/MUTE row, drums, the 16 steps and the bottom bar all stay in view. */
@media (orientation: landscape) and (max-height: 560px) {
  html[data-layout="phone"], html[data-layout="phone"] body { height: 100%; overflow: hidden; }
  .md.phone { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; display: grid; gap: 5px;
    grid-template-columns: minmax(180px, 26%) minmax(0, 1fr) auto;
    grid-template-rows: 40px auto 40px 40px minmax(40px, 1fr) 40px;
    grid-template-areas: "hd hd hd" "kn kn kn" "vw sc sd" "in in in" "stp stp stp" "bar bar bar"; }
  .md.phone .phd { grid-area: hd; }
  .md.phone .phd .key.big, .md.phone .lcd, .md.phone .key.menu { min-height: 40px; height: 40px; }
  .md.phone .lcd { padding-top: 2px; padding-bottom: 2px; }
  .md.phone .pkn { grid-area: kn; border-top: 0; padding-top: 0; }
  .md.phone .krow { min-height: 52px; }
  .md.phone .krow .kb { --s: 32px; }
  .md.phone .krow .kl, .md.phone .krow .kv { font-size: 8px; }
  .md.phone .pview { grid-area: vw; }
  .md.phone .pview .seg .key { min-height: 40px; height: 40px; padding: 0 4px; }
  .md.phone .pscn { grid-area: sc; margin-top: 0 !important; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .md.phone .pscn .key { min-height: 40px; }
  .md.phone .pscn .key.sc { flex: 0 0 40px; }
  .md.phone .pmid, .md.phone.vall .pmid { grid-area: sd; display: flex; height: 40px; min-height: 0; max-height: none; flex: none; }
  .md.phone .pmid .pov { display: none; }
  .md.phone .pside, .md.phone .pside[style] { display: flex; flex-direction: row; width: auto; gap: 4px; }
  .md.phone .pside .key { flex: 0 0 auto; min-width: 64px; min-height: 40px; max-height: 40px; padding: 10px 6px 0; font-size: 8px; white-space: nowrap; }
  .md.phone .pinst { grid-area: in; grid-template-columns: repeat(15, minmax(0, 1fr)); }
  .md.phone .pinst .key { min-height: 40px; height: 40px; padding-top: 11px; }
  .md.phone .pstepw { grid-area: stp; height: auto; min-height: 0; display: flex; }
  .md.phone .pstepw .steps.one { flex: 1; grid-template-columns: repeat(16, minmax(0, 1fr)); grid-template-rows: minmax(40px, 1fr); max-height: 120px; }
  .md.phone.vall .pstepw { display: none; }
  .md.phone .pgrid { grid-area: 4 / 1 / 6 / -1; min-height: 0; }
  .md.phone.vall .pkn { display: none; }
  .md.phone.vall { grid-template-rows: 40px 0 40px 40px minmax(40px, 1fr) 40px; }
  .md.phone .pbar { grid-area: bar; position: static; margin-top: 0; }
  .md.phone .pbar .key { min-height: 40px; height: 40px; }
}

/* beats in and out: IMPORT, EXPORT, MIDI clip (drag it onto a DAW track) */
.md .bio { display: flex; gap: 6px; }
.md .bio .key.io { flex: 1 1 0; min-width: 0; }
.md.desk .beats .bio { margin-left: auto; }
.md.desk .beats .bio .key.io { flex: none; min-width: 62px; }
.md .sheet .bio { grid-column: 1 / -1; }
.md .sheet .bio .key.io { min-height: 44px; }
.md .key.io[draggable="true"] { cursor: grab; }

/* one PLAY / STOP key */
.md .key.play { font-variant-numeric: tabular-nums; }
.md.desk .hk .key.play { min-width: 128px; }
.md.phone .phd { grid-template-columns: 84px minmax(0, 1fr) auto; }
.md.phone .phd .key.play { font-size: 11px; letter-spacing: .08em; padding: 0 4px; }
.md .key.play.on { color: var(--g); text-shadow: 0 0 8px rgba(61,255,122,.8); }

/* MD|187 (amber) and MD|888 (red): the same console in the colour of their keyboard firmware. MD|442 stays green. */
.md[data-style="187"] { --g: #ffb02e; --lit: linear-gradient(#ffcc6b, #f29a12); --glow: 0 0 0 2px var(--g), 0 0 14px rgba(255,176,46,.75); }
.md[data-style="888"] { --g: #ff3d57; --lit: linear-gradient(#ff7a8a, #e3213d); --glow: 0 0 0 2px var(--g), 0 0 14px rgba(255,61,87,.75); }
.md[data-style="187"] .st.on, .md[data-style="187"] .pk.on, .md[data-style="187"] .pk.held { box-shadow: 0 0 10px rgba(255,176,46,.55), inset 0 1px 0 rgba(255,255,255,.45); color: #3a2300; border-color: #a86400; }
.md[data-style="888"] .st.on, .md[data-style="888"] .pk.on, .md[data-style="888"] .pk.held { box-shadow: 0 0 10px rgba(255,61,87,.55), inset 0 1px 0 rgba(255,255,255,.45); color: #3a0009; border-color: #9c1026; }
.md[data-style="187"] .lcd .tp, .md[data-style="187"] .key.play.on, .md[data-style="187"] .key.big.go.on { text-shadow: 0 0 12px rgba(255,176,46,.6); }
.md[data-style="888"] .lcd .tp, .md[data-style="888"] .key.play.on, .md[data-style="888"] .key.big.go.on { text-shadow: 0 0 12px rgba(255,61,87,.6); }
.md[data-style="187"] .key.led.on::before, .md[data-style="187"] .key.led.hit::before { box-shadow: 0 0 6px var(--g), 0 0 12px rgba(255,176,46,.7); }
.md[data-style="888"] .key.led.on::before, .md[data-style="888"] .key.led.hit::before { box-shadow: 0 0 6px var(--g), 0 0 12px rgba(255,61,87,.7); }
.md[data-style="187"] .key.sel, .md[data-style="187"].desk .sec.sel, .md[data-style="187"] .strip.sel, .md[data-style="187"] .key.sw.on { border-color: #a86400; }
.md[data-style="888"] .key.sel, .md[data-style="888"].desk .sec.sel, .md[data-style="888"] .strip.sel, .md[data-style="888"] .key.sw.on { border-color: #9c1026; }
.md[data-style="187"] .key.sw.on { background: linear-gradient(#fff0d6, #ffd58f); }
.md[data-style="888"] .key.sw.on { background: linear-gradient(#ffe0e5, #ffaab5); }
.md[data-style="187"][data-theme="dark"] .key.sw.on { background: linear-gradient(#7a4f0c, #5c3a06); color: #fff6e6; }
.md[data-style="888"][data-theme="dark"] .key.sw.on { background: linear-gradient(#7a1424, #5a0d1a); color: #ffeef0; }
.md[data-style="187"] .ovr.sel { background: rgba(255,176,46,.1); } .md[data-style="888"] .ovr.sel { background: rgba(255,61,87,.1); }
/* the machine switch under the desktop logo: 442 · 187 · 888 */
.md.desk .logo .lsw { display: flex; gap: 4px; margin-top: 8px; }
.md.desk .logo .key.sty { flex: 1; min-height: 22px; min-width: 0; font-family: 'Martian Mono', monospace; font-variation-settings: normal; font-size: 10px; font-weight: 500; letter-spacing: .08em; padding: 0 4px; }
.md.desk .logo .key.sty.on { color: var(--g); background: linear-gradient(#141517, #08090a); border-color: var(--g); }
.md .seg.style .key { font-weight: 600; letter-spacing: .06em; }
/* wide screens: the tools row (One drum … Random) stays inside the console; the drum name gives way first */
.md.desk .tools { min-width: 0; }
.md.desk .tools { gap: 7px; }
.md.desk .tools .wide .key { min-width: 104px; }
.md.desk .tools .lab { margin-left: 4px; }
.md.desk .tools .selnm { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 20px; }

/* WRITE (loop record) beside PLAY: plain until armed, then solid red so it is never mistaken for REC (full-song recording) */
.md .key.wr { white-space: nowrap; }
.md .key.wr.on { background: #c21818; color: #fff; border-color: #ff3b3b; box-shadow: 0 0 0 1px #ff3b3b, 0 0 14px rgba(255,59,59,.45); }
.md .key.wr.on::before { background: #fff; box-shadow: 0 0 6px #fff; }
/* SONG keys at the top: ● SONG records the whole set, ▶ SONG plays it back, WAV saves it */
.md.desk .hk .sgk { display: flex; gap: 4px; align-items: stretch; padding: 0 6px; border-left: 1px solid rgba(127,127,127,.25); border-right: 1px solid rgba(127,127,127,.25); }
.md.desk .hk .sgk .key { min-width: 74px; }
.md.desk .hk .sgk .key:disabled { opacity: .4; }
.md .key.song.on:not(.rec) { color: #e8a317; }

/* ---------- each machine has its own look ----------
   MD|442: graphite and green (the base styles). MD|187: warm walnut and cream with amber, a 90s sampler.
   MD|888: cold black steel with red and a slanted logo, built for hard techno. Colours and type only: no size or layout changes. */
.md[data-style="187"] .logo b, .md[data-style="888"] .logo b { color: var(--g); }
.md[data-style="187"] .logo { font-variation-settings: 'wdth' 112; letter-spacing: -.02em; }
.md[data-style="888"] .logo { font-style: italic; }
.md[data-style="888"].desk .hd .logo > b, .md[data-style="888"].desk .hd .logo { letter-spacing: -.05em; }
.md[data-style="888"] .lcd .tp { font-style: italic; }

/* MD|187 light: cream and tan */
.md[data-style="187"] { --panel: repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 1px, rgba(80,50,10,.03) 1px 3px), linear-gradient(180deg, #efe6d2 0%, #ddcfb3 50%, #cbb995 100%); --keyb: linear-gradient(#fbf5e8, #e2d6bd); --line: rgba(70,45,10,.22); --ink: #2a1d0c; --mut: #6b5534; }
.md[data-style="187"] .md-console { border-color: #a58d66; }
.md[data-style="187"] .lcd { background: #120b04; color: #ffe6bb; }
.md[data-style="187"] .lcd .l1 { text-shadow: 0 0 6px rgba(255,190,90,.55); }
.md[data-style="187"] .lcd .l2, .md[data-style="187"] .lcd .tl { color: #c9a777; }
.md[data-style="187"].desk .sec-t { background: linear-gradient(#3b2b1a, #1d140b); color: #ffe9c4; }
/* MD|187 dark: walnut */
.md[data-style="187"][data-theme="dark"] { --panel: repeating-linear-gradient(90deg, rgba(255,220,170,.018) 0 1px, transparent 1px 3px), linear-gradient(180deg, #352b22 0%, #2b231c 50%, #251e18 100%); --keyb: linear-gradient(#5a4d40, #463b31); --dark: linear-gradient(#1a140f, #120d09); --kbd: #75644f; --line: rgba(255,220,170,.13); --ink: #f6ead6; --mut: #c4ae8e; }
.md[data-style="187"][data-theme="dark"] .md-console { border-color: #6a5236; box-shadow: inset 0 1px 0 rgba(255,220,170,.12), 0 30px 80px rgba(0,0,0,.7); }
.md[data-style="187"][data-theme="dark"] .logo { color: #f6ead2; }
.md[data-style="187"][data-theme="dark"].desk .sec-t { background: linear-gradient(#1f1812, #150f0a); color: #f6ead6; }
.md[data-style="187"][data-theme="dark"] .key.big { background: linear-gradient(#1a130c, #0d0905); border-color: #75644f; }
.md[data-style="187"][data-theme="dark"] .lcd { background: #0c0703; box-shadow: inset 0 2px 8px rgba(0,0,0,.9), inset 0 0 0 1px rgba(255,190,90,.12); }

/* MD|888 light: cold steel */
.md[data-style="888"] { --panel: repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, rgba(0,10,30,.04) 1px 2px), linear-gradient(180deg, #dde1e6 0%, #bcc2ca 50%, #a1a8b1 100%); --keyb: linear-gradient(#f2f4f7, #c9ced5); --ink: #101318; }
.md[data-style="888"] .md-console { border-color: #7b2230; }
.md[data-style="888"] .lcd { background: #080203; color: #ffe1e5; }
.md[data-style="888"] .lcd .l1 { text-shadow: 0 0 6px rgba(255,61,87,.55); }
.md[data-style="888"] .lcd .l2, .md[data-style="888"] .lcd .tl { color: #c98a93; }
.md[data-style="888"].desk .sec-t { background: linear-gradient(#2a0c12, #0c0506); color: #ffe6ea; }
/* MD|888 dark: black steel with hazard stripes */
.md[data-style="888"][data-theme="dark"] { --panel: repeating-linear-gradient(135deg, rgba(255,255,255,.014) 0 10px, transparent 10px 20px), linear-gradient(180deg, #1c1d21 0%, #16171a 50%, #111214 100%); --keyb: linear-gradient(#36383e, #28292e); --dark: linear-gradient(#111113, #09090a); --kbd: #4d4f56; --line: rgba(255,255,255,.09); --ink: #f2f3f5; --mut: #9fa3ab; }
.md[data-style="888"][data-theme="dark"] .md-console { border-color: #5a1520; box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 1px rgba(255,61,87,.08), 0 30px 80px rgba(0,0,0,.8); }
.md[data-style="888"][data-theme="dark"].desk .sec-t { background: linear-gradient(#0f0f11, #070708); color: #f2f3f5; }
.md[data-style="888"][data-theme="dark"] .key.big { background: linear-gradient(#0d0d0f, #040405); border-color: #5a1520; }
.md[data-style="888"][data-theme="dark"] .lcd { background: #040102; box-shadow: inset 0 2px 8px rgba(0,0,0,.95), inset 0 0 0 1px rgba(255,61,87,.14); }
.md[data-style="888"][data-theme="dark"] .md-fit.fs, .md[data-style="888"] .md-fit.fs { background: #050506; }
.md[data-style="187"] .md-fit.fs { background: #0c0906; }

/* MIDI monitor line in the MIDI panel: what the keyboard really sends */
.md .mstat.mmon { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; padding: 6px 8px; border: 1px dashed rgba(127,127,127,.5); border-radius: 6px; margin: 6px 0; }

/* phone: the three machines sit under the header, always in view */
.md.phone .phd .pmach { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.md.phone .pmach .key.sty { min-height: 32px; min-width: 0; padding: 0 4px; font-family: 'Martian Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.md.phone .pmach .key.sty.on { color: var(--g); background: linear-gradient(#141517, #08090a); border-color: var(--g); box-shadow: 0 0 8px color-mix(in srgb, var(--g) 45%, transparent); }
@media (orientation: landscape) and (max-height: 560px) {
  .md.phone .phd { grid-template-columns: 84px auto minmax(0, 1fr) auto; }
  .md.phone .phd > * { grid-row: 1; }
  .md.phone .phd .key.play { grid-column: 1; } .md.phone .phd .pmach { grid-column: 2; grid-template-columns: repeat(3, 58px); gap: 4px; } .md.phone .phd .lcd { grid-column: 3; } .md.phone .phd .key.menu { grid-column: 4; }
  .md.phone .pmach .key.sty { min-height: 40px; height: 40px; font-size: 9px; }
}
@media (orientation: portrait) and (max-height: 700px) { .md.phone .pmach .key.sty { min-height: 22px; height: 22px; font-size: 9px; } }
