/* ==========================================================================
   Akai MPK Mini Play mk3 Web Editor — Stylesheet
   MPC-inspired dark hardware theme with high tactile feedback & responsiveness
   ========================================================================== */

:root {
  --akai-red: #e21a22;
  --akai-red-bright: #ff383f;
  --akai-red-glow: rgba(226, 26, 34, 0.45);
  --akai-amber: #ff9d00;
  --akai-green: #10b981;
  --akai-green-glow: rgba(16, 185, 129, 0.35);

  --chassis-bg: #101114;
  --panel-bg: #171920;
  --panel-border: #262933;
  --card-bg: #1f222c;
  --card-hover: #262936;
  --card-border: #2e3240;

  --pad-bg: #282c37;
  --pad-border: #1a1c23;
  --pad-shadow: rgba(0, 0, 0, 0.6);
  --pad-active: #e21a22;
  --pad-active-glow: rgba(226, 26, 34, 0.7);

  --white-key-bg: #f5f6f8;
  --white-key-pressed: #d6d9e0;
  --black-key-bg: #16171b;
  --black-key-pressed: #2a2c33;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: "SF Mono", "Roboto Mono", "Fira Code", Menlo, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--chassis-bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header & Brand Bar */
.app-header {
  background: linear-gradient(180deg, #1d2029 0%, #15171d 100%);
  border-bottom: 2px solid var(--akai-red);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.akai-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.akai-badge {
  background: var(--akai-red);
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: 0 0 12px var(--akai-red-glow);
}

.model-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.model-title span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}

/* MIDI Connection Bar */
.midi-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  background: #252833;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
}

.connection-pill.connected {
  background: rgba(16, 185, 129, 0.15);
  color: var(--akai-green);
  border-color: rgba(16, 185, 129, 0.4);
}

.connection-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.connection-pill.connected .status-dot {
  background: var(--akai-green);
  box-shadow: 0 0 8px var(--akai-green-glow);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

.midi-select-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.midi-select {
  background: #111318;
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  max-width: 170px;
}

.midi-select:focus-visible {
  border-color: var(--akai-red);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--akai-red);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--akai-red);
  color: #fff;
  border-color: #b7151c;
  box-shadow: 0 2px 6px rgba(226, 26, 34, 0.35);
}

.btn-primary:hover {
  background: var(--akai-red-bright);
  box-shadow: 0 2px 10px var(--akai-red-glow);
}

.btn-secondary {
  background: #272a36;
  color: var(--text-main);
  border-color: var(--card-border);
}

.btn-secondary:hover {
  background: #313544;
  color: #fff;
}

.btn-ram {
  background: #2a1e12;
  color: var(--akai-amber);
  border-color: rgba(255, 157, 0, 0.4);
}

.btn-ram:hover, .btn-ram.active {
  background: rgba(255, 157, 0, 0.25);
  box-shadow: 0 0 10px rgba(255, 157, 0, 0.3);
}

/* Action & Favorite Bar */
.favorite-toolbar {
  background: #14161d;
  border-bottom: 1px solid var(--panel-border);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.slots-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.slot-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.slot-buttons {
  display: flex;
  gap: 0.35rem;
}

.slot-btn {
  background: #1b1e27;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.slot-btn:hover {
  background: #282c38;
  color: #fff;
}

.slot-btn.active {
  background: var(--akai-red);
  color: #fff;
  border-color: #ff383f;
  box-shadow: 0 0 8px var(--akai-red-glow);
}

.preset-io-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.preset-name-input {
  background: #0d0f13;
  color: #fff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  width: 140px;
}

.preset-name-input:focus-visible {
  border-color: var(--akai-red);
  outline: none;
}

/* Hardware Mode Warning Notice Banner */
.mode-notice-banner {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.1) 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  margin: 0.85rem 1.5rem 0 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mode-notice-icon {
  font-size: 1.15rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.mode-notice-body {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #fef3c7;
}

.mode-notice-body strong {
  color: #fbbf24;
}

.mode-notice-title {
  display: inline;
  font-weight: 700;
  color: #f59e0b;
  margin-right: 0.3rem;
}

.mode-notice-body span {
  display: block;
  margin-top: 0.2rem;
  color: rgba(254, 243, 199, 0.85);
  font-size: 0.78rem;
}

.mode-notice-close {
  background: transparent;
  border: none;
  color: rgba(254, 243, 199, 0.6);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}

.mode-notice-close:hover {
  color: #fff;
  background: rgba(245, 158, 11, 0.3);
}

.mode-info-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  letter-spacing: 0.2px;
}

/* Main Dashboard Workspace */
.main-workspace {
  flex: 1;
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Card / Section Panels */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  background: #1c1e28;
  border-bottom: 1px solid var(--panel-border);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.panel-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--akai-red);
}

