﻿:root {
  --bg-color: #0a0e14;
  --panel-bg: rgba(20, 26, 35, 0.95);
  --border-color: #2a3447;
  --accent-color: #3b82f6;
  --text-color: #e0e6ed;
  --text-muted: #8b92a8;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #06b6d4;
  --research: #8b5cf6;
  --code: #00d4aa;
  --glow-blue: rgba(59, 130, 246, 0.15);
  --glow-purple: rgba(139, 92, 246, 0.15);
  --glow-cyan: rgba(0, 212, 255, 0.1);

  /* Design tokens - spacing, radii, transitions */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --spacing-xs: 6px;
  --spacing-sm: 10px;
  --spacing-md: 14px;
  --spacing-lg: 20px;
  --spacing-xl: 24px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-default: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --modal-width-sm: 450px;
  --modal-width-md: 600px;
  --modal-width-lg: 700px;
  --modal-width-xl: 900px;
}

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

body {
  font-family:
    "Space Grotesk", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  user-select: none;
  height: 100vh;
  width: 100vw;
}

/* Animated Background Grid - Simplified for performance */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.5) 1px, transparent 1px);
  background-size: 60px 60px;
  will-change: transform;
}

/* Floating Particles - Optimized */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(59, 130, 246, 0.35);
  border-radius: 50%;
  animation: float-particle 18s linear infinite;
  will-change: transform, opacity;
}

@keyframes float-particle {
  0% {
    transform: translateY(100vh);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-20vh);
    opacity: 0;
  }
}

.game-container {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar canvas"
    "toolbar toolbar";
  grid-template-columns: 360px 1fr;
  grid-template-rows: 70px 1fr 160px;
  height: 100vh;
  width: 100vw;
  gap: 0;
}

.header {
  grid-area: header;
  background: linear-gradient(
    180deg,
    rgba(20, 26, 35, 0.98),
    rgba(15, 20, 28, 0.95)
  );
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(59, 130, 246, 0.1) inset;
  backdrop-filter: blur(10px);
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a855f7, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.5px;
  text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.version-badge {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.4);
  animation: version-pulse 3s ease-in-out infinite;
}

@keyframes version-pulse {
  0%,
  100% {
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.4);
  }
  50% {
    box-shadow: 0 2px 20px rgba(219, 39, 119, 0.5);
  }
}

.header-stats {
  display: flex;
  gap: 12px;
}

.stat-box {
  background: linear-gradient(
    145deg,
    rgba(20, 26, 35, 0.9),
    rgba(10, 14, 20, 0.95)
  );
  border: 1px solid rgba(59, 130, 246, 0.15);
  padding: 8px 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 85px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transition: left 0.5s;
}

.stat-box:hover::before {
  left: 100%;
}

.stat-box:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(
    145deg,
    rgba(30, 40, 55, 0.95),
    rgba(15, 20, 30, 0.98)
  );
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}
.stat-box:active {
  transform: translateY(0) scale(0.98);
}

.stat-icon {
  font-size: 14px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 4px currentColor);
  transition: transform 0.3s;
}
.stat-box:hover .stat-icon {
  transform: scale(1.1);
}
.stat-value {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.stat-rate {
  font-size: 10px;
  color: var(--success);
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  margin-top: 2px;
}

.stat-box.money {
  border-color: rgba(251, 191, 36, 0.2);
}
.stat-box.money .stat-icon {
  color: #fbbf24;
}
.stat-box.money:hover {
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.1);
}

.stat-box.research {
  border-color: rgba(139, 92, 246, 0.2);
}
.stat-box.research .stat-icon {
  color: #a78bfa;
}
.stat-box.research:hover {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.1);
}

.stat-box.code {
  border-color: rgba(0, 212, 170, 0.2);
}
.stat-box.code .stat-icon {
  color: var(--code);
}
.stat-box.code:hover {
  border-color: rgba(0, 212, 170, 0.4);
  box-shadow: 0 4px 15px rgba(0, 212, 170, 0.1);
}

/* Sidebar - Optimized */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(
    180deg,
    rgba(12, 17, 28, 0.98),
    rgba(8, 12, 20, 0.99)
  );
  border-right: 1px solid rgba(59, 130, 246, 0.08);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  z-index: 40;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
  contain: layout style;
  will-change: transform;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.5), rgba(139, 92, 246, 0.5));
}

/* Panel - Enhanced */
.panel {
  background: linear-gradient(
    145deg,
    rgba(22, 30, 46, 0.75),
    rgba(14, 20, 32, 0.85)
  );
  border-radius: 14px;
  contain: layout style paint;
  content-visibility: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.02) inset;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
  border-color: rgba(59, 130, 246, 0.15);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(59, 130, 246, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.panel-title {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.panel-title i {
  filter: drop-shadow(0 0 4px currentColor);
}

.action-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.02)
  );
  color: #e2e8f0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.04)
  );
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

.btn-research {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.25),
    rgba(124, 58, 237, 0.15)
  );
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.15);
}
.btn-research:hover {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.4),
    rgba(124, 58, 237, 0.25)
  );
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
  transform: translateY(-2px);
}

.btn-code {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.2),
    rgba(0, 180, 150, 0.1)
  );
  border-color: rgba(0, 212, 170, 0.4);
  color: #5eead4;
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.15);
}
.btn-code:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.3),
    rgba(0, 180, 150, 0.2)
  );
  box-shadow: 0 4px 15px rgba(0, 212, 170, 0.25);
  transform: translateY(-2px);
}

.btn-contract {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.2),
    rgba(217, 119, 6, 0.1)
  );
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
}
.btn-contract:hover {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.3),
    rgba(217, 119, 6, 0.2)
  );
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
  transform: translateY(-2px);
}

.btn-prestige {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  border: none;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
  animation: prestige-glow 2s ease-in-out infinite;
}
.btn-prestige:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
  filter: brightness(1.1);
}

@keyframes prestige-glow {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
  }
  50% {
    box-shadow: 0 4px 25px rgba(219, 39, 119, 0.45);
  }
}

.btn-help {
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.2),
    rgba(8, 145, 178, 0.1)
  );
  border-color: rgba(6, 182, 212, 0.4);
  color: #67e8f9;
}
.btn-help:hover {
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.3),
    rgba(8, 145, 178, 0.2)
  );
  transform: translateY(-2px);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  transition: 0.3s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
.btn-settings {
  background: linear-gradient(
    135deg,
    rgba(107, 114, 128, 0.15),
    rgba(75, 85, 99, 0.08)
  );
  border: 1px solid rgba(156, 163, 175, 0.25);
  color: #9ca3af;
  width: 100%;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 13px;
}
.btn-settings:hover {
  background: linear-gradient(
    135deg,
    rgba(107, 114, 128, 0.25),
    rgba(75, 85, 99, 0.15)
  );
  border-color: rgba(156, 163, 175, 0.4);
  color: #e5e7eb;
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.25);
}
.btn-settings:active {
  transform: rotate(90deg) scale(0.95);
}
.btn-small {
  padding: 6px;
  font-size: 10px;
}

.storage-bar-container {
  margin-top: 8px;
}
.storage-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 500;
}
.storage-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.storage-fill {
  height: 100%;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.heat-container {
  margin-top: 8px;
}
.heat-track {
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
}
.heat-fill {
  height: 100%;
  width: 0%;
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.3s;
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
  position: relative;
}
.heat-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  animation: shimmer 3s infinite;
  will-change: transform;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.router-cost {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin-top: 10px;
  padding: 10px 14px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-family: "JetBrains Mono", monospace;
}
.router-cost .cost-value {
  color: #fcd34d;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}
.router-cost .cost-value.affordable {
  color: #34d399;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
.router-cost .cost-value.expensive {
  color: #f87171;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Code Panel Styles */
.code-panel {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.08),
    rgba(0, 212, 170, 0.03)
  );
  border: 1px solid rgba(0, 212, 170, 0.2);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.2),
    0 0 30px rgba(0, 212, 170, 0.05);
}

.code-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.code-stat {
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.3));
  padding: 12px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(0, 212, 170, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.code-stat-label {
  font-size: 9px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.code-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #5eead4;
  font-family: "JetBrains Mono", monospace;
  text-shadow: 0 0 15px rgba(0, 212, 170, 0.4);
  margin-top: 4px;
}

.code-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-btn {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.12),
    rgba(0, 180, 150, 0.06)
  );
  border: 1px solid rgba(0, 212, 170, 0.25);
  color: #5eead4;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.1);
}

.code-btn:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.2),
    rgba(0, 180, 150, 0.1)
  );
  border-color: rgba(0, 212, 170, 0.4);
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0, 212, 170, 0.2);
}

.code-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.code-btn-cost {
  font-size: 10px;
  color: #94a3b8;
  font-family: "JetBrains Mono", monospace;
}

/* Driver Badges */
.driver-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.driver-badge {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.15),
    rgba(0, 180, 150, 0.08)
  );
  border: 1px solid rgba(0, 212, 170, 0.3);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  color: #5eead4;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.1);
  transition: all 0.25s ease;
}

.driver-badge:hover {
  transform: scale(1.05);
  border-color: rgba(0, 212, 170, 0.5);
  box-shadow: 0 4px 15px rgba(0, 212, 170, 0.2);
}

