:root {
  --bg-dark: #0f172a;
  --bg-panel: rgba(30, 41, 59, 0.7);
  --primary: #f43f5e; /* Rose/Red */
  --accent: #3b82f6;  /* Blue */
  --success: #10b981; /* Green */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-main: 'Inter', sans-serif;
  --hud-height: 64px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  background-image: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
  color: var(--text-main);
  font-family: var(--font-main);
}

/* --- Typography --- */
h1, h2, h3, button, input { font-family: var(--font-main); }

/* --- Layout --- */
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Canvas --- */
#gameCanvas {
  flex: 1;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* --- HUD (Heads Up Display) --- */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--hud-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through to canvas where empty */
}

/* Glassmorphism utility */
.glass {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.hud-panel {
  pointer-events: auto;
  padding: 8px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-display {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  gap: 16px;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.dot.green { background-color: var(--success); color: var(--success); }
.dot.blue { background-color: var(--accent); color: var(--accent); }

/* --- Controls / Bottom Bar --- */
.controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 10;
  pointer-events: auto;
}

.btn {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.btn:active { transform: scale(0.96); }
.btn:hover { background: rgba(255, 255, 255, 0.1); }

.btn-primary {
  background: var(--primary);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}
.btn-primary:hover { background: #e11d48; }

/* --- Menu / Overlay --- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 90%;
  max-width: 400px;
  padding: 24px;
  border-radius: 20px;
  text-align: center;
}

.modal h2 { margin-top: 0; margin-bottom: 8px; }
.modal p { color: var(--text-muted); margin-bottom: 24px; }

/* --- Narration Toast --- */
.toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 12px 20px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 20;
  max-width: 90%;
  text-align: center;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Power Meter --- */
.power-indicator {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.power-indicator.visible { opacity: 1; }
.power-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--primary));
  width: 0%;
  transition: width 0.1s linear;
}

@media (max-width: 600px) {
  .hud { padding: 0 8px; }
  .score-display { font-size: 0.9rem; gap: 10px; }
  .controls { width: 90%; justify-content: center; bottom: 16px; }
}
