
:root {
  --primary-bg: #0a0a0a;
  --secondary-bg: #1a1a1a;
  --accent-bg: #2a2a2a;
  --primary-text: #e0e0e0;
  --accent-text: #00d4ff;
  --success-color: #00ff88;
  --warning-color: #ffaa00;
  --error-color: #ff4444;
  --border-color: #333;
  --glow-color: #00d4ff;
  --transition-speed: 0.2s;
}

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

html, body {
  height: 100vh;
  background: linear-gradient(135deg, var(--primary-bg) 0%, #0f0f0f 100%);
  color: var(--primary-text);
  font-family: 'Courier New', 'SF Mono', monospace;
  overflow: hidden;
  position: relative;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 30s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* Mode Toggle */
#mode-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.mode-btn {
  padding: 10px 20px;
  background: transparent;
  color: var(--primary-text);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  transition: all var(--transition-speed);
  position: relative;
}

.mode-btn.active {
  background: var(--accent-text);
  color: var(--primary-bg);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.mode-btn:hover:not(.active) {
  background: var(--accent-bg);
}

/* Popup Styles */
#popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(10px);
}

#popup {
  background: var(--secondary-bg);
  border: 2px solid var(--accent-text);
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 0 50px rgba(0, 212, 255, 0.3);
  animation: popupEnter 0.3s ease-out;
}

@keyframes popupEnter {
  from { opacity: 0; transform: scale(0.8) translateY(-20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

#popup h2 {
  color: var(--accent-text);
  margin-bottom: 20px;
  font-size: 24px;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

#email-input {
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  padding: 12px 15px;
  margin: 15px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  width: 300px;
  transition: all var(--transition-speed);
}

#email-input:focus {
  outline: none;
  border-color: var(--accent-text);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

#popup button {
  background: linear-gradient(45deg, var(--accent-text), #0099cc);
  color: var(--primary-bg);
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  font-size: 14px;
  transition: all var(--transition-speed);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#popup button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

/* HUD-style Scoreboard */
#scoreboard {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 100;
  font-size: 12px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.score-label {
  color: var(--accent-text);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.score-value {
  font-size: 16px;
  font-weight: bold;
  color: var(--success-color);
  text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
}

/* Command Bar */
#command-bar {
  position: fixed;
  top: 100px;
  left: 20px;
  right: 20px;
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  backdrop-filter: blur(10px);
  z-index: 100;
  transition: all var(--transition-speed);
}

.command-input {
  flex: 1;
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  transition: all var(--transition-speed);
}

.command-input:focus {
  outline: none;
  border-color: var(--accent-text);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.command-btn {
  background: var(--accent-bg);
  color: var(--primary-text);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  transition: all var(--transition-speed);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.command-btn:hover {
  background: var(--accent-text);
  color: var(--primary-bg);
  transform: translateY(-1px);
}

.command-btn.primary {
  background: linear-gradient(45deg, var(--success-color), #00cc66);
  color: var(--primary-bg);
  font-weight: bold;
}

.command-btn.danger {
  background: linear-gradient(45deg, var(--error-color), #cc3333);
  color: white;
}

/* Main Layout */
#main {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 440px);
  margin-top: 160px;
  margin-bottom: 280px;
  position: relative;
}

/* Cloud Container */
#cloud-container {
  flex: 1;
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin: 0 20px;
  background: rgba(10, 10, 10, 0.8);
  overflow: auto;
  backdrop-filter: blur(5px);
}

#cloud {
  position: relative;
  width: 3000px;
  height: 2000px;
  background: radial-gradient(circle at 30% 30%, rgba(0, 212, 255, 0.03) 0%, transparent 50%);
}

/* Domain Items */
.domain-item {
  position: absolute;
  cursor: grab;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  user-select: none;
  background: rgba(42, 42, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  transition: all var(--transition-speed);
  backdrop-filter: blur(5px);
}

.domain-item:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-text);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.domain-item.highlighted {
  background: linear-gradient(45deg, var(--warning-color), #cc8800);
  color: var(--primary-bg);
  font-weight: bold;
  box-shadow: 0 0 15px rgba(255, 170, 0, 0.4);
}

.domain-item.selected {
  background: linear-gradient(45deg, var(--success-color), #00cc66);
  color: var(--primary-bg);
  border-color: var(--success-color);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.domain-item:active {
  cursor: grabbing;
}

/* Buckets Container */
#buckets-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 280px;
  background: rgba(26, 26, 26, 0.95);
  border-top: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 20px;
  gap: 15px;
  backdrop-filter: blur(10px);
  z-index: 50;
}

#buckets {
  flex: 1;
  height: 100%;
  display: flex;
  gap: 15px;
  overflow: hidden;
  position: relative;
}

/* Navigation Buttons */
.bucket-nav-btn {
  background: linear-gradient(45deg, var(--accent-text), #0099cc);
  color: var(--primary-bg);
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  font-size: 12px;
  transition: all var(--transition-speed);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 100px;
}

.bucket-nav-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}

.bucket-nav-btn:disabled {
  background: var(--accent-bg);
  color: #666;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Buckets */
.bucket {
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 15px;
  min-width: 200px;
  width: 200px;
  height: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(42, 42, 42, 0.6);
  backdrop-filter: blur(10px);
  transition: all var(--transition-speed);
  position: relative;
  overflow: hidden;
}

.bucket::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-text), var(--success-color));
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.bucket:hover::before {
  opacity: 1;
}

.bucket:hover {
  border-color: var(--accent-text);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.15);
}

.bucket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.bucket h3 {
  font-size: 13px;
  color: var(--accent-text);
  line-height: 1.3;
  flex: 1;
  margin-right: 10px;
  text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}

.expand-toggle {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-text);
  border: 1px solid var(--accent-text);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  font-weight: bold;
  transition: all var(--transition-speed);
  text-transform: uppercase;
}

.expand-toggle:hover {
  background: var(--accent-text);
  color: var(--primary-bg);
}

.progress {
  background: var(--primary-bg);
  height: 8px;
  width: 100%;
  margin: 8px 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar {
  background: linear-gradient(90deg, var(--success-color), #00cc66);
  height: 100%;
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.bucket-content {
  font-size: 10px;
  line-height: 1.2;
  color: #aaa;
  max-height: 120px;
  overflow-y: auto;
  display: none;
}

/* Agent Mode Styles */
body.agent-mode {
  --primary-text: #00ff00;
  --accent-text: #ff00ff;
  --success-color: #00ff00;
}

body.agent-mode .domain-item {
  font-size: 10px;
  padding: 3px 6px;
  font-family: 'Courier New', monospace;
}

body.agent-mode #scoreboard {
  font-size: 10px;
  grid-template-columns: repeat(4, 1fr);
}

body.agent-mode .bucket {
  min-width: 150px;
  width: 150px;
  height: 200px;
}

body.agent-mode .bucket h3 {
  font-size: 11px;
}

/* Feedback System */
#feedback {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 26, 0.95);
  border: 2px solid var(--success-color);
  border-radius: 10px;
  padding: 20px 30px;
  font-size: 16px;
  font-weight: bold;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 500;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.2);
}

#feedback.success {
  color: var(--success-color);
  border-color: var(--success-color);
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

#feedback.error {
  color: var(--error-color);
  border-color: var(--error-color);
  box-shadow: 0 0 30px rgba(255, 68, 68, 0.3);
}

#feedback.partial {
  color: var(--warning-color);
  border-color: var(--warning-color);
  box-shadow: 0 0 30px rgba(255, 170, 0, 0.3);
}