.driver-badge i {
  font-size: 10px;
  filter: drop-shadow(0 0 4px currentColor);
}

.contract-widget {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.1),
    rgba(217, 119, 6, 0.05)
  );
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
  display: none;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
}
.contract-widget.active {
  display: block;
  animation: contract-pulse 2s ease-in-out infinite;
}
@keyframes contract-pulse {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
  }
  50% {
    box-shadow: 0 4px 25px rgba(245, 158, 11, 0.2);
  }
}
.contract-timer {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: #fcd34d;
  float: right;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.event-log {
  position: absolute;
  bottom: 180px;
  left: 380px;
  width: 320px;
  max-height: 180px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  pointer-events: none;
  z-index: 100;
  mask-image: linear-gradient(to bottom, transparent 0%, black 20%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%);
}
.log-entry {
  background: linear-gradient(
    90deg,
    rgba(20, 26, 35, 0.98),
    rgba(15, 20, 28, 0.95)
  );
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  border-left: 3px solid #3b82f6;
  animation: log-slide-in 0.3s ease-out;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.03) inset;
  font-family: "JetBrains Mono", monospace;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  flex-shrink: 0;
}

.log-entry::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.3), transparent);
}

.log-entry.good {
  border-left-color: #10b981;
}
.log-entry.good::before {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.3), transparent);
}

.log-entry.bad {
  border-left-color: #ef4444;
}
.log-entry.bad::before {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.3), transparent);
}

.log-entry.code {
  border-left-color: #00d4aa;
}
.log-entry.code::before {
  background: linear-gradient(90deg, rgba(0, 212, 170, 0.3), transparent);
}

.log-entry.warning {
  border-left-color: #f59e0b;
}
.log-entry.warning::before {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.3), transparent);
}

@keyframes log-slide-in {
  from {
    opacity: 0;
    transform: translateX(15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.zoom-controls {
  position: absolute;
  bottom: 180px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  background: linear-gradient(
    145deg,
    rgba(20, 26, 35, 0.95),
    rgba(15, 20, 28, 0.98)
  );
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.zoom-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.zoom-btn:hover {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.04)
  );
  border-color: rgba(59, 130, 246, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}
.zoom-btn:active {
  transform: scale(0.95);
}
.zoom-btn-settings {
  background: linear-gradient(
    145deg,
    rgba(107, 114, 128, 0.15),
    rgba(75, 85, 99, 0.08)
  );
  border-color: rgba(156, 163, 175, 0.2);
  color: #9ca3af;
}
.zoom-btn-settings:hover {
  background: linear-gradient(
    145deg,
    rgba(107, 114, 128, 0.25),
    rgba(75, 85, 99, 0.15)
  );
  border-color: rgba(156, 163, 175, 0.35);
  color: #e5e7eb;
  transform: scale(1.05) rotate(45deg);
  box-shadow: 0 4px 15px rgba(107, 114, 128, 0.2);
}
.zoom-level {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  padding: 6px 0;
  font-family: "JetBrains Mono", monospace;
}

.instructions-list {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.7;
}
.instructions-list li {
  margin-bottom: 8px;
  list-style: none;
  padding-left: 20px;
  position: relative;
  transition: all 0.2s ease;
}
.instructions-list li:hover {
  color: #e2e8f0;
  transform: translateX(4px);
}
.instructions-list li::before {
  content: "\25B8";
  position: absolute;
  left: 0;
  color: #60a5fa;
  font-weight: bold;
}
.instructions-list .key {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  padding: 3px 8px;
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  color: #f1f5f9;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.canvas-viewport {
  grid-area: canvas;
  position: relative;
  background: #0f1218;
  overflow: hidden;
  cursor: grab;
  z-index: 1;
}
.canvas-viewport:active {
  cursor: grabbing;
}

.world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  width: 0;
  height: 0;
  will-change: transform;
}

.grid-bg {
  position: absolute;
  top: -5000px;
  left: -5000px;
  width: 10000px;
  height: 10000px;
  background-image:
    linear-gradient(rgba(40, 50, 70, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 50, 70, 0.3) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

svg.connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: all;
  z-index: 1;
}
.cable {
  fill: none;
  stroke: rgba(100, 116, 139, 0.4);
  stroke-width: 4px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  pointer-events: stroke;
}
.cable:hover {
  stroke: rgba(239, 68, 68, 0.8);
  stroke-width: 8px;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
}
.cable-inner {
  fill: none;
  stroke: #2dd4bf;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-dasharray: 12 12;
  animation: flow 1s linear infinite;
  opacity: 0;
  pointer-events: none;
  will-change: stroke-dashoffset;
  filter: drop-shadow(0 0 4px currentColor);
}
.cable-group.active .cable-inner {
  opacity: 1;
}
.cable-group.active .cable {
  stroke: rgba(15, 23, 42, 0.6);
  stroke-width: 6px;
  opacity: 0.9;
}
.cable-group.disconnected .cable {
  opacity: 0.4;
  stroke: rgba(239, 68, 68, 0.3);
  stroke-dasharray: 4 8;
}
.cable-group.disconnected .cable-inner {
  opacity: 0;
}
.cable-group.power .cable-inner {
  stroke: #f59e0b;
}
.cable-group.money .cable-inner {
  stroke: #10b981;
}
.cable-group.code .cable-inner {
  stroke: #00d4aa;
}
@keyframes flow {
  to {
    stroke-dashoffset: -24;
  }
}

/* Cable Delete Mode */
.cable-delete-mode .cable {
  cursor: crosshair !important;
  animation: pulse-delete 1.5s infinite;
  pointer-events: stroke !important;
}
.cable-delete-mode .cable-group {
  pointer-events: all !important;
}
.cable-delete-mode .cable:hover {
  stroke: #ef4444 !important;
  stroke-width: 6px !important;
}
@keyframes pulse-delete {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.7;
  }
}
#cableDeleteBtn.active {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  animation: pulse 2s infinite;
}

.node {
  position: absolute;
  width: 170px;
  min-height: 70px;
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.95),
    rgba(20, 26, 35, 0.98)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 0;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
  z-index: 10;
}

.node::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

.node.coding {
  border-color: rgba(0, 212, 170, 0.5) !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(0, 212, 170, 0.2),
    0 0 60px rgba(0, 212, 170, 0.1);
}
.node.coding .node-icon-box {
  animation: pulse-code 2s infinite;
}
@keyframes pulse-code {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(0, 212, 170, 0);
  }
}

.node.disconnected {
  border-color: rgba(239, 68, 68, 0.4) !important;
  opacity: 0.7;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}
.node.overheating {
  animation: shake 0.5s infinite;
  border-color: #ef4444 !important;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}
@keyframes shake {
  0% {
    transform: translate(1px, 1px) rotate(0deg);
  }
  25% {
    transform: translate(-1px, -2px) rotate(-1deg);
  }
  50% {
    transform: translate(-3px, 0px) rotate(1deg);
  }
  75% {
    transform: translate(3px, 2px) rotate(0deg);
  }
  100% {
    transform: translate(1px, -1px) rotate(-1deg);
  }
}
.node.infected {
  border-color: rgba(139, 92, 246, 0.6) !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(139, 92, 246, 0.3);
  animation: infected-pulse 2s infinite;
}

@keyframes infected-pulse {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
  }
}

.node.selected {
  border-color: rgba(59, 130, 246, 0.6) !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(59, 130, 246, 0.3),
    0 0 30px rgba(59, 130, 246, 0.2);
}
.clean-btn {
  display: none;
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
}
.clean-btn:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}
.node.infected .clean-btn {
  display: block;
}
.node:hover {
  border-color: var(--text-muted);
}

