/* ==========================================================================
   Unfair Advantage — Interactive Labs Telemetry Workbench (#labs)
   ========================================================================== */

.console-header {
  justify-content: flex-start;
  gap: 18px;
}

.console-header > img {
  flex: none;
  filter: drop-shadow(0 2px 6px rgba(232, 17, 45, 0.25));
}

.console-label {
  margin-left: auto;
}

.tabs {
  position: relative;
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(7, 8, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  isolation: isolate;
}

.tab-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(232, 17, 45, 0.26), rgba(154, 12, 32, 0.22));
  border: 1px solid rgba(255, 46, 70, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 160, 170, 0.22), 0 4px 14px -4px rgba(232, 17, 45, 0.45);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.36s var(--ease), width 0.36s var(--ease);
}

.tabs button {
  position: relative;
  z-index: 1;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 580;
  min-height: 36px;
  color: var(--muted);
  transition: color 0.2s var(--sine);
}

.tabs button:hover,
.tabs button[aria-selected='true'] {
  color: #ffffff;
}

.console-body {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 0.78fr);
}

/* Telemetry Plot & 3D Volume Viewport */
.screen {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) auto;
  background: #0a0c11;
}

.screen-head,
.screen-foot {
  align-items: center;
  background: rgba(13, 16, 23, 0.92);
  min-height: 46px;
  padding: 8px 18px;
  font-size: 10.5px;
  color: var(--muted);
}

.screen-head {
  border-bottom: 1px solid var(--line);
}

.screen-foot {
  border-top: 1px solid var(--line);
}

.screen-head > span:first-child {
  color: var(--text);
}

.plot-badge {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  white-space: nowrap;
  transition: border-color 0.22s, background-color 0.22s, color 0.22s;
}

.plot-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--signal);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--signal);
}

.plot-deck {
  position: relative;
  min-width: 0;
  min-height: 310px;
  isolation: isolate;
  background: radial-gradient(ellipse 75% 70% at 50% 50%, #131722 0%, #090b10 100%);
}

.plot-deck #plot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 310px;
}

.plot-deck.spatial-on #plot {
  opacity: 0;
  pointer-events: none;
}

#spatial {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
}

#spatial:active {
  cursor: grabbing;
}

#plot.drawing {
  touch-action: none;
  cursor: crosshair;
}

.field-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
}

#lab-panel:not([data-lab='dash']) :is(.direction-layer, .dash-markers),
#lab-panel[data-lab='dash'] :is(.timeline-axis, #playhead, #cursor) {
  display: none;
}

.workshop #track {
  stroke: rgba(154, 166, 190, 0.38);
  stroke-dasharray: 5 6;
  stroke-linecap: round;
}

.workshop #trace {
  stroke: var(--signal);
  filter: drop-shadow(0 0 8px rgba(255, 46, 70, 0.65));
}

.workshop #trace-wake,
.workshop #draft-ink {
  stroke: #ff7a89;
}

#dash-runner circle {
  fill: var(--crimson);
  stroke: #ffb3bc;
}

.workshop #plot.drawing :is(#trace, .dash-markers) {
  opacity: 0.16;
}

.workshop #plot:not(.drawing) #draft-ink {
  display: none;
}

/* Live Analytical Telemetry Readout Bar inside Screen Foot */
.lab-metrics {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--dim);
}

.lab-metrics b {
  color: var(--text-soft);
  font-weight: 500;
}

/* Controls Sidebar */
.controls {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 2.6vw, 36px);
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 24, 34, 0.92), rgba(14, 17, 24, 0.98));
}

.controls .eyebrow {
  color: var(--crimson-hot);
}

.controls h3 {
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 700;
  margin: 8px 0 8px;
  letter-spacing: -0.04em;
  color: var(--text);
}

.controls > p:not(.eyebrow) {
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--muted);
  margin-bottom: 18px;
}

.dash-options {
  margin-bottom: 16px;
}

.pattern-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--crimson-hot);
  margin: 0 0 8px;
}

.pattern-label span {
  margin-left: 6px;
  color: var(--text-soft);
  text-transform: uppercase;
  font-weight: 500;
}

/* Camera Mode Selector */
.camera-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.camera-modes button {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  padding: 8px 12px;
  min-height: 38px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.camera-modes button:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.camera-modes button[aria-pressed='true'] {
  color: #ffffff;
  border-color: rgba(255, 46, 70, 0.5);
  background: linear-gradient(180deg, rgba(232, 17, 45, 0.24), rgba(164, 12, 32, 0.2));
}

.cam-help,
.draw-help {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--dim);
  margin: 7px 0 16px;
}

.draw-help {
  margin-bottom: 4px;
}

/* Move Pattern Dual Toggle */
.pattern-picker {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  isolation: isolate;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(7, 8, 12, 0.72);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  margin-bottom: 16px;
}

