:root {
  --bg1: #0a0b14;
  --bg2: #14081f;
  --neon: #00f0ff;
  --pink: #ff2bd6;
  --purple: #8b5cf6;
  --table: #123b2e;
  --text: #eef5ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg1) 70%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* HUD */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px;
  z-index: 5;
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 62px;
}
.stat-label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a93a8; }
.stat-val { font-size: 22px; font-weight: 800; color: var(--neon); text-shadow: 0 0 12px rgba(0,240,255,.55); }
.hud-title {
  font-size: 18px; font-weight: 900; letter-spacing: 0.28em;
  color: transparent; -webkit-text-stroke: 1px var(--neon);
  text-shadow: 0 0 18px rgba(0,240,255,.35);
}

/* Canvas fills the middle. Canvas drawing is normally below content; we want
   the canvas to BE the game area covering the main zone. */
main {
  position: relative;
  flex: 1;
  min-height: 0;
}
#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 10;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.panel {
  text-align: center;
  padding: 34px 28px;
  border-radius: 22px;
  background: rgba(18, 20, 34, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.45);
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.28), inset 0 0 30px rgba(0, 0, 0, 0.4);
  max-width: 86vw;
}
.panel h1 { font-size: 40px; letter-spacing: 0.1em; margin-bottom: 10px; }
.panel p { color: #aab3c5; font-size: 15px; margin-bottom: 22px; line-height: 1.45; }
.neon { color: var(--neon); text-shadow: 0 0 18px rgba(0,240,255,.65); }

.btn {
  font-size: 17px; font-weight: 800; letter-spacing: 0.08em;
  color: #08121a;
  background: linear-gradient(135deg, var(--neon), #7cd8ff);
  border: none; border-radius: 14px;
  padding: 13px 40px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 240, 255, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,240,255,.55); }
.btn:active { transform: translateY(0); }

.mute {
  position: absolute; bottom: 14px; right: 14px;
  font-size: 20px; cursor: pointer; z-index: 11;
  opacity: 0.6; user-select: none; touch-action: manipulation;
}
.mute.muted { opacity: 0.35; }