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

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  overflow: hidden;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#gameCanvas {
  display: block;
  background: #16213e;
}

/* HUD */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #333;
  z-index: 10;
}

#hud-left { display: flex; gap: 20px; }
#hud-left span { font-size: 14px; }

#hud-right { display: flex; gap: 8px; }

button {
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #e94560;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border-radius: 3px;
  transition: background 0.15s;
}
button:hover { background: #e94560; color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tower panel */
#tower-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.8);
  border-top: 1px solid #333;
  padding: 8px 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title {
  font-size: 12px;
  color: #aaa;
  white-space: nowrap;
}

#tower-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tower-btn {
  padding: 5px 10px;
  font-size: 12px;
}

.tower-btn.selected {
  background: #e94560;
  color: #fff;
}

.tower-btn:disabled {
  border-color: #444;
  color: #555;
}

/* Skill tree overlay */
#skill-tree-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

#skill-tree-content {
  background: #16213e;
  border: 1px solid #e94560;
  border-radius: 6px;
  padding: 20px;
  width: 90%;
  max-width: 860px;
  max-height: 85vh;
  overflow-y: auto;
}

.overlay-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e94560;
}

#close-skill-tree {
  padding: 2px 8px;
  font-size: 14px;
}

#skill-paths {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.skill-path {
  background: #0f3460;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 10px;
}

.skill-path-title {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #fff;
}

.skill-node {
  background: #1a1a2e;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.skill-node:hover { border-color: #e94560; }

.skill-node.unlocked {
  border-color: #4caf50;
  background: #1b3a1f;
}

.skill-node.locked-path {
  border-color: #ff5722;
  opacity: 0.6;
  cursor: not-allowed;
}

.skill-node.locked-prev {
  opacity: 0.5;
  cursor: not-allowed;
}

.skill-cost {
  color: #ffd700;
  float: right;
}

/* Quiz modal */
#quiz-modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

#quiz-content {
  background: #16213e;
  border: 2px solid #e94560;
  border-radius: 8px;
  padding: 28px;
  width: 90%;
  max-width: 560px;
}

#quiz-subject {
  font-size: 11px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

#quiz-question {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 20px;
  color: #fff;
}

#quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  background: #0f3460;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: border-color 0.15s;
}

.quiz-option:hover { border-color: #e94560; }
.quiz-option.correct { border-color: #4caf50; background: #1b3a1f; }
.quiz-option.wrong { border-color: #f44336; background: #3a1b1b; }

#quiz-feedback {
  margin-top: 14px;
  font-size: 14px;
  min-height: 20px;
  text-align: center;
}

/* Game over */
#game-over-screen {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-over-content {
  background: #16213e;
  border: 2px solid #e94560;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
}

#game-over-title { font-size: 32px; color: #e94560; margin-bottom: 12px; }
#game-over-msg { font-size: 16px; color: #aaa; margin-bottom: 24px; }

.hidden { display: none !important; }

/* Gold highlight */
#gold-display { color: #ffd700; }
#tokens-display { color: #4dd; }
#lives-display { color: #f88; }
#wave-display { color: #adf; }
