/* ========================================================================
   LUMINA VJ — component styles (knobs, sliders, LEDs, switches, etc.)
   ======================================================================== */

/* ----------  KNOB  ---------- */
.knob-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}
.knob {
  position: relative;
  width: var(--knob-size, 56px);
  height: var(--knob-size, 56px);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
}
.knob:active { cursor: grabbing; }
.knob-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
}
.knob-ring svg { width: 100%; height: 100%; transform: rotate(-135deg); }
.knob-ring .track {
  fill: none;
  stroke: rgba(0,0,0,0.6);
  stroke-width: 3;
}
.knob-ring .fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px var(--accent-glow));
  transition: stroke-dashoffset 0.05s linear;
}
.knob-body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #6e6e78 0%, #3a3a42 30%, #1e1e22 70%, #0e0e10 100%);
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,0.18),
    inset 0 -3px 5px rgba(0,0,0,0.7),
    0 4px 8px rgba(0,0,0,0.7),
    0 1px 0 rgba(255,255,255,0.04);
}
.knob-body::before {
  /* brushed metal */
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg,
      rgba(255,255,255,0.05) 0deg 2deg,
      rgba(0,0,0,0.1) 2deg 4deg);
  mix-blend-mode: overlay;
}
.knob-indicator {
  position: absolute;
  top: 4px; left: 50%;
  width: 3px; height: 38%;
  background: linear-gradient(180deg, var(--accent), transparent 70%);
  border-radius: 2px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--angle, 0deg));
  box-shadow: 0 0 5px var(--accent-glow);
}
.knob-label {
  font-family: var(--font-display);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}
.knob-value {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--accent);
  text-shadow: 0 0 4px var(--accent-glow);
  letter-spacing: 0.05em;
  min-height: 12px;
}
.knob-small { --knob-size: 42px; }
.knob-large { --knob-size: 72px; }

