:root {
  color-scheme: dark;
  --bg: #070808;
  --panel: rgba(12, 14, 14, 0.82);
  --panel-solid: #111313;
  --panel-soft: rgba(22, 24, 22, 0.64);
  --line: rgba(233, 218, 182, 0.16);
  --line-strong: rgba(255, 209, 126, 0.46);
  --text: #f5efe2;
  --muted: #b9ad94;
  --dim: #7d7566;
  --cyan: #f0c46d;
  --cyan-soft: rgba(240, 196, 109, 0.2);
  --amber: #ffb43f;
  --amber-soft: rgba(255, 180, 63, 0.18);
  --green: #78ff86;
  --red: #ff5b58;
  --wood-1: #d7a66f;
  --wood-2: #b67b43;
  --wood-3: #7c4d2b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  overflow: auto;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px),
    radial-gradient(circle at 42% 0%, rgba(255, 177, 70, 0.16), transparent 42%),
    radial-gradient(circle at 78% 92%, rgba(240, 196, 109, 0.1), transparent 38%),
    linear-gradient(140deg, #050606 0%, #0b0d0c 48%, #050504 100%);
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

input,
select {
  color: var(--text);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

input[type="range"] {
  accent-color: #d69b43;
}

.app-shell {
  width: min(1800px, 100vw);
  min-height: 100svh;
  margin: 0 auto;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.topbar {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(270px, 0.85fr) minmax(620px, 1.72fr) minmax(220px, 0.62fr);
  gap: 10px;
}

.brand-lockup,
.transport-strip,
.master-strip,
.camera-panel,
.channel-panel,
.dock-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 242, 206, 0.07), rgba(255, 255, 255, 0.018)),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 18px 46px rgba(0, 0, 0, 0.26);
}

.brand-lockup {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow,
.panel-title span,
.section-head span,
.value-control span,
.master-volume span,
.tracking-readouts span,
.gesture-legend span,
.channel-meta span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.69rem;
  font-weight: 800;
}

h1 {
  margin: 1px 0 0;
  font-size: clamp(1.55rem, 2.2vw, 2.3rem);
  letter-spacing: 0.02em;
  line-height: 1;
}

.status-pill {
  flex: none;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--green);
  background: rgba(120, 255, 134, 0.08);
}

.status-pill.hot {
  color: var(--amber);
  background: rgba(255, 180, 63, 0.12);
  border-color: rgba(255, 180, 63, 0.34);
}

.status-pill.warn {
  color: #ffd66e;
  background: rgba(255, 214, 110, 0.12);
}

.transport-strip {
  padding: 8px;
  display: grid;
  grid-template-columns: 50px 42px minmax(82px, 0.8fr) minmax(190px, 1.2fr) minmax(92px, 0.75fr) minmax(160px, 1.1fr);
  align-items: stretch;
  gap: 8px;
}

.icon-command,
.small-command,
.wood-button,
.sample-action,
.state-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.015)),
    rgba(9, 10, 10, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 22px rgba(0, 0, 0, 0.22);
}

.icon-command {
  min-width: 42px;
  display: grid;
  place-items: center;
  font-size: 1.02rem;
}

