/* DGPL System-1 — 150,000 Particle Sorter Simulator Stylesheet */

:root {
  --bg: #07090e;
  --panel-bg: rgba(15, 20, 30, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f4f8;
  --text-muted: #8b9bb4;
  --accent-cyan: #00f0ff;
  --accent-blue: #007aff;
  --accent-red: #ff3b30;
  --accent-green: #34c759;
  --accent-yellow: #ffcc00;
  --accent-purple: #af52de;
  --accent-amber: #ff9500;
  --font-main: 'Inter', -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-main);
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

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

/* Glassmorphic Utilities */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* Top Navigation */
.top-nav {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  box-shadow: 0 0 15px var(--accent-cyan);
  animation: orbPulse 3s infinite ease-in-out;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px var(--accent-cyan); }
  50% { transform: scale(1.15); box-shadow: 0 0 22px var(--accent-cyan), 0 0 35px var(--accent-blue); }
}

.brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: block;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: -2px;
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

.text-cyan { color: var(--accent-cyan); }
.text-emerald { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }

/* Left Camera Card */
.camera-card {
  position: absolute;
  top: 92px;
  left: 20px;
  padding: 16px;
  width: 200px;
  z-index: 10;
}

.card-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 12px;
}

.camera-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cam-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cam-btn svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.cam-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.cam-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.cam-btn.active svg {
  color: var(--accent-cyan);
}

/* Right Buckets Panel */
.buckets-card {
  position: absolute;
  top: 92px;
  right: 20px;
  width: 280px;
  padding: 18px;
  z-index: 10;
}

.buckets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.bucket-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.bucket-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.bucket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.bg-red { background: var(--accent-red); box-shadow: 0 0 8px var(--accent-red); }
.bg-green { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.bg-blue { background: var(--accent-blue); box-shadow: 0 0 8px var(--accent-blue); }
.bg-yellow { background: var(--accent-yellow); box-shadow: 0 0 8px var(--accent-yellow); }
.bg-purple { background: var(--accent-purple); box-shadow: 0 0 8px var(--accent-purple); }

.count-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  transition: width 0.15s ease;
  border-radius: 4px;
}

.fill-red { background: linear-gradient(90deg, #ff3b30, #ff6b64); }
.fill-green { background: linear-gradient(90deg, #34c759, #62e482); }
.fill-blue { background: linear-gradient(90deg, #007aff, #5ac8fa); }
.fill-yellow { background: linear-gradient(90deg, #ffcc00, #ffe066); }
.fill-purple { background: linear-gradient(90deg, #af52de, #da8eff); }

.total-progress-wrap {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.total-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar-bg.total {
  height: 8px;
}

.fill-rainbow {
  background: linear-gradient(90deg, #ff3b30, #ff9500, #ffcc00, #34c759, #007aff, #af52de);
}

/* Bottom Driver Dock */
.bottom-dock-container {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.driver-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  min-height: 72px;
}

.dock-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock-divider {
  width: 1px;
  height: 38px;
  background: rgba(255, 255, 255, 0.1);
}

.dock-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: block;
}

.primary-btn {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  border: 1px solid rgba(0, 198, 255, 0.4);
  border-radius: 10px;
  color: #ffffff;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 114, 255, 0.4);
  transition: all 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 114, 255, 0.6);
}

.primary-btn.active {
  background: linear-gradient(135deg, #ff3b30, #ff9500);
  border-color: #ff3b30;
  box-shadow: 0 4px 20px rgba(255, 59, 48, 0.5);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Speed Slider Section */
.speed-section {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 220px;
}

.speed-label-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.speed-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
}

.neon-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

.neon-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.neon-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 9px;
  color: var(--text-muted);
}

/* Arm Selectors */
.arm-selectors {
  display: flex;
  gap: 6px;
}

.arm-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.arm-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.arm-btn.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Rate Section */
.rate-section {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.rate-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rate-display strong {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-green);
  text-shadow: 0 0 10px rgba(52, 199, 89, 0.4);
}

.rate-display small {
  font-size: 10px;
  color: var(--text-muted);
}

/* Completion Modal */
.completion-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: 90vw;
  padding: 32px;
  border-radius: 20px;
  z-index: 100;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 240, 255, 0.2);
  border: 1px solid rgba(0, 240, 255, 0.3);
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.completion-modal.hidden {
  display: none;
}

@keyframes modalPop {
  0% { transform: translate(-50%, -46%) scale(0.95); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.modal-badge {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}

.modal-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.m-label {
  font-size: 11px;
  color: var(--text-muted);
}

.m-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

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

/* API Status Pill & Modal Enhancements */
.api-pill {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  background: rgba(0, 240, 255, 0.08);
  transition: all 0.2s ease;
}

.api-pill:hover {
  background: rgba(0, 240, 255, 0.18);
  border-color: rgba(0, 240, 255, 0.5);
  transform: translateY(-1px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  display: inline-block;
  animation: pulseDot 1.8s infinite ease-in-out;
}

.pulse-dot.connected {
  background: #34c759;
  box-shadow: 0 0 10px #34c759;
}

.pulse-dot.warning {
  background: #ff9500;
  box-shadow: 0 0 10px #ff9500;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.key-modal-content {
  text-align: left;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-desc code {
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.key-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.key-input-wrap label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.key-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #fff;
  outline: none;
  transition: all 0.2s ease;
}

.key-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.key-hint {
  font-size: 11px;
  color: #64748b;
}

.link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

