﻿/* ==========================================
   MPCOSMOS520 - Hardware Red Groovebox UI
   Based on design reference
   ========================================== */

:root {
  --red-body:      #c41a00;
  --red-dark:      #a01400;
  --red-bright:    #e02000;
  --red-deep:      #7a0e00;

  --screen-bg:     #0d1117;
  --screen-border: #1a2a1a;

  --knob-body:     #1a1a1a;
  --knob-rim:      #333;
  --btn-body:      #2a2a2a;
  --btn-rim:       #444;
  --btn-text:      #cccccc;

  --pad-dark:      #111111;
  --pad-border:    #2a2a2a;

  --col-purple:    #9933ff;
  --col-yellow:    #ffcc00;
  --col-cyan:      #00ccff;
  --col-orange:    #ff6600;
  --col-green:     #00cc44;

  --seq-yellow:    #ffcc00;
  --seq-red:       #ff3300;
  --seq-white:     #ffffff;
  --seq-blue:      #3399ff;

  --text-white:    #f0f0f0;
  --text-gray:     #999999;
  --text-dim:      #555555;
  --text-orange:   #ff9900;

  --font-hw:       'Arial Black', 'Impact', sans-serif;
  --font-mono:     'Courier New', monospace;
  --font-ui:       'Arial', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: #8a0f00;
  font-family: var(--font-ui);
  font-size: 12px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ==========================================
   HARDWARE BODY
   ========================================== */
#hardware-body {
  width: 100%;
  height: 100%;
  background: var(--red-body);
  display: flex;
  flex-direction: column;
  padding: 8px 12px 6px 12px;
  gap: 0;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4), inset 0 -2px 8px rgba(0,0,0,0.3);
}

/* ==========================================
   HEADER ROW
   ========================================== */
#header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 4px;
  -webkit-app-region: drag;
}

.logo-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.logo-main {
  font-family: var(--font-hw);
  font-size: 26px;
  font-weight: 900;
  color: white;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.logo-sub {
  font-size: 13px;
  color: var(--text-orange);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.win-controls {
  display: flex;
  gap: 8px;
  -webkit-app-region: no-drag;
}
.win-btn {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  opacity: 0.85;
}
.win-btn:hover { opacity: 1; }
.win-btn.close  { background: #ff5f57; }
.win-btn.min    { background: #febc2e; }
.win-btn.max    { background: #28c840; }

/* Knobs top right */
.top-knobs {
  display: flex;
  gap: 20px;
  align-items: flex-end;
}

/* ==========================================
   MAIN AREA
   ========================================== */
#main-area {
  display: flex;
  flex: 1;
  gap: 10px;
  overflow: hidden;
  padding: 0 2px;
}

/* ==========================================
   SCREEN SECTION (left)
   ========================================== */
#screen-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#screen-frame {
  flex: 1;
  background: var(--screen-bg);
  border: 3px solid #1a1a1a;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px #0a0a0a,
    inset 0 0 20px rgba(0,0,0,0.8),
    0 4px 12px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Screen header bar */
#screen-header {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  background: #0a0a0a;
  border-bottom: 1px solid #222;
  gap: 8px;
  flex-shrink: 0;
}

.screen-menu-btn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 14px;
  cursor: pointer;
}
.screen-menu-btn span {
  width: 5px; height: 5px;
  background: var(--red-bright);
  border-radius: 1px;
  display: block;
}

.screen-track-name {
  font-size: 11px;
  color: var(--text-white);
  font-weight: bold;
  flex: 1;
}
.screen-bank {
  font-size: 10px;
  color: var(--text-gray);
}
.screen-pattern-pill {
  background: var(--red-bright);
  color: white;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 1px;
}
.screen-pattern-num {
  font-size: 11px;
  color: var(--text-white);
  font-weight: bold;
}

/* BPM display in screen header */
.screen-bpm {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--col-cyan);
  font-weight: bold;
  cursor: ns-resize;
  padding: 2px 6px;
  background: #111;
  border-radius: 3px;
  border: 1px solid #222;
  letter-spacing: 1px;
  user-select: none;
  -webkit-user-select: none;
}
.screen-bpm:hover { border-color: var(--col-cyan); }

/* Pattern length buttons (16/32) in screen header */
.screen-len-btn {
  font-size: 8px;
  font-weight: bold;
  padding: 2px 5px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}
.screen-len-btn:hover { color: var(--text-gray); }
.screen-len-btn.active {
  background: var(--red-deep);
  color: white;
  border-color: var(--red-bright);
}

/* Screen content - piano roll / sequencer */
#screen-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Left mini sidebar inside screen */
#screen-sidebar {
  width: 28px;
  background: #080808;
  border-right: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  gap: 8px;
}
.screen-nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.1s;
}
.screen-nav-icon:hover { color: var(--text-gray); }
.screen-nav-icon.active { color: var(--red-bright); }

