/* Beat Surge: 极频共振 Stylesheet */
:root {
  --bg-color: #04060d;
  --accent-cyan: #00f3ff;
  --accent-pink: #ff007f;
  --accent-gold: #ffd700;
  --accent-purple: #9d4edd;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --glass-bg: rgba(11, 16, 33, 0.75);
  --glass-border: rgba(0, 243, 255, 0.25);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #0a1128 0%, #03050a 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* --- HUD Overlay --- */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 16px) 16px env(safe-area-inset-bottom, 16px) 16px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.track-info-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.track-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.track-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.score-stats-card {
  text-align: right;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.score-num {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-main);
}

.bpm-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-pink);
  margin-top: 2px;
}

/* Life & Resonance Meter */
.meter-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.meter-track {
  width: min(340px, 86vw);
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.meter-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-pink), var(--accent-cyan));
  border-radius: 999px;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 12px var(--accent-cyan);
}

.overdrive-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 0, 127, 0.2);
  border: 1px solid var(--accent-pink);
  color: var(--accent-pink);
  transition: all 0.2s ease;
}

.overdrive-pill.active {
  background: var(--accent-pink);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-pink);
  animation: pulse-glow 0.8s infinite alternate;
}

@keyframes pulse-glow {
  from { transform: scale(1); filter: brightness(1); }
  to { transform: scale(1.08); filter: brightness(1.3); }
}

/* Quick Floating Controls (top right buttons) */
.hud-actions {
  position: absolute;
  bottom: 24px;
  right: 20px;
  display: flex;
  gap: 12px;
  pointer-events: auto;
  z-index: 15;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-icon:active {
  transform: scale(0.92);
  border-color: var(--accent-cyan);
}

/* Bottom Strike Instruction */
.strike-hint {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* --- Modals --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 5, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  width: min(440px, 90vw);
  background: linear-gradient(135deg, rgba(16, 24, 48, 0.95), rgba(7, 10, 20, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 243, 255, 0.15);
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-pink);
  margin-bottom: 8px;
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-top: 2px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent-cyan), #0077ff);
  border: none;
  border-radius: 14px;
  color: #03050a;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 243, 255, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(1.15);
}

.btn-secondary {
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.08);
}

.keys-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 14px;
}