/* ----------  SLIDER (vertical fader)  ---------- */
.fader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.fader-track {
  width: 22px;
  height: var(--fader-h, 110px);
  background:
    linear-gradient(180deg, #0a0a0c 0%, #14141a 100%);
  border-radius: 11px;
  box-shadow: var(--nshadow-in-sm);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fader-fill {
  position: absolute;
  left: 8px; right: 8px;
  bottom: 4px;
  height: var(--fill, 50%);
  background: linear-gradient(180deg, var(--accent), var(--accent-glow));
  border-radius: 4px;
  box-shadow: 0 0 8px var(--accent-glow);
  opacity: 0.6;
}
.fader-cap {
  position: absolute;
  left: -8px; right: -8px;
  bottom: calc(var(--fill, 50%) - 11px);
  height: 22px;
  background:
    linear-gradient(180deg, #4a4a52 0%, #2a2a30 50%, #1a1a1e 100%);
  border-radius: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 2px 4px rgba(0,0,0,0.7);
  cursor: grab;
  touch-action: none;
}
.fader-cap::before {
  content: "";
  position: absolute;
  left: 4px; right: 4px;
  top: 50%; height: 2px;
  margin-top: -1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  box-shadow: 0 0 5px var(--accent-glow);
  border-radius: 1px;
}

/* horizontal slider */
.hslider {
  position: relative;
  height: 22px;
  width: 100%;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.hslider-track {
  width: 100%;
  height: 8px;
  background: linear-gradient(180deg, #0a0a0c, #16161a);
  border-radius: 4px;
  box-shadow: var(--nshadow-in-sm);
  position: relative;
}
.hslider-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--fill, 50%);
  background: linear-gradient(90deg, var(--accent-glow), var(--accent));
  border-radius: 4px;
  box-shadow: 0 0 6px var(--accent-glow);
}
.hslider-thumb {
  position: absolute;
  top: 50%;
  left: var(--fill, 50%);
  width: 14px; height: 18px;
  margin: -9px 0 0 -7px;
  background: linear-gradient(180deg, #5a5a64 0%, #2a2a30 100%);
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 2px 3px rgba(0,0,0,0.7);
}

/* ----------  LED dot  ---------- */
.led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #0d0d10;
  box-shadow:
    inset 0 1px 1px rgba(0,0,0,0.8),
    inset 0 -1px 1px rgba(255,255,255,0.05);
  position: relative;
}
.led.on {
  background: var(--c, var(--led-green));
  box-shadow:
    0 0 6px var(--cg, var(--led-green-glow)),
    0 0 10px var(--cg, var(--led-green-glow)),
    inset 0 1px 1px rgba(255,255,255,0.4);
}
.led-amber.on  { --c: var(--led-amber);  --cg: var(--led-amber-glow); }
.led-cyan.on   { --c: var(--led-cyan);   --cg: var(--led-cyan-glow); }
.led-green.on  { --c: var(--led-green);  --cg: var(--led-green-glow); }
.led-red.on    { --c: var(--led-red);    --cg: var(--led-red-glow); }
.led-magenta.on{ --c: var(--led-magenta);--cg: var(--led-magenta);   }

/* ----------  VU meter ladder  ---------- */
.vu {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  padding: 6px 5px;
  background: linear-gradient(180deg, #0a0a0c, #14141a);
  border-radius: var(--r-sm);
  box-shadow: var(--nshadow-in-sm);
}
.vu-seg {
  width: 14px;
  height: 5px;
  border-radius: 1.5px;
  background: #1a1a1e;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.7);
  opacity: 0.4;
}
.vu-seg.on { opacity: 1; box-shadow: 0 0 4px currentColor; }
.vu-seg.g { color: var(--led-green); }
.vu-seg.a { color: var(--led-amber); }
.vu-seg.r { color: var(--led-red); }
.vu-seg.on.g { background: var(--led-green); }
.vu-seg.on.a { background: var(--led-amber); }
.vu-seg.on.r { background: var(--led-red); }

/* ----------  Toggle switch (mechanical flip)  ---------- */
.flip {
  position: relative;
  width: 38px; height: 22px;
  background: linear-gradient(180deg, #0a0a0c, #1a1a1e);
  border-radius: 4px;
  box-shadow: var(--nshadow-in-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.flip-lever {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 18px;
  background:
    linear-gradient(180deg, #5a5a64 0%, #2a2a30 100%);
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 2px 3px rgba(0,0,0,0.7);
  transition: left 0.15s cubic-bezier(.4,1.4,.6,1);
}
.flip.on .flip-lever {
  left: 20px;
  background: linear-gradient(180deg, var(--accent), var(--accent-glow));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 0 6px var(--accent-glow),
    0 2px 3px rgba(0,0,0,0.7);
}

/* ----------  Preset card (sidebar rack) ---------- */
.preset-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background:
    linear-gradient(180deg, var(--panel-hi), var(--panel));
  border-radius: var(--r-md);
  box-shadow: var(--nshadow-out-sm);
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
}
.preset-card:hover { transform: translateY(-1px); }
.preset-card.active {
  box-shadow: var(--nshadow-in-sm);
}
.preset-card.active::after {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}
.preset-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #0a0a0c, #14141a);
  box-shadow: var(--nshadow-in-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.preset-name {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.preset-tag {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ----------  Stage / preview screen ---------- */
.stage {
  grid-area: stage;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.stage > * { min-width: 0; min-height: 0; }
.stage-bezel {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.screen-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 8px;
  background: #000;
  border-radius: var(--r-md);
  box-shadow:
    inset 0 0 0 2px #0a0a0c,
    inset 0 0 0 4px #2a2a30,
    inset 0 0 26px rgba(0,0,0,0.9),
    0 0 0 1px rgba(0,0,0,0.6),
    0 8px 20px rgba(0,0,0,0.7);
  overflow: hidden;
  display: block;
}
.screen-frame > canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.screen-frame canvas {
  width: 100%; height: 100%; display: block;
}
.screen-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(0,0,0,0.5) 100%);
  mix-blend-mode: multiply;
}
.screen-corner {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255, 174, 58, 0.6);
  text-shadow: 0 0 3px var(--led-amber-glow);
  letter-spacing: 0.08em;
  pointer-events: none;
}

/* Stage toolbar (above screen) */
.stage-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 0;
}
.stage-tabs {
  display: flex;
  gap: 4px;
  background: linear-gradient(180deg, #0a0a0c, #16161a);
  padding: 3px;
  border-radius: var(--r-md);
  box-shadow: var(--nshadow-in-sm);
}
.stage-tab {
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-faint);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}
.stage-tab.active {
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  color: var(--accent);
  text-shadow: 0 0 4px var(--accent-glow);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 1px 0 rgba(0,0,0,0.5);
}

/* Stage bottom strip with REC light + time + format */
.stage-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  height: 36px;
  flex-shrink: 0;
}

/* ----------  Param dock (right side) ---------- */
.dock-section {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--panel-lo), #1a1a1e);
  border-radius: var(--r-md);
  box-shadow: var(--nshadow-in-sm);
}
.dock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.dock-row:first-of-type { margin-top: 4px; }
.dock-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 600;
}
.knob-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.knob-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.knob-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* ----------  Transport bar bottom ---------- */
.transport-bar {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 10px;
  align-items: stretch;
  height: 100%;
}
.transport-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.timeline {
  position: relative;
  flex: 1;
  height: 32px;
  background: linear-gradient(180deg, #0a0a0c, #14141a);
  border-radius: var(--r-sm);
  box-shadow: var(--nshadow-in-sm);
  overflow: hidden;
  cursor: pointer;
}
.timeline-wave {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 4px;
}
.timeline-wave span {
  flex: 1;
  background: linear-gradient(180deg,
    rgba(255,174,58,0.7),
    rgba(255,122,26,0.4));
  border-radius: 1px;
  min-height: 2px;
}
.timeline-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--led-cyan);
  box-shadow: 0 0 8px var(--led-cyan-glow);
  pointer-events: none;
  z-index: 2;
}
.timeline-playhead::before, .timeline-playhead::after {
  content: "";
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: 8px; height: 6px;
  background: var(--led-cyan);
  box-shadow: 0 0 5px var(--led-cyan-glow);
}
.timeline-playhead::before { top: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.timeline-playhead::after  { bottom: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* ----------  Topbar ---------- */
.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 14px;
  border-right: 1px solid rgba(255,255,255,0.04);
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(180deg, #1a1a1e, #0a0a0c);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 2px 4px rgba(0,0,0,0.5);
  display: grid;
  place-items: center;
  position: relative;
}
.brand-mark::before {
  content: "";
  position: absolute;
  width: 3px; height: 14px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow);
  left: 9px; top: 9px;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 8px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow);
  left: 9px; bottom: 9px;
}
.brand-mark > * { display: none; }
.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: var(--ink);
}
.brand-text small {
  display: block;
  font-size: 8px;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
  font-weight: 500;
  margin-top: 1px;
}

.menubar {
  display: flex;
  gap: 2px;
}
.menubar .nbtn { padding: 6px 10px; font-size: 10px; }

.topbar-spacer { flex: 1; }
.topbar-cluster { display: flex; align-items: center; gap: 8px; }

/* file display widget */
.now-playing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 32px;
  min-width: 220px;
  max-width: 320px;
}
.np-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--led-amber);
  text-shadow: 0 0 4px var(--led-amber-glow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
}
.modal {
  width: min(640px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel-lo));
  border-radius: var(--r-xl);
  box-shadow:
    0 30px 80px rgba(0,0,0,0.8),
    var(--nshadow-out);
  padding: 22px;
  position: relative;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
}
.modal-sub {
  font-size: 11px;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

/* radio chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: linear-gradient(180deg, #0a0a0c, #14141a);
  padding: 6px;
  border-radius: var(--r-md);
  box-shadow: var(--nshadow-in-sm);
}
.chip {
  flex: 1;
  min-width: 60px;
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
  border: none;
}
.chip:hover { color: var(--ink-dim); }
.chip.active {
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  color: var(--accent);
  text-shadow: 0 0 4px var(--accent-glow);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 1px 0 rgba(0,0,0,0.5);
}

/* Cast / fullscreen modes */
.fullscreen-mirror {
  position: fixed; inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fullscreen-mirror canvas {
  width: 100%; height: 100%;
}
.fullscreen-exit {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 210;
}

/* tweak panel inside the app */
.local-tweaks {
  position: absolute;
  bottom: 110px;
  right: 16px;
  width: 200px;
  z-index: 30;
}

/* small responsive utilities */
.hide-mobile { }
.show-mobile { display: none; }
@media (max-width: 900px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }
  .knob-grid { grid-template-columns: repeat(3, 1fr); }
  .transport-bar { grid-template-columns: 1fr; }
  .transport-section { padding: 4px 8px; gap: 6px; }
}

/* ============ LUMINA MOBILE (≤900px) — fix overflow & stacking ============ */
@media (max-width: 900px){
  .shell{overflow-x:hidden;}
  .topbar,.topbar-inner,.stage-toolbar,.stage-tabs,.dock-row,.topbar-cluster{flex-wrap:wrap!important;max-width:100%;}
  .stage-toolbar,.stage-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;}
  .topbar,.topbar-inner{height:auto!important;row-gap:6px;padding-top:6px;padding-bottom:6px;}
  /* workspace panels: stack inline-styled flex rows that overflow (board library | elements, etc.) */
  .stage-bezel [style*="display: flex"]{flex-wrap:wrap;}
  .stage-bezel [style*="display: flex"] > *{min-width:0;max-width:100%;}
  .panel{max-width:100%;}

  /* workspace 3-col layouts (library | canvas | panel) -> stack on mobile */
  .lum-wsgrid, .workspace{grid-template-columns:1fr!important;grid-auto-rows:minmax(0,auto)!important;overflow-y:auto;}
  .lum-wsgrid > *, .workspace > *{min-width:0!important;max-width:100%!important;}
  .lum-wsgrid > *{max-height:48vh;overflow:auto;}

}
