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

body {
  background: #202124;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e8eaed;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

#back-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #5f6368;
  transition: background 0.2s;
  line-height: 1;
}

#back-btn:hover {
  background: #80868b;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  width: 100%;
  max-width: 860px;
}

/* Toolbar */
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

#stat-hits,
#stat-accuracy,
#stat-timer {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#stat-timer {
  color: #ef5350;
  min-width: 50px;
  text-align: right;
}

/* Mode bar */
#mode-bar {
  display: flex;
  gap: 6px;
  background: #292a2d;
  padding: 4px;
  border-radius: 12px;
}

.mode-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #9aa0a6;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-btn:hover {
  color: #e8eaed;
}

.mode-btn.active {
  background: #ef5350;
  color: #fff;
}

/* Arena */
#arena {
  width: 100%;
  height: min(520px, calc(100vh - 260px));
  min-height: 300px;
  background: #181a1b;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* Start / end screens */
#start-screen,
#end-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(24, 26, 27, 0.95);
  z-index: 10;
}

#start-screen h2,
#end-screen h2 {
  font-size: 32px;
  margin-bottom: 8px;
  color: #ef5350;
}

#start-screen p,
#end-screen p {
  font-size: 16px;
  color: #9aa0a6;
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.6;
}

#start-btn,
#end-screen button {
  background: #ef5350;
  border: none;
  padding: 14px 40px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

#start-btn:hover,
#end-screen button:hover {
  background: #f44336;
}

#start-btn:active,
#end-screen button:active {
  transform: scale(0.95);
}

/* Targets */
.target {
  position: absolute;
  border-radius: 50%;
  cursor: crosshair;
  transition: transform 0.08s;
  z-index: 5;
}

.target:active {
  transform: scale(0.9);
}

.target-ring {
  position: absolute;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Hit effect */
.hit-effect {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  animation: hitPop 0.3s ease-out forwards;
}

@keyframes hitPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Miss effect */
.miss-effect {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 6;
  animation: missFade 0.4s ease-out forwards;
}

@keyframes missFade {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

/* Tracking target */
.target.tracking {
  transition: none;
}

/* Stats bar */
#stats-bar {
  display: flex;
  gap: 24px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-size: 12px;
  color: #5f6368;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e8eaed;
}

/* Floating score text */
.float-score {
  position: absolute;
  pointer-events: none;
  z-index: 7;
  font-size: 16px;
  font-weight: 700;
  color: #4caf50;
  animation: floatUp 0.6s ease-out forwards;
}

@keyframes floatUp {
  0% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -40px); opacity: 0; }
}

@media (max-width: 640px) {
  #game-container {
    padding: 10px;
  }

  #arena {
    height: min(420px, calc(100vh - 240px));
  }

  .mode-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  #stat-hits,
  #stat-accuracy,
  #stat-timer {
    font-size: 15px;
  }

  .stat-value {
    font-size: 16px;
  }

  #stats-bar {
    gap: 16px;
  }
}
