/* =========================================================================
   rudiment lab - style.css
   Modern Industrial Studio & Hardware Aesthetic
   Typography: Space Grotesk + Space Mono / System Clean
   Corners: Ultra-Sharp (2px)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Surfaces & Chassis */
  --bg: #07080b;
  --panel: #101217;
  --panel-surface: #14161f;
  --panel-hover: #1a1d28;
  --panel-inset: #0a0b0f;
  
  /* Borders & Dividers */
  --panel-edge: #222634;
  --panel-edge-subtle: #191c26;
  --panel-edge-bright: #32384a;
  --panel-edge-active: #48526c;
  
  /* Text & Inks */
  --ink: #cfd4e2;
  --ink-bright: #ffffff;
  --dim: #7f8599;
  --dimmer: #4c5163;
  
  /* Precision Instrument Colorways */
  --hand-l: #3b82f6;        /* Left Hand (Electric Blue) */
  --hand-l-dim: #1d386b;
  --hand-r: #06b6d4;        /* Right Hand (Cyan/Teal) */
  --hand-r-dim: #134450;
  --kick: #f59e0b;          /* Kick / Bass (Amber) */
  --accent: #f59e0b;        /* Dynamic Accent Gold */
  --accent-dim: #452d05;
  --active: #ef4444;        /* Live Strike Red */
  --led-green: #10b981;     /* Running State */
  
  /* Geometry & Corners (Ultra-Sharp 2px) */
  --radius-xs: 1px;
  --radius-sm: 2px;
  --radius-md: 2px;
  --radius-lg: 3px;
  
  /* Typography */
  --font-ui: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: 'Space Mono', 'SF Mono', 'Segoe UI Mono', Menlo, Consolas, monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  padding: 18px 14px 48px;
  line-height: 1.45;
  display: flex;
  justify-content: center;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 540px;
}

/* Top Hub Navigation */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 3px;
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-sm);
}

.nav-tab {
  flex: 1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 4px;
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  transition: all 120ms ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nav-tab:hover {
  color: var(--ink);
  background: var(--panel-surface);
}

.nav-tab.active {
  border-color: var(--panel-edge-bright);
  background: var(--panel);
  color: var(--ink-bright);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Header Area */
.header-area {
  margin-bottom: 14px;
  padding: 0 2px;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-bright);
  text-transform: lowercase;
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--panel-edge-subtle);
  border: 1px solid var(--panel-edge);
  color: var(--hand-l);
  font-weight: 700;
}

.badge-tag.accent { color: var(--accent); }
.badge-tag.cyan { color: var(--hand-r); }

.subhead {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.subhead-dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  display: inline-block;
}

/* Button & Control Surface */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--dim);
  cursor: pointer;
  transition: all 90ms ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.btn.wide {
  padding: 8px 12px;
  flex: 1;
}

.btn.btn-sm {
  padding: 3px 7px;
  font-size: 10px;
}

.btn.mono {
  font-family: var(--font-mono);
}

.btn:hover:not(:disabled) {
  border-color: var(--panel-edge-bright);
  color: var(--ink-bright);
  background: var(--panel-hover);
}

.btn.active {
  border-color: var(--panel-edge-active);
  background: var(--panel-surface);
  color: var(--ink-bright);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 1px 2px rgba(0,0,0,0.3);
}

.btn.active-accent {
  border-color: var(--accent);
  background: var(--accent);
  color: #07080b;
  font-weight: 700;
}

.btn.active-primary {
  border-color: var(--hand-l);
  background: #172544;
  color: #93c5fd;
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--panel-edge-subtle);
  color: var(--dimmer);
}

.btn:focus-visible {
  outline: 2px solid var(--hand-l);
  outline-offset: 1px;
}

/* Flex Utilities */
.flex-row {
  display: flex;
  gap: 6px;
}

.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

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

.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }

/* Structural Panels & Cards */
.panel-box {
  padding: 12px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.card {
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--dim);
}

.card b {
  color: var(--ink);
}

