/* ==========================================================================
   Deaf DJ Live Sound-Reactive Shader Suite Styles
   Theme: High-Contrast Neo-Noir / Tactical Cybernetic HUD
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #050508;
  color: #e0e0e0;
  font-family: 'Courier Prime', monospace;
}

/* Gritty Halftone Overlay */
.halftone-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(#ffffff 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 10;
}

/* Projection Canvas Wrapper */
#canvas-projection-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

#canvas-container {
  width: 100%;
  height: 100%;
}

#canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ==========================================================================
   Top DJ HUD
   ========================================================================== */
.dj-top-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: linear-gradient(to bottom, rgba(5, 5, 8, 0.96) 0%, rgba(5, 5, 8, 0) 100%);
  z-index: 100;
  pointer-events: none;
  gap: 24px;
  flex-wrap: nowrap;
}

.dj-top-hud > * {
  pointer-events: auto;
}

.hud-col {
  display: flex;
  align-items: center;
}

.hud-col.center {
  flex-shrink: 0;
}

.hud-col.right {
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}

.hud-divider {
  width: 1px;
  height: 28px;
  background: #25253a;
  margin: 0 4px;
}

.audio-source-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-back {
  color: #ff3366;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 51, 102, 0.1);
  padding: 8px 14px;
  border: 1px solid rgba(255, 51, 102, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-back:hover {
  background: #ff3366;
  color: #000;
}

.shader-title {
  font-family: 'Special Elite', cursive, monospace;
  font-size: 1.25rem;
  color: #ffffff;
  letter-spacing: 1.5px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
  white-space: nowrap;
  margin: 0;
}

/* ==========================================================================
   FFT Frequency Spectrum Telemetry (Aligned)
   ========================================================================== */
.telemetry-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 18, 0.9);
  border: 1px solid #2a2a40;
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0,0,0,0.85);
}

.spectrum-mini-bars {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 42px;
}

.bar-track {
  width: 20px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  display: flex;
  align-items: flex-end;
  padding: 2px;
  margin-bottom: 5px;
}

.bar-fill {
  width: 100%;
  height: 4px;
  min-height: 4px;
  border-radius: 2px;
  transition: height 0.05s ease-out;
}

.bar-fill.sub { background: #ff0033; box-shadow: 0 0 8px #ff0033; }
.bar-fill.bass { background: #ff6600; box-shadow: 0 0 8px #ff6600; }
.bar-fill.mid { background: #00ff88; box-shadow: 0 0 8px #00ff88; }
.bar-fill.high { background: #0066ff; box-shadow: 0 0 8px #0066ff; }
.bar-fill.air { background: #cc00ff; box-shadow: 0 0 8px #cc00ff; }

.freq-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #ddd;
  letter-spacing: 0.5px;
  line-height: 1;
  margin-bottom: 2px;
}

.freq-sub {
  font-size: 0.55rem;
  color: #666;
  line-height: 1;
  white-space: nowrap;
}

/* Buttons */
.hud-btn {
  background: #12121c;
  color: #aaa;
  border: 1px solid #333348;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: #202030;
  color: #fff;
  border-color: #00e5ff;
}

.hud-btn.active {
  background: #00e5ff;
  color: #000;
  border-color: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.hud-btn.alt {
  border-color: #ffaa00;
  color: #ffaa00;
}

.hud-btn.alt:hover {
  background: #ffaa00;
  color: #000;
}

.file-upload-label {
  display: inline-block;
  cursor: pointer;
}

/* ==========================================================================
   Bottom DJ Deck / Shader Switcher
   ========================================================================== */
.dj-bottom-deck {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.95) 0%, rgba(5, 5, 8, 0) 100%);
  padding: 16px 24px 20px;
  z-index: 100;
}

.deck-controls-row {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.gain-meter-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(12, 12, 20, 0.9);
  padding: 8px 14px;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
}

.ctrl-label {
  font-size: 0.7rem;
  color: #888;
}

#slider-gain {
  accent-color: #00e5ff;
  width: 90px;
}

#gain-val {
  font-size: 0.75rem;
  color: #00e5ff;
  width: 35px;
}

.clip-badge {
  font-size: 0.65rem;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 2px;
  background: #200;
  color: #600;
  border: 1px solid #400;
  transition: all 0.05s ease;
}

.clip-badge.clipping {
  background: #ff0033;
  color: #fff;
  border-color: #ff0033;
  box-shadow: 0 0 12px #ff0033;
}

.shader-quick-dock {
  display: flex;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
  padding-bottom: 4px;
}

.shader-tab-btn {
  flex: 1;
  min-width: 95px;
  background: #0f0f18;
  border: 1px solid #2a2a3a;
  color: #888;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  text-align: left;
  border-radius: 3px;
  transition: all 0.15s ease;
  position: relative;
}

.shader-tab-btn .hotkey {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.6rem;
  color: #555;
  border: 1px solid #333;
  padding: 1px 4px;
  border-radius: 2px;
}

.shader-tab-btn .tab-name {
  display: block;
  font-weight: bold;
  color: #ccc;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shader-tab-btn:hover {
  border-color: #00e5ff;
  background: #181828;
}

.shader-tab-btn.active {
  border-color: #ff0055;
  background: rgba(255, 0, 85, 0.15);
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.4);
}