.icon-command.primary {
  border-color: rgba(240, 196, 109, 0.72);
  color: #1b1006;
  background: linear-gradient(180deg, #ffe0a1, #d99735 56%, #8a4e18);
  box-shadow: 0 0 24px rgba(240, 196, 109, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.icon-command.primary.playing {
  color: #140800;
  border-color: rgba(255, 180, 63, 0.74);
  background: linear-gradient(180deg, #ffe58c, #ffad35 52%, #d66d1f);
  box-shadow: 0 0 24px rgba(255, 180, 63, 0.26), inset 0 -2px 0 rgba(0, 0, 0, 0.28);
}

.value-control,
.master-volume {
  min-width: 0;
  padding: 6px 9px;
  display: grid;
  align-items: center;
  gap: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.value-control input[type="number"],
.value-control select {
  width: 100%;
  height: 31px;
  padding: 0 8px;
  font-weight: 850;
}

.value-control.compact {
  grid-template-columns: auto 1fr auto;
  column-gap: 8px;
}

.value-control.compact span {
  grid-column: 1 / -1;
}

.value-control strong {
  color: var(--cyan);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.master-strip {
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 55px 1fr;
  gap: 12px;
  align-items: center;
}

.meter-block {
  height: 44px;
  display: flex;
  align-items: end;
  gap: 6px;
}

.meter-bar {
  width: 15px;
  height: 42px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: end;
}

.meter-bar i {
  width: 100%;
  height: 24%;
  background: linear-gradient(180deg, var(--green), var(--amber));
  transition: height 120ms linear;
}

.meter-bar.ghost i {
  height: 54%;
  opacity: 0.48;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(285px, 0.72fr) minmax(610px, 1.72fr) minmax(270px, 0.7fr);
  gap: 10px;
}

.camera-panel,
.channel-panel {
  min-height: 0;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.panel-title,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title strong,
.section-head strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  color: var(--text);
}

.small-command {
  min-height: 34px;
  padding: 0 12px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.72rem;
  font-weight: 900;
}

.small-command.running {
  color: var(--amber);
  border-color: rgba(255, 180, 63, 0.38);
}

.camera-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.5)),
    url("assets/studio-desk.png") center / cover;
}

#webcam,
#handOverlay,
.camera-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#webcam {
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0;
  filter: contrast(1.04) saturate(0.86) brightness(0.72);
  transition: opacity 240ms ease;
}

#webcam.live {
  opacity: 1;
}

#handOverlay {
  pointer-events: none;
  z-index: 4;
}

.camera-fallback {
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 196, 109, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.34));
  backdrop-filter: blur(1px);
}

.camera-fallback span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.72rem;
  font-weight: 850;
}

.camera-fallback strong {
  font-size: clamp(1.2rem, 2.8vw, 1.8rem);
}

.camera-fallback p {
  margin: 0;
  color: var(--muted);
  max-width: 260px;
}

.camera-fallback.hidden {
  display: none;
}

.hand-cursor {
  position: fixed;
  z-index: 40;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -50%);
  border: 2px solid currentColor;
  border-radius: 999px;
  display: none;
  place-items: center;
  pointer-events: none;
  font-weight: 950;
  font-size: 0.72rem;
  text-shadow: 0 1px 6px #000;
  box-shadow: 0 0 22px currentColor;
}

.hand-cursor.left {
  color: var(--cyan);
}

.hand-cursor.right {
  color: var(--amber);
}

.hand-cursor.grabbing {
  width: 48px;
  height: 48px;
  background: rgba(240, 196, 109, 0.14);
}

.tracking-readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tracking-readouts div,
.gesture-legend,
.message-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
}

.tracking-readouts div {
  padding: 9px 10px;
}

.tracking-readouts strong {
  display: block;
  margin-top: 4px;
  color: var(--cyan);
  font-size: 0.82rem;
}

.gesture-legend {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.gesture-legend div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
}

.gesture-legend strong {
  color: var(--text);
  font-size: 0.78rem;
}

.message-panel {
  min-height: 54px;
  padding: 12px;
  color: #efe3cb;
  line-height: 1.35;
  display: grid;
  align-items: center;
}

.instrument-panel {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(440px, 1fr) auto;
  gap: 10px;
}

.board-shell {
  min-height: 0;
  min-width: 0;
  padding: 12px;
  display: grid;
  perspective: 1400px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 48% 10%, rgba(255, 188, 83, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.18));
}