.node-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.01)
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 15px 15px 0 0;
  height: auto;
  min-height: 60px;
}
.node-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.25));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}
.node:hover .node-icon-box {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.node.working .node-icon-box {
  animation: pulse-work 1.2s infinite;
  border-color: rgba(16, 185, 129, 0.3);
}
@keyframes pulse-work {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
}
.node-info {
  flex: 1;
  overflow: visible;
  min-width: 0;
}
.node-title {
  font-size: 12px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
  max-width: 110px;
}
.node-lvl {
  font-size: 9px;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

.port {
  width: 16px;
  height: 16px;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 2px solid #475569;
  border-radius: 50%;
  position: absolute;
  z-index: 30;
  cursor: crosshair;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.port:hover {
  transform: scale(1.8);
  background: #f8fafc;
  border-color: #60a5fa;
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.5);
}
.port.in {
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
.port.out {
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Node Body Container (holds flow badge and ports) */
.node-body {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 12px 12px;
}

/* Node Hierarchy Flow Badges */
.node-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.flow-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.5px;
  border: 1px solid currentColor;
}
.flow-badge.tier-1 { color: #60a5fa; background: rgba(96, 165, 250, 0.1); }
.flow-badge.tier-2 { color: #a78bfa; background: rgba(167, 139, 250, 0.1); }
.flow-badge.tier-3 { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.flow-badge.tier-4 { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }

/* Glossary Modal Styles */
.glossary-grid {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 8px;
}
.glossary-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.glossary-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 15px var(--glow-blue);
}
.glossary-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.glossary-icon {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.glossary-name {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.glossary-tier-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.glossary-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
  min-height: 3em;
}
.glossary-stats {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.glossary-stat {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.glossary-ports {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}
.port-info {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid currentColor;
}
.port-info.in { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
.port-info.out { color: #10b981; background: rgba(16, 185, 129, 0.1); }

/* Invalid Flow Feedback */
@keyframes invalid-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.invalid-shake {
  animation: invalid-shake 0.2s cubic-bezier(.36,.07,.19,.97) both;
  background: rgba(239, 68, 68, 0.05) !important;
}

/* Dragging state highlights */
body.dragging-out .port.in,
body.dragging-in .port.out {
  animation: port-pulse-valid 0.8s infinite alternate;
  border-width: 3px;
}

@keyframes port-pulse-valid {
  from { box-shadow: 0 0 15px currentColor; }
  to { box-shadow: 0 0 30px currentColor, 0 0 10px currentColor inset; }
}

body.dragging-out .port.out,
body.dragging-in .port.in {
  opacity: 0.2;
  pointer-events: none;
  filter: grayscale(1);
}

/* ==================== CUSTOM TOOLTIP ==================== */
.custom-tooltip {
  position: absolute;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.98));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  color: #f1f5f9;
  font-size: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(10px);
  max-width: 250px;
  line-height: 1.4;
  backdrop-filter: blur(8px);
}
.custom-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.custom-tooltip-title {
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 4px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.custom-tooltip-lvl {
  font-size: 10px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}
.custom-tooltip-desc {
  color: #94a3b8;
  margin-bottom: 4px;
}
.custom-tooltip-fw {
  color: #f97316;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dotted rgba(255, 255, 255, 0.1);
}

/* ==================== TASK 23: NODE DEPTH ==================== */

/* Wide Nodes (Physical Footprint - 2x1) */
.node.node-wide {
  width: 340px;
}
.node.node-wide .node-title {
  max-width: 220px;
}

/* Wide node port positions (4 ports) */
.node.node-wide .port.port-tl { left: -8px; top: 30%; transform: translateY(-50%); }
.node.node-wide .port.port-bl { left: -8px; top: 70%; transform: translateY(-50%); }
.node.node-wide .port.port-tr { right: -8px; top: 30%; transform: translateY(-50%); }
.node.node-wide .port.port-br { right: -8px; top: 70%; transform: translateY(-50%); }

/* Bottleneck Indicator */
.node.bottlenecked {
  border-color: rgba(245, 158, 11, 0.6) !important;
  animation: bottleneck-pulse 1.5s infinite;
}
.node.bottlenecked::after {
  content: "\26A0";
  position: absolute;
  top: -10px;
  right: -5px;
  font-size: 16px;
  z-index: 50;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.6));
}
@keyframes bottleneck-pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.4); }
}

/* Bandwidth Usage Bar */
.bandwidth-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  margin: 0;
  position: relative;
}
.bandwidth-fill {
  height: 100%;
  border-radius: 0 0 16px 16px;
  transition: width 0.5s ease, background 0.3s ease;
  position: relative;
  box-shadow: 0 0 8px currentColor;
}
.bandwidth-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: bw-shimmer 2s infinite;
}
@keyframes bw-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Firmware Badge */
.firmware-badge {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 20, 28, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Firmware-specific node styles */
.node.firmware-encrypted_db {
  border-color: rgba(168, 85, 247, 0.4) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.15);
}
.node.firmware-high_freq {
  border-color: rgba(249, 115, 22, 0.4) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(249, 115, 22, 0.15);
}
.node.firmware-cdn_hub {
  border-color: rgba(59, 130, 246, 0.4) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Firmware Modal */
.firmware-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 15px;
}
.firmware-option {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(20, 26, 35, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}
.firmware-option:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.firmware-option .fw-icon {
  font-size: 28px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 8px currentColor);
}
.firmware-option .fw-name {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 6px;
}
.firmware-option .fw-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 10px;
}
.firmware-option .fw-cost {
  font-size: 12px;
  font-weight: 700;
  color: #fcd34d;
  font-family: "JetBrains Mono", monospace;
}

/* ==================== END TASK 23 ==================== */

.toolbar {
  grid-area: toolbar;
  background: linear-gradient(
    180deg,
    rgba(20, 26, 35, 0.98),
    rgba(15, 20, 28, 0.99)
  );
  border-top: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}
.tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}
.tab {
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.tab:hover {
  color: #e2e8f0;
}
.tab.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
}
.tab.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  filter: blur(2px);
}

.items-tray {
  flex: 1;
  padding: 15px 20px;
  overflow-x: auto;
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Custom scrollbar for items tray */
.items-tray::-webkit-scrollbar {
  height: 6px;
}
.items-tray::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}
.items-tray::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 3px;
}
.items-tray::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

.shop-item {
  min-width: 150px;
  height: auto;
  min-height: 115px;
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.8),
    rgba(20, 26, 35, 0.9)
  );
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
.shop-item:hover:not(.disabled) {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-4px) scale(1.02);
  background: linear-gradient(
    145deg,
    rgba(40, 50, 70, 0.9),
    rgba(30, 40, 55, 0.95)
  );
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(59, 130, 246, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}
.shop-item.disabled {
  opacity: 0.35;
  filter: grayscale(0.8);
  cursor: not-allowed;
}
.shop-item.unaffordable:not(.disabled) {
  opacity: 0.7;
  border-color: rgba(239, 68, 68, 0.4);
}
.shop-item.unaffordable .item-cost {
  color: #ef4444; /* Red cost text */
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}
.item-cost {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.2),
    rgba(245, 158, 11, 0.1)
  );
  color: #fcd34d;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  font-family: "JetBrains Mono", monospace;
}
.item-icon {
  font-size: 22px;
  margin-bottom: 8px;
  color: #fff;
  filter: drop-shadow(0 0 8px currentColor);
  transition: transform 0.3s;
}
.shop-item:hover .item-icon {
  transform: scale(1.1);
}
.item-name {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 3px;
  letter-spacing: 0.3px;
}
.item-desc {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.3;
}

/* Shop Item Flow Tier Badge */
.item-flow-tier {
  margin-top: 2px;
  margin-bottom: 6px;
}
.item-flow-tier .flow-badge {
  font-size: 8.5px;
  padding: 2px 5px;
}

/* Hover Tooltip for Nodes */
.node-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10000;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(5, 8, 15, 0.98));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 12px;
  width: 200px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.node-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.node-tooltip-title {
  font-weight: 700;
  font-size: 14px;
  color: #60a5fa;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.node-tooltip-stat {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}
.node-tooltip-stat span:first-child {
  color: #94a3b8;
}
.node-tooltip-stat span:last-child {
  font-family: "JetBrains Mono", monospace;
  font-weight: bold;
}

/* Modal System - Optimized */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 12, 0.9);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  will-change: opacity;
  contain: layout style;
}
.modal-overlay[style*="flex"] {
  opacity: 1;
}

.modal {
  background: linear-gradient(
    145deg,
    rgba(26, 35, 48, 0.98),
    rgba(15, 23, 35, 0.99)
  );
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 20px;
  padding: 0;
  width: 700px;
  max-width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 100px rgba(59, 130, 246, 0.1);
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
  overflow: hidden;
  will-change: transform, opacity;
  contain: layout style;
}
.modal-overlay[style*="flex"] .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Hide modals that are not displayed to improve performance */
.modal-overlay:not([style*="flex"]) {
  visibility: hidden;
  pointer-events: none;
}
.modal-overlay:not([style*="flex"]) .modal {
  visibility: hidden;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.welcome-container {
  display: flex;
  gap: 12px;
  max-width: 1100px;
  width: 95%;
  max-height: 85vh;
}
.welcome-main {
  flex: 1.3;
  background: linear-gradient(
    145deg,
    rgba(26, 32, 44, 0.98),
    rgba(20, 26, 35, 0.99)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  max-height: 85vh;
}
.welcome-sidebar {
  flex: 0.85;
  background: linear-gradient(
    145deg,
    rgba(26, 32, 44, 0.98),
    rgba(20, 26, 35, 0.99)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  max-height: 85vh;
}
.welcome-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.1), transparent);
  border-radius: 16px 16px 0 0;
}
.welcome-sidebar-header h2 {
  color: #60a5fa;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 600;
}
.welcome-sidebar-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.update-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.feature-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.feature-item:last-child {
  border-bottom: none;
}
.feature-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2),
    rgba(37, 99, 235, 0.1)
  );
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #60a5fa;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.feature-icon.new {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.2),
    rgba(5, 150, 105, 0.1)
  );
  color: #34d399;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.2);
}
.feature-icon.code {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.2),
    rgba(0, 180, 150, 0.1)
  );
  color: #5eead4;
  box-shadow: 0 4px 10px rgba(0, 212, 170, 0.15);
  border-color: rgba(0, 212, 170, 0.2);
}
.feature-content h4 {
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 5px 0;
  letter-spacing: 0.3px;
}
.feature-content p {
  color: #94a3b8;
  font-size: 11px;
  margin: 0;
  line-height: 1.5;
}
.version-tag {
  font-size: 11px;
  color: #64748b;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "JetBrains Mono", monospace;
}