.shader-tab-btn.active .tab-name {
  color: #ff3377;
}

/* ==========================================================================
   Projection Mapping Overlay & Corner Handles
   ========================================================================== */
.projection-mapper-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  pointer-events: none !important;
}

.projection-grid-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.proj-status-bar {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 20, 0.95);
  border: 1px solid #00e5ff;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
  padding: 10px 18px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  z-index: 1020;
  font-size: 0.8rem;
  color: #00e5ff;
  font-weight: bold;
  letter-spacing: 1px;
  backdrop-filter: blur(8px);
}

.proj-status-title {
  white-space: nowrap;
  font-size: 0.75rem;
  margin-right: 6px;
}

.proj-mini-btn {
  background: #18182c;
  color: #ddd;
  border: 1px solid #3d3d5c;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.proj-mini-btn:hover {
  background: #2b2b48;
  color: #fff;
  border-color: #00e5ff;
}

.proj-mini-btn.primary {
  background: #00e5ff;
  color: #000;
  border-color: #00e5ff;
}

.proj-mini-btn.primary:hover {
  background: #33eeff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.proj-quad-outline {
  fill: rgba(0, 229, 255, 0.05);
  stroke: #00e5ff;
  stroke-width: 2px;
  stroke-dasharray: 8 4;
}

.proj-crosshair {
  stroke: rgba(255, 170, 0, 0.45);
  stroke-width: 1.5px;
  stroke-dasharray: 4 4;
}

.proj-subgrid {
  stroke: rgba(0, 229, 255, 0.3);
  stroke-width: 1px;
  stroke-dasharray: 3 3;
}

.proj-target-ring {
  fill: none;
  stroke: #ff0055;
  stroke-width: 1.5px;
  stroke-dasharray: 4 2;
  opacity: 0.75;
}

.proj-target-center {
  fill: #00e5ff;
  opacity: 0.8;
}

.proj-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  margin-left: -18px;
  border-radius: 50%;
  background: #ff0055;
  border: 3px solid #fff;
  cursor: grab;
  box-shadow: 0 0 20px #ff0055, 0 0 35px rgba(255, 0, 85, 0.6);
  z-index: 1010;
  touch-action: none;
  pointer-events: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

/* Expanded invisible grab target for easy grabbing even at edge of screen */
.proj-handle::before {
  content: '';
  position: absolute;
  top: -24px;
  left: -24px;
  right: -24px;
  bottom: -24px;
  border-radius: 50%;
  pointer-events: auto;
}

