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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a1b4d;
  font-family: 'Orbitron', sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#canvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  pointer-events: none;
  z-index: 10;
}
#hud button { pointer-events: auto; }

.hud-left, .hud-center, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hud-center { align-items: center; }
.hud-right { align-items: flex-end; gap: 8px; }

.stat {
  display: flex;
  flex-direction: column;
  color: #fff;
  text-shadow: 0 0 8px #00f2fe, 0 2px 4px rgba(0,0,0,0.6);
  font-weight: 900;
  line-height: 1;
}
.stat span:last-child { font-size: 28px; }
.stat.small span:last-child { font-size: 16px; color: #ffe66d; text-shadow: 0 0 6px #ffa502; }
.stat .label {
  font-size: 10px;
  letter-spacing: 2px;
  opacity: 0.75;
  margin-bottom: 2px;
}
.hud-center .stat span:last-child { font-size: 22px; color: #ffe66d; }

#lives { font-size: 20px; letter-spacing: 2px; }

#muteBtn {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 20px;
  padding: 4px 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#muteBtn:active { transform: scale(0.9); }

/* ---------- Level flash ---------- */
.flash {
  position: fixed;
  top: 42%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  font-size: clamp(28px, 8vw, 64px);
  font-weight: 900;
  color: #ffe66d;
  text-shadow: 0 0 20px #ff6b35, 0 0 40px #ff4757;
  pointer-events: none;
  white-space: nowrap;
}
.flash.anim { animation: flashIn 1.2s ease-out forwards; }
@keyframes flashIn {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(30,95,168,0.35), rgba(10,27,77,0.85));
  backdrop-filter: blur(3px);
}

.panel {
  text-align: center;
  padding: 32px 28px;
  border-radius: 24px;
  background: rgba(10,20,50,0.7);
  border: 2px solid rgba(0,242,254,0.35);
  box-shadow: 0 0 50px rgba(0,242,254,0.25), inset 0 0 30px rgba(0,242,254,0.08);
  max-width: 90vw;
  animation: pop 0.5s cubic-bezier(0.18,0.9,0.3,1.3);
}
@keyframes pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.title {
  font-size: clamp(40px, 12vw, 84px);
  font-weight: 900;
  color: #fff;
  letter-spacing: 4px;
  text-shadow: 0 0 20px #00f2fe, 0 0 40px #4facfe;
  line-height: 0.9;
}
.title .sub {
  font-size: clamp(20px, 5vw, 36px);
  color: #ffe66d;
  text-shadow: 0 0 16px #ffa502;
  letter-spacing: 6px;
}
.title.gover {
  color: #ff4757;
  text-shadow: 0 0 20px #ff4757, 0 0 40px #ff6b35;
  font-size: clamp(36px, 11vw, 72px);
}

.tag {
  font-family: 'Vazirmatn', sans-serif;
  color: #9fe3ff;
  margin: 12px 0 24px;
  font-size: 15px;
  font-weight: 700;
}

.bigbtn {
  font-family: 'Vazirmatn', 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #0a1b4d;
  background: linear-gradient(135deg, #ffe66d, #ffa502);
  border: none;
  border-radius: 16px;
  padding: 16px 32px;
  cursor: pointer;
  box-shadow: 0 6px 0 #c77800, 0 0 30px rgba(255,166,2,0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}
.bigbtn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #c77800, 0 0 40px rgba(255,166,2,0.7); }
.bigbtn:active { transform: translateY(4px); box-shadow: 0 2px 0 #c77800; }

.instructions {
  margin-top: 24px;
  font-family: 'Vazirmatn', sans-serif;
  color: #cfe8ff;
  font-size: 13px;
  line-height: 2;
  opacity: 0.85;
}

.gostats {
  font-family: 'Vazirmatn', sans-serif;
  color: #fff;
  font-size: 18px;
  line-height: 2.2;
  margin: 8px 0 24px;
}
.gostats b { color: #ffe66d; font-family: 'Orbitron'; }

.remix {
  position: fixed;
  bottom: 12px;
  color: rgba(255,255,255,0.6);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px dotted rgba(255,255,255,0.4);
  z-index: 40;
}
.remix:hover { color: #00f2fe; }