/* Chassis Well (Inset dark area) */
.chassis-well {
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
}

/* Master Transport Deck */
.transport-deck {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

.transport-top-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.btn-play-master {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-edge-bright);
  background: #141721;
  color: var(--ink-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 100ms ease;
  user-select: none;
}

.btn-play-master:hover {
  background: #1b202e;
  border-color: #434c64;
}

.btn-play-master.running {
  background: #10241b;
  border-color: var(--led-green);
  color: #4ade80;
}

.play-led {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--dimmer);
  transition: all 120ms ease;
}

.btn-play-master.running .play-led {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.tempo-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.tempo-readout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.tempo-label-small {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dimmer);
  font-weight: 700;
}

.tempo-val-large {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-bright);
  font-variant-numeric: tabular-nums;
}

.tempo-steppers {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.btn-stepper {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 0;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  color: var(--dim);
  border-radius: var(--radius-xs);
  cursor: pointer;
  text-align: center;
  user-select: none;
}

.btn-stepper:hover {
  background: var(--panel-hover);
  color: var(--ink);
  border-color: var(--panel-edge-bright);
}

/* Tempo Slider */
.slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.bpm-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.bpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 1px;
  background: var(--ink-bright);
  border: 1px solid var(--panel-edge-bright);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.6);
  transition: background 80ms ease;
}

.bpm-slider::-webkit-slider-thumb:hover {
  background: #ffffff;
  border-color: var(--hand-l);
}

.bpm-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 1px;
  background: var(--ink-bright);
  border: 1px solid var(--panel-edge-bright);
  cursor: pointer;
}

/* Rate & Subdivision Selector */
.subdivision-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-edge-subtle);
}

.subdivision-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

.btn-subdiv {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--panel-edge);
  background: var(--panel-inset);
  color: var(--dim);
  cursor: pointer;
  transition: all 80ms ease;
  text-align: center;
}

.btn-subdiv:hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.btn-subdiv.active {
  background: #17243b;
  border-color: #2b4573;
  color: #60a5fa;
}

/* Note Rate Readout Info */
.note-rate-indicator {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--dimmer);
  text-align: center;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Sound Swapper / Channel Strip */
.sound-swapper-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
}

.sound-swapper-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.sound-row:last-child {
  margin-bottom: 0;
}

.sound-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.sound-select {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--panel-inset);
  color: var(--ink);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 100ms ease;
}

.sound-select:focus {
  border-color: var(--accent);
}

/* Step Sequencer / Note Bar Styles */
.seq-wrapper {
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  position: relative;
  overflow-x: auto;
}

.rud-sequence {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.rud-note-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 26px;
  cursor: pointer;
  user-select: none;
  padding: 3px 2px;
  border-radius: var(--radius-xs);
  transition: background 60ms ease;
}

.rud-note-col:hover {
  background: rgba(255,255,255,0.04);
}

.rud-accent {
  font-family: var(--font-mono);
  font-size: 9px;
  height: 12px;
  color: var(--accent);
  font-weight: 700;
}

.rud-note {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  border-radius: var(--radius-xs);
  padding: 3px 6px;
  transition: all 50ms ease;
  color: var(--hand-l);
  border: 1px solid transparent;
}

.rud-note.accent {
  font-size: 21px;
  font-weight: 700;
}

.rud-note.right {
  color: var(--hand-r);
}

.rud-note.left {
  color: var(--hand-l);
}

.rud-note.active {
  background: var(--active) !important;
  color: #ffffff !important;
  border-color: #f87171 !important;
}

.rud-rest {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--dimmer);
  padding: 3px 4px;
  transition: color 50ms ease;
}

.rud-rest.active {
  color: var(--active);
}

.rud-grace {
  font-size: 9px;
  vertical-align: super;
  font-weight: 700;
}

.info-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
}

/* Hands Independence Visualization */
.hands-row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  margin-bottom: 6px;
  min-height: 24px;
}

.hands-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  width: 16px;
  text-align: left;
}