/* Piano roll area */
#piano-roll-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#piano-roll-header {
  height: 20px;
  background: #0d0d0d;
  border-bottom: 1px solid #1e1e1e;
  position: relative;
  overflow: hidden;
}
#timeline-canvas {
  width: 100%; height: 100%;
  display: block;
}

#piano-roll-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

#piano-keys-col {
  width: 40px;
  min-width: 40px;
  background: #0a0a0a;
  border-right: 1px solid #1e1e1e;
  overflow-y: auto;
  overflow-x: hidden;
}
#piano-keys-col::-webkit-scrollbar { display: none; }

.piano-key {
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  font-size: 8px;
  font-family: var(--font-mono);
  cursor: pointer;
  border-bottom: 1px solid #111;
}
.piano-key.white { background: #1e1e1e; color: #555; }
.piano-key.black { background: #0a0a0a; height: 10px; color: #333; }
.piano-key.c { color: #888; font-weight: bold; }
.piano-key.white:hover { background: #cc220033; }
.piano-key.black:hover { background: #cc220022; }

#roll-canvas-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}
#roll-canvas {
  display: block;
  cursor: crosshair;
}

/* Velocity bar at bottom of screen */
#velocity-bar {
  height: 40px;
  background: #080808;
  border-top: 1px solid #1e1e1e;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 4px 8px;
  flex-shrink: 0;
}
#velocity-label {
  position: absolute;
  bottom: 4px;
  left: 44px;
  font-size: 9px;
  color: var(--col-green);
  font-family: var(--font-mono);
  letter-spacing: 1px;
}
#velocity-canvas { width: 100%; height: 100%; display: block; }

/* Screen bottom mode tabs */
#screen-modes {
  display: flex;
  background: #080808;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.screen-mode-tab {
  flex: 1;
  padding: 5px 4px;
  text-align: center;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  cursor: pointer;
  text-transform: uppercase;
  border-right: 1px solid #1a1a1a;
  transition: all 0.1s;
}
.screen-mode-tab:last-child { border-right: none; }
.screen-mode-tab:hover { color: var(--text-gray); }
.screen-mode-tab.active {
  background: #1a1a1a;
  color: white;
  border-bottom: 2px solid white;
}
.screen-mode-tab .icon-shuffle {
  display: inline-block;
  width: 10px; height: 10px;
  color: var(--col-cyan);
}

/* ==========================================
   RIGHT CONTROLS SECTION
   ========================================== */
#right-controls {
  width: 240px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Knobs row */
.knobs-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.knob-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.knob-label {
  font-size: 8px;
  color: var(--text-white);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: bold;
}
.knob-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 6px var(--red-bright);
  margin-bottom: -2px;
}

.knob {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #3a3a3a 0%, #1a1a1a 50%, #0d0d0d 100%);
  border: 2px solid #3a3a3a;
  box-shadow:
    0 3px 8px rgba(0,0,0,0.8),
    inset 0 1px 2px rgba(255,255,255,0.07),
    0 0 0 1px #111;
  cursor: pointer;
  position: relative;
}
.knob.small { width: 34px; height: 34px; }
.knob::after {
  content: '';
  position: absolute;
  width: 2px; height: 12px;
  background: white;
  border-radius: 1px;
  left: 50%; top: 5px;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
}
.knob.small::after { height: 8px; top: 4px; }

/* Button rows */
.btn-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.btn-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.btn-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.btn-row.cols-1 { grid-template-columns: 1fr; }

.hw-btn {
  background: linear-gradient(180deg, #2e2e2e 0%, #1e1e1e 100%);
  border: 1px solid #444;
  border-bottom: 2px solid #111;
  border-radius: 4px;
  color: var(--btn-text);
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 5px 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.08s;
  font-family: var(--font-ui);
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}
.hw-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: rgba(255,255,255,0.04);
  border-radius: 3px 3px 0 0;
}
.hw-btn:hover { background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%); }
.hw-btn:active, .hw-btn.active {
  background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
  border-bottom-width: 1px;
  transform: translateY(1px);
}
.hw-btn .btn-led {
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #333;
  margin: 0 auto 2px;
}
.hw-btn.active .btn-led { background: var(--red-bright); box-shadow: 0 0 4px var(--red-bright); }
.hw-btn.led-green.active .btn-led { background: var(--col-green); box-shadow: 0 0 4px var(--col-green); }

