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

body {
  overflow: hidden;
  background: #0a0e17;
  font-family: 'DM Sans', sans-serif;
  color: #e8ecf1;
  -webkit-user-select: none;
  user-select: none;
}

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

/* HUD Top Bar */
#hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(8,12,21,0.92) 0%, rgba(8,12,21,0) 100%);
  z-index: 100;
  pointer-events: none;
}

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

#city-name-wrapper {
  flex-shrink: 0;
}

#city-name {
  font-family: 'Archivo Black', sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
  color: #f0c040;
  text-shadow: 0 0 20px rgba(240, 192, 64, 0.3);
  outline: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
  padding-bottom: 2px;
  cursor: text;
}

#city-name:focus {
  border-bottom-color: #f0c040;
}

#stats-bar {
  display: flex;
  gap: 24px;
  align-items: center;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
}

.stat-icon {
  font-size: 16px;
}

.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  color: #e8ecf1;
  min-width: 50px;
}

#speed-controls {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  padding: 4px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
}

.speed-btn {
  background: transparent;
  border: none;
  color: #8892a4;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.speed-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #e8ecf1;
}

.speed-btn.active {
  background: rgba(240, 192, 64, 0.2);
  color: #f0c040;
}

/* Income Toast */
#income-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 167, 69, 0.9);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  z-index: 150;
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
}

#income-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}

#income-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Bottom Toolbar */
#toolbar-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

#toolbar-bottom > * {
  pointer-events: auto;
}

.toolbar-categories {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: none;
}

.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  color: #8892a4;
  min-width: 70px;
}

.cat-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #e8ecf1;
}

.cat-btn.active {
  background: rgba(240, 192, 64, 0.12);
  border-color: rgba(240, 192, 64, 0.4);
  color: #f0c040;
}

.cat-btn.active .cat-label {
  color: #f0c040;
}

.demolish-btn.active {
  background: rgba(220, 53, 69, 0.15);
  border-color: rgba(220, 53, 69, 0.5);
  color: #ff6b7a;
}

.demolish-btn.active .cat-label {
  color: #ff6b7a;
}

.cat-icon {
  font-size: 22px;
}

.cat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #8892a4;
}

/* Submenu */
#submenu {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 700px;
  padding: 0 16px;
  margin-bottom: -1px;
}

#submenu.hidden {
  display: none;
}

#submenu-items {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(20px);
  border-radius: 16px 16px 0 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: none;
  overflow-x: auto;
  max-width: 100%;
}

.submenu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
  flex-shrink: 0;
}

.submenu-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}

.submenu-item.active {
  background: rgba(240, 192, 64, 0.15);
  border-color: #f0c040;
}

.submenu-item .item-name {
  font-size: 11px;
  font-weight: 600;
  color: #e8ecf1;
  white-space: nowrap;
}

.submenu-item .item-cost {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #6fdd8b;
}

.submenu-item .item-preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  margin-bottom: 2px;
}

/* Tooltip */
#tooltip {
  position: fixed;
  background: rgba(10, 14, 23, 0.95);
  color: #e8ecf1;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  pointer-events: none;
  z-index: 200;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  max-width: 200px;
}

#tooltip.hidden {
  display: none;
}

/* Footer */
#footer {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 90;
}

#footer a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  text-decoration: none;
  transition: color 0.2s;
}

#footer a:hover {
  color: rgba(255,255,255,0.5);
}

/* Instructions Overlay */
#instructions {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 8, 15, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(10px);
}

#instructions.hidden {
  display: none;
}

.instructions-content {
  text-align: center;
  max-width: 400px;
  padding: 40px;
}

.instructions-content h2 {
  font-family: 'Archivo Black', sans-serif;
  font-size: 36px;
  color: #f0c040;
  margin-bottom: 8px;
  text-shadow: 0 0 40px rgba(240, 192, 64, 0.3);
}

.instructions-content p {
  font-size: 16px;
  color: #8892a4;
  margin-bottom: 28px;
}

.controls-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
  text-align: left;
}

.controls-info div {
  font-size: 13px;
  color: #8892a4;
}

kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #e8ecf1;
  margin-right: 8px;
}

#start-btn {
  background: linear-gradient(135deg, #f0c040, #e8a020);
  color: #0a0e17;
  border: none;
  padding: 14px 40px;
  border-radius: 14px;
  font-family: 'Archivo Black', sans-serif;
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(240, 192, 64, 0.3);
}

#start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(240, 192, 64, 0.5);
}

/* Mobile */
@media (max-width: 640px) {
  .cat-label {
    display: none;
  }
  
  .cat-btn {
    min-width: 44px;
    padding: 8px 10px;
  }
  
  #stats-bar {
    gap: 8px;
  }
  
  .stat-item {
    padding: 4px 8px;
  }
  
  .stat-value {
    font-size: 12px;
    min-width: 30px;
  }
  
  #city-name {
    font-size: 16px;
  }

  #speed-controls {
    display: none;
  }
  
  #hud-top {
    padding: 8px 12px;
  }

  .submenu-item {
    min-width: 65px;
    padding: 6px 8px;
  }
}