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

body {
  background: #0f0f1a;
  font-family: 'Segoe UI', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* ── HUD ── */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
}

.hud-item {
  color: #e0e0ff;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.hud-item span {
  color: #a78bfa;
}

#timer.urgent {
  color: #f87171 !important;
  animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; }
  to   { opacity: 0.4; }
}

/* ── Arena ── */
#arena {
  position: fixed;
  top: 56px; left: 0; right: 0; bottom: 0;
}

/* ── Target squares ── */
.target {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: rgba(255,255,255,0.9);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.08s ease;
  animation: pop-in 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.target:hover  { transform: scale(1.12); }
.target:active { transform: scale(0.92); }

@keyframes pop-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes pop-out {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.4); opacity: 0.6; }
  100% { transform: scale(0);   opacity: 0; }
}

.target.clicked {
  animation: pop-out 0.22s ease forwards;
  pointer-events: none;
}

/* ── Floating score +1 ── */
.float-point {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fde68a;
  pointer-events: none;
  animation: float-up 0.7s ease forwards;
  z-index: 20;
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-60px); }
}

/* ── Overlay (start / end) ── */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

#overlay-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 48px 56px;
  text-align: center;
  color: #e0e0ff;
  max-width: 420px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

#overlay-box h1 {
  font-size: 2.6rem;
  font-weight: 800;
  color: #a78bfa;
  margin-bottom: 16px;
}

#overlay-box p {
  font-size: 1rem;
  line-height: 1.6;
  color: #c4c4e0;
  margin-bottom: 28px;
}

#overlay-box .result-score {
  font-size: 3.5rem;
  font-weight: 900;
  color: #fde68a;
  display: block;
  margin: 12px 0 4px;
}

#overlay-box .result-wave {
  font-size: 1rem;
  color: #a78bfa;
  margin-bottom: 28px;
  display: block;
}

#start-btn, #restart-btn {
  background: #7c3aed;
  color: #fff;
  border: none;
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#start-btn:hover, #restart-btn:hover  { background: #6d28d9; transform: scale(1.04); }
#start-btn:active, #restart-btn:active { transform: scale(0.97); }

/* ── Scores table ── */
.scores-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #a78bfa;
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.92rem;
}

.score-table th {
  color: #7c6fa0;
  font-weight: 600;
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.score-table td {
  color: #d4d4f0;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.score-table tr.new-entry td {
  color: #fde68a;
  font-weight: 700;
}

.no-scores {
  font-size: 0.9rem;
  color: #7c6fa0;
  margin-bottom: 24px !important;
}