.panel-body {
  padding: 1rem;
}

/* Section 1: Sound Module & FX Rack (Span 12 cols or 7 cols) */
.sound-panel {
  grid-column: span 12;
}

@media (min-width: 1100px) {
  .sound-panel {
    grid-column: span 7;
  }
}

.sound-selectors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.select-card {
  background: #111319;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.select-card label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.custom-select {
  background: #1b1e28;
  color: #fff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  width: 100%;
}

.custom-select:focus-visible {
  border-color: var(--akai-red);
}

/* 8 FX Sliders Rack */
.fx-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .fx-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.fx-card {
  background: #12141a;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}

.fx-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fx-slider-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.fx-slider {
  width: 100%;
  height: 6px;
  accent-color: var(--akai-red);
  background: #252834;
  border-radius: 3px;
  cursor: pointer;
}

.fx-val {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #fff;
}

/* Section 2: Arpeggiator & Channels (Span 5 cols) */
.arp-panel {
  grid-column: span 12;
}

@media (min-width: 1100px) {
  .arp-panel {
    grid-column: span 5;
  }
}

.arp-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.switch-input {
  display: none;
}

.switch-track {
  width: 42px;
  height: 22px;
  background: #272a36;
  border-radius: 11px;
  position: relative;
  transition: background 0.2s ease;
  border: 1px solid var(--panel-border);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch-input:checked + .switch-track {
  background: var(--akai-red);
  border-color: #ff383f;
}

.switch-input:checked + .switch-track::after {
  transform: translateX(20px);
}

/* Section 3: 8 Rotary Q-Link Knobs (Span 12 cols, above Pads) */
.knobs-panel {
  grid-column: span 12;
}

@media (min-width: 1100px) {
  .knobs-panel {
    grid-column: span 12;
  }
}

.knobs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .knobs-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

.knob-unit {
  background: #12141a;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  position: relative;
  transition: border-color 0.15s ease;
}

.knob-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.1rem;
}

.knob-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
}

.knob-bank-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.knob-bank-badge.bank-a {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.4);
}

.knob-bank-badge.bank-b {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.knob-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--panel-border);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  width: 100%;
  outline: none;
}

.knob-name-input:focus-visible {
  border-color: var(--akai-red);
  color: #fff;
}

.knob-dial-visual {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #3d414f 0%, #1a1c22 75%);
  border: 2px solid #2e3240;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.knob-dial-visual:active,
.knob-dial-visual.active-drag {
  cursor: grabbing;
  border-color: var(--akai-red) !important;
  box-shadow: 0 0 12px var(--akai-red-glow) !important;
}

.knob-indicator {
  position: absolute;
  width: 3px;
  height: 14px;
  background: var(--akai-red);
  top: 4px;
  border-radius: 2px;
  transform-origin: bottom center;
  box-shadow: 0 0 4px var(--akai-red-glow);
  will-change: transform;
  transform: translateZ(0);
  pointer-events: none;
  transition: none !important;
}

.knob-val-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  color: #38ef7d;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(56, 239, 125, 0.25);
  min-width: 46px;
  text-align: center;
  letter-spacing: 0.5px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.knob-cc-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Section 4: 16 MPC Drum Pads Matrix (Span 12 cols, below Knobs) */
.pads-panel {
  grid-column: span 12;
}

@media (min-width: 1100px) {
  .pads-panel {
    grid-column: span 12;
  }
}

.bank-tabs {
  display: flex;
  gap: 0.4rem;
}

.tab-btn {
  background: #1b1e27;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.tab-btn.active {
  background: #282c38;
  color: #fff;
  border-color: var(--akai-red);
}

.pads-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  max-width: 580px;
  margin: 0.5rem auto 0 auto;
}

