/* SPDX-License-Identifier: GPL-3.0-only */
:root {
  --bg: #0d0d10;
  --body: #1c1d21;
  --body-edge: #2a2b31;
  --ink: #e8e8ea;
  --muted: #8b8b93;
  --accent: #ef9f27;
  --key-white: #f2f2ee;
  --key-black: #18181b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.muted { color: var(--muted); }
kbd { background: #26262c; border: 1px solid #3a3a42; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 12px; }

.top-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 20px; }
.brand .logo { font-weight: 700; font-size: 20px; color: var(--accent); letter-spacing: .5px; }
.brand .sub { color: var(--muted); margin-left: 8px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip { background: #24252b; color: var(--ink); border: 1px solid #383943; border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
.chip:hover { border-color: #55565f; }
.chip.check { display: inline-flex; gap: 6px; align-items: center; cursor: default; }

#stage { position: relative; padding: 8px 12px 0; overflow: hidden; }
#device { position: absolute; top: 8px; left: 0; width: 1180px; transform-origin: top left; background: linear-gradient(#202126, var(--body)); border: 1px solid var(--body-edge);
  border-radius: 18px; padding: 22px 26px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.55); user-select: none; -webkit-user-select: none; touch-action: none; }
.panel { display: grid; grid-template-columns: 170px 360px minmax(0, 1fr); gap: 26px; align-items: start; }

/* buttons */
.btn-grid { display: grid; gap: 10px 8px; }
.btn-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.btn-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 16px; }
.hbtn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.hbtn .cap { width: 100%; height: 26px; border-radius: 6px; background: #2b2c33; border: 1px solid #3c3d46; border-bottom-width: 3px;
  display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; color: #d6d6da; white-space: nowrap; overflow: hidden; }
.hbtn.down .cap { transform: translateY(1px); border-bottom-width: 2px; background: #33343c; }
.hbtn .led { position: absolute; top: 4px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: #3a3a40; }
.hbtn .led.on { background: #ffd28a; box-shadow: 0 0 6px #ffb84d; }
.hbtn .led.on.red { background: #ff6a5c; box-shadow: 0 0 6px #ff3b2f; }
.hbtn .led.on.green { background: #86f0a0; box-shadow: 0 0 6px #43d36b; }
.hbtn .what { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.15; min-height: 23px; overflow-wrap: anywhere; }

.wheels { display: flex; gap: 22px; justify-content: center; margin-top: 22px; }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.wheel input { writing-mode: vertical-lr; direction: rtl; height: 120px; width: 34px; accent-color: #9a9aa4; }

/* screen */
.screen-frame { background: #08080a; border: 1px solid #34353c; border-radius: 10px; padding: 12px; box-shadow: inset 0 0 0 1px #000; }
#screen { width: 336px; height: 336px; display: block; image-rendering: auto; background: #101012; border-radius: 2px; }

/* knobs */
.knobs { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.knob { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: ns-resize; }
.knob .dial { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3a3b43, #1f2025 70%);
  border: 1px solid #44454e; position: relative; box-shadow: 0 3px 6px rgba(0,0,0,.5); }
.knob .dial::after { content: ""; position: absolute; left: 50%; top: 5px; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: #e9e9ec; }
.knob span { font-size: 10px; color: var(--muted); }

/* pads and faders */
.pads-and-faders { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 18px; margin-top: 16px; align-items: stretch; }
.pads { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.pad { aspect-ratio: 1 / 1; border-radius: 8px; background: #26272d; border: 1px solid #3a3b44; cursor: pointer; transition: background 40ms linear; }
.pad.down { transform: scale(.96); }
.faders { display: flex; justify-content: space-around; align-items: center; }
.fader { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.fader input { writing-mode: vertical-lr; direction: rtl; height: 120px; width: 28px; accent-color: var(--accent); }

/* keys */
.keybed { position: relative; height: 150px; margin-top: 24px; background: #0b0b0d; border-radius: 6px; padding: 6px 6px 0; }
.key { position: absolute; top: 6px; border-radius: 0 0 5px 5px; cursor: pointer; }
.key.white { background: linear-gradient(#fff, var(--key-white)); border: 1px solid #b9b9b4; height: 138px; z-index: 1; }
.key.black { background: linear-gradient(#2b2b30, var(--key-black)); border: 1px solid #000; height: 88px; z-index: 2; }
.key.white.down { background: #ffe2b0; }
.key.black.down { background: #6a4b16; }
.key .lbl { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 10px; color: #99999a; pointer-events: none; }

.help { max-width: 1180px; margin: 14px auto 30px; padding: 0 20px; color: #c9c9ce; display: grid; gap: 6px; font-size: 13px; }

.overlay { position: fixed; inset: 0; background: rgba(5,5,8,.82); display: flex; align-items: center; justify-content: center; z-index: 10; }
.overlay.hidden { display: none; }
.start-card { background: #18191d; border: 1px solid #33343b; border-radius: 14px; padding: 28px 32px; max-width: 420px; text-align: center; }
.start-card h1 { margin: 0 0 6px; color: var(--accent); font-size: 30px; }
.start-card p { color: #c9c9ce; }
#start-btn { margin-top: 10px; background: var(--accent); color: #2a1800; border: 0; border-radius: 10px; padding: 12px 22px; font: 600 15px system-ui, sans-serif; cursor: pointer; }
.err { color: #ff8a80; min-height: 1em; }

/* MIDI monitor and learn */
.small { font-size: 12px; }
.midi-panel { max-width: 1180px; margin: 0 auto 6px; padding: 8px 20px; display: grid; gap: 8px; }
.midi-panel.hidden { display: none; }
.midi-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#learn-btn.on { background: var(--accent); color: #2a1800; border-color: var(--accent); }
.midi-log { font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #cfcfd4; background: #121216; border: 1px solid #2a2b31;
  border-radius: 8px; padding: 6px 10px; height: 96px; overflow: auto; white-space: pre; }
.learning [data-learn] { outline: 1px dashed rgba(239, 159, 39, .55); outline-offset: 2px; border-radius: 8px; cursor: crosshair; }
.learning [data-learn].target { outline: 2px solid var(--accent); }
.learning [data-learn].linked::after { content: ""; }