.hands-cell-col {
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.hands-cell-col.beat-start {
  margin-left: 5px;
  border-left: 1px dashed var(--panel-edge);
  padding-left: 2px;
}

.hands-bar {
  width: 100%;
  border-radius: var(--radius-xs);
  transition: background 40ms ease;
}

/* Practice Pad Graphic */
.pad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pad-graphic-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.pad-graphic {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: #14161f;
  border: 3px solid #2a2f3f;
  box-shadow: inset 0 0 16px rgba(0,0,0,0.85), 0 4px 14px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.pad-hit-active {
  background: var(--active) !important;
}

/* Pad Gauges */
.pad-gauges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
}

.gauge-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gauge-bar {
  width: 52px;
  height: 5px;
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: 1px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  width: 0%;
  transition: width 50ms ease;
}

/* Bar Selector Badges & Loop Controls */
.fills-bar-indicators {
  display: flex;
  gap: 4px;
}

.fills-bar-badge {
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: var(--panel-inset);
  color: var(--dim);
  border: 1px solid var(--panel-edge);
  cursor: pointer;
  user-select: none;
  transition: all 80ms ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fills-bar-badge:hover {
  background: var(--panel-hover);
  color: var(--ink-bright);
  border-color: var(--panel-edge-bright);
}

.fills-bar-badge.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
}

/* Real-time playback playing head state */
.fills-bar-badge.playing-bar {
  background: var(--ink-bright) !important;
  color: #07080b !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.fills-bar-badge.playing-bar.fill-bar {
  background: var(--active) !important;
  color: #ffffff !important;
  border-color: #f87171 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.fills-bar-badge.fill-bar {
  color: #f87171;
  border-color: #3b1d24;
}

/* Layer Isolator / Solo-Mute Strips (Purdie & Groove Focus) */
.layer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-xs);
  margin-bottom: 5px;
}

.layer-strip:last-child {
  margin-bottom: 0;
}

.layer-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.layer-controls {
  display: flex;
  gap: 4px;
}

.btn-solo, .btn-mute {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--dim);
  cursor: pointer;
  user-select: none;
  transition: all 80ms ease;
}

.btn-solo.active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

.btn-mute.active {
  background: #dc2626;
  border-color: #f87171;
  color: #ffffff;
}

/* Step Column Sequencer (Groove & Fill) */
.step-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 24px;
  flex: 1;
  padding: 3px 2px;
  background: var(--panel-inset);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-xs);
  cursor: pointer;
  user-select: none;
  transition: all 50ms ease;
  min-height: 48px;
}

.step-col.beat-start {
  border-left: 1.5px solid var(--panel-edge-bright);
}

.step-col:hover {
  background: var(--panel-hover);
  border-color: var(--panel-edge-bright);
}

.step-col.active-step {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.45);
}

.step-head {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--dimmer);
  line-height: 1;
  margin-bottom: 3px;
}

.step-head.beat-head {
  color: var(--ink-bright);
  font-weight: 700;
  font-size: 9px;
}

.step-tokens {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.seq-token {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 2px;
  border-radius: 1px;
  line-height: 1.1;
  text-align: center;
  width: 100%;
}

.seq-token.token-top {
  background: rgba(6, 182, 212, 0.15);
  color: var(--hand-r);
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.seq-token.token-snare {
  background: rgba(59, 130, 246, 0.18);
  color: var(--hand-l);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.seq-token.token-snare.ghost {
  opacity: 0.55;
  font-size: 7px;
  background: transparent;
  border-color: rgba(59, 130, 246, 0.2);
}

.seq-token.token-kick {
  background: rgba(245, 158, 11, 0.2);
  color: var(--kick);
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.seq-token.token-rest {
  color: var(--dimmer);
  font-size: 11px;
  padding: 0;
}

.seq-token.accent {
  font-weight: 900;
  box-shadow: 0 0 4px currentColor;
}

/* Footer Note */
.footer-note {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dimmer);
  text-align: center;
  line-height: 1.6;
}