/* Changelog Panel */
.changelog-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid rgba(255, 255, 255, 0.08);
}
.changelog-header {
  font-size: 14px;
  color: #f1f5f9;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.3px;
}
.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.changelog-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.2s ease;
}
.changelog-item:hover {
  color: #e2e8f0;
}
.changelog-item:last-child {
  border-bottom: none;
}
.changelog-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.changelog-badge.fix {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.changelog-badge.balance {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.changelog-badge.bug {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.changelog-badge.ui {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}
.changelog-badge.new {
  background: rgba(236, 72, 153, 0.2);
  color: #ec4899;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(20, 26, 35, 0.8);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 5px;
  border: 2px solid rgba(20, 26, 35, 0.8);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
}
::-webkit-scrollbar-corner {
  background: rgba(20, 26, 35, 0.8);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 rgba(20, 26, 35, 0.8);
}

/* Modal body scrollbars */
.modal-body::-webkit-scrollbar {
  width: 12px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4a5568, #2d3748);
  border-radius: 6px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #64748b, #4a5568);
}

/* Welcome sidebar scrollbar */
.welcome-sidebar-body::-webkit-scrollbar {
  width: 8px;
}
.welcome-sidebar-body::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  border-radius: 4px;
}
.welcome-sidebar-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
}

/* Research tree scrollbar */
.research-tree-container::-webkit-scrollbar {
  height: 12px;
}
.research-tree-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border-radius: 6px;
}
.research-tree-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

/* Research Tree - Optimized */
.research-tree-container {
  position: relative;
  min-height: 700px;
  overflow: auto;
  background: radial-gradient(
    circle at center,
    rgba(30, 40, 55, 0.8) 0%,
    rgba(15, 20, 30, 0.95) 100%
  );
  border-radius: 12px;
  border: 1px solid var(--border-color);
  will-change: transform;
  contain: layout style;
}
.research-tree-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.research-tree-line {
  stroke: #4a5568;
  stroke-width: 2;
  fill: none;
  transition: stroke 0.3s ease;
}
.research-tree-line.unlocked {
  stroke: var(--research);
  stroke-width: 4;
  filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.6));
}
.research-tree-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 30px;
  padding: 40px;
  position: relative;
  z-index: 2;
  min-width: 1200px;
  contain: layout style;
}
.research-tier {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}
.tier-label {
  font-size: 11px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 15px;
  padding: 6px 16px;
  background: linear-gradient(135deg, #4a5568, #2d3748);
  border-radius: 20px;
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.tier-label.tier-1 {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}
.tier-label.tier-2 {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.tier-label.tier-3 {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
}
.tier-label.tier-4 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.tier-label.tier-5 {
  background: linear-gradient(135deg, #ec4899, #db2777);
}
.tier-label.tier-6 {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}
/* Tech Cards - Optimized */
.tech-card {
  background: linear-gradient(135deg, #2d3748, #1a202c);
  border: 2px solid #4a5568;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
  position: relative;
  width: 140px;
  z-index: 3;
  will-change: transform;
  contain: layout style;
  backface-visibility: hidden;
}
.tech-card:hover:not(.locked):not(.owned) {
  border-color: var(--research);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25);
}
.tech-card.locked {
  opacity: 0.5;
  filter: grayscale(1);
  cursor: not-allowed;
}
.tech-card.owned {
  border-color: var(--success);
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.2),
    rgba(16, 185, 129, 0.05)
  );
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
}
.tech-card.owned::after {
  content: "\2713";
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--success);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.tech-card.available {
  border-color: var(--research);
  animation: pulse-available 3s infinite;
}
@keyframes pulse-available {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(139, 92, 246, 0);
  }
}
.tech-icon {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--research);
}
.tech-card.owned .tech-icon {
  color: var(--success);
}
.tech-card.locked .tech-icon {
  color: #64748b;
}
.tech-name {
  font-weight: bold;
  color: #fff;
  font-size: 12px;
  margin-bottom: 5px;
}
.tech-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.3;
}
.tech-cost {
  color: var(--research);
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.tech-cost.affordable {
  color: var(--success);
}
.tech-req {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* === Tier Navigation Bar === */
.research-tier-nav {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(20, 26, 35, 0.95), rgba(15, 20, 30, 0.8));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  justify-content: center;
  flex-wrap: wrap;
}

.tier-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'JetBrains Mono', monospace;
}

.tier-nav-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.tier-nav-btn.completed {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.tier-nav-label {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.tier-nav-progress {
  font-size: 9px;
  color: #64748b;
}

.tier-nav-btn.completed .tier-nav-progress {
  color: #10b981;
}

/* Tier nav button colors */
.tier-nav-1 { border-color: rgba(34, 197, 94, 0.3); }
.tier-nav-1:hover { border-color: #22c55e; box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2); }
.tier-nav-2 { border-color: rgba(59, 130, 246, 0.3); }
.tier-nav-2:hover { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2); }
.tier-nav-3 { border-color: rgba(168, 85, 247, 0.3); }
.tier-nav-3:hover { border-color: #a855f7; box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2); }
.tier-nav-4 { border-color: rgba(245, 158, 11, 0.3); }
.tier-nav-4:hover { border-color: #f59e0b; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2); }
.tier-nav-5 { border-color: rgba(236, 72, 153, 0.3); }
.tier-nav-5:hover { border-color: #ec4899; box-shadow: 0 4px 12px rgba(236, 72, 153, 0.2); }
.tier-nav-6 { border-color: rgba(239, 68, 68, 0.3); }
.tier-nav-6:hover { border-color: #ef4444; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }

/* === Tech Card Tier Accent Strip === */
.tech-tier-accent {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 12px 0 0 12px;
  opacity: 0.8;
}

.tier-accent-1 { background: linear-gradient(180deg, #22c55e, #16a34a); }
.tier-accent-2 { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.tier-accent-3 { background: linear-gradient(180deg, #a855f7, #7c3aed); }
.tier-accent-4 { background: linear-gradient(180deg, #f59e0b, #d97706); }
.tier-accent-5 { background: linear-gradient(180deg, #ec4899, #db2777); }
.tier-accent-6 { background: linear-gradient(180deg, #ef4444, #dc2626); }

/* === Tech Unlocks Tooltip === */
.tech-unlocks {
  font-size: 9px;
  color: #60a5fa;
  margin-bottom: 6px;
  padding: 3px 6px;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.tech-card.owned .tech-unlocks {
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.15);
}

.tech-card.locked .tech-unlocks {
  color: #475569;
  background: rgba(71, 85, 105, 0.08);
  border-color: rgba(71, 85, 105, 0.15);
}

/* === Tier Label Sub-Name === */
.tier-label-name {
  display: block;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-top: 2px;
}

.tier-label-num {
  display: block;
}

/* === Unlock Celebration Animation === */
.tech-card.just-unlocked {
  animation: tech-unlock-celebrate 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  z-index: 10;
}

@keyframes tech-unlock-celebrate {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  30% {
    transform: scale(1.12);
    box-shadow:
      0 0 30px rgba(16, 185, 129, 0.5),
      0 0 60px rgba(16, 185, 129, 0.2);
  }
  60% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
  }
}

/* === Partial Connector Line (prerequisite unlocked, target not yet) === */
.research-tree-line.partial {
  stroke: rgba(139, 92, 246, 0.4);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

/* === Animated Flowing Lines for Owned Connections === */
.research-tree-line.unlocked {
  stroke: var(--research);
  stroke-width: 3;
  filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.6));
  stroke-dasharray: 8 4;
  animation: research-line-flow 1.5s linear infinite;
}

@keyframes research-line-flow {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -24; }
}

/* === ULP: Disable Research Tree Animations === */
body.ultra-low-perf .tech-card.just-unlocked {
  animation: none !important;
}

body.ultra-low-perf .research-tree-line.unlocked {
  animation: none !important;
  stroke-dasharray: none !important;
  filter: none !important;
}

body.ultra-low-perf .tech-card.available {
  animation: none !important;
}

body.ultra-low-perf .tech-card.available::before {
  animation: none !important;
}

body.ultra-low-perf .tier-nav-btn:hover {
  transform: none !important;
}

/* Code Modal - Optimized */
.code-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  will-change: transform;
  contain: layout style;
}
.code-section {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid var(--border-color);
  contain: layout style paint;
}
.code-section h3 {
  color: var(--code);
  font-size: 14px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.driver-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  contain: layout;
}
.driver-card {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 170, 0.1),
    rgba(0, 212, 170, 0.05)
  );
  border: 1px solid rgba(0, 212, 170, 0.3);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  will-change: transform;
  contain: layout style;
  backface-visibility: hidden;
}
.driver-card:hover:not(.locked) {
  border-color: var(--code);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 212, 170, 0.2);
}
.driver-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.driver-card.installed {
  border-color: var(--success);
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.15),
    rgba(16, 185, 129, 0.05)
  );
}
.driver-card.updating {
  animation: driver-pulse 0.3s ease;
}
@keyframes driver-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}
.driver-icon {
  font-size: 20px;
  color: var(--code);
  margin-bottom: 5px;
}
.driver-name {
  font-size: 11px;
  font-weight: bold;
  color: #fff;
}
.driver-desc {
  font-size: 9px;
  color: var(--text-muted);
  margin: 4px 0;
}
.driver-cost {
  font-size: 10px;
  color: var(--code);
}
.driver-level {
  font-size: 9px;
  color: var(--success);
  margin-top: 4px;
}

/* Optimize stat value changes */
.code-stat-value {
  transition: color 0.2s ease;
}
.code-stat-value.changed {
  animation: value-flash 0.3s ease;
}
@keyframes value-flash {
  0% {
    color: #fff;
    text-shadow: 0 0 10px currentColor;
  }
  100% {
    color: var(--code);
    text-shadow: none;
  }
}

.contract-item {
  background: rgba(40, 50, 70, 0.4);
  border: 1px solid #4a5568;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.contract-item h4 {
  color: #fff;
  font-size: 14px;
  margin-bottom: 4px;
}
.contract-item p {
  color: #a0aec0;
  font-size: 12px;
}
.contract-reward {
  color: #fbbf24;
  font-weight: bold;
  font-size: 13px;
  text-align: right;
}

#contextMenu {
  position: fixed;
  background: linear-gradient(
    145deg,
    rgba(26, 35, 48, 0.98),
    rgba(15, 23, 35, 0.99)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  z-index: 5000;
  display: none;
  min-width: 170px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(10px);
  animation: ctx-appear 0.2s ease;
}

@keyframes ctx-appear {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ctx-item {
  padding: 12px 16px;
  cursor: pointer;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}
.ctx-item:hover {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.15),
    rgba(37, 99, 235, 0.1)
  );
  color: #fff;
}
.ctx-item.danger {
  color: #f87171;
}
.ctx-item.danger:hover {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.15),
    rgba(220, 38, 38, 0.1)
  );
  color: #fca5a5;
}
.ctx-item span:last-child {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}

.help-section {
  margin-bottom: 24px;
  padding: 16px;
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.4),
    rgba(20, 26, 35, 0.5)
  );
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.help-section h3 {
  color: #60a5fa;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.help-item {
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.6),
    rgba(20, 26, 35, 0.7)
  );
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
}
.help-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
.help-item-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
  color: #f1f5f9;
}
.help-item-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.floating-text {
  position: fixed;
  pointer-events: none;
  font-weight: 700;
  font-size: 15px;
  z-index: 3000;
  animation: float-up 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  text-shadow: 0 0 20px currentColor;
  font-family: "JetBrains Mono", monospace;
}
@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
}

