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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: 'Space Mono', monospace;
}

#gameCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

#ui {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  pointer-events: none;
}

#score {
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 2px;
}

#combo {
  font-size: 18px;
  color: #f0a500;
  letter-spacing: 1px;
  text-align: right;
}

#combo.hidden { opacity: 0; }

#feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: bold;
  pointer-events: none;
  opacity: 0;
  letter-spacing: 2px;
  text-shadow: 0 0 10px currentColor;
}

#startScreen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111;
  gap: 16px;
  z-index: 10;
}

#startScreen h1 {
  font-size: 48px;
  color: #fff;
  letter-spacing: 4px;
}

#startScreen p {
  font-size: 16px;
  color: #aaa;
  letter-spacing: 1px;
}

#startBtn {
  margin-top: 16px;
  padding: 14px 40px;
  font-size: 18px;
  font-family: 'Space Mono', monospace;
  background: #fff;
  color: #111;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  font-weight: bold;
  transition: opacity 0.15s;
}

#startBtn:active { opacity: 0.7; }

#bgmControl {
  position: fixed;
  bottom: 88px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

#bgmLabel {
  color: #aaa;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
}

#bgmSelect {
  background: #1a1a1a;
  border: 2px solid #555;
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  max-width: 130px;
}

#bgmToggle {
  background: none;
  border: 2px solid #555;
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s;
}

#bgmToggle.off {
  border-color: #333;
  color: #555;
}

#bgmVolume {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: #555;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

#bgmVolume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

#bgmVolume.disabled {
  opacity: 0.25;
  pointer-events: none;
}

#seControl {
  position: fixed;
  bottom: 52px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

#seToggle {
  background: none;
  border: 2px solid #555;
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s;
}

#seToggle.off {
  border-color: #333;
  color: #555;
}

#seVolume {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: #555;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

#seVolume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

#seVolume.disabled {
  opacity: 0.25;
  pointer-events: none;
}

#startBgmRow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aaa;
  font-size: 13px;
  letter-spacing: 1px;
}

#startBgmSelect {
  background: #222;
  border: 1px solid #555;
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  max-width: 200px;
}

#bgmProgress {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 6;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}

#bgmProgressBar {
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,0.5);
  transition: width 0.25s linear;
}

#endDialog {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
  z-index: 20;
  gap: 24px;
}

#endDialog.hidden { display: none; }

#endDialogMsg {
  color: #fff;
  font-size: 20px;
  letter-spacing: 2px;
  font-family: 'Space Mono', monospace;
}

#endDialogBtns {
  display: flex;
  gap: 16px;
}

#endContinueBtn, #endStopBtn {
  padding: 12px 32px;
  font-size: 15px;
  font-family: 'Space Mono', monospace;
  border: 2px solid #fff;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  font-weight: bold;
  background: none;
  color: #fff;
  transition: opacity 0.15s;
}

#endContinueBtn { background: #fff; color: #111; }
#endContinueBtn:active, #endStopBtn:active { opacity: 0.7; }

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');