/* Forge Defense — Tower Defense Styles
   Built by Nova Forge + Amazon Nova Pro */

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

body {
  background: #0a0a14;
  color: #e4e4f0;
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* --- Canvas --- */
#gameCanvas {
  display: block;
  image-rendering: pixelated;
  border: 1px solid rgba(167,139,250,0.15);
  border-radius: 4px;
}

/* --- HUD top bar --- */
#hud {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 44px;
  background: rgba(22,22,42,0.95);
  border-bottom: 1px solid rgba(167,139,250,0.15);
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 16px;
  font-size: 14px;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.hud-item { display:flex; align-items:center; gap:6px; }
.hud-label { color:#94a3b8; font-size:11px; text-transform:uppercase; letter-spacing:0.05em; }
.hud-val { font-weight:700; font-variant-numeric:tabular-nums; }
#goldVal { color:#facc15; }
#livesVal { color:#ef4444; }
#waveVal { color:#a78bfa; }
#scoreVal { color:#67e8f9; }

#waveBtn {
  background: linear-gradient(135deg, #a78bfa, #67e8f9);
  color: #0f0f1a; border: none; border-radius: 6px;
  padding: 6px 16px; font-weight: 700; font-size: 12px;
  cursor: pointer; font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}
#waveBtn:hover { transform:scale(1.05); box-shadow:0 0 12px rgba(167,139,250,0.4); }
#waveInfo {
  color: #64748b; font-size: 11px; max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.speed-controls { display:flex; gap:4px; }
.speed-btn {
  background: rgba(167,139,250,0.12); border:1px solid rgba(167,139,250,0.2);
  color: #94a3b8; border-radius: 4px; padding: 3px 10px;
  font-size: 11px; cursor: pointer; font-family: inherit; font-weight: 600;
  transition: all 0.15s;
}
.speed-btn.active { background:rgba(167,139,250,0.3); color:#e4e4f0; border-color:#a78bfa; }
.speed-btn:hover { background:rgba(167,139,250,0.2); }

/* --- Side panel (tower selector) --- */
#sidePanel {
  display: none;
  position: fixed; right: 0; top: 44px; bottom: 0;
  width: 160px;
  background: rgba(22,22,42,0.95);
  border-left: 1px solid rgba(167,139,250,0.15);
  flex-direction: column;
  padding: 10px;
  gap: 6px;
  z-index: 10;
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.panel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px; color: #a78bfa;
  text-align: center; margin-bottom: 4px;
  letter-spacing: 0.05em;
}
.tower-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(167,139,250,0.12);
  border-radius: 6px; padding: 8px; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
  color: #e4e4f0;
}
.tower-btn:hover { background:rgba(167,139,250,0.1); border-color:rgba(167,139,250,0.3); }
.tower-btn.active { background:rgba(167,139,250,0.18); border-color:#a78bfa; box-shadow:0 0 8px rgba(167,139,250,0.2); }
.tower-btn.cannot-afford { opacity:0.4; }
.tower-icon {
  width: 28px; height: 28px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.tower-meta { display: flex; flex-direction: column; }
.tower-name { font-size: 11px; font-weight: 700; }
.tower-cost { font-size: 10px; color: #facc15; }

/* --- Tower info panel --- */
#towerInfo {
  margin-top: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(167,139,250,0.1);
  border-radius: 6px;
  min-height: 80px;
}
.info-name { font-weight:700; font-size:13px; margin-bottom:4px; }
.info-stat { font-size:11px; color:#94a3b8; margin-bottom:2px; }
.upgrade-btn, .sell-btn {
  display: block; width: 100%; margin-top: 6px;
  padding: 6px; border: none; border-radius: 4px;
  font-family: inherit; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.upgrade-btn { background:rgba(167,139,250,0.25); color:#a78bfa; }
.upgrade-btn:hover { background:rgba(167,139,250,0.4); }
.sell-btn { background:rgba(239,68,68,0.15); color:#ef4444; }
.sell-btn:hover { background:rgba(239,68,68,0.3); }

/* --- Start / End screens --- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,20,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.overlay h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  background: linear-gradient(135deg, #a78bfa, #67e8f9);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.overlay .subtitle {
  color: #94a3b8; font-size: 13px; margin-bottom: 32px;
}
.play-btn {
  background: linear-gradient(135deg, #a78bfa, #67e8f9);
  color: #0f0f1a; border: none; border-radius: 8px;
  padding: 14px 40px; font-size: 16px; font-weight: 800;
  cursor: pointer; font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.04em;
}
.play-btn:hover { transform:scale(1.05); box-shadow:0 0 24px rgba(167,139,250,0.5); }
.badge {
  position: fixed; bottom: 14px; right: 14px;
  background: rgba(22,22,42,0.8); border: 1px solid rgba(167,139,250,0.15);
  border-radius: 6px; padding: 6px 12px;
  font-size: 10px; color: #64748b;
  z-index: 200;
}
.badge a { color: #a78bfa; text-decoration: none; }
.badge a:hover { text-decoration: underline; }

#endScreen { display:none; }
#endTitle { font-family:'Press Start 2P', monospace; font-size:32px; margin-bottom:8px; }
#endScore { color:#94a3b8; font-size:14px; margin-bottom:24px; }

/* --- Layout wrapper --- */
#gameWrap {
  display: flex; align-items: center; justify-content: center;
  margin-top: 44px;
  width: calc(100vw - 160px);
  height: calc(100vh - 44px);
}

/* --- Responsive --- */
@media (max-width: 1000px) {
  #sidePanel { width: 130px; }
  #gameWrap { width: calc(100vw - 130px); }
  .tower-btn { padding: 6px; }
}
@media (max-width: 700px) {
  #sidePanel { display: none !important; }
  #gameWrap { width: 100vw; }
  #gameCanvas { max-width: 100vw; max-height: calc(100vh - 44px); }
}
