/* Quarksmith: Forge of Creation - AAA Stylesheet */

:root {
  --primary-cyan: #00ffff;
  --primary-magenta: #ff00ff;
  --primary-yellow: #ffff00;
  --electric-blue: #0080ff;
  --neon-green: #00ff00;
  --hot-red: #ff0044;
  --deep-purple: #6600ff;
  --bg-dark: #000011;
  --bg-panel: rgba(0, 20, 40, 0.9);
  --bg-darker: rgba(0, 10, 20, 0.95);
  --text-primary: #ffffff;
  --text-secondary: #88ccff;
  --border-glow: rgba(0, 255, 255, 0.5);
}

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

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  user-select: none;
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #001133 0%, #000011 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.loading-content {
  text-align: center;
}

.loading-title {
  font-family: 'Orbitron', monospace;
  font-size: 5rem;
  font-weight: 900;
  background: linear-gradient(45deg, var(--primary-cyan), var(--primary-magenta));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

.loading-subtitle {
  font-size: 1.5rem;
  color: var(--text-secondary);
  letter-spacing: 0.5rem;
  margin-top: -0.5rem;
}

.loading-bar {
  width: 300px;
  height: 4px;
  background: rgba(0, 100, 150, 0.3);
  margin: 2rem auto;
  overflow: hidden;
  border-radius: 2px;
}

.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--primary-cyan), transparent);
  animation: loading-sweep 1.5s ease-in-out infinite;
}

@keyframes loading-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

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

/* Game Container */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Top HUD */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(180deg, var(--bg-panel) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  pointer-events: none;
}

.hud-top > * {
  pointer-events: auto;
}

.game-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.title-main {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--primary-cyan), var(--electric-blue));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.2rem;
}

/* Stats Panel */
.stats-panel {
  display: flex;
  gap: 2rem;
  background: var(--bg-darker);
  padding: 1rem 2rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.1rem;
}

.stat-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-cyan);
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.stat-bar {
  width: 100%;
  height: 3px;
  background: rgba(0, 100, 150, 0.3);
  margin-top: 0.5rem;
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--primary-cyan);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary-cyan);
}

.energy-fill {
  width: 100%;
}

/* Controls */
.controls {
  display: flex;
  gap: 1rem;
}

