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

:root {
  --bg-dark: #0a0a12;
  --bg-panel: #0d0d1a;
  --bg-card: #12122a;
  --accent-blue: #00d4ff;
  --accent-green: #39ff14;
  --accent-pink: #ff2e63;
  --accent-gold: #ffd700;
  --accent-purple: #a855f7;
  --text-primary: #e0e0f0;
  --text-secondary: #8888aa;
  --glow-blue: 0 0 20px rgba(0, 212, 255, 0.4);
  --glow-green: 0 0 20px rgba(57, 255, 20, 0.4);
  --glow-pink: 0 0 20px rgba(255, 46, 99, 0.4);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Share Tech Mono', monospace;
}

#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

#ui-overlay > * {
  pointer-events: auto;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(10,10,18,0.95) 0%, rgba(10,10,18,0.7) 100%);
  border-bottom: 1px solid rgba(0,212,255,0.2);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  letter-spacing: 2px;
}

.tier-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(0,212,255,0.3);
  white-space: nowrap;
}

.points-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.points-icon {
  font-size: 1.3rem;
  animation: pulse-glow 2s ease-in-out infinite;
}

.points-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-family: 'Share Tech Mono', monospace;
}

.auto-rate {
  font-size: 0.8rem;
  color: var(--accent-green);
}

#main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  pointer-events: none;
}

#left-panel {
  width: 380px;
  max-width: 45vw;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(90deg, rgba(10,10,18,0.92) 0%, rgba(10,10,18,0.6) 90%, transparent 100%);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,212,255,0.3) transparent;
}

#left-panel::-webkit-scrollbar {
  width: 6px;
}

#left-panel::-webkit-scrollbar-track {
  background: transparent;
}

#left-panel::-webkit-scrollbar-thumb {
  background: rgba(0,212,255,0.3);
  border-radius: 3px;
}

/* Click Zone */
#click-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 10px 0;
}

#particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.click-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid var(--accent-blue);
  background: radial-gradient(circle at 40% 40%, #1a2a4a, #0a0a20);
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease;
  box-shadow: var(--glow-blue), inset 0 0 30px rgba(0,212,255,0.1);
  animation: btn-idle-pulse 3s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  outline: none;
}

.click-btn:active {
  transform: scale(0.92);
  animation: none;
}

.click-btn:hover {
  border-color: var(--accent-green);
  box-shadow: var(--glow-green), inset 0 0 30px rgba(57,255,20,0.1);
}

.cpu-icon {
  width: 50px;
  height: 50px;
  position: relative;
}

.cpu-die {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #334, #556);
  border: 2px solid var(--accent-blue);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  box-shadow: inset 0 0 8px rgba(0,212,255,0.5);
}

.cpu-pins {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(0,212,255,0.3) 8px, rgba(0,212,255,0.3) 10px),
    repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(0,212,255,0.3) 8px, rgba(0,212,255,0.3) 10px);
  mask: radial-gradient(circle, transparent 32%, black 34%);
  -webkit-mask: radial-gradient(circle, transparent 32%, black 34%);
}

.click-label {
  font-size: 0.7rem;
  color: var(--accent-blue);
  font-family: 'Orbitron', sans-serif;
  font-weight: 500;
  text-align: center;
}

.float-particle {
  position: absolute;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-gold);
  pointer-events: none;
  animation: float-up 0.9s ease-out forwards;
  text-shadow: 0 0 10px rgba(255,215,0,0.6);
}

@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.5); }
}

@keyframes btn-idle-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,212,255,0.3), inset 0 0 30px rgba(0,212,255,0.1); }
  50% { box-shadow: 0 0 40px rgba(0,212,255,0.5), inset 0 0 40px rgba(0,212,255,0.2); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Stats Dashboard */
#stats-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
}

