/**
 * QUICK CIRCUIT BENCHMARK STYLESHEET (style.css)
 * Golden Standard 3D Cyber Chamber with Center Holographic Circuit Terminal
 * Adheres to ReflexBench Assessment Development Specification
 */

:root {
  --test-accent: #10b981;
  --test-accent-soft: rgba(16, 185, 129, 0.12);
  --test-accent-border: rgba(16, 185, 129, 0.25);
  --primary-accent: #10b981;
  --secondary-accent: #00f0ff;
  --bg-dark: #060912;
  --panel-bg: #0d131f;
  --border-color: #1e293b;
}


/* ── Fullscreen Fit-to-Screen Constraints during Active Gameplay ONLY ── */
body:has(#panelTask.active) {
  overflow: hidden !important;
}

body:has(#panelTask.active) header.panda-header,
body:has(#panelTask.active) .panda-nav,
body:has(#panelTask.active) footer.panda-footer,
body:has(#panelTask.active) .t-ambient-glow,
body:has(#panelTask.active) .t-seo-container,
body:has(#panelTask.active) .t-nav {
  display: none !important;
}

body:has(#panelTask.active) .t-shell {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body:has(#panelTask.active) .t-card {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: #060912 !important;
  box-shadow: none !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
}

body:has(#panelTask.active) #panelTask {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  position: relative !important;
  overflow: hidden !important;
}

/* ══ 1. INTRO PANEL PREVIEW ══ */
.qc-preview-arena {
  width: 100%;
  max-width: 330px;
  height: 104px;
  margin: 1.25rem auto 1rem;
  background: rgba(13, 19, 31, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.qc-preview-track {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.qc-prev-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 48px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  gap: 2px;
  transition: all 0.3s;
}

.qc-prev-node .material-symbols-outlined {
  font-size: 16px;
  line-height: 1;
}

.qc-prev-pwr {
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid #10b981;
  color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.qc-prev-core {
  background: rgba(0, 240, 255, 0.1);
  border: 1.5px solid #00f0ff;
  color: #00f0ff;
  animation: qcCoreGlow 5.0s infinite linear;
}

.qc-prev-board {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qc-prev-tile {
  width: 48px;
  height: 48px;
  background: #111827;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.qc-prev-tile svg {
  width: 48px;
  height: 48px;
  display: block;
}

.qc-prev-tile .qc-wire {
  fill: none;
  stroke: #334155;
  stroke-width: 8;
  stroke-linecap: square;
  transition: stroke 0.25s, filter 0.25s;
}

.qc-prev-tile.t1 .qc-wire {
  stroke: #10b981;
  filter: drop-shadow(0 0 4px #10b981);
}

.qc-prev-tile.t2 svg {
  animation: qcRotateTile2 5.0s infinite linear;
  transform-origin: 24px 24px;
}

.qc-prev-tile.t2 .qc-wire {
  animation: qcTile2Wire 5.0s infinite linear;
}

.qc-prev-tile.t3 .qc-wire {
  animation: qcTile3Wire 5.0s infinite linear;
}

/* Standardized Click Hand Cursor (Bounding Box 20x20) */
.qc-preview-click {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  pointer-events: none;
  z-index: 10;
  animation: qcCursorMotion 5.0s infinite linear;
}

.qc-preview-click .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  display: block;
  color: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

@keyframes qcRotateTile2 {
  0%, 25% { transform: rotate(0deg); }
  32%, 85% { transform: rotate(90deg); }
  92%, 100% { transform: rotate(0deg); }
}

@keyframes qcTile2Wire {
  0%, 26% { stroke: #334155; filter: none; }
  32%, 85% { stroke: #10b981; filter: drop-shadow(0 0 6px #10b981); }
  90%, 100% { stroke: #334155; filter: none; }
}

@keyframes qcTile3Wire {
  0%, 33% { stroke: #334155; filter: none; }
  38%, 85% { stroke: #10b981; filter: drop-shadow(0 0 6px #10b981); }
  90%, 100% { stroke: #334155; filter: none; }
}

@keyframes qcCoreGlow {
  0%, 35% {
    background: rgba(0, 240, 255, 0.1);
    border-color: #00f0ff;
    color: #00f0ff;
    box-shadow: none;
  }
  40%, 85% {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.6);
  }
  92%, 100% {
    background: rgba(0, 240, 255, 0.1);
    border-color: #00f0ff;
    color: #00f0ff;
    box-shadow: none;
  }
}

@keyframes qcCursorMotion {
  0% {
    left: 230px;
    top: 85px;
    opacity: 0;
    transform: translate(-35%, -15%) scale(1);
  }
  12% {
    left: 165px;
    top: 52px;
    opacity: 1;
    transform: translate(-35%, -15%) scale(1);
  }
  24% {
    left: 165px;
    top: 52px;
    opacity: 1;
    transform: translate(-35%, -15%) scale(1);
  }
  27% {
    left: 165px;
    top: 52px;
    opacity: 1;
    transform: translate(-35%, -15%) scale(0.8);
  }
  32% {
    left: 165px;
    top: 52px;
    opacity: 1;
    transform: translate(-35%, -15%) scale(1);
  }
  48% {
    left: 215px;
    top: 75px;
    opacity: 0.8;
    transform: translate(-35%, -15%) scale(1);
  }
  60%, 100% {
    left: 240px;
    top: 88px;
    opacity: 0;
    transform: translate(-35%, -15%) scale(1);
  }
}

.circuit-preview-caption {
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ══ 2. TASK / PLAY PANEL (Full Viewport with 3D Golden Standard Arena) ══ */
#panelTask {
  flex: 1;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: none;
  position: relative;
  overflow: hidden;
  background-color: #060912;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%23ffffff' stroke='%23000000' stroke-width='1.2'/%3E%3C/svg%3E") 12 12, crosshair;
}

#panelTask.active {
  display: block;
}

/* ══ 3. RESULT PANEL (Standard ReflexBench UI) ══ */
#panelResult,
#panelResults {
  display: none;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
}

#panelResult.active,
#panelResults.active {
  display: flex;
}

/* ════ 3D WEBGL CYBER ARENA (Golden Standard Environment) ════ */
.circuit-3d-arena {
  width: 100vw !important;
  height: 100vh !important;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background-color: #060912;
  box-shadow: none !important;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.circuit-3d-arena::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(4, 7, 13, 0.75) 100%);
  pointer-events: none;
  z-index: 2;
}

#webgl-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ════ MINIMALIST FLOATING TOP HUD (Friend or Foe Standards) ════ */
.top-header {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  background: transparent;
  border: none;
  z-index: 30;
  pointer-events: none;
}

.header-left,
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 19, 31, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-decoration: none;
}

.hub-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.round-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 19, 31, 0.75);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.countdown-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #10b981;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.restart-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.restart-pill:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  border-color: #ef4444;
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}

/* Suppress all corner text, cam hud, and stats ribbon */
.wd-cam-hud,
.board-status-pill,
.stats-ribbon,
.wd-target-tag {
  display: none !important;
}

/* ══ Performance Brackets Trainee Row ══ */
.rt-range-row.trainee .rt-range-dot {
  background: #ef4444;
}

.rt-range-row.trainee.active {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
}

.rt-range-row.trainee.active .rt-range-label,
.rt-range-row.trainee.active .rt-range-val {
  color: #ef4444 !important;
  font-weight: 700 !important;
}

/* ── Center Kinetic ctOS Workstation ── */
.circuit-workstation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 536px;
  height: 336px;
  z-index: 20;
}

.circuit-grid-wrapper {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 336px;
  height: 336px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Subtle Alignment Guide Lines Between All Cogs ── */
.circuit-cog-grid-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 336px;
  height: 336px;
  pointer-events: none;
  z-index: 1;
}

.cog-guide-lines line {
  stroke-width: 1.6px;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-dasharray: 6 3;
  opacity: 0.28;
  transition: stroke 0.2s, opacity 0.2s;
}

.circuit-workstation.theme-tron .cog-guide-lines line { stroke: #e879f9; opacity: 0.28; }
.circuit-workstation.theme-relay .cog-guide-lines line { stroke: #f59e0b; opacity: 0.28; }
.circuit-workstation.theme-coupler .cog-guide-lines line { stroke: #fb7185; opacity: 0.38; }

/* ── 4x4 ctOS Conduit Junction Matrix ── */
.circuit-grid-board {
  position: relative;
  z-index: 2;
  width: 336px;
  height: 336px;
  display: grid;
  grid-template-columns: repeat(4, 84px);
  grid-template-rows: repeat(4, 84px);
  gap: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Tile Touch Target with Tactical Hover Reticle */
.circuit-tile {
  position: relative;
  width: 84px;
  height: 84px;
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  transition: transform 0.12s cubic-bezier(0.18, 0.9, 0.32, 1.2);
}

.circuit-tile::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 4px;
  border: 1px dashed transparent;
  pointer-events: none;
  transition: all 0.15s ease-out;
  opacity: 0;
  z-index: 5;
}

.circuit-tile:hover::before {
  opacity: 1;
  border-color: rgba(0, 240, 255, 0.45);
  background: radial-gradient(circle at center, rgba(0, 240, 255, 0.08) 0%, transparent 75%);
  box-shadow: inset 0 0 14px rgba(0, 240, 255, 0.15);
}

.circuit-tile:active {
  transform: scale(0.97);
}

.circuit-svg {
  width: 84px;
  height: 84px;
  display: block;
  overflow: visible;
  pointer-events: none;
  transition: transform 0.16s cubic-bezier(0.18, 0.9, 0.32, 1.2);
}

/* ── Conduits ── */
.wd-conduit-casing {
  stroke: rgba(4, 9, 18, 0.95);
  stroke-width: 9;
  stroke-linecap: butt;
  stroke-linejoin: round;
  fill: none;
}

.wd-conduit-body {
  stroke: rgba(140, 185, 225, 0.5);
  stroke-width: 5;
  stroke-linecap: butt;
  stroke-linejoin: round;
  fill: none;
  transition: opacity 0.15s, stroke 0.15s, filter 0.15s;
}

.wd-conduit-data {
  stroke: #ffffff;
  stroke-width: 2.2;
  stroke-linecap: butt;
  stroke-linejoin: round;
  stroke-dasharray: 6 3;
  fill: none;
  opacity: 0.85;
  transition: opacity 0.15s, filter 0.15s;
}

.circuit-tile:hover .wd-conduit-body {
  stroke: rgba(0, 240, 255, 0.9);
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6));
}

.circuit-tile:hover .wd-conduit-data {
  opacity: 1;
  stroke: #ffffff;
  filter: drop-shadow(0 0 4px #00f0ff);
}

.wd-conduit-laser {
  opacity: 0;
  stroke: #00f0ff;
  stroke-width: 8;
  stroke-linecap: butt;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 0 8px #00f0ff) drop-shadow(0 0 18px rgba(0, 240, 255, 0.9));
  transition: opacity 0.15s;
}

.wd-conduit-core {
  opacity: 0;
  stroke: #ffffff;
  stroke-width: 2.8;
  stroke-linecap: butt;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 0 4px #ffffff);
  transition: opacity 0.15s;
}

.circuit-tile.energized .wd-conduit-body,
.circuit-tile.energized .wd-conduit-data {
  opacity: 0;
}

.circuit-tile.energized .wd-conduit-laser,
.circuit-tile.energized .wd-conduit-core {
  opacity: 1;
}

.circuit-tile.energized::before {
  opacity: 0.4;
  border-color: rgba(0, 240, 255, 0.25);
}

/* ════ 3 CURATED THEMES ════ */
/* Theme 1: Vector TRON */
.circuit-workstation.theme-tron .pure-lead-wire.lead-in { background: #f43f5e; box-shadow: 0 0 14px #f43f5e; }
.circuit-workstation.theme-tron .power-diamond-node .diamond-bracket { color: #f43f5e; text-shadow: 0 0 10px #f43f5e; }
.circuit-workstation.theme-tron .power-diamond-node .diamond-frame { border-color: #f43f5e; background: #1e002e; box-shadow: 0 0 18px rgba(244, 63, 94, 0.65); }
.circuit-workstation.theme-tron .power-icon-svg { color: #fef08a; filter: drop-shadow(0 0 8px #fef08a); }
.circuit-workstation.theme-tron .lock-diamond-node .diamond-bracket { color: #f43f5e; text-shadow: 0 0 10px #f43f5e; }
.circuit-workstation.theme-tron .lock-diamond-node .diamond-frame { border-color: #f43f5e; background: #1e002e; box-shadow: 0 0 18px rgba(244, 63, 94, 0.65); }
.circuit-workstation.theme-tron .lock-icon-svg { color: #fef08a; filter: drop-shadow(0 0 8px #fef08a); }

/* Theme 2: Cyber Relay Box */
.circuit-workstation.theme-relay .pure-lead-wire.lead-in { background: #f59e0b; box-shadow: 0 0 12px #f59e0b; }
.circuit-workstation.theme-relay .power-diamond-node .diamond-bracket { color: #f59e0b; text-shadow: 0 0 8px #f59e0b; }
.circuit-workstation.theme-relay .power-diamond-node .diamond-frame { border-color: #f59e0b; background: #291804; box-shadow: 0 0 16px rgba(245, 158, 11, 0.55); }
.circuit-workstation.theme-relay .power-icon-svg { color: #fbbf24; filter: drop-shadow(0 0 6px #fbbf24); }
.circuit-workstation.theme-relay .lock-diamond-node .diamond-bracket { color: #f59e0b; text-shadow: 0 0 8px #f59e0b; }
.circuit-workstation.theme-relay .lock-diamond-node .diamond-frame { border-color: #f59e0b; background: #291804; box-shadow: 0 0 16px rgba(245, 158, 11, 0.45); }
.circuit-workstation.theme-relay .lock-icon-svg { color: #fbbf24; filter: drop-shadow(0 0 6px #fbbf24); }

/* Theme 3: Optic Isolator */
.circuit-workstation.theme-coupler .pure-lead-wire.lead-in { background: #f43f5e; box-shadow: 0 0 14px #f43f5e; }
.circuit-workstation.theme-coupler .power-diamond-node .diamond-bracket { color: #fb7185; text-shadow: 0 0 8px #fb7185; }
.circuit-workstation.theme-coupler .power-diamond-node .diamond-frame { border-color: #fb7185; background: #260510; box-shadow: 0 0 16px rgba(251, 113, 133, 0.55); }
.circuit-workstation.theme-coupler .power-icon-svg { color: #f43f5e; filter: drop-shadow(0 0 6px #f43f5e); }
.circuit-workstation.theme-coupler .lock-diamond-node .diamond-bracket { color: #fb7185; text-shadow: 0 0 8px #fb7185; }
.circuit-workstation.theme-coupler .lock-diamond-node .diamond-frame { border-color: #fb7185; background: #260510; box-shadow: 0 0 16px rgba(251, 113, 133, 0.45); }
.circuit-workstation.theme-coupler .lock-icon-svg { color: #f43f5e; filter: drop-shadow(0 0 6px #f43f5e); }

/* Theme SVG Stylings */
.tron-track-casing { stroke: #0a0014; stroke-width: 9; fill: none; }
.tron-track-rail { stroke: #c026d3; stroke-width: 3.8; stroke-dasharray: 6 3; fill: none; transition: all 0.15s; }
.tron-diamond { fill: #1e002e; stroke: #f43f5e; stroke-width: 1.8; filter: drop-shadow(0 0 6px #f43f5e); transition: all 0.2s; }
.tron-tick { stroke: #f43f5e; stroke-width: 1.5; }
.tron-track-laser { opacity: 0; stroke: #f43f5e; stroke-width: 8; fill: none; filter: drop-shadow(0 0 16px #f43f5e); transition: opacity 0.15s; }
.tron-track-core { opacity: 0; stroke: #fef08a; stroke-width: 3; fill: none; filter: drop-shadow(0 0 5px #fef08a); transition: opacity 0.15s; }
.circuit-tile:hover .tron-track-rail { stroke: #f43f5e; filter: drop-shadow(0 0 8px #f43f5e); }
.circuit-tile.energized .tron-track-rail { opacity: 0; }
.circuit-tile.energized .tron-track-laser, .circuit-tile.energized .tron-track-core { opacity: 1; }
.circuit-tile.energized .tron-diamond { fill: #fef08a; stroke: #f43f5e; filter: drop-shadow(0 0 12px #f43f5e); }

.relay-conduit-casing { stroke: #110d06; stroke-width: 10; fill: none; }
.relay-conduit-bus { stroke: #d97706; stroke-width: 4; fill: none; transition: all 0.15s; }
.relay-housing { fill: #1c1917; stroke: #78350f; stroke-width: 1.6; transition: all 0.2s; }
.relay-bolt { fill: #d97706; }
.relay-window { fill: #292524; stroke: #d97706; stroke-width: 1; }
.relay-coil { stroke: #f59e0b; stroke-width: 1.4; }
.relay-contact { fill: #78350f; stroke: #f59e0b; stroke-width: 0.8; }
.relay-vent { stroke: #78350f; stroke-width: 1.2; }
.relay-conduit-laser { opacity: 0; stroke: #f59e0b; stroke-width: 8; fill: none; filter: drop-shadow(0 0 14px #f59e0b) drop-shadow(0 0 24px rgba(245,158,11,0.8)); transition: opacity 0.15s; }
.relay-conduit-core { opacity: 0; stroke: #fffbeb; stroke-width: 3; fill: none; filter: drop-shadow(0 0 4px #ffffff); transition: opacity 0.15s; }
.circuit-tile:hover .relay-conduit-bus { stroke: #fbbf24; filter: drop-shadow(0 0 6px #f59e0b); }
.circuit-tile.energized .relay-conduit-bus { opacity: 0; }
.circuit-tile.energized .relay-conduit-laser, .circuit-tile.energized .relay-conduit-core { opacity: 1; }
.circuit-tile.energized .relay-housing { fill: #451a03; stroke: #f59e0b; filter: drop-shadow(0 0 12px #f59e0b); }
.circuit-tile.energized .relay-window { fill: #f59e0b; stroke: #fffbeb; }
.circuit-tile.energized .relay-contact { fill: #ffffff; }

.coupler-trace-casing { stroke: #16040a; stroke-width: 9; fill: none; }
.coupler-trace-fiber { stroke: #e11d48; stroke-width: 3.6; fill: none; transition: all 0.15s; }
.coupler-box { fill: #1c0610; stroke: #9f1239; stroke-width: 1.4; transition: all 0.2s; }
.coupler-aperture { fill: #0d0106; stroke: #e11d48; stroke-width: 1.2; transition: all 0.2s; }
.coupler-lens { fill: #fb7185; filter: drop-shadow(0 0 4px #fb7185); transition: all 0.2s; }
.coupler-trace-laser { opacity: 0; stroke: #f43f5e; stroke-width: 8; fill: none; filter: drop-shadow(0 0 14px #f43f5e) drop-shadow(0 0 24px #fb7185); transition: opacity 0.15s; }
.coupler-trace-core { opacity: 0; stroke: #ffffff; stroke-width: 2.8; fill: none; filter: drop-shadow(0 0 4px #ffffff); transition: opacity 0.15s; }
.circuit-tile:hover .coupler-trace-fiber { stroke: #fb7185; filter: drop-shadow(0 0 6px #f43f5e); }
.circuit-tile.energized .coupler-trace-fiber { opacity: 0; }
.circuit-tile.energized .coupler-trace-laser, .circuit-tile.energized .coupler-trace-core { opacity: 1; }
.circuit-tile.energized .coupler-box { fill: #881337; stroke: #f43f5e; filter: drop-shadow(0 0 12px #f43f5e); }
.circuit-tile.energized .coupler-lens { fill: #ffffff; filter: drop-shadow(0 0 8px #ffffff); }

/* ── Pure Power Feed Node (Left) ── */
.pure-port-node {
  position: absolute;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: top 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pure-port-node.port-source {
  left: 20px;
  width: 56px;
  height: 44px;
}

.power-diamond-node {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.power-diamond-node .diamond-bracket {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: #00f0ff;
  text-shadow: 0 0 8px #00f0ff;
}

.power-diamond-node .diamond-frame {
  width: 28px;
  height: 28px;
  border: 1.8px solid #00f0ff;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 12, 22, 0.95);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.55), inset 0 0 8px rgba(0, 240, 255, 0.25);
}

.power-icon-svg {
  transform: rotate(-45deg);
  color: #00f0ff;
  filter: drop-shadow(0 0 6px #00f0ff);
}

.pure-lead-wire.lead-in {
  position: absolute;
  right: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 7px;
  background: #00f0ff;
  box-shadow: 0 0 10px #00f0ff;
  pointer-events: none;
}

.pure-lead-wire.lead-in::after {
  content: '';
  position: absolute;
  inset: 2px 0;
  background: #ffffff;
  box-shadow: 0 0 4px #ffffff;
}

/* ── Security Lock Terminal (Right) ── */
.pure-port-node.port-lock {
  right: 20px;
  width: 56px;
  height: 44px;
}

.lock-diamond-node {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.lock-diamond-node .diamond-bracket {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: #00f0ff;
  text-shadow: 0 0 8px #00f0ff;
  transition: color 0.2s;
}

.lock-diamond-node .diamond-frame {
  width: 28px;
  height: 28px;
  border: 1.8px solid #00f0ff;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 12, 22, 0.95);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
  transition: all 0.25s ease-out;
}

.lock-icon-svg {
  transform: rotate(-45deg);
  color: #00f0ff;
  filter: drop-shadow(0 0 6px #00f0ff);
  transition: all 0.2s;
}

.lock-shackle {
  transition: transform 0.2s cubic-bezier(0.18, 0.9, 0.32, 1.2);
}

.pure-lead-wire.lead-out {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 7px;
  background: #253d5a;
  pointer-events: none;
  transition: all 0.2s;
}

.pure-port-node.port-lock.connected .diamond-frame {
  border-color: #10b981;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.85);
  background: rgba(4, 25, 18, 0.95);
}

.pure-port-node.port-lock.connected .diamond-bracket {
  color: #10b981;
  text-shadow: 0 0 10px #10b981;
}

.pure-port-node.port-lock.connected .lock-icon-svg {
  color: #10b981;
  filter: drop-shadow(0 0 8px #10b981);
}

.pure-port-node.port-lock.connected .lock-shackle {
  transform: translateY(-3.5px);
}

.pure-port-node.port-lock.connected .pure-lead-wire.lead-out {
  background: #10b981;
  box-shadow: 0 0 12px #10b981;
}

.pure-port-node.port-lock.connected .pure-lead-wire.lead-out::after {
  content: '';
  position: absolute;
  inset: 2px 0;
  background: #ffffff;
  box-shadow: 0 0 4px #ffffff;
}

/* Surge flash on complete */
.circuit-grid-board.surge-flash {
  animation: boardSurge 0.4s ease-out;
}

@keyframes boardSurge {
  0% { filter: drop-shadow(0 0 40px #00f0ff) brightness(1.7); }
  50% { filter: drop-shadow(0 0 25px #10b981) brightness(1.4); }
  100% { filter: none; }
}

@media (max-width: 640px) {
  .stats-ribbon {
    gap: 0.8rem;
  }
  .mini-label {
    font-size: 0.55rem;
  }
  .mini-val {
    font-size: 0.85rem;
  }
  .board-status-pill {
    display: none;
  }
  .wd-corner .wd-tag {
    font-size: 0.62rem;
  }
}

/* ── Floating Score Badge on Circuit Solve ── */
.qc-score-float {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 100;
  animation: qcFloatUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.qc-score-float .float-points {
  font-family: var(--font-m, 'JetBrains Mono', monospace);
  font-size: 28px;
  font-weight: 900;
  color: #10b981;
  text-shadow: 0 0 16px rgba(16, 185, 129, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.04em;
}

.qc-score-float .float-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qc-score-float .float-tag {
  font-family: var(--font-m, 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.qc-score-float .tag-time {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.qc-score-float .tag-combo {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.qc-score-float .tag-flawless {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid rgba(6, 182, 212, 0.5);
  color: #22d3ee;
}

@keyframes qcFloatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.0);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -85%) scale(0.98);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -120%) scale(0.92);
  }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE VIEWPORT OPTIMIZATIONS (Strictly Scoped to Mobile Screen Widths)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body:has(#panelTask.active) .t-shell,
  body:has(#panelTask.active) .t-card,
  body:has(#panelTask.active) #panelTask {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .top-header {
    top: max(12px, env(safe-area-inset-top, 12px)) !important;
    left: 12px !important;
    right: 12px !important;
  }

  .circuit-workstation {
    transform: translate(-50%, -50%);
    transform-origin: center center;
  }
}

@media (max-width: 560px) {
  .circuit-workstation {
    transform: translate(-50%, -50%) scale(0.68) !important;
    transform-origin: center center !important;
  }
}

@media (max-width: 440px) {
  .circuit-workstation {
    transform: translate(-50%, -50%) scale(0.62) !important;
    transform-origin: center center !important;
  }
}

@media (max-width: 380px) {
  .circuit-workstation {
    transform: translate(-50%, -50%) scale(0.55) !important;
    transform-origin: center center !important;
  }
}

@media (max-width: 330px) {
  .circuit-workstation {
    transform: translate(-50%, -50%) scale(0.48) !important;
    transform-origin: center center !important;
  }
}