.control-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-darker);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.control-btn.active {
  background: rgba(0, 255, 255, 0.2);
  border-color: var(--primary-cyan);
  color: var(--primary-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.control-btn svg {
  fill: currentColor;
}

/* Left Toolbar */
.toolbar-left {
  position: absolute;
  left: 0;
  top: 100px;
  bottom: 20px;
  width: 280px;
  background: var(--bg-panel);
  border-right: 1px solid rgba(0, 255, 255, 0.2);
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.toolbar-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-cyan);
  margin-bottom: 1.5rem;
  letter-spacing: 0.2rem;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.category {
  margin-bottom: 2rem;
}

.category-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.1rem;
}

.tool-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tool {
  background: var(--bg-darker);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.tool:hover {
  border-color: var(--primary-cyan);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 255, 255, 0.2);
}

.tool.active {
  background: rgba(0, 255, 255, 0.1);
  border-color: var(--primary-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.tool-icon {
  font-family: 'Orbitron', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-shadow: 0 0 10px currentColor;
}

.tool-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.tool-cost {
  font-size: 0.7rem;
  color: var(--primary-yellow);
  margin-top: 0.25rem;
}

/* Template Tools */
.template-tool {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--bg-darker), rgba(0, 255, 255, 0.05));
  border: 1px solid rgba(0, 255, 255, 0.3);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.template-tool::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.template-tool:hover::before {
  left: 100%;
}

.template-tool .tool-icon {
  font-size: 1.2rem;
  color: var(--primary-cyan);
}

/* Particle Icon Colors */
.electron-icon { color: #0080ff; }
.positron-icon { color: #ff0044; }
.muon-icon { color: #8888ff; }
.neutrino-icon { color: #888888; }
.up-icon { color: #ff4444; }
.down-icon { color: #4444ff; }
.strange-icon { color: #ff44ff; }
.charm-icon { color: #44ff44; }
.photon-icon { color: #ffff00; }
.gluon-icon { color: #00ff00; }
.w-icon { color: #ff8800; }
.z-icon { color: #8800ff; }
.higgs-icon { color: #ff00ff; }
.proton-icon { color: #ff6666; }
.neutron-icon { color: #888888; }
.carbon-nucleus-icon { color: #606060; }

/* Right Panel */
.panel-right {
  position: absolute;
  right: 0;
  top: 100px;
  bottom: 20px;
  width: 320px;
  background: var(--bg-panel);
  border-left: 1px solid rgba(0, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.panel-tab {
  flex: 1;
  padding: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.1rem;
  transition: all 0.3s ease;
}

.panel-tab:hover {
  background: rgba(0, 255, 255, 0.05);
  color: var(--primary-cyan);
}

.panel-tab.active {
  background: rgba(0, 255, 255, 0.1);
  color: var(--primary-cyan);
  border-bottom: 2px solid var(--primary-cyan);
}

.panel-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  overflow: hidden;
}

/* Info Panel */
#info-panel h3 {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--primary-cyan);
}

.particle-info {
  background: var(--bg-darker);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(0, 255, 255, 0.1);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 255, 255, 0.1);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.info-value {
  font-family: 'Orbitron', monospace;
  color: var(--primary-cyan);
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.controls-info h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

kbd {
  background: var(--bg-darker);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  color: var(--primary-cyan);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Achievements */
.achievement {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-darker);
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid rgba(0, 255, 255, 0.1);
  opacity: 0.5;
  filter: grayscale(1);
  transition: all 0.3s ease;
}

.achievement.unlocked {
  opacity: 1;
  filter: grayscale(0);
  border-color: rgba(0, 255, 0, 0.3);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
  animation: achievement-unlock 0.5s ease;
}

@keyframes achievement-unlock {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.achievement-icon {
  font-size: 2rem;
}

.achievement-name {
  font-weight: 600;
  color: var(--primary-cyan);
  margin-bottom: 0.25rem;
}

.achievement-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Journal */
.journal-entry {
  padding: 0.75rem;
  background: var(--bg-darker);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--primary-cyan);
}

.journal-time {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.journal-text {
  font-size: 0.9rem;
}

/* Help Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 15px;
  padding: 3rem;
  max-width: 600px;
  box-shadow: 0 0 50px rgba(0, 255, 255, 0.3);
}

.overlay-content h2 {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--primary-cyan), var(--primary-magenta));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.help-section {
  margin-top: 2rem;
}

.help-section h3 {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.help-section ul {
  list-style: none;
  padding-left: 1rem;
}

.help-section li {
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  position: relative;
}

.help-section li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--primary-cyan);
}

.close-btn {
  background: var(--bg-darker);
  border: 1px solid var(--primary-cyan);
  color: var(--primary-cyan);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-weight: 600;
  cursor: pointer;
  margin-top: 2rem;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  transform: translateY(-2px);
}

/* Notifications */
.notification {
  position: fixed;
  top: 100px;
  right: 340px;
  background: var(--bg-darker);
  border: 1px solid var(--primary-cyan);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
  animation: slide-in 0.3s ease;
  z-index: 100;
}

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

.notification.success {
  border-color: var(--neon-green);
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
}

.notification.fade-out {
  animation: slide-out 0.5s ease;
}

@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

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

::-webkit-scrollbar-track {
  background: rgba(0, 20, 40, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 1200px) {
  .toolbar-left {
    width: 240px;
  }
  
  .panel-right {
    width: 280px;
  }
  
  .tool-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stats-panel {
    gap: 1rem;
    padding: 0.75rem 1rem;
  }
  
  .stat {
    min-width: 60px;
  }
  
  .toolbar-left,
  .panel-right {
    position: fixed;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .panel-right {
    transform: translateX(100%);
  }
  
  .toolbar-left.active,
  .panel-right.active {
    transform: translateX(0);
  }
}

/* Structure Detection */
.structure-name {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-cyan);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.structure-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-value.active {
  color: var(--neon-green);
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
} 