.board-surface {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: clamp(18px, 2.1vw, 30px);
  display: grid;
  grid-template-rows: 54px minmax(330px, 1fr) 74px;
  gap: 14px;
  border-radius: 18px;
  overflow: hidden;
  color: #2b1c0f;
  background:
    linear-gradient(90deg, rgba(84, 46, 17, 0.16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(84, 46, 17, 0.09) 1px, transparent 1px),
    radial-gradient(circle at 24% 18%, rgba(255, 245, 190, 0.32), transparent 30%),
    linear-gradient(112deg, rgba(255, 255, 255, 0.16), transparent 42%),
    url("assets/maple-panel.png") center / cover,
    linear-gradient(90deg, var(--wood-1), #d9ad74 24%, #c89154 52%, #e0b67d 77%, #b97b43);
  background-size: 92px 100%, 100% 17px, auto, auto, cover, auto;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    inset 0 -22px 34px rgba(83, 44, 15, 0.22),
    0 32px 70px rgba(0, 0, 0, 0.52);
  transform: rotateX(1.5deg);
}

.board-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(2deg, transparent 0 16px, rgba(87, 47, 18, 0.045) 16px 17px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 16%, transparent 82%, rgba(49, 24, 8, 0.14));
  mix-blend-mode: multiply;
}

.board-top-details,
.board-bottom-controls,
.grid-area {
  position: relative;
  z-index: 2;
}

.board-top-details {
  display: grid;
  grid-template-columns: 96px 1fr 76px;
  align-items: start;
}

.brand-mark {
  font-weight: 950;
  letter-spacing: 0.08em;
  color: rgba(42, 25, 11, 0.68);
}

.speaker-grille {
  justify-self: center;
  width: min(230px, 38%);
  display: grid;
  grid-template-columns: repeat(8, 5px);
  gap: 8px;
  justify-content: center;
  padding-top: 8px;
}

.speaker-grille i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(36, 21, 10, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.board-leds {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.board-leds span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
}

.board-leds span:last-child {
  background: rgba(35, 20, 9, 0.36);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.38);
}

.grid-area {
  min-height: 0;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 12px;
  align-self: center;
}

.row-labels {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  padding-top: 27px;
  gap: 0;
}

.row-label {
  display: grid;
  grid-template-columns: 18px 12px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding-right: 10px;
  font-weight: 900;
  color: rgba(38, 22, 8, 0.82);
  border-bottom: 1px solid rgba(45, 24, 9, 0.22);
}

.row-label strong {
  text-align: right;
}

.row-label em {
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
}

.row-label span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(36, 20, 8, 0.28);
}

.row-label.active span {
  background: var(--amber);
  box-shadow: 0 0 14px var(--amber);
}

.grid-frame {
  position: relative;
  display: grid;
  grid-template-rows: 26px 1fr;
  align-self: center;
  min-width: 0;
  aspect-ratio: 8 / 5;
  max-height: 100%;
  border-radius: 12px;
}

.step-numbers {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  text-align: center;
  color: rgba(43, 25, 10, 0.72);
  font-weight: 850;
  font-size: 0.82rem;
}

.beat-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(5, 1fr);
  min-height: 0;
  border: 2px solid rgba(34, 19, 8, 0.55);
  border-radius: 11px;
  overflow: hidden;
  background: rgba(255, 228, 166, 0.1);
  box-shadow: inset 0 2px 10px rgba(42, 23, 8, 0.16), 0 11px 18px rgba(87, 44, 16, 0.12);
}

.cell {
  position: relative;
  min-height: 0;
  container-type: size;
  border-right: 1px solid rgba(31, 18, 8, 0.5);
  border-bottom: 1px solid rgba(31, 18, 8, 0.5);
  background: rgba(255, 255, 255, 0.025);
  transition: background 120ms ease, box-shadow 120ms ease;
}

.cell:nth-child(8n) {
  border-right: 0;
}

.cell:nth-child(n + 33) {
  border-bottom: 0;
}

.cell.selected {
  background: rgba(240, 196, 109, 0.16);
  box-shadow: inset 0 0 0 2px rgba(240, 196, 109, 0.82), 0 0 22px rgba(240, 196, 109, 0.18);
}

.cell.play-col {
  background: rgba(255, 177, 60, 0.16);
}

.cell.play-hit {
  box-shadow: inset 0 0 0 2px rgba(255, 180, 63, 0.78), 0 0 28px rgba(255, 180, 63, 0.44);
}

.cell.outside-length {
  background: rgba(28, 20, 13, 0.26);
}

