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

body {
  margin: 0;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #0b0f1a;
  color: #e9f2ff;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

#hud button,
#hud label {
  pointer-events: auto;
}

.top-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#calibrate-progress {
  width: 180px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  display: none;
}

#calibrate-bar {
  display: block;
  width: 0%;
  height: 100%;
  background: #ffe88a;
}

button {
  background: #2c8cff;
  border: none;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
}

button:disabled {
  background: #4a5b78;
  color: #c9d6ea;
}

#status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 14px;
  color: #dfe9fb;
}

#score-wrap {
  display: flex;
  align-items: center;
}

#score-label {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

#instructions {
  font-size: 13px;
  max-width: 520px;
  line-height: 1.3;
  color: #c2d2f0;
}

@media (max-width: 720px) {
  #hud {
    padding: 8px 10px;
    gap: 6px;
  }

  .top-row {
    gap: 6px;
  }

  button {
    padding: 10px 12px;
    font-size: 14px;
    min-height: 44px;
  }

  #calibrate-progress {
    width: 140px;
  }

  #status-row {
    font-size: 12px;
  }

  #score-label {
    font-size: 24px;
  }

  #score-label {
    font-size: 24px;
  }

  #instructions {
    font-size: 12px;
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .top-row {
    align-items: stretch;
  }

  button {
    width: 100%;
  }

  #calibrate-progress {
    width: 100%;
  }
}

.toggle {
  font-size: 13px;
  color: #dfe9fb;
}

#debug-canvas {
  position: fixed;
  width: 160px;
  height: 120px;
  bottom: 12px;
  right: 12px;
  border: 1px solid #22334f;
  border-radius: 4px;
  background: #0b0f1a;
  display: none;
  z-index: 9;
}

#countdown {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: clamp(72px, 18vw, 220px);
  font-weight: 800;
  color: #ffe88a;
  text-shadow: 0 0 12px rgba(255, 140, 40, 0.9),
               0 0 28px rgba(255, 120, 20, 0.8);
  z-index: 8;
  pointer-events: none;
}