/* Achievements */
.achievement-popup {
  position: fixed;
  top: 90px;
  right: -450px;
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.98),
    rgba(217, 119, 6, 0.98)
  );
  color: white;
  padding: 18px 24px;
  border-radius: 16px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 0 40px rgba(245, 158, 11, 0.3);
  z-index: 4000;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 380px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
}
.achievement-popup.show {
  right: 24px;
  animation: achievement-glow 2s ease-in-out infinite;
}

@keyframes achievement-glow {
  0%,
  100% {
    box-shadow:
      0 20px 50px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(255, 255, 255, 0.1) inset,
      0 0 40px rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow:
      0 20px 50px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(255, 255, 255, 0.1) inset,
      0 0 60px rgba(245, 158, 11, 0.5);
  }
}

.achievement-popup i {
  font-size: 28px;
  margin-right: 14px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}
.achievement-popup h4 {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.achievement-popup p {
  margin: 0;
  font-size: 13px;
  opacity: 0.95;
  font-weight: 500;
}
.achievement-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Event Notifications */
.event-notification {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-1000px);
  background: linear-gradient(
    145deg,
    rgba(20, 26, 35, 0.99),
    rgba(15, 23, 35, 0.98)
  );
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 24px 36px;
  border-radius: 20px;
  z-index: 3500;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  min-width: 420px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 80px rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(10px);
}
.event-notification.show {
  transform: translateX(-50%) translateY(0);
}
.event-notification.good {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 80px rgba(16, 185, 129, 0.2);
}
.event-notification.bad {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 80px rgba(239, 68, 68, 0.2);
}
.event-notification h3 {
  margin: 0 0 12px 0;
  color: #60a5fa;
  font-size: 18px;
  font-weight: 700;
}
.event-notification.good h3 {
  color: #34d399;
}
.event-notification.bad h3 {
  color: #f87171;
}
.event-notification p {
  color: #e2e8f0;
  font-size: 14px;
  margin-bottom: 12px;
}
.event-notification #eventEffect {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

/* Stats Panel */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-item {
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.7),
    rgba(20, 26, 35, 0.8)
  );
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.25s ease;
}
.stat-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.stat-label {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.stat-value-large {
  font-size: 20px;
  font-weight: 700;
  color: #60a5fa;
  margin-top: 6px;
  font-family: "JetBrains Mono", monospace;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Particle Effects */
.particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  animation: particle-fade 1s ease-out forwards;
}
@keyframes particle-fade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0) translate(var(--tx), var(--ty));
  }
}

/* Multi-select */
.selection-box {
  position: absolute;
  border: 2px dashed var(--accent-color);
  background: rgba(59, 130, 246, 0.1);
  pointer-events: none;
  z-index: 100;
}
.node.selected-multi {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

/* Combo indicator */
.combo-indicator {
  position: fixed;
  top: 140px;
  right: 20px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 14px;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
  z-index: 2500;
}
.combo-indicator.show {
  opacity: 1;
  transform: scale(1.1);
}

/* Prestige Button */
.prestige-btn {
  background: linear-gradient(135deg, #7c3aed, #db2777) !important;
  color: white !important;
  font-weight: bold;
  animation: prestige-pulse 2s infinite;
}
@keyframes prestige-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
  }
  50% {
    box-shadow: 0 0 20px 5px rgba(124, 58, 237, 0.2);
  }
}

/* Cloud Save Status */
.cloud-save-status {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(20, 26, 35, 0.95);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}
.cloud-save-status.online {
  border-color: #10b981;
  color: #10b981;
}
.cloud-save-status.syncing {
  border-color: #f59e0b;
  color: #f59e0b;
  animation: pulse 1s infinite;
}
.cloud-save-status.error {
  border-color: #ef4444;
  color: #ef4444;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Notification animations */
@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Sync indicator in sidebar */
.sync-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
}
.sync-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
           VISUAL ENHANCEMENTS � Task 3
           ============================================ */

/* === Enhanced Canvas Background with Ambient Glow === */
.canvas-viewport::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      ellipse 800px 600px at 30% 40%,
      rgba(59, 130, 246, 0.04) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 600px 500px at 70% 60%,
      rgba(139, 92, 246, 0.03) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 500px 400px at 50% 50%,
      rgba(0, 212, 170, 0.02) 0%,
      transparent 70%
    );
  pointer-events: none;
  z-index: 0;
  animation: ambient-shift 20s ease-in-out infinite alternate;
}

@keyframes ambient-shift {
  0% {
    background:
      radial-gradient(
        ellipse 800px 600px at 30% 40%,
        rgba(59, 130, 246, 0.04) 0%,
        transparent 70%
      ),
      radial-gradient(
        ellipse 600px 500px at 70% 60%,
        rgba(139, 92, 246, 0.03) 0%,
        transparent 70%
      ),
      radial-gradient(
        ellipse 500px 400px at 50% 50%,
        rgba(0, 212, 170, 0.02) 0%,
        transparent 70%
      );
  }
  50% {
    background:
      radial-gradient(
        ellipse 700px 500px at 60% 30%,
        rgba(139, 92, 246, 0.04) 0%,
        transparent 70%
      ),
      radial-gradient(
        ellipse 800px 600px at 40% 70%,
        rgba(59, 130, 246, 0.03) 0%,
        transparent 70%
      ),
      radial-gradient(
        ellipse 600px 400px at 50% 50%,
        rgba(0, 212, 255, 0.02) 0%,
        transparent 70%
      );
  }
  100% {
    background:
      radial-gradient(
        ellipse 600px 500px at 70% 50%,
        rgba(0, 212, 170, 0.04) 0%,
        transparent 70%
      ),
      radial-gradient(
        ellipse 700px 600px at 30% 40%,
        rgba(59, 130, 246, 0.03) 0%,
        transparent 70%
      ),
      radial-gradient(
        ellipse 500px 400px at 50% 60%,
        rgba(139, 92, 246, 0.02) 0%,
        transparent 70%
      );
  }
}

/* === Cyberpunk Scanline Overlay === */
.canvas-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.015) 2px,
    rgba(0, 0, 0, 0.015) 4px
  );
  pointer-events: none;
  z-index: 999;
  mix-blend-mode: multiply;
}

/* === Enhanced Grid Background with Breathing Effect === */
.grid-bg {
  animation: grid-breathe 8s ease-in-out infinite;
}

@keyframes grid-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* === Enhanced Node Type Glow Effects === */
.node[data-type="core"] {
  border-color: rgba(59, 130, 246, 0.25);
}
.node[data-type="core"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(59, 130, 246, 0.15),
    0 0 80px rgba(59, 130, 246, 0.05);
}

.node[data-type="download"] {
  border-color: rgba(96, 165, 250, 0.15);
}
.node[data-type="download"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(96, 165, 250, 0.12);
}

.node[data-type="upload"] {
  border-color: rgba(45, 212, 191, 0.15);
}
.node[data-type="upload"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(45, 212, 191, 0.12);
}

.node[data-type="infra"] {
  border-color: rgba(251, 191, 36, 0.12);
}
.node[data-type="infra"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(251, 191, 36, 0.1);
}

