* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body {
  background: #09090b;
  color: #e4e4e7;
  font-family: 'Courier New', Courier, monospace;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Contenedor deslizante (Viewport + Track de 200% ancho) */
#viewport {
  width: 100%;
  max-width: 460px;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: #111113;
}

#slider-track {
  display: flex;
  width: 200%;
  height: 100%;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

#slider-track.show-help {
  transform: translateX(-50%);
}

.panel {
  width: 50%;
  height: 100%;
  flex-shrink: 0;
}

/* CHASIS ALUMINIO NEGRO M8 MODEL:02 */
.chassis-panel {
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.m8-chassis {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #1d1d21 0%, #121215 100%);
  border-radius: 16px;
  border: 1px solid #2e2e34;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.08), 0 12px 30px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  padding: 12px 12px 14px 12px;
}

/* BISEL Y PANTALLA TFT */
.tft-bezel {
  flex: 1;
  background: #050506;
  border-radius: 8px;
  padding: 6px;
  border: 1px solid #27272a;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tft-screen {
  flex: 1;
  background: #08090c;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 12px;
}

.tft-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  border-bottom: 1px solid #18181b;
  font-weight: bold;
  font-size: 11px;
}

.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.c-red { color: #f43f5e; }
.c-cyan { color: #38bdf8; }
.c-green { color: #4ade80; }
.c-dim { color: #52525b; }

#oscilloscope {
  background: #040507;
  border: 1px solid #18181b;
}

.tft-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.screen-content {
  flex: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Sidebar derecha tipo M8 */
.tft-sidebar {
  width: 58px;
  border-left: 1px solid #18181b;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
}

.minimap {
  display: flex;
  gap: 4px;
  background: #111217;
  padding: 3px 5px;
  border-radius: 3px;
}

.minimap span {
  color: #52525b;
  font-weight: bold;
  cursor: pointer;
  padding: 1px 2px;
}

.minimap span.active {
  color: #38bdf8;
  border-bottom: 1px solid #38bdf8;
}

.track-meters {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 9px;
}

.t-row {
  display: flex;
  justify-content: space-between;
  color: #71717a;
}

.t-row b {
  color: #38bdf8;
  font-weight: normal;
}

.bottom-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #52525b;
  font-size: 8px;
  letter-spacing: 0.5px;
}

.bottom-map b {
  color: #38bdf8;
}

/* CUADRÍCULA PHRASE */
.grid-head {
  display: grid;
  grid-template-columns: 24px repeat(4, 1fr);
  color: #71717a;
  font-size: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid #18181b;
  text-align: center;
}

.grid-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 2px;
}

.p-row {
  display: grid;
  grid-template-columns: 24px repeat(4, 1fr);
  align-items: center;
  text-align: center;
  font-size: 11.5px;
  border-radius: 2px;
}

.p-row.playing-row {
  background: rgba(56, 189, 248, 0.14);
}

.p-idx {
  color: #52525b;
  font-size: 10px;
}

.p-idx.beat {
  color: #a1a1aa;
  font-weight: bold;
}

.p-cell {
  padding: 1px 0;
  color: #3f3f46;
  border-radius: 2px;
  cursor: pointer;
}

.p-cell.filled {
  color: #e4e4e7;
}

.p-cell.cursor {
  background: #38bdf8;
  color: #050506;
  font-weight: bold;
}

/* VISTA INST & MIXER */
.param-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
}

.param-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  padding: 4px;
  border-radius: 3px;
}

.param-item.cursor {
  background: rgba(56, 189, 248, 0.18);
  outline: 1px solid #38bdf8;
}

.bar-wrap {
  width: 110px;
  height: 8px;
  background: #18181b;
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #38bdf8;
}

/* ZONA INFERIOR: LOGO M8 + TECLAS MECÁNICAS */
.deck-area {
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Logo M8 serigrafiado (botón interactivo para abrir ayuda) */
.m8-logo-btn {
  align-self: flex-start;
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 5px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}

.m8-logo-btn:active {
  transform: scale(0.94);
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
}

.logo-bars {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
  margin-bottom: 2px;
}

.logo-bars span {
  width: 3.5px;
  background: #d4d4d8;
  display: block;
}

.logo-bars .b1 { height: 7px; }
.logo-bars .b2 { height: 12px; }
.logo-bars .b3 { height: 9.5px; }

.logo-text {
  color: #e4e4e7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
}

.help-hint {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  background: #38bdf8;
  color: #09090b;
  font-size: 9px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.controls-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

/* Rejillas de altavoz mecanizadas */
.speaker-grille {
  display: flex;
  flex-direction: column;
  gap: 3.5px;
  padding-bottom: 14px;
}

.speaker-grille span {
  width: 18px;
  height: 2.5px;
  background: #070709;
  border-bottom: 1px solid #27272a;
  border-radius: 2px;
}

/* Matriz de 8 teclas Kailh Choc negras mate */
.key-matrix {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.key-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.m8-key {
  width: 100%;
  aspect-ratio: 1.15 / 1;
  background: linear-gradient(180deg, #27272c 0%, #19191d 100%);
  border: 1px solid #35353c;
  border-bottom: 4px solid #0b0b0d;
  border-radius: 6px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.08);
  cursor: pointer;
  transition: transform 0.05s;
}

.m8-key:active, .m8-key.held {
  transform: translateY(2px);
  border-bottom-width: 1px;
  background: #1e1e24;
  border-color: #38bdf8;
}

.key-label {
  font-size: 8.5px;
  color: #71717a;
  font-weight: bold;
  letter-spacing: 0.3px;
  height: 10px;
}

/* PANEL 2: PANTALLA DE AYUDA Y EJEMPLOS */
.help-panel {
  background: #0e0e11;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #27272a;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #141418;
  border-bottom: 1px solid #27272a;
}

.help-header h2 {
  font-size: 13px;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.back-btn {
  background: #27272a;
  color: #e4e4e7;
  border: 1px solid #3f3f46;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.back-btn:active {
  background: #38bdf8;
  color: #09090b;
}

.help-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  user-select: text;
  -webkit-user-select: text;
}

.help-card {
  background: #16161a;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 12px;
}

.help-card h3 {
  font-size: 13px;
  color: #f43f5e;
  margin-bottom: 8px;
}

.help-card p, .help-card li {
  font-size: 12px;
  line-height: 1.45;
  color: #d4d4d8;
}

.help-card ul {
  padding-left: 16px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-card code {
  background: #09090b;
  color: #38bdf8;
  padding: 1px 4px;
  border-radius: 3px;
}

.combo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.combo-item {
  display: flex;
  flex-direction: column;
  background: #101014;
  padding: 7px 9px;
  border-radius: 5px;
  border-left: 2px solid #38bdf8;
}

.combo-item .keys {
  font-size: 11px;
  font-weight: bold;
  color: #38bdf8;
  margin-bottom: 2px;
}

.combo-item .desc {
  font-size: 11.5px;
  color: #a1a1aa;
}

.preset-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.preset-btn {
  background: #1e1e24;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 9px 10px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preset-btn strong {
  color: #4ade80;
  font-size: 12px;
}

.preset-btn span {
  color: #a1a1aa;
  font-size: 11px;
}

.preset-btn:active {
  border-color: #4ade80;
  background: #27272f;
}