.proj-handle-tag {
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  pointer-events: none;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.proj-handle-coords {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: bold;
  background: rgba(10, 10, 18, 0.92);
  border: 1px solid #00e5ff;
  color: #00e5ff;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* Invert coordinates label for bottom handles so they stay inside the screen */
.handle-2 .proj-handle-coords,
.handle-3 .proj-handle-coords {
  top: -28px;
}

.proj-handle:hover {
  background: #ff3377;
  box-shadow: 0 0 25px #ff3377, 0 0 45px rgba(255, 51, 119, 0.8);
}

.proj-handle.dragging,
.proj-handle:active {
  cursor: grabbing;
  background: #00ff88;
  border-color: #ffffff;
  box-shadow: 0 0 30px #00ff88, 0 0 50px rgba(0, 255, 136, 0.8);
}

.proj-handle.dragging .proj-handle-tag,
.proj-handle:active .proj-handle-tag {
  color: #000;
}

/* Dim HUD and deck during Mapping Mode to prevent obstruction */
body.mapping-mode-active .dj-top-hud,
body.mapping-mode-active .dj-bottom-deck {
  opacity: 0.15;
  pointer-events: none;
  filter: blur(0.5px);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

body.mapping-mode-active .dj-top-hud:hover,
body.mapping-mode-active .dj-bottom-deck:hover {
  opacity: 0.85;
  pointer-events: auto;
  filter: none;
}

/* ==========================================================================
   Start Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 4, 8, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.noir-modal-card {
  max-width: 580px;
  padding: 36px;
  background: #0e0e18;
  border: 1px solid #2a2a3e;
  border-left: 5px solid #ff0055;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
}

.noir-modal-card h2 {
  font-family: 'Special Elite', cursive, monospace;
  font-size: 1.8rem;
  margin: 12px 0;
  color: #fff;
}

.noir-modal-card p {
  color: #99a;
  line-height: 1.6;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.noir-btn {
  flex: 1;
  padding: 14px;
  background: #181826;
  color: #ccc;
  border: 1px solid #333348;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.noir-btn:hover {
  background: #252538;
  color: #fff;
  border-color: #00e5ff;
}

.noir-btn.primary {
  background: #ff0055;
  color: #fff;
  border-color: #ff0055;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.noir-btn.primary:hover {
  background: #ff2277;
}

/* ==========================================================================
   Slide-Out DJ Tweak Drawer
   ========================================================================== */
.dj-tweak-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  background: rgba(10, 10, 18, 0.96);
  backdrop-filter: blur(16px);
  border-left: 2px solid #00e5ff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.9);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.dj-tweak-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 22px 28px;
  border-bottom: 1px solid #202035;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: rgba(14, 14, 24, 0.8);
}

.drawer-header h2 {
  font-family: 'Special Elite', cursive, monospace;
  font-size: 1.15rem;
  color: #fff;
  margin-top: 4px;
}

.drawer-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.drawer-close-btn:hover {
  color: #ff0055;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 30px 60px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.tweak-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #00e5ff;
  letter-spacing: 1.8px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.tweak-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}

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

.tweak-label {
  font-size: 0.72rem;
  color: #ccc;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.tweak-val {
  font-size: 0.78rem;
  color: #00e5ff;
  font-family: monospace;
  font-weight: bold;
}

/* Custom Styled Range Sliders */
.tweak-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #141424;
  border-radius: 4px;
  outline: none;
  border: 1px solid #282840;
  margin: 4px 0 6px;
}

.tweak-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00e5ff;
  cursor: pointer;
  box-shadow: 0 0 10px #00e5ff;
  border: 2.5px solid #fff;
  transition: transform 0.1s ease;
}

.tweak-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #ff0055;
  box-shadow: 0 0 12px #ff0055;
}

/* Storage & Preset Buttons */
.storage-btn-group {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.tweak-btn {
  flex: 1;
  padding: 12px;
  background: #181828;
  color: #ddd;
  border: 1px solid #33334e;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.tweak-btn:hover {
  background: #25253e;
  color: #fff;
}

.tweak-btn.primary {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  color: #00e5ff;
}

.tweak-btn.primary:hover {
  background: #00e5ff;
  color: #000;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.tweak-btn.danger {
  border-color: #ff3366;
  color: #ff3366;
}

.tweak-btn.danger:hover {
  background: #ff3366;
  color: #fff;
}

.storage-status {
  font-size: 0.65rem;
  color: #667;
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