.node[data-type="lab"] {
  border-color: rgba(139, 92, 246, 0.15);
}
.node[data-type="lab"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(139, 92, 246, 0.12);
}

.node[data-type="special"] {
  border-color: rgba(249, 115, 22, 0.15);
}
.node[data-type="special"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(249, 115, 22, 0.12);
}

.node[data-type="advanced"] {
  border-color: rgba(100, 116, 139, 0.15);
}
.node[data-type="advanced"]:hover {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(100, 116, 139, 0.12);
}

/* === Enhanced Header with Animated Border Glow === */
.header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.4) 20%,
    rgba(139, 92, 246, 0.5) 50%,
    rgba(59, 130, 246, 0.4) 80%,
    transparent 100%
  );
  animation: header-glow-sweep 6s ease-in-out infinite;
}

@keyframes header-glow-sweep {
  0%,
  100% {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(59, 130, 246, 0.4) 20%,
      rgba(139, 92, 246, 0.5) 50%,
      rgba(59, 130, 246, 0.4) 80%,
      transparent 100%
    );
  }
  33% {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(139, 92, 246, 0.4) 20%,
      rgba(0, 212, 170, 0.5) 50%,
      rgba(139, 92, 246, 0.4) 80%,
      transparent 100%
    );
  }
  66% {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(0, 212, 170, 0.4) 20%,
      rgba(59, 130, 246, 0.5) 50%,
      rgba(0, 212, 170, 0.4) 80%,
      transparent 100%
    );
  }
}

/* === Enhanced Toolbar with Top Glow Border === */
.toolbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.3) 30%,
    rgba(59, 130, 246, 0.5) 50%,
    rgba(59, 130, 246, 0.3) 70%,
    transparent 100%
  );
  z-index: 1;
}

.toolbar {
  position: relative;
}

/* === Enhanced Cable Glow Effects === */
.cable-group.active .cable {
  filter: drop-shadow(0 0 3px rgba(71, 85, 105, 0.3));
}
.cable-group.active .cable-inner {
  filter: drop-shadow(0 0 4px currentColor);
}
.cable-group.power .cable-inner {
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.4));
}
.cable-group.money .cable-inner {
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
}
.cable-group.code .cable-inner {
  filter: drop-shadow(0 0 6px rgba(0, 212, 170, 0.4));
}

/* === Enhanced Port Glow on Hover === */
.port.in:hover {
  box-shadow:
    0 0 20px rgba(59, 130, 246, 0.6),
    0 0 40px rgba(59, 130, 246, 0.3),
    0 0 60px rgba(59, 130, 246, 0.1);
}
.port.out:hover {
  box-shadow:
    0 0 20px rgba(16, 185, 129, 0.6),
    0 0 40px rgba(16, 185, 129, 0.3),
    0 0 60px rgba(16, 185, 129, 0.1);
}

/* === Enhanced Stat Box Micro-interactions === */
.stat-box .stat-value {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-box:hover .stat-value {
  text-shadow: 0 0 15px currentColor;
}
.stat-box.money:hover .stat-value {
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}
.stat-box.research:hover .stat-value {
  text-shadow: 0 0 15px rgba(167, 139, 250, 0.5);
}
.stat-box.code:hover .stat-value {
  text-shadow: 0 0 15px rgba(0, 212, 170, 0.5);
}

/* === Enhanced Panel Hover with Colored Glow === */
.panel {
  position: relative;
}
.panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(59, 130, 246, 0.3),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}
.panel:hover::before {
  opacity: 1;
}

/* === Enhanced Shop Item Hover with Type-colored Glow === */
.shop-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 14px;
  background: radial-gradient(
    ellipse at center,
    rgba(59, 130, 246, 0.05) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.shop-item:hover:not(.disabled)::before {
  opacity: 1;
}

/* === Enhanced Active Tab Indicator === */
.tab.active {
  text-shadow: 0 0 20px rgba(96, 165, 250, 0.4);
}

/* === Subtle Vignette Effect on Canvas === */
.canvas-viewport {
  background: radial-gradient(ellipse at center, #0f1218 0%, #0a0d12 100%);
}

/* === Enhanced Node Working State === */
.node.working {
  border-color: rgba(16, 185, 129, 0.2);
}
.node.working::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 17px;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(16, 185, 129, 0.15) 10%,
    transparent 20%
  );
  animation: node-working-spin 3s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes node-working-spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Enhanced Floating Text with Better Animation === */
.floating-text {
  filter: blur(0px);
  transition: filter 0.3s;
}

/* === Enhanced Event Log Entries === */
.log-entry {
  backdrop-filter: blur(8px);
}
.log-entry::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 3px;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent);
}
.log-entry.good::after {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), transparent);
}
.log-entry.bad::after {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), transparent);
}

/* === Enhanced Modal Backdrop === */
.modal-overlay[style*="flex"] {
  background: radial-gradient(
    ellipse at center,
    rgba(5, 8, 12, 0.82) 0%,
    rgba(5, 8, 12, 0.95) 100%
  );
  backdrop-filter: blur(14px);
}

/* === Enhanced Welcome Modal Glow === */
.welcome-main {
  position: relative;
}
.welcome-main::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(59, 130, 246, 0.4),
    transparent
  );
  z-index: 1;
}

/* === Enhanced Sidebar Border Glow === */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(59, 130, 246, 0.2) 20%,
    rgba(139, 92, 246, 0.15) 50%,
    rgba(59, 130, 246, 0.2) 80%,
    transparent 100%
  );
  z-index: 1;
}

.sidebar {
  position: relative;
}

/* === Enhanced Button Press Feedback === */
.btn:active {
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2) inset;
}
.btn-primary:active {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3) inset;
}

/* === Enhanced Zoom Controls Glass Effect === */
.zoom-controls {
  backdrop-filter: blur(12px);
}

/* === Enhanced Context Menu � use outline instead of border-image to preserve border-radius === */
#contextMenu {
  border: 1px solid rgba(99, 110, 140, 0.25);
  outline: 1px solid rgba(59, 130, 246, 0.12);
  outline-offset: -1px;
}

/* === Enhanced Achievement Popup === */
.achievement-popup.show {
  backdrop-filter: blur(8px);
}

/* === Smooth Resource Value Transitions === */
.stat-value,
.stat-rate {
  transition: all 0.3s ease;
}

/* === Enhanced Research Tech Card Hover === */
.tech-card:hover:not(.locked):not(.owned) {
  backdrop-filter: blur(4px);
}
.tech-card.available {
  position: relative;
}
.tech-card.available::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.3),
    rgba(59, 130, 246, 0.2),
    rgba(139, 92, 246, 0.3)
  );
  z-index: -1;
  opacity: 0;
  animation: tech-available-glow 3s ease-in-out infinite;
}

@keyframes tech-available-glow {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* === Enhanced Daily Rewards Modal === */
.daily-reward-item.current {
  position: relative;
}
.daily-reward-item.current::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.4),
    rgba(245, 158, 11, 0.2)
  );
  z-index: -1;
  animation: reward-pulse 2s ease-in-out infinite;
}

@keyframes reward-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* === Enhanced Particle Variety === */
.particle:nth-child(3n) {
  background: rgba(139, 92, 246, 0.3);
  width: 3px;
  height: 3px;
}
.particle:nth-child(5n) {
  background: rgba(0, 212, 170, 0.25);
  width: 1px;
  height: 1px;
}
.particle:nth-child(7n) {
  background: rgba(251, 191, 36, 0.2);
  width: 2px;
  height: 2px;
  animation-duration: 25s;
}

/* === Enhanced Background Grid Animation === */
.bg-grid {
  animation: grid-drift 30s linear infinite;
}

@keyframes grid-drift {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(60px, 60px);
  }
}

/* === Enhanced Node Icon Glow by Color === */
.node-icon-box i {
  filter: drop-shadow(0 0 6px currentColor);
  transition: filter 0.3s ease;
}
.node:hover .node-icon-box i {
  filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 20px currentColor);
}

/* === Enhanced Storage Bar === */
.storage-fill {
  position: relative;
}
.storage-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: storage-shimmer 2s ease-in-out infinite;
}

@keyframes storage-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* === Enhanced Contract Widget === */
.contract-widget.active {
  position: relative;
  overflow: hidden;
}
.contract-widget.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(245, 158, 11, 0.05),
    transparent
  );
  animation: contract-sweep 3s ease-in-out infinite;
}

@keyframes contract-sweep {
  0% {
    left: -50%;
  }
  100% {
    left: 150%;
  }
}

/* === Smooth Page Load Transition === */
.game-container {
  animation: game-fade-in 0.8s ease-out;
}

@keyframes game-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* === Enhanced Selection Box === */
.selection-box {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow:
    0 0 20px rgba(59, 130, 246, 0.1),
    inset 0 0 20px rgba(59, 130, 246, 0.05);
}

/* === Enhanced Cloud Save Status === */
.cloud-save-status {
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.cloud-save-status.online {
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
}

/* === Enhanced Prestige Button === */
.prestige-btn {
  position: relative;
  overflow: hidden;
}
.prestige-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 10%,
    transparent 20%
  );
  animation: prestige-spin 4s linear infinite;
  pointer-events: none;
}

@keyframes prestige-spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Enhanced Tooltip Styles === */
[title]:hover {
  position: relative;
}