.drum-pad {
  background: linear-gradient(145deg, #2a2e3a 0%, #1f222b 100%);
  border: 2px solid #161820;
  border-radius: var(--radius-sm);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.5rem;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.08), 0 4px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.08s ease;
  position: relative;
}

.drum-pad:hover {
  background: linear-gradient(145deg, #323746 0%, #252834 100%);
  border-color: #2e3240;
}

.drum-pad:active, .drum-pad.hit {
  background: linear-gradient(145deg, var(--akai-red) 0%, #9e1016 100%);
  border-color: #ff4d54;
  box-shadow: 0 0 16px var(--pad-active-glow), inset 0 0 8px rgba(0, 0, 0, 0.4);
  transform: translateY(1px);
}

.pad-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pad-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-dim);
}

.drum-pad:hover .pad-num {
  color: var(--text-muted);
}

.drum-pad.hit .pad-num {
  color: #fff;
}

.pad-note-display {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  text-align: center;
  color: #fff;
  margin: auto 0;
}

.pad-edit-input {
  background: #111319;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.3rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  width: 100%;
  text-align: center;
  outline: none;
}

.pad-edit-input:focus-visible {
  border-color: var(--akai-red);
  color: #fff;
}
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.knob-cc-input {
  background: #191c24;
  color: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  padding: 0.1rem 0.2rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  width: 38px;
  text-align: center;
}

/* Section 5: Keybed & Arp Velocity Curves (Span 12 cols) */
.keybed-panel {
  grid-column: span 12;
}

.keybed-wrapper {
  background: #0d0e12;
  border: 2px solid #1f222b;
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.piano-keys-container {
  display: flex;
  position: relative;
  height: 140px;
  user-select: none;
  justify-content: center;
  background: #111217;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.8);
}

.piano-key {
  position: relative;
  cursor: pointer;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  transition: all 0.05s ease;
}

.piano-key.white {
  width: 38px;
  height: 120px;
  background: linear-gradient(180deg, #ffffff 0%, var(--white-key-bg) 90%, #d8dade 100%);
  border: 1px solid #9aa0a6;
  border-top: none;
  z-index: 1;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.4), inset 0 -2px 3px rgba(0, 0, 0, 0.15);
}

.piano-key.white:active, .piano-key.white.pressed {
  background: var(--white-key-pressed);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

.piano-key.black {
  width: 22px;
  height: 75px;
  background: linear-gradient(180deg, #2c2d33 0%, var(--black-key-bg) 85%, #050507 100%);
  border: 1px solid #000;
  z-index: 2;
  margin-left: -11px;
  margin-right: -11px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.7), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.piano-key.black:active, .piano-key.black.pressed {
  background: var(--black-key-pressed);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transform: translateY(2px);
}

.key-label {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  pointer-events: none;
}

.piano-key.black .key-label {
  color: #71717a;
  bottom: 4px;
}

/* Joystick XY Pad & Calibration Rack */
.extra-controls-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  grid-column: span 12;
}

.joystick-panel {
  grid-column: span 12;
}

@media (min-width: 900px) {
  .joystick-panel {
    grid-column: span 5;
  }
}

.joystick-touchpad {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 240px;
  margin: 0 auto 1rem auto;
  background: #111319;
  border: 2px solid var(--card-border);
  border-radius: var(--radius-sm);
  position: relative;
  cursor: crosshair;
  overflow: hidden;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.8);
  touch-action: none;
  user-select: none;
}

.joystick-axis-line-x {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #252834;
}

.joystick-axis-line-y {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #252834;
}

.joystick-thumb {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff4d54 0%, var(--akai-red) 70%, #9e1016 100%);
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  box-shadow: 0 0 10px var(--akai-red-glow);
  pointer-events: none;
  transition: left 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275), top 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.joystick-touchpad.is-dragging .joystick-thumb {
  transition: none;
}

.velocity-panel {
  grid-column: span 12;
}

@media (min-width: 900px) {
  .velocity-panel {
    grid-column: span 7;
  }
}

.curve-svg {
  width: 100%;
  height: 140px;
  background: #111319;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
}

.curve-sliders-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* MIDI RX Activity Indicators */
.midi-rx-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #1b1e27;
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  transition: all 0.15s ease;
}

