/* ===================================
   HOME DEFENDER — styles.css
   =================================== */

:root {
  --bg-1: #0b1020;
  --bg-2: #0d1226;
  --neon-cyan:   #00ffff;
  --neon-green:  #00ff88;
  --neon-yellow: #ffee00;
  --neon-pink:   #ff00ff;
  --neon-orange: #ff6600;
  --neon-blue:   #0088ff;
  --neon-purple: #cc00ff;
  --neon-red:    #ff2244;
  --border-col:  rgba(0, 255, 255, 0.18);
}

/* ---- Site base (matches ybro.net — Bootstrap default system font) ---- */
html, body {
  background: radial-gradient(1200px 600px at 20% -10%, rgba(178,107,255,.07), transparent),
              radial-gradient(900px 500px at 100% 10%, rgba(34,224,255,.07), transparent),
              linear-gradient(180deg, var(--bg-1), var(--bg-2));
  color: #e6f3ff;
  min-height: 100vh;
}

.glass {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  border-radius: 16px;
}

/* ============================================
   STATS BAR
   ============================================ */
.hd-statsbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hd-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 900;
  font-size: 0.9rem;
  letter-spacing: 3px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  white-space: nowrap;
  margin-right: 4px;
}

.hd-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  background: rgba(0,255,255,0.04);
  border: 1px solid var(--border-col);
  border-radius: 5px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ============================================
   CANVAS + OVERLAY CONTAINER
   ============================================ */
.hd-game-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  line-height: 0; /* remove gap under canvas */
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border: 1.5px solid rgba(0,255,255,0.3);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0,255,255,0.08);
  cursor: pointer;
}

/* ---- Canvas Overlays (buffs, info) ---- */
.hd-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 18, 0.96);
  border-radius: 8px;
  z-index: 10;
  overflow-y: auto;
  padding: 14px 14px 18px;
  line-height: 1.4;
}

.hd-overlay::-webkit-scrollbar { width: 4px; }
.hd-overlay::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.hd-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-col);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.hd-overlay-close {
  background: none;
  border: 1px solid #444;
  color: #aaa;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.hd-overlay-close:hover { border-color: var(--neon-red); color: var(--neon-red); }

/* ============================================
   CONTROL BAR
   ============================================ */
.hd-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  max-width: 640px;
  margin: 0 auto;
}

.hd-wave-section {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hd-ctrl-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: stretch;
}

/* ---- Control buttons ---- */
.btn-ctrl {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.18);
  color: #aaa;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-ctrl:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

.btn-ctrl.active-speed {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
  box-shadow: 0 0 8px rgba(255,238,0,0.15);
}

.btn-ctrl.active-auto {
  border-color: var(--neon-green);
  color: var(--neon-green);
  text-shadow: 0 0 6px var(--neon-green);
  box-shadow: 0 0 8px rgba(0,255,136,0.15);
}

.btn-ctrl.active-overlay {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0,255,255,0.15);
}

/* ============================================
   TOWER PLACEMENT MODAL GRID
   ============================================ */
.tower-place-card {
  padding: 10px 8px;
  border: 1px solid;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  background: rgba(255,255,255,0.03);
  transition: all 0.15s;
  position: relative;
}

.tower-place-card:hover {
  background: rgba(255,255,255,0.09);
  transform: translateY(-2px);
}

.tower-place-card.cant-afford {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.tower-place-abbr {
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 3px;
}

.tower-place-name {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
}

.tower-place-desc {
  font-size: 0.6rem;
  color: #777;
  line-height: 1.3;
  margin-bottom: 5px;
}

.tower-place-stats {
  font-size: 0.58rem;
  color: #666;
  margin-bottom: 5px;
  line-height: 1.4;
}

.tower-place-cost {
  font-size: 0.72rem;
  font-weight: 700;
}

/* ============================================
   UPGRADE MODAL
   ============================================ */
.upg-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.upg-special-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid;
  letter-spacing: 1px;
  margin-top: 6px;
}

/* ============================================
   BUFF OVERLAY
   ============================================ */
.buff-card {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 0.12s;
}

.buff-card:hover { background: rgba(255,255,255,0.04); }
.buff-card:last-child { border-bottom: none; }

.buff-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.buff-name { font-size: 0.8rem; font-weight: 700; }
.buff-desc { font-size: 0.65rem; color: #666; margin-bottom: 5px; }
.buff-pips { display: flex; gap: 3px; }

.pip {
  width: 10px; height: 10px;
  border-radius: 2px;
  border: 1px solid currentColor;
}
.pip.filled { background: currentColor; }

/* ============================================
   ENEMY LEGEND (info overlay)
   ============================================ */
.enemy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.72rem;
}
.enemy-row:last-child { border-bottom: none; }

.enemy-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-neon-green {
  background: transparent;
  border: 2px solid var(--neon-green);
  color: var(--neon-green);
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 0.8rem;
  text-shadow: 0 0 6px var(--neon-green);
  box-shadow: 0 0 10px rgba(0,255,136,0.12);
  transition: all 0.18s;
}

.btn-neon-green:hover {
  background: rgba(0,255,136,0.12);
  color: #fff;
  box-shadow: 0 0 20px rgba(0,255,136,0.3);
}

.btn-neon-green:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ============================================
   DIFFICULTY + MODALS
   ============================================ */
.diff-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid;
  white-space: nowrap;
}
.diff-badge.easy      { color: #00ffff; border-color: #00ffff; }
.diff-badge.normal    { color: #00ff88; border-color: #00ff88; }
.diff-badge.hard      { color: #ffee00; border-color: #ffee00; }
.diff-badge.nightmare { color: #ff2244; border-color: #ff2244; }

.hd-modal {
  background: #07071a;
  border: 1px solid rgba(0,255,255,0.35);
  box-shadow: 0 0 40px rgba(0,255,255,0.12);
  color: #e6f3ff;
}

.neon-title {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 5px;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan), 0 0 40px rgba(0,255,255,0.3);
}

.letter-space { letter-spacing: 3px; }

.diff-btn {
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-align: left;
  padding: 10px 14px;
  transition: transform 0.15s;
}
.diff-btn:hover { transform: translateX(4px); }

/* ============================================
   NEON HELPERS
   ============================================ */
.neon-cyan   { color: var(--neon-cyan);   text-shadow: 0 0 6px var(--neon-cyan); }
.neon-green  { color: var(--neon-green);  text-shadow: 0 0 6px var(--neon-green); }
.neon-yellow { color: var(--neon-yellow); text-shadow: 0 0 6px var(--neon-yellow); }
.neon-pink   { color: var(--neon-pink);   text-shadow: 0 0 6px var(--neon-pink); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .hd-title { display: none; }   /* save space on tiny screens */
  .hd-stats { gap: 5px; }
  .stat-chip { font-size: 0.7rem; padding: 2px 5px; }
  .btn-ctrl { font-size: 0.62rem; padding: 5px 7px; }
}