/* === Subtle Text Rendering Enhancement === */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === Enhanced Focus States for Accessibility === */
.btn:focus-visible,
.tab:focus-visible,
.shop-item:focus-visible,
.tech-card:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* === Form Input Styles (extracted from inline) === */
.form-input {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.form-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.form-input::placeholder {
  color: #64748b;
}
.form-input + .form-input {
  margin-top: 10px;
}

/* === Setting Item Styles (extracted from inline) === */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 10px;
  transition: background 0.2s ease;
}
.setting-item:last-child {
  margin-bottom: 0;
}
.setting-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.setting-item-label {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
}
.setting-item-desc {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.settings-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
}
.settings-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.settings-section h3 {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.settings-section h3 i {
  filter: drop-shadow(0 0 4px currentColor);
  font-size: 14px;
}

/* Danger Zone section emphasis */
.settings-section:last-child h3 {
  color: var(--danger);
}

/* === Reduce Motion Mode === */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* === Enhanced Disabled State === */
.shop-item.disabled {
  position: relative;
  border-color: rgba(100, 116, 139, 0.08);
}
.shop-item.disabled:hover {
  transform: none;
  cursor: not-allowed;
}

/* === Desktop Download Button === */
.desktop-download-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.12),
    rgba(59, 130, 246, 0.08)
  );
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 12px;
  color: #7dd3fc;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.1);
}
.desktop-download-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 212, 255, 0.08),
    transparent
  );
  animation: desktop-shimmer 3s ease-in-out infinite;
}
@keyframes desktop-shimmer {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(50%);
  }
}
.desktop-download-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.2),
    rgba(59, 130, 246, 0.15)
  );
  border-color: rgba(0, 212, 255, 0.5);
  transform: translateY(-2px);
  box-shadow:
    0 8px 30px rgba(0, 212, 255, 0.2),
    0 0 20px rgba(0, 212, 255, 0.1);
}
.desktop-download-btn:active {
  transform: translateY(0);
}
.desktop-download-btn i {
  font-size: 22px;
  color: #00d4ff;
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
  flex-shrink: 0;
}
.desktop-download-btn strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #e0f2fe;
  margin-bottom: 2px;
}
.desktop-download-btn small {
  display: block;
  font-size: 10px;
  color: #64748b;
  font-weight: 400;
}

/* === Coding Upgrade Tree === */
.coding-upgrade-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 212, 170, 0.15);
}
.coding-tier {
  margin-bottom: 16px;
}
.coding-tier-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}
.coding-tier-label.tier-1 {
  color: #5eead4;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.2);
}
.coding-tier-label.tier-2 {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.coding-tier-label.tier-3 {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.coding-upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.coding-upgrade-card {
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}
.coding-upgrade-card:hover:not(.locked):not(.owned) {
  border-color: rgba(0, 212, 170, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 170, 0.15);
}
.coding-upgrade-card.owned {
  background: linear-gradient(
    145deg,
    rgba(0, 212, 170, 0.12),
    rgba(0, 180, 150, 0.06)
  );
  border-color: rgba(0, 212, 170, 0.3);
}
.coding-upgrade-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.coding-upgrade-card .upgrade-icon {
  font-size: 20px;
  margin-bottom: 6px;
  color: #5eead4;
  filter: drop-shadow(0 0 6px rgba(0, 212, 170, 0.4));
}
.coding-upgrade-card.owned .upgrade-icon {
  color: #10b981;
}
.coding-upgrade-card .upgrade-name {
  font-size: 10px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 4px;
}
.coding-upgrade-card .upgrade-desc {
  font-size: 9px;
  color: #64748b;
  margin-bottom: 6px;
  line-height: 1.3;
}
.coding-upgrade-card .upgrade-cost {
  font-size: 9px;
  font-weight: 600;
  color: #5eead4;
  font-family: "JetBrains Mono", monospace;
}
.coding-upgrade-card.owned .upgrade-cost {
  color: #10b981;
}

/* === Ultra Low Performance Mode === */
body.ultra-low-perf * {
  box-shadow: none !important;
  text-shadow: none !important;
  backdrop-filter: none !important;
}

body.ultra-low-perf .bg-grid {
  display: none !important;
}

body.ultra-low-perf .node:hover,
body.ultra-low-perf .btn:hover,
body.ultra-low-perf .stat-box:hover,
body.ultra-low-perf .action-btn:hover {
  transform: none !important;
}

body.ultra-low-perf .cable.active {
  stroke-dasharray: none !important;
  animation: none !important;
}

body.ultra-low-perf .router-node .node-icon-bg,
body.ultra-low-perf .quantum-node .node-icon-bg {
  animation: none !important;
}

body.ultra-low-perf .version-badge {
  animation: none !important;
}

body.ultra-low-perf .btn-prestige {
  animation: none !important;
}

/* ==================== TUTORIAL SYSTEM ==================== */

/* Overlay - dims everything except the highlighted element */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 12, 0.75);
  z-index: 9998;
  display: none;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

/* Highlight ring � spotlight cutout effect */
.tutorial-highlight {
  position: fixed;
  z-index: 9999;
  display: none;
  border: 2px solid rgba(96, 165, 250, 0.9);
  border-radius: 12px;
  /* Spotlight cutout: massive box-shadow dims the entire viewport */
  box-shadow:
    0 0 0 9999px rgba(5, 8, 12, 0.82),
    0 0 25px rgba(59, 130, 246, 0.5),
    0 0 50px rgba(59, 130, 246, 0.2),
    inset 0 0 15px rgba(59, 130, 246, 0.08);
  pointer-events: none;
  animation: tutorial-spotlight-pulse 2s ease-in-out infinite;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tutorial-spotlight-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 9999px rgba(5, 8, 12, 0.82),
      0 0 25px rgba(59, 130, 246, 0.5),
      0 0 50px rgba(59, 130, 246, 0.2),
      inset 0 0 15px rgba(59, 130, 246, 0.08);
    border-color: rgba(96, 165, 250, 0.9);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(5, 8, 12, 0.82),
      0 0 35px rgba(96, 165, 250, 0.7),
      0 0 70px rgba(59, 130, 246, 0.35),
      inset 0 0 25px rgba(59, 130, 246, 0.12);
    border-color: rgba(147, 197, 253, 1);
  }
}

/* When spotlight highlight is active, overlay becomes transparent (shadow does the dimming) */
.tutorial-overlay.spotlight {
  background: transparent;
}

/* ULP: disable tutorial glow effects */
body.ultra-low-perf .tutorial-highlight {
  animation: none !important;
  box-shadow: 0 0 0 9999px rgba(5, 8, 12, 0.85) !important;
}

body.ultra-low-perf .tutorial-tooltip {
  backdrop-filter: none !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

body.ultra-low-perf .node-tooltip {
  transition: none !important;
  backdrop-filter: none !important;
}

body.ultra-low-perf .tutorial-tooltip::before {
  display: none !important;
}

body.ultra-low-perf .tutorial-btn-next {
  box-shadow: none !important;
}

/* Tooltip card */
.tutorial-tooltip {
  position: fixed;
  z-index: 10000;
  display: none;
  width: 380px;
  max-width: 90vw;
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.97),
    rgba(10, 15, 25, 0.98)
  );
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 16px;
  padding: 0;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(59, 130, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  font-family: "Space Grotesk", sans-serif;
  opacity: 0;
  transform: translateY(15px);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tutorial-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tutorial-tooltip.pos-center {
  transform: translate(-50%, -50%);
}

.tutorial-tooltip.pos-center.show {
  transform: translate(-50%, -50%);
}

/* Tooltip top glow bar */
.tutorial-tooltip::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(59, 130, 246, 0.8),
    rgba(139, 92, 246, 0.6),
    rgba(59, 130, 246, 0.8),
    transparent
  );
  border-radius: 2px;
}

