:root { --bg: #161d36; --panel: #1f2a4d; --key: #d8deee; --keyd: #7b86a6; --ink: #1d2540; --acc: #c7f0d8; --accd: #5f9a7e; --root: #8fd0ff; --rootd: #3b78a8; --line: #0b1020;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0c1120; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--mono); font-weight: 700; color: var(--acc); touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, select { font: inherit; }

.app { width: min(100vw, 520px); height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); }

/* Transport */
.transport { display: flex; align-items: center; gap: 10px; flex: none; }
.bpm { display: flex; align-items: center; gap: 6px; }
.bpmv { min-width: 50px; text-align: center; line-height: 1; }
.bpmv output { display: block; font-size: 20px; }
.bpmv small { font-size: 9px; opacity: .7; letter-spacing: .1em; }
.mode { margin-left: auto; font-size: 13px; letter-spacing: .08em; padding: 6px 10px; border: 2px solid var(--keyd); border-radius: 4px; }

/* Display */
.lcdwrap { flex: none; }
.lcd { background: #c7f0d8; border: 4px solid var(--line); border-radius: 8px; box-shadow: inset 0 0 12px rgba(20,40,20,.5), 0 0 0 2px #2c3a66; line-height: 0; overflow: hidden; }
#lcd { display: block; margin: 0 auto; image-rendering: pixelated; touch-action: none; }

/* Buttons */
.b { appearance: none; border: 0; height: 44px; min-width: 44px; padding: 0 6px; border-radius: 6px; background: var(--key); color: var(--ink); font-size: 13px; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 3px 0 var(--keyd); transition: transform .04s, box-shadow .04s; }
.b.sm { min-width: 44px; padding: 0; font-size: 20px; }
.b.down, .b:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--keyd); }
.b.on { background: var(--acc); box-shadow: 0 3px 0 var(--accd); }
.b.on.down { box-shadow: 0 1px 0 var(--accd); }
.b:disabled { opacity: .35; }
.b.play { width: 56px; background: var(--acc); box-shadow: 0 3px 0 var(--accd); }
.b.play.on { background: #ff9d8a; box-shadow: 0 3px 0 #b3503f; }

/* Bedienfelder */
.views { flex: none; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 2px 4px; margin: 0 -2px; }
.view { display: flex; flex-direction: column; gap: 8px; }
.view[hidden] { display: none; }
.row { display: flex; gap: 6px; align-items: center; }
.row .b { flex: 1 1 0; min-width: 0; }
.row .sp { flex: 1 1 0; min-width: 0; }
.row .b.sm { flex: none; }
.chip { flex: none !important; width: 40px; min-width: 40px; }
.octv { font-size: 12px; min-width: 34px; text-align: center; white-space: nowrap; }
select { flex: 1; height: 44px; border: 0; border-radius: 6px; background: var(--panel); color: var(--acc); padding: 0 10px; font-size: 14px; box-shadow: inset 0 0 0 2px var(--keyd); }
#root { flex: .5; }
.soon { margin: 24px 8px; line-height: 1.6; text-align: center; opacity: .8; }

/* Tastatur 3 × 8 */
.kb { flex: 1 1 150px; min-height: 140px; display: flex; flex-direction: column; gap: 6px; }
.kb[hidden] { display: none; }
.krow { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.key { appearance: none; border: 0; border-radius: 6px; background: var(--key); color: var(--ink); box-shadow: 0 4px 0 var(--keyd); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 0; min-height: 40px; transition: transform .04s, box-shadow .04s; }
.key b { font-size: 16px; } .key small { font-size: 10px; opacity: .6; margin-top: 3px; }
.key.root { background: var(--root); box-shadow: 0 4px 0 var(--rootd); }
.key.down, .key:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--keyd); background: var(--acc); }
.key:disabled { opacity: .18; box-shadow: none; }

/* Sound-Regler */
#v-sound { gap: 4px; padding-bottom: 6px; }
.app[data-tab=sound] .views { flex: 1 1 auto; }
.app[data-tab=sound] .kb { flex: 0 0 140px; min-height: 140px; }
.chips.wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.wrap .chip { width: auto; min-width: 0; flex: 1 1 auto !important; height: 36px; font-size: 12px; }
h3 { margin: 8px 0 0; font-size: 11px; letter-spacing: .15em; opacity: .65; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.par { display: grid; grid-template-columns: 1fr auto; align-items: center; font-size: 12px; }
.pv { color: #fff; }
.par input { grid-column: 1 / -1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; background: var(--panel); border-radius: 2px; box-shadow: inset 0 0 0 2px var(--keyd); }
input[type=range]::-moz-range-track { height: 8px; background: var(--panel); border-radius: 2px; box-shadow: inset 0 0 0 2px var(--keyd); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 26px; margin-top: -9px; background: var(--acc); border-radius: 3px; box-shadow: 0 3px 0 var(--accd); }
input[type=range]::-moz-range-thumb { width: 20px; height: 26px; background: var(--acc); border: 0; border-radius: 3px; box-shadow: 0 3px 0 var(--accd); }

/* Tabs */
.tabs { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tab { appearance: none; border: 0; height: 46px; border-radius: 6px 6px 2px 2px; background: var(--panel); color: var(--acc); font-size: 12px; letter-spacing: .06em; box-shadow: inset 0 0 0 2px var(--keyd); cursor: pointer; }
.tab.on { background: var(--acc); color: var(--ink); box-shadow: none; }

/* Dreiecke statt Emoji-anfälliger Zeichen */
.tri { display: block; width: 14px; height: 14px; background: currentColor; }
.tri.left { clip-path: polygon(100% 0, 100% 100%, 0 50%); }
.tri.right { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.tri.play { clip-path: polygon(10% 0, 100% 50%, 10% 100%); }
.play.on .tri.play { clip-path: polygon(10% 10%, 90% 10%, 90% 90%, 10% 90%); }

/* Rhythmus */
.dgrid { display: grid; grid-template-columns: 40px repeat(16, 1fr); gap: 3px 2px; touch-action: none; }
.dlab { appearance: none; border: 0; border-left: 4px solid var(--c); border-radius: 3px; background: var(--panel); color: var(--acc); font-size: 9px; letter-spacing: 0; padding: 0 0 0 2px; text-align: left; height: clamp(30px, 5.2dvh, 42px); cursor: pointer; margin-right: 2px; }
.dlab:active { background: var(--c); color: var(--ink); }
.c { height: clamp(30px, 5.2dvh, 42px); border-radius: 3px; background: #2a3763; box-shadow: inset 0 0 0 1px #3a4a80; }
.c.g2 { background: #222d54; }
.c.on { background: var(--c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.c.ph { box-shadow: inset 0 0 0 3px #fff; }
.pads { flex: 1 1 56px; min-height: 56px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; touch-action: none; }
.pads[hidden] { display: none; }
.pad { appearance: none; border: 0; border-radius: 8px; background: var(--c); color: var(--ink); font-size: 10px; letter-spacing: 0; padding: 0; box-shadow: 0 4px 0 rgba(0,0,0,.35); cursor: pointer; transition: transform .04s, box-shadow .04s; }
.pad:active, .pad.hot { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); filter: brightness(1.15); }
.b.rec.on { background: #ff6b5a; color: #fff; box-shadow: 0 3px 0 #a3281b; }
#v-song .b { flex: 1; }