/* Large encoder + MORT/MUTE area */
.encoder-section {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.encoder-large {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2a2a 0%, #111 60%, #080808 100%);
  border: 3px solid #333;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.9),
    inset 0 1px 3px rgba(255,255,255,0.05),
    0 0 0 1px #0a0a0a;
  cursor: pointer;
  position: relative;
}
.encoder-large::after {
  content: '';
  position: absolute;
  width: 3px; height: 18px;
  background: var(--text-gray);
  border-radius: 2px;
  left: 50%; top: 6px;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
}

.mort-mute-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==========================================
   BOTTOM SECTION
   ========================================== */
#bottom-section {
  display: flex;
  gap: 10px;
  height: 160px;
  min-height: 140px;
  padding: 4px 2px 0;
}

/* Pad grid 2x5 */
#pad-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pad-row {
  display: flex;
  gap: 5px;
}

.pad {
  width: 90px; height: 70px;
  background: var(--pad-dark);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 4px 6px;
  touch-action: none;
  transition: all 0.05s;
  box-shadow:
    0 3px 8px rgba(0,0,0,0.8),
    inset 0 1px 1px rgba(255,255,255,0.03);
  overflow: hidden;
}

/* Colored borders per pad type */
.pad { border: 2px solid #2a2a2a; }
.pad.color-purple { border-color: var(--col-purple); }
.pad.color-yellow { border-color: var(--col-yellow); }
.pad.color-cyan   { border-color: var(--col-cyan); }
.pad.color-orange { border-color: var(--col-orange); }

.pad::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%);
  border-radius: 4px;
}

.pad-label {
  font-size: 9px;
  font-weight: bold;
  color: var(--text-gray);
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

.pad.hit {
  filter: brightness(2.5);
  transform: scale(0.97);
}

/* Selected pad â€” persistent selection ring for import workflow */
.pad.selected {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.75),
    0 0 14px rgba(255, 255, 255, 0.12),
    0 3px 8px rgba(0, 0, 0, 0.8);
}

/* Pad has a real sample loaded â€” green dot in bottom-right corner */
.pad.has-sample::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--col-green);
  box-shadow: 0 0 5px var(--col-green);
  bottom: 5px;
  right: 6px;
}

.pad:active {
  filter: brightness(2);
  transform: scale(0.96);
}

/* Under pads: name label */
.pad-name-label {
  font-size: 9px;
  color: var(--text-gray);
  text-align: center;
  margin-top: -2px;
}

/* Right of pads: mini buttons + encoder */
#pad-controls {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.pad-mini-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pad-mini-row {
  display: flex;
  gap: 4px;
}

.hw-btn.mini {
  padding: 4px 6px;
  font-size: 7px;
  min-width: 50px;
}

/* ==========================================
   TRANSPORT BAR
   ========================================== */
#transport-bar {
  display: flex;
  gap: 6px;
  padding: 6px 0 2px;
  align-items: center;
}

.transport-btn {
  flex: 1;
  padding: 7px 6px;
  background: linear-gradient(180deg, #222 0%, #141414 100%);
  border: 1px solid #3a3a3a;
  border-bottom: 2px solid #0a0a0a;
  border-radius: 4px;
  color: var(--text-white);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  transition: all 0.08s;
  font-family: var(--font-ui);
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.transport-btn:hover { background: linear-gradient(180deg, #2e2e2e 0%, #1e1e1e 100%); }
.transport-btn:active, .transport-btn.active {
  transform: translateY(1px);
  border-bottom-width: 1px;
  background: #0d0d0d;
}
.transport-btn.play.active   { color: var(--col-green); border-color: var(--col-green); }
.transport-btn.rec.active    { color: var(--red-bright); border-color: var(--red-bright); }
.transport-btn.overdub       { background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%); }
.transport-btn.export        { color: var(--text-gray); }
.transport-btn.export.active { color: var(--col-green); border-color: var(--col-green); animation: rec-blink 0.8s step-end infinite; }

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* LED indicator row above transport */
.led-strip {
  height: 4px;
  display: flex;
  gap: 2px;
  padding: 0 2px;
  overflow: hidden;
}
.led-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--red-deep);
  transition: background 0.05s;
}
.led-dot.beat  { background: var(--red-bright); }
.led-dot.step  { background: var(--red-body); }

/* ==========================================
   SCROLLBARS
   ========================================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* =============================================
   STEP SEQUENCER UI
   ============================================= */

#step-seq-area {
  flex: 1;
  display: none; /* toggled by nav */
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  background: var(--bg-screen, #111);
}

.sequi-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  box-sizing: border-box;
}