.token {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(58cqw, 72cqh, 50px);
  min-width: 30px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(31, 18, 8, 0.68);
  background:
    linear-gradient(90deg, rgba(55, 31, 12, 0.18) 1px, transparent 1px),
    radial-gradient(circle at 30% 22%, rgba(255, 235, 177, 0.5), transparent 27%),
    linear-gradient(135deg, #c3935b, #80502b 78%);
  background-size: 13px 100%, auto, auto;
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.28), inset 0 -6px 12px rgba(30, 14, 4, 0.32), 0 10px 12px rgba(40, 20, 8, 0.32);
  transition: transform 140ms ease, filter 140ms ease;
}

.token::after {
  content: "";
  position: absolute;
  right: 18%;
  top: 18%;
  width: 21%;
  height: 3px;
  border-radius: 999px;
  background: rgba(42, 24, 9, 0.44);
  transform: rotate(-20deg);
}

.token.second {
  filter: brightness(0.62) saturate(0.86);
  background:
    linear-gradient(90deg, rgba(255, 226, 159, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 70% 78%, rgba(255, 214, 135, 0.22), transparent 26%),
    linear-gradient(135deg, #3b3128, #151411 82%);
}

.token.both::before {
  content: "";
  position: absolute;
  inset: -9px 7px 9px -7px;
  z-index: -1;
  border-radius: 50%;
  border: 1px solid rgba(31, 18, 8, 0.6);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 236, 183, 0.44), transparent 28%),
    linear-gradient(135deg, #cda06a, #704627 74%);
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.24), 0 6px 10px rgba(34, 17, 5, 0.24);
}

.token.ghost-token {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  width: 50px;
  min-width: 0;
}

.token.ghost-token:hover {
  transform: translateY(-3px);
}

.board-bottom-controls {
  display: grid;
  grid-template-columns: 78px 1fr 86px;
  gap: 18px;
  align-items: center;
}

.wood-knob {
  position: relative;
  border: 1px solid rgba(34, 18, 7, 0.66);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 238, 185, 0.32), transparent 26%),
    linear-gradient(135deg, #4b2f1d, #1b1711 74%);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.18), inset 0 -8px 12px rgba(0, 0, 0, 0.4), 0 14px 20px rgba(42, 19, 6, 0.24);
}

.transport-knob {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  color: var(--amber);
  font-size: 1.08rem;
}

.mini-controls {
  display: flex;
  align-items: end;
  gap: 18px;
}