/* Header */
.tutorial-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tutorial-tooltip-title {
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.tutorial-tooltip-title i {
  color: #60a5fa;
  font-size: 18px;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.tutorial-step-count {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  font-family: "JetBrains Mono", monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Body */
.tutorial-tooltip-body {
  padding: 14px 20px;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.65;
}

.tutorial-tooltip-body strong {
  color: #e2e8f0;
  font-weight: 600;
}

/* Footer */
.tutorial-tooltip-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Progress dots */
.tutorial-progress {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-bottom: 12px;
}

.tutorial-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.tutorial-dot.active {
  background: #3b82f6;
  border-color: #60a5fa;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
  transform: scale(1.2);
}

.tutorial-dot.done {
  background: #10b981;
  border-color: #34d399;
}

/* Action buttons */
.tutorial-tooltip-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.tutorial-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Space Grotesk", sans-serif;
}

.tutorial-btn-next {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.tutorial-btn-next:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.tutorial-btn-skip {
  background: transparent;
  color: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  padding: 6px 14px;
}

.tutorial-btn-skip:hover {
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.tutorial-btn-skip:empty {
  display: none;
}

/* ==================== LOGIC CONTROLLER ==================== */
.logic-modal {
  width: 560px;
  max-width: 95vw;
  max-height: 85vh;
}

.logic-rule-row {
  background: rgba(244, 114, 182, 0.05);
  border: 1px solid rgba(244, 114, 182, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.logic-rule-row:hover {
  border-color: rgba(244, 114, 182, 0.35);
}

.logic-rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.logic-rule-num {
  font-size: 11px;
  font-weight: 700;
  color: #f472b6;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.logic-rule-status {
  font-size: 10px;
  color: var(--text-muted);
}

.logic-rule-status.active {
  color: #10b981;
}

.logic-rule-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logic-rule-condition,
.logic-rule-action {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.logic-rule-condition label,
.logic-rule-action label {
  font-size: 11px;
  font-weight: 700;
  color: #60a5fa;
  min-width: 35px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.logic-rule-action label {
  color: #fbbf24;
}

.logic-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 6px 8px;
  font-size: 12px;
  min-width: 100px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.logic-select:focus {
  border-color: #f472b6;
  outline: none;
}

.logic-select-sm {
  min-width: 50px;
  max-width: 55px;
  text-align: center;
}

.logic-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 6px 8px;
  font-size: 12px;
  width: 90px;
  transition: border-color 0.2s;
}

.logic-input:focus {
  border-color: #f472b6;
  outline: none;
}

.logic-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* =======================================================================
   19. SINGULARITY / PRESTIGE UI
   ======================================================================= */
.singularity-skill-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  padding: 20px;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.singularity-skill-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, transparent, #a855f7, transparent);
  opacity: 0.5;
}

.singularity-skill-card:hover {
  transform: translateY(-3px);
  border-color: rgba(168, 85, 247, 0.8);
  box-shadow: 0 8px 25px rgba(168, 85, 247, 0.2);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(88, 28, 135, 0.2));
}

.singularity-skill-icon {
  font-size: 32px;
  color: #c084fc;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.6));
}

.singularity-skill-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 5px;
  text-shadow: 0 0 5px rgba(168, 85, 247, 0.3);
}

.singularity-skill-desc {
  font-size: 12px;
  color: #94a3b8;
  flex-grow: 1;
  margin-bottom: 15px;
  line-height: 1.4;
}

.singularity-skill-level {
  font-size: 11px;
  color: #fbbf24;
  margin-bottom: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.singularity-btn {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(107, 33, 168, 0.4));
  border: 1px solid #a855f7;
  color: #e9d5ff;
  padding: 8px 15px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-size: 13px;
}

.singularity-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(107, 33, 168, 0.6));
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.singularity-btn:disabled {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(148, 163, 184, 0.2);
  color: rgba(148, 163, 184, 0.5);
  cursor: not-allowed;
}

.singularity-skill-card.maxed {
  border-color: #fbbf24;
}
.singularity-skill-card.maxed::before {
  background: linear-gradient(90deg, transparent, #fbbf24, transparent);
}
.singularity-skill-card.maxed .singularity-skill-icon {
  color: #fbbf24;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.6));
}
.singularity-skill-card.maxed .singularity-btn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

/* ============================================
   TASK 34: HEAVY UI POLISHING
   ============================================ */

/* === 1. Daily Reward Items === */
.daily-reward-header {
  text-align: center;
  margin-bottom: 20px;
}
.daily-rewards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.daily-reward-item {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(20, 26, 35, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  transition: all var(--transition-default);
  position: relative;
  overflow: hidden;
}
.daily-reward-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.daily-reward-item:hover::before {
  opacity: 1;
}
.daily-reward-item:hover {
  border-color: rgba(251, 191, 36, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.daily-reward-item .reward-icon {
  font-size: 22px;
  margin-bottom: 6px;
  color: #fbbf24;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.3));
}
.daily-reward-item .reward-day {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.daily-reward-item .reward-amount {
  font-size: 14px;
  font-weight: 700;
  color: #fcd34d;
  font-family: "JetBrains Mono", monospace;
  margin-top: 4px;
}
.daily-reward-item.claimed {
  opacity: 0.45;
  border-color: rgba(16, 185, 129, 0.2);
}
.daily-reward-item.claimed .reward-icon {
  color: #10b981;
}
.daily-reward-item.current {
  border-color: rgba(251, 191, 36, 0.5);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.04));
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.1);
}

/* Premium tier rewards (Day 5-7) */
.daily-reward-item.premium {
  border-color: rgba(168, 85, 247, 0.25);
}
.daily-reward-item.premium .reward-icon {
  color: #c084fc;
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.4));
}
.daily-reward-item.premium .reward-amount {
  background: linear-gradient(135deg, #fcd34d, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Claim button animation */
.daily-claim-btn {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-default);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
  letter-spacing: 0.3px;
}
.daily-claim-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(251, 191, 36, 0.4);
  filter: brightness(1.1);
}
.daily-claim-btn:active {
  transform: translateY(0);
}
.daily-claim-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent 0%, rgba(255,255,255,0.15) 10%, transparent 20%);
  animation: claim-spin 4s linear infinite;
  pointer-events: none;
}
@keyframes claim-spin {
  to { transform: rotate(360deg); }
}
.daily-claim-btn.claimed {
  background: linear-gradient(135deg, #10b981, #059669);
  cursor: default;
  animation: none;
}
.daily-claim-btn.claimed::after {
  display: none;
}

/* === 2. Modal Top Glow Line === */
.modal::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), rgba(139, 92, 246, 0.4), rgba(59, 130, 246, 0.5), transparent);
  z-index: 1;
  pointer-events: none;
}
.modal {
  position: relative;
}

/* Modal close button consistency */
.btn-close-modal {
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition-default);
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-close-modal:hover {
  background: linear-gradient(145deg, rgba(239,68,68,0.12), rgba(220,38,38,0.06));
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  transform: translateY(-1px);
}
.btn-close-modal:active {
  transform: translateY(0);
}

/* === 3. Sidebar Panel Separators === */
.panel + .panel {
  position: relative;
}
.panel + .panel::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.08), transparent);
  pointer-events: none;
}

/* Account panel helper text styling */
.panel .sidebar-hint {
  font-size: 10px;
  color: #64748b;
  font-style: italic;
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* Account login button glow */
.btn-account-login {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-default);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.12);
}
.btn-account-login:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.15));
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
}

/* === 4. Achievements Modal === */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.achievement-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(20, 26, 35, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition-default);
  position: relative;
  overflow: hidden;
}
.achievement-card:hover {
  border-color: rgba(251, 191, 36, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.achievement-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, rgba(100, 116, 139, 0.3), transparent);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.achievement-card.unlocked::before {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
}
.achievement-card.unlocked {
  border-color: rgba(251, 191, 36, 0.15);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.04), rgba(30, 41, 59, 0.6));
}
.achievement-card.locked {
  opacity: 0.5;
  filter: grayscale(0.4);
}
.achievement-card .ach-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.achievement-card.unlocked .ach-icon {
  border-color: rgba(251, 191, 36, 0.2);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.1);
}
.achievement-card .ach-name {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 3px;
}
.achievement-card .ach-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}
.achievement-card.just-unlocked {
  animation: ach-celebrate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ach-celebrate {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); }
  40% { transform: scale(1.04); box-shadow: 0 0 25px rgba(251, 191, 36, 0.3); }
  100% { transform: scale(1); box-shadow: none; }
}

/* === 5. Form Divider ("OR" line) === */
.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.form-divider::before,
.form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

/* Enhanced form input focus */
.form-input:focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.1),
    0 0 20px rgba(59, 130, 246, 0.08);
}

/* === 6. Tab Animation === */
.tab {
  position: relative;
}
.tab::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  right: 50%;
  height: 2px;
  background: #3b82f6;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}
.tab.active::before {
  left: 20%;
  right: 20%;
  opacity: 0.6;
}
.tab:hover::before {
  left: 30%;
  right: 30%;
  opacity: 0.3;
}

/* === 7. Shop Item Locked Badge === */
.shop-item.disabled::after {
  content: "\f023";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: rgba(100, 116, 139, 0.4);
  pointer-events: none;
  z-index: 2;
}

/* === 8. Context Menu Separator === */
.ctx-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  margin: 4px 8px;
}

/* === 9. Sidebar Scrollbar Unification === */
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.2));
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.4), rgba(139, 92, 246, 0.35));
}

/* === 10. Small Modal Width Helper === */
.modal-sm { width: var(--modal-width-sm); max-width: 95%; }
.modal-md { width: var(--modal-width-md); max-width: 95%; }
.modal-lg { width: var(--modal-width-lg); max-width: 95%; }
.modal-xl { width: var(--modal-width-xl); max-width: 95%; }

/* === 11. ULPM Compliance for Task 34 Additions === */
body.ultra-low-perf .daily-claim-btn::after {
  display: none !important;
}
body.ultra-low-perf .daily-reward-item:hover {
  transform: none !important;
}
body.ultra-low-perf .daily-reward-item::before {
  display: none !important;
}
body.ultra-low-perf .modal::before {
  display: none !important;
}
body.ultra-low-perf .achievement-card:hover {
  transform: none !important;
}
body.ultra-low-perf .achievement-card.just-unlocked {
  animation: none !important;
}
body.ultra-low-perf .panel + .panel::after {
  display: none !important;
}
body.ultra-low-perf .tab::before {
  display: none !important;
}
body.ultra-low-perf .btn-close-modal:hover,
body.ultra-low-perf .btn-account-login:hover {
  transform: none !important;
}
body.ultra-low-perf .shop-item.disabled::after {
  display: none !important;
}