.sequi-row {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-height: 14px;
}

.sequi-label {
  width: 44px;
  min-width: 44px;
  font-size: 8px;
  color: var(--text-dim, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: right;
  padding-right: 5px;
  user-select: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
.sequi-label:hover {
  color: var(--text-orange, #e05010);
}

.sequi-cell {
  flex: 1;
  height: 100%;
  min-height: 14px;
  border-radius: 2px;
  background: #181818;
  border: 1px solid #222;
  cursor: pointer;
  transition: background 0.05s, box-shadow 0.05s;
  position: relative;
  box-sizing: border-box;
}
.sequi-cell:hover {
  background: #252525 !important;
  border-color: #444 !important;
}

/* Group beat marker (every 4 steps) */
.sequi-cell[data-step="0"],
.sequi-cell[data-step="4"],
.sequi-cell[data-step="8"],
.sequi-cell[data-step="12"],
.sequi-cell[data-step="16"],
.sequi-cell[data-step="20"],
.sequi-cell[data-step="24"],
.sequi-cell[data-step="28"] {
  background: #1e1e1e;
  border-color: #2e2e2e;
}

.sequi-vel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 0 0 2px 2px;
  display: none;
}

/* Mixer & Samples placeholders */
#mixer-area,
#samples-area {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  color: var(--text-dim, #666);
  font-size: 11px;
}

/* =============================================
   PROJECT BUTTONS (Save / Load / New)
   ============================================= */

.transport-btn.save-proj {
  background: #0a2a0a;
  color: #4cff4c;
  border-color: #1a5a1a;
  font-size: 9px;
  letter-spacing: 0.5px;
}
.transport-btn.save-proj:hover {
  background: #1a4a1a;
  border-color: #4cff4c;
}

.transport-btn.load-proj {
  background: #0a1a2a;
  color: #4caaff;
  border-color: #1a3a5a;
  font-size: 9px;
  letter-spacing: 0.5px;
}
.transport-btn.load-proj:hover {
  background: #1a2a4a;
  border-color: #4caaff;
}

.transport-btn.new-proj {
  background: #1a1a1a;
  color: #888;
  border-color: #333;
  font-size: 9px;
  letter-spacing: 0.5px;
}
.transport-btn.new-proj:hover {
  background: #2a2a2a;
  color: #ccc;
  border-color: #666;
}

/* =============================================
   SPLASH SCREEN
   ============================================= */

#splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
#splash-logo {
  width: 480px;
  max-width: 80vw;
}

/* =============================================
   ADSR POPUP
   ============================================= */

#adsr-popup {
  position: fixed;
  display: none;
  z-index: 9000;
  background: #141414;
  border: 1px solid #e03010;
  border-radius: 6px;
  padding: 10px 12px;
  width: 210px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
  user-select: none;
  -webkit-user-select: none;
}

#adsr-title {
  font-size: 9px;
  font-weight: bold;
  color: #e03010;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-family: var(--font-mono);
}

.adsr-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.adsr-lbl {
  width: 10px;
  font-size: 9px;
  font-weight: bold;
  color: #e03010;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.adsr-row input[type="range"] {
  flex: 1;
  accent-color: #e03010;
  cursor: pointer;
  height: 14px;
}

.adsr-val {
  width: 38px;
  font-size: 8px;
  color: var(--text-gray);
  font-family: var(--font-mono);
  text-align: right;
  flex-shrink: 0;
}

/* =============================================
   PATTERN CHAIN PANEL
   ============================================= */

#chain-panel {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: #0a0a0a;
  border-top: 1px solid #222;
  flex-shrink: 0;
}