.mini-controls label {
  min-width: 120px;
  display: grid;
  gap: 5px;
  color: rgba(43, 25, 10, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  font-weight: 900;
}

.wood-button {
  justify-self: end;
  width: min(100%, 86px);
  min-height: 42px;
  padding: 0 14px;
  color: #2a1808;
  border-color: rgba(44, 25, 9, 0.38);
  background: linear-gradient(180deg, rgba(255, 229, 174, 0.64), rgba(191, 127, 62, 0.42));
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wood-button.danger {
  color: #50120c;
}

.bottom-dock {
  min-height: 138px;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.1fr);
  gap: 10px;
}

.dock-section,
.left-actions {
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.left-actions {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
}

.token-tray {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.token-tray .ghost-token:nth-child(n + 7) {
  opacity: 0.62;
}

.state-buttons,
.sample-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.state-dock {
  grid-template-rows: auto 1fr;
}

.inspector-head {
  align-items: start;
}

.inspector-tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(48px, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.inspector-tab {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.inspector-tab.active {
  color: #1b1006;
  background: var(--cyan);
}

.inspector-panel {
  min-width: 0;
  min-height: 0;
}

.hidden {
  display: none !important;
}

.state-btn {
  min-width: 0;
  min-height: 66px;
  padding: 8px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.state-btn small {
  color: var(--muted);
  font-weight: 800;
}

.state-btn.active {
  color: var(--cyan);
  border-color: rgba(240, 196, 109, 0.72);
  box-shadow: 0 0 18px rgba(240, 196, 109, 0.16);
}

.sound-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.sound-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.sound-title span,
.sound-control span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.61rem;
  font-weight: 850;
}

.sound-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sound-control b {
  font: inherit;
}

.sound-control output {
  color: var(--amber);
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.sound-title strong {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  align-content: center;
}

.sound-control {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.sound-control input {
  width: 100%;
}

.sample-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sample-action {
  min-width: 0;
  min-height: 66px;
  padding: 8px;
  color: var(--text);
  font-weight: 900;
}

.left-actions .sample-action {
  min-height: 54px;
  font-size: 0.82rem;
}

.channel-panel {
  grid-template-rows: auto 1fr;
}

.channel-strips {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  gap: 9px;
}

.channel-strip {
  min-height: 98px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.012)),
    rgba(0, 0, 0, 0.18);
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.channel-strip.selected-row {
  border-color: rgba(240, 196, 109, 0.42);
  box-shadow: inset 0 0 0 1px rgba(240, 196, 109, 0.14), 0 0 18px rgba(240, 196, 109, 0.08);
}

.channel-meta {
  min-width: 0;
  display: grid;
  align-content: space-between;
}

.channel-meta strong {
  font-size: 0.92rem;
}

.row-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 14px var(--amber);
}

.channel-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.knob-control {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.knob-control span,
.toggle-row span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.61rem;
  font-weight: 850;
}

.knob-control input {
  width: 100%;
}

.toggle-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.toggle-button {
  min-width: 34px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  font-weight: 950;
  color: var(--muted);
}

.toggle-button.active {
  color: #1b1006;
  background: var(--cyan);
  border-color: rgba(240, 196, 109, 0.76);
}

.mute-button.muted {
  color: #1b0303;
  background: var(--red);
  border-color: rgba(255, 91, 88, 0.72);
}

.drag-proxy {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  width: 54px;
  height: 54px;
}

.drag-proxy .token {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  width: 54px;
}

@media (min-width: 1221px) and (max-height: 1000px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    width: min(1680px, 100vw);
    height: 100svh;
    min-height: 0;
    padding: 6px 8px;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
  }

  .topbar {
    height: 50px;
    min-height: 0;
    gap: 7px;
    grid-template-columns: minmax(250px, 0.78fr) minmax(560px, 1.62fr) minmax(200px, 0.56fr);
  }

  .brand-lockup {
    padding: 7px 13px;
  }

  h1 {
    font-size: clamp(1.3rem, 1.75vw, 1.78rem);
  }

  .status-pill {
    padding: 7px 10px;
  }

  .transport-strip {
    padding: 6px;
    grid-template-columns: 42px 36px minmax(72px, 0.66fr) minmax(164px, 1fr) minmax(78px, 0.56fr) minmax(138px, 0.9fr);
    gap: 6px;
  }

  .icon-command {
    min-width: 36px;
    min-height: 36px;
  }

  .value-control,
  .master-volume {
    padding: 5px 8px;
  }

  .value-control input[type="number"],
  .value-control select {
    height: 27px;
  }

  .master-strip {
    padding: 7px 10px;
  }

  .meter-block {
    height: 38px;
  }

  .meter-bar {
    height: 36px;
  }

  .workspace {
    min-height: 0;
    grid-template-columns: minmax(265px, 0.66fr) minmax(570px, 1.58fr) minmax(250px, 0.64fr);
    gap: 7px;
  }

  .camera-panel,
  .channel-panel {
    padding: 8px;
    gap: 7px;
  }

  .camera-stage {
    aspect-ratio: 16 / 9;
  }

  .tracking-readouts div {
    padding: 7px 8px;
  }

  .gesture-legend {
    padding: 8px;
    gap: 5px;
  }

  .gesture-legend div {
    font-size: 0.78rem;
  }

  .left-actions {
    padding: 8px;
    gap: 7px;
  }

  .left-actions .sample-action {
    min-height: 42px;
  }

  .message-panel {
    min-height: 42px;
    padding: 8px 10px;
  }

  .instrument-panel {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .board-shell {
    padding: 6px;
    border-radius: 15px;
  }

  .board-surface {
    padding: 11px 18px;
    grid-template-rows: 28px minmax(320px, 1fr) 42px;
    gap: 7px;
    border-radius: 15px;
  }

  .board-top-details {
    grid-template-columns: 76px 1fr 58px;
  }

  .speaker-grille {
    padding-top: 2px;
    gap: 6px;
  }

  .grid-area {
    grid-template-columns: 96px 1fr;
    gap: 8px;
  }

  .row-labels {
    padding-top: 24px;
  }

  .grid-frame {
    max-height: 480px;
  }

  .board-bottom-controls {
    grid-template-columns: 50px minmax(0, 1fr) 88px;
    gap: 12px;
  }

  .transport-knob {
    width: 46px;
    height: 46px;
  }

  .mini-controls {
    gap: 14px;
  }

  .mini-controls label {
    min-width: 100px;
  }

  .wood-button {
    width: 76px;
    min-height: 34px;
    padding: 0 10px;
  }

  .bottom-dock {
    height: 122px;
    min-height: 0;
    gap: 6px;
  }

  .dock-section {
    padding: 6px 7px;
    gap: 4px;
  }

  .token-tray {
    min-height: 42px;
    gap: 7px;
  }

  .token.ghost-token {
    width: 32px;
    flex: 0 0 32px;
  }

  .state-btn {
    min-height: 40px;
    padding: 5px;
    font-size: 0.78rem;
  }

  .sound-grid {
    gap: 1px 8px;
    align-content: start;
  }

  .sound-panel {
    grid-template-rows: 1fr;
  }

  .sound-title {
    display: none;
  }

  .sound-control span {
    font-size: 0.56rem;
    line-height: 1;
  }

  .sound-control output {
    font-size: 0.56rem;
  }

  .sound-control {
    gap: 1px;
  }

  .sound-control input {
    height: 12px;
  }

  .channel-strips {
    gap: 6px;
  }

  .channel-strip {
    min-height: 70px;
    padding: 6px 7px;
    grid-template-columns: 50px 1fr;
    gap: 7px;
  }

  .channel-controls {
    gap: 4px 6px;
  }

  .knob-control span,
  .toggle-row span,
  .channel-meta span {
    font-size: 0.58rem;
  }

  .toggle-button {
    min-height: 26px;
  }
}

@media (max-width: 1220px) and (min-width: 821px) {
  .app-shell {
    min-height: auto;
  }

  .topbar {
    grid-template-columns: minmax(240px, 0.56fr) minmax(560px, 1fr);
  }

  .master-strip {
    grid-column: 1 / -1;
    min-height: 54px;
  }

  .workspace {
    grid-template-columns: minmax(245px, 0.38fr) minmax(560px, 1fr);
  }

  .channel-panel {
    grid-column: 1 / -1;
  }

  .instrument-panel {
    grid-template-rows: auto auto;
  }

  .bottom-dock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .state-btn,
  .sample-action {
    font-size: 0.84rem;
  }

  .board-surface {
    min-height: 560px;
  }

  .channel-strips {
    grid-template-columns: repeat(5, minmax(200px, 1fr));
    grid-template-rows: none;
    overflow-x: auto;
  }
}

@media (max-width: 820px) {
  .app-shell {
    min-height: auto;
    padding: 8px;
  }

  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    min-height: 56px;
    padding: 8px 12px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .transport-strip {
    grid-template-columns: 44px 38px 86px 118px 74px 128px;
    min-height: 58px;
    gap: 6px;
    overflow: hidden;
  }

  .transport-strip .value-control {
    min-width: 0;
  }

  .transport-strip .value-control.compact {
    grid-template-columns: 1fr;
  }

  .transport-strip .value-control.compact strong {
    display: none;
  }

  .master-strip {
    display: none;
  }

  .instrument-panel {
    order: -1;
    grid-template-rows: auto auto;
  }

  .bottom-dock {
    grid-template-columns: 1fr;
  }

  .state-dock {
    grid-column: 1 / -1;
  }

  .token-tray {
    justify-content: space-between;
  }

  .token.ghost-token {
    flex: 0 0 38px;
    width: 38px;
  }

  .state-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sound-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .state-btn {
    min-height: 62px;
    font-size: 0.78rem;
  }

  .grid-area {
    grid-template-columns: 88px 1fr;
  }

  .row-label {
    font-size: 0.72rem;
    grid-template-columns: 16px 10px minmax(0, 1fr);
    gap: 6px;
    padding-right: 6px;
  }

  .board-surface {
    padding: 14px;
    grid-template-rows: 42px minmax(330px, 1fr) 70px;
    border-radius: 16px;
  }

  .cell {
    min-height: 46px;
  }
}