/* Minimap */
#minimap-container {
  position: fixed;
  bottom: 300px;
  right: 20px;
  width: 300px;
  height: 200px;
  background: rgba(26, 26, 26, 0.95);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  z-index: 150;
  backdrop-filter: blur(10px);
  transition: all var(--transition-speed);
}

#minimap-container.minimized {
  display: none;
}

#minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
}

#minimap-title {
  font-size: 11px;
  color: var(--accent-text);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#minimap-minimize {
  background: var(--error-color);
  color: white;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  transition: all var(--transition-speed);
}

#minimap {
  position: relative;
  width: 100%;
  height: calc(100% - 30px);
  background: var(--primary-bg);
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}

#minimap-viewport {
  position: absolute;
  border: 2px solid var(--warning-color);
  background: rgba(255, 170, 0, 0.1);
  pointer-events: none;
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
}

/* Keyboard Shortcuts Overlay */
#shortcuts-overlay {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 10px;
  color: #888;
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity var(--transition-speed);
}

body.agent-mode #shortcuts-overlay {
  opacity: 1;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--primary-bg);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, var(--accent-text), #0099cc);
  border-radius: 6px;
  border: 2px solid var(--primary-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #00ffff, var(--accent-text));
}

/* Responsive Design */
@media (max-width: 1200px) {
  .bucket {
    min-width: 180px;
    width: 180px;
  }
  
  body.agent-mode .bucket {
    min-width: 130px;
    width: 130px;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Data Visualization Elements */
.data-point {
  width: 4px;
  height: 4px;
  background: var(--accent-text);
  border-radius: 50%;
  position: absolute;
  box-shadow: 0 0 5px var(--accent-text);
  animation: dataFloat 3s ease-in-out infinite;
}

@keyframes dataFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}