.midi-rx-pill .rx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #374151;
  transition: all 0.1s ease;
}

.midi-rx-pill.active {
  color: var(--akai-green);
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
}

.midi-rx-pill.active .rx-dot {
  background: var(--akai-green);
  box-shadow: 0 0 8px var(--akai-green-glow);
}

.midi-rx-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #101217;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
}

.rx-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #374151;
  transition: background 0.08s ease, box-shadow 0.08s ease;
}

.rx-led.active {
  background: var(--akai-green);
  box-shadow: 0 0 10px var(--akai-green);
}

.rx-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.event-counter {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  background: #12141a;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
}

.monitor-tab-buttons {
  display: flex;
  gap: 0.3rem;
}

.monitor-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  user-select: none;
}

.filter-check input {
  accent-color: var(--akai-red);
  cursor: pointer;
}

.autoscroll-toggle, .sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.autoscroll-toggle input, .sound-toggle input {
  accent-color: var(--akai-red);
  cursor: pointer;
}

/* Event Stream Table */
.stream-table-header {
  display: grid;
  grid-template-columns: 80px 115px 45px 180px 110px 1fr;
  padding: 0.4rem 0.8rem;
  background: #13151c;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.stream-table-body {
  height: 170px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: #0b0c10;
  display: flex;
  flex-direction: column;
}

.stream-row {
  display: grid;
  grid-template-columns: 80px 115px 45px 180px 110px 1fr;
  padding: 0.3rem 0.8rem;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.05s ease;
}

.stream-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.stream-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.stream-row.highlight-note {
  animation: flash-row 0.3s ease;
}

@keyframes flash-row {
  0% { background: rgba(226, 26, 34, 0.25); }
  100% { background: transparent; }
}

/* Event Badges */
.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.badge-noteon {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-noteoff {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.4);
}

.badge-cc {
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.badge-pitchbend {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-aftertouch, .badge-polyaftertouch {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-sysex {
  background: rgba(226, 26, 34, 0.25);
  color: #ff4d54;
  border: 1px solid rgba(226, 26, 34, 0.5);
}

.badge-clock {
  background: rgba(71, 85, 105, 0.2);
  color: #64748b;
  border: 1px solid rgba(71, 85, 105, 0.3);
}

.badge-other {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.col-hex {
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* Hardware-to-UI Reaction Classes */
.piano-key.hw-pressed {
  background: linear-gradient(180deg, #ff4d54 0%, var(--akai-red) 100%) !important;
  color: #fff !important;
  box-shadow: 0 0 12px var(--akai-red-glow) !important;
  transform: translateY(2px);
}

.piano-key.black.hw-pressed {
  background: linear-gradient(180deg, #991b1b 0%, var(--akai-red) 100%) !important;
}

.drum-pad.hw-hit {
  background: linear-gradient(145deg, var(--akai-red-bright) 0%, #b91c1c 100%) !important;
  border-color: #ff6b72 !important;
  box-shadow: 0 0 20px var(--pad-active-glow) !important;
  transform: scale(0.97);
}

.knob-dial-visual.hw-turning {
  border-color: var(--akai-red) !important;
  box-shadow: 0 0 10px var(--akai-red-glow) !important;
}

/* SysEx Console / Log Drawer */
.log-drawer {
  grid-column: span 12;
  background: #0d0e12;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.log-header {
  background: #161820;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.log-terminal {
  padding: 0.75rem 1rem;
  height: 170px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #a1a1aa;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #0b0c10;
}

.log-entry {
  display: flex;
  gap: 0.5rem;
}

.log-entry.info { color: #60a5fa; }
.log-entry.sysex { color: var(--akai-red-bright); }
.log-entry.success { color: var(--akai-green); }
.log-entry.warn { color: var(--akai-amber); }

/* App Footer */
.app-footer {
  background: #0f1014;
  border-top: 1px solid var(--panel-border);
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: auto;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

.app-footer a:hover {
  color: #fff;
}