.chain-label {
  font-size: 8px;
  font-weight: bold;
  color: #e03010;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

#chain-slots {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}

.chain-slot-btn {
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #888;
  font-size: 9px;
  font-weight: bold;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.1s;
}
.chain-slot-btn:hover { background: #2a2a2a; color: #ccc; border-color: #555; }
.chain-slot-btn.playing {
  background: #3a0800;
  color: #e03010;
  border-color: #e03010;
  box-shadow: 0 0 6px rgba(224,48,16,0.4);
}
.chain-slot-btn.chain-add  { color: var(--col-green); border-color: #1a4a1a; }
.chain-slot-btn.chain-remove { color: #ff6666; border-color: #4a1a1a; }

#chain-indicator {
  font-size: 8px;
  font-family: var(--font-mono);
  color: #666;
  margin-left: auto;
  flex-shrink: 0;
}
#chain-panel.active #chain-indicator { color: #e03010; }

.transport-btn.chain { color: var(--text-gray); }
.transport-btn.chain.active {
  color: #e03010;
  border-color: #e03010;
  background: #1a0500;
  animation: rec-blink 1.2s step-end infinite;
}

/* =============================================
   SETTINGS VIEW — MIDI
   ============================================= */

#settings-area {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--screen-bg);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.settings-section-title {
  font-size: 9px;
  font-weight: bold;
  color: #e03010;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  border-bottom: 1px solid #e03010;
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.settings-label {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-top: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-midi-btn {
  padding: 4px 14px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #666;
  font-size: 9px;
  font-weight: bold;
  font-family: var(--font-mono);
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.1s;
}
.settings-midi-btn:hover      { border-color: #555; color: #ccc; }
.settings-midi-btn.on         { background: #0a2a08; border-color: #2a6a20; color: #4cff4c; }

.settings-midi-status {
  font-size: 14px;
  color: #333;
  transition: color 0.3s;
  line-height: 1;
}
.settings-midi-status.on { color: #4cff4c; text-shadow: 0 0 8px #4cff4c; }

.settings-device-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #080808;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  padding: 5px 8px;
  min-height: 26px;
}
.settings-device-item {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--col-green);
}

.settings-monitor {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--col-cyan);
  background: #080808;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  padding: 4px 8px;
  min-height: 22px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-input-num {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #ccc;
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 3px 6px;
  width: 52px;
  text-align: center;
}
.settings-input-num:focus { outline: none; border-color: #e03010; }

.settings-dim {
  font-size: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Knob mapping table */
#settings-knob-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
}

.settings-knob-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid #111;
}
.settings-knob-row:last-child { border-bottom: none; }
.settings-knob-row:hover { background: #0d0d0d; }

.settings-knob-label {
  width: 22px;
  font-size: 9px;
  font-weight: bold;
  color: #e03010;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.settings-knob-cc {
  width: 52px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  color: var(--col-cyan);
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 2px 4px;
  text-align: center;
  flex-shrink: 0;
}
.settings-knob-cc:focus { outline: none; border-color: #e03010; }

.settings-arrow {
  font-size: 9px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.settings-func-label {
  font-size: 9px;
  color: #ccc;
  font-family: var(--font-mono);
  flex: 1;
}

/* =============================================
   HEADER LOGO IMAGE
   ============================================= */

#header-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
}

.logo-block {
  display: flex;
  align-items: center;
}

/* =============================================
   LICENCE MODAL
   ============================================= */

#licence-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#licence-box {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 32px;
  width: 380px;
  text-align: center;
  box-shadow: 0 0 40px rgba(220,50,20,0.2);
}
#licence-logo { width: 200px; margin-bottom: 16px; }
#licence-box h2 { color: #fff; font-size: 18px; margin: 0 0 4px; }
.licence-sub { color: #e03010; font-size: 12px; margin: 0 0 2px; }
.licence-version { color: #444; font-size: 10px; margin: 0 0 20px; }
#licence-input {
  width: 100%;
  padding: 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  letter-spacing: 2px;
  text-align: center;
  box-sizing: border-box;
  margin-bottom: 8px;
}
#licence-input:focus { outline: none; border-color: #e03010; }
#licence-error { color: #ff4444; font-size: 11px; min-height: 16px; margin-bottom: 8px; }
#licence-activate-btn {
  width: 100%;
  padding: 12px;
  background: #e03010;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 12px;
}
#licence-activate-btn:hover { background: #c02000; }
.licence-links { margin-bottom: 12px; }
.licence-links a { color: #e03010; font-size: 11px; text-decoration: none; }
#licence-demo-btn {
  background: none;
  border: 1px solid #333;
  color: #555;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
#licence-demo-btn:hover { color: #888; border-color: #555; }

/* Demo timer badge */
#demo-timer-badge {
  position: fixed;
  top: 8px;
  right: 60px;
  background: rgba(220,50,20,0.9);
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  z-index: 9000;
  display: none;
}