.stat-header {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.stat-fps .stat-value { color: #ff4444; }
.stat-proc .stat-value { color: var(--accent-blue); }
.stat-temp .stat-value { color: #ff4444; }

.stat-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease, background 0.5s ease;
  width: 0%;
}

.stat-fps .stat-bar-fill { background: #ff4444; }
.stat-proc .stat-bar-fill { background: var(--accent-blue); }
.stat-temp .stat-bar-fill { background: #ff4444; }

/* Skill Tree */
#skill-tree {
  flex: 1;
}

.tree-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#tree-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.branch-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  transition: border-color 0.3s;
}

.branch-section:hover {
  border-color: rgba(0,212,255,0.2);
}

.branch-header {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.branch-nodes {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
}

.node {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  color: var(--text-secondary);
}

.node.locked {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(1);
}

.node.affordable {
  border-color: var(--accent-green);
  animation: node-pulse 2s ease-in-out infinite;
  opacity: 1;
  filter: none;
  cursor: pointer;
}

.node.unlocked {
  border-color: var(--accent-blue);
  background: rgba(0,212,255,0.15);
  box-shadow: 0 0 15px rgba(0,212,255,0.3);
  opacity: 1;
  filter: none;
}

.node.unlocked::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.6rem;
  background: var(--accent-green);
  color: #000;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.node-connector {
  width: 12px;
  min-width: 12px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.node-connector.lit {
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(0,212,255,0.5);
}

.node-cost {
  position: absolute;
  bottom: -16px;
  font-size: 0.5rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-family: 'Orbitron', sans-serif;
}

.node.affordable .node-cost {
  color: var(--accent-green);
}

@keyframes node-pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(57,255,20,0.2); }
  50% { box-shadow: 0 0 20px rgba(57,255,20,0.5); }
}

@keyframes node-unlock {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.node.just-unlocked {
  animation: node-unlock 0.5s ease forwards;
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 100;
  background: rgba(12,12,30,0.97);
  border: 1px solid var(--accent-blue);
  border-radius: 10px;
  padding: 12px 15px;
  max-width: 280px;
  box-shadow: 0 0 30px rgba(0,212,255,0.2);
  pointer-events: none;
}

.tooltip-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.tooltip-flavor {
  font-style: italic;
  font-size: 0.72rem;
  color: var(--accent-pink);
  margin-bottom: 8px;
  line-height: 1.3;
}

.tooltip-stats {
  font-size: 0.7rem;
  color: var(--accent-green);
  margin-bottom: 4px;
}

.tooltip-cost {
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-family: 'Orbitron', sans-serif;
}

.tooltip-req {
  font-size: 0.62rem;
  color: var(--accent-pink);
  margin-top: 4px;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 60px;
  right: 15px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(12,12,30,0.95);
  border: 1px solid var(--accent-gold);
  border-radius: 10px;
  padding: 12px 18px;
  min-width: 240px;
  box-shadow: 0 0 25px rgba(255,215,0,0.2);
  animation: toast-in 0.4s ease forwards;
  pointer-events: auto;
}

.toast.dismissing {
  animation: toast-out 0.3s ease forwards;
}

.toast-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 3px;
}

.toast-msg {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(80px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(80px); }
}

/* Footer */
.app-footer {
  position: fixed;
  bottom: 8px;
  right: 15px;
  z-index: 50;
  pointer-events: auto;
}

.app-footer a {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.2);
  text-decoration: none;
  font-family: 'Share Tech Mono', monospace;
}

.app-footer a:hover {
  color: rgba(255,255,255,0.5);
}

/* Mobile */
@media (max-width: 768px) {
  #left-panel {
    width: 100%;
    max-width: 100%;
    height: 60vh;
    position: fixed;
    bottom: 0;
    left: 0;
    background: linear-gradient(0deg, rgba(10,10,18,0.97) 0%, rgba(10,10,18,0.85) 100%);
    border-top: 1px solid rgba(0,212,255,0.2);
    border-radius: 16px 16px 0 0;
    z-index: 20;
  }

  #scene-container {
    height: 40vh;
  }

  .app-title {
    font-size: 1rem;
  }

  .click-btn {
    width: 110px;
    height: 110px;
  }

  #stats-dashboard {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .stat-value {
    font-size: 1rem;
  }

  .header-left {
    gap: 8px;
  }

  .points-display {
    font-size: 0.9rem;
  }
}