/* ============ 全局样式 ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

:root {
  --accent: #00e5ff;
  --accent2: #ff2d95;
  --bg-dark: #05060f;
  --panel: rgba(10, 14, 30, 0.9);
  --text: #e8f6ff;
  --text-dim: #7f9bb0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  color: var(--text);
}

/* ============ 游戏容器 ============ */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #0b1030 0%, var(--bg-dark) 70%);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============ 通用界面层 ============ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(4, 6, 18, 0.72);
  backdrop-filter: blur(6px);
  z-index: 10;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ============ 标题 ============ */
.title {
  font-size: clamp(48px, 9vw, 88px);
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(180deg, #ffffff 0%, var(--accent) 55%, #0066ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(0, 229, 255, 0.35);
  animation: float-title 3s ease-in-out infinite;
}

.title span {
  color: var(--accent2);
  background: linear-gradient(180deg, #ffb1dd 0%, var(--accent2) 60%, #7a0048 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

@keyframes float-title {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.subtitle {
  color: var(--text-dim);
  font-size: 16px;
  letter-spacing: 2px;
}

/* ============ 难度选择 ============ */
.difficulty {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diff-label {
  color: var(--text-dim);
  font-size: 15px;
  letter-spacing: 2px;
}

.btn-diff {
  padding: 8px 26px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-diff:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-diff.active {
  color: #02121c;
  background: linear-gradient(180deg, #7df5ff 0%, var(--accent) 100%);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.45);
}

/* ============ 操作说明 ============ */
.controls-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 28px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 12px;
  background: var(--panel);
  font-size: 14px;
  color: var(--text-dim);
}

.control-item {
  display: flex;
  justify-content: space-between;
  gap: 32px;
}

.key {
  display: inline-block;
  min-width: 90px;
  color: var(--accent);
  font-weight: 600;
}

/* ============ 按钮 ============ */
.btn {
  padding: 14px 56px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #02121c;
  background: linear-gradient(180deg, #7df5ff 0%, var(--accent) 50%, #0095c8 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 0 36px rgba(0, 229, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  background: linear-gradient(180deg, #3a4a66 0%, #223047 100%);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  box-shadow: 0 0 24px rgba(120, 160, 220, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ============ 各界面细节 ============ */
.screen-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
}

.high-score {
  color: #ffd166;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
}

.hint {
  color: var(--text-dim);
  font-size: 12px;
}

/* 结算界面 */
.score-box {
  padding: 24px 48px;
  border: 1px solid rgba(255, 45, 149, 0.3);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 2px;
}

.big-number {
  font-size: 56px;
  font-weight: 900;
  color: var(--accent2);
  text-shadow: 0 0 30px rgba(255, 45, 149, 0.5);
  margin: 6px 0;
}

.new-record {
  color: #ffd166;
  font-size: 16px;
  font-weight: 700;
  animation: blink-record 1s ease-in-out infinite;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  color: var(--text-dim);
}

.stats-row b {
  color: var(--accent);
  font-size: 15px;
}

@keyframes blink-record {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============ HUD ============ */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  font-size: 15px;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

#hud div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#hud span {
  color: var(--accent);
  font-weight: 700;
}

#hud-center {
  align-items: center;
  color: var(--text-dim);
}

#hud-center span {
  color: #ffd166;
}

#hud-right {
  align-items: flex-end;
}

#hud-right span {
  color: var(--accent2);
}