.pattern-indicator {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: calc(50% - 4px);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(232, 17, 45, 0.28), rgba(154, 12, 32, 0.22));
  border: 1px solid rgba(255, 46, 70, 0.5);
  transition: transform 0.36s var(--ease);
  pointer-events: none;
}

.pattern-picker[data-mode='lethal'] .pattern-indicator {
  transform: translateX(100%);
}

.pattern-picker button {
  position: relative;
  border: 0;
  background: transparent;
  min-width: 0;
  min-height: 36px;
  padding: 6px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 580;
  color: var(--muted);
  transition: color 0.2s;
}

.pattern-picker button[aria-pressed='true'] {
  color: #ffffff;
}

/* Draw / Reset Actions */
.draw-actions {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 8px;
}

.draw-actions button {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 8px 12px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.18s var(--snap);
}

.draw-actions button:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.draw-primary {
  border-color: rgba(255, 46, 70, 0.5) !important;
  background: linear-gradient(180deg, rgba(232, 17, 45, 0.25), rgba(154, 12, 32, 0.2)) !important;
  color: #ffffff !important;
}

.draw-primary[aria-pressed='true'] {
  background: linear-gradient(180deg, #f31e38, #c40d24) !important;
  box-shadow: 0 0 20px -4px rgba(232, 17, 45, 0.7);
}

/* Precision Scrubber */
.readout {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.readout output {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scrubber {
  margin: 12px 0 18px;
}

.scrubber input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--signal) 0%,
    var(--crimson-hot) var(--progress, 42%),
    rgba(255, 255, 255, 0.12) var(--progress, 42%),
    rgba(255, 255, 255, 0.12) 100%
  );
  cursor: pointer;
}

.scrubber input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--signal);
  box-shadow: 0 0 14px rgba(255, 46, 70, 0.8), 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: transform 0.18s var(--spring);
}

.scrubber input[type='range']::-webkit-slider-thumb:hover {
  transform: scale(1.16);
}

.scrubber input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--signal);
  box-shadow: 0 0 14px rgba(255, 46, 70, 0.8), 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* Primary Replay Trigger */
.replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 118, 134, 0.42);
  background: linear-gradient(180deg, #ee1934 0%, #c10c23 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 650;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 10px 24px -8px rgba(232, 17, 45, 0.55);
  transition: transform 0.22s var(--ease), filter 0.2s, box-shadow 0.24s;
}

.replay:not(:disabled):hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 14px 30px -8px rgba(255, 46, 70, 0.72);
}

.replay:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.replay-glyph {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.pause-glyph,
.workshop[data-playback='running'] .play-glyph {
  display: none;
}

.workshop[data-playback='running'] .pause-glyph {
  display: inline;
}

.workshop[data-playback='running'] .plot-badge {
  border-color: rgba(255, 46, 70, 0.55);
  color: #ffd5db;
  background: rgba(232, 17, 45, 0.2);
}

.workshop[data-playback='running'] #dash-runner {
  filter: drop-shadow(0 0 8px rgba(255, 46, 70, 0.9));
}

.no-script {
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .console-body {
    grid-template-columns: 1fr;
  }
  .controls {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .plot-deck,
  .plot-deck #plot {
    min-height: 250px;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .console-header {
    padding: 10px 14px;
    gap: 10px;
  }
  .console-label {
    display: none;
  }
  .console-body {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
  .controls {
    border-left: 1px solid var(--line);
    border-top: 0;
    padding: 14px 16px;
  }
  .controls h3 {
    font-size: 20px;
    margin: 4px 0 4px;
  }
  .controls > p:not(.eyebrow) {
    font-size: 12px;
    margin-bottom: 10px;
  }
  .screen {
    grid-template-rows: auto minmax(200px, 1fr) auto;
  }
  .plot-deck,
  .plot-deck #plot {
    min-height: 200px;
  }
  .cam-help,
  .draw-help {
    display: none;
  }
  .pattern-picker {
    margin-bottom: 10px;
  }
  .replay {
    min-height: 40px;
  }
}

@media (pointer: coarse) {
  .scrubber {
    margin: 6px 0 12px;
    padding-block: 8px;
  }
  .scrubber input[type='range'] {
    height: 8px;
  }
  .scrubber input[type='range']::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
  .scrubber input[type='range']::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 600px) {
  .console-header {
    padding: 10px 12px;
    gap: 8px;
  }
  .console-header > img,
  .console-label {
    display: none;
  }
  .tabs {
    width: 100%;
    min-width: 0;
  }
  .tabs button {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .screen-head,
  .screen-foot {
    padding-inline: 12px;
    font-size: 9.5px;
  }
  .lab-metrics {
    display: none;
  }
}
