* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- Overlay 通用 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(160deg, #0a0a1a 0%, #1a0a2e 50%, #0a0a1a 100%);
  color: #fff;
  text-align: center;
  padding: 24px;
}

.overlay.hidden {
  display: none;
}

/* ---------- 开始界面 ---------- */
.game-title {
  font-size: clamp(40px, 12vw, 72px);
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #00d9ff, #a855f7, #ff6b6b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(168, 85, 247, 0.3);
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from {
    filter: drop-shadow(0 0 8px rgba(0, 217, 255, 0.4));
  }
  to {
    filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.6));
  }
}

.game-subtitle {
  font-size: clamp(14px, 3.5vw, 18px);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.menu-high-score {
  font-size: 18px;
  color: #ffd700;
  font-weight: 600;
  min-height: 24px;
}

.daily-streak {
  font-size: 14px;
  color: #ff6b6b;
  min-height: 20px;
}

.instructions {
  margin-top: 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 2;
}

.instructions p {
  margin: 0;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  margin-top: 8px;
  padding: 14px 48px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #00d9ff, #0099ff);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(0, 217, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(0, 217, 255, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-large {
  padding: 18px 56px;
  font-size: 24px;
}

.btn-secondary {
  padding: 10px 32px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- 结算界面 ---------- */
.new-record {
  font-size: 28px;
  font-weight: 800;
  color: #ffd700;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0% {
    transform: scale(0);
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.new-record.hidden {
  display: none;
}

.final-score-label {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
}

.final-score {
  font-size: clamp(48px, 14vw, 80px);
  font-weight: 900;
  color: #00d9ff;
  text-shadow: 0 0 30px rgba(0, 217, 255, 0.4);
  line-height: 1.2;
}

.beat-percent {
  font-size: 16px;
  color: #a855f7;
  font-weight: 600;
}

.high-score-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
}

.best-combo-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
}

.next-bonus {
  font-size: 14px;
  color: #ffd700;
  margin-top: -4px;
}

/* ---------- 分享提示 ---------- */
.share-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  z-index: 20;
  animation: toastFade 2s ease forwards;
}

@keyframes toastFade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- 2.0 新增样式 ---------- */
.menu-coins {
  font-size: 18px;
  color: #ffd700;
  font-weight: 700;
  min-height: 24px;
}

.daily-challenge-info {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  max-width: 320px;
  line-height: 1.6;
  text-align: center;
}

.menu-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.menu-icons {
  display: flex;
  gap: 12px;
  position: absolute;
  bottom: 24px;
}

.menu-icons .btn-icon {
  position: static;
}

.ending-text {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  line-height: 1.6;
  max-width: 360px;
}

.coins-earned {
  font-size: 18px;
  color: #ffd700;
  font-weight: 700;
}

/* ---------- 商店 ---------- */
#shop-screen,
#collection-screen,
#daily-screen {
  overflow-y: auto;
  justify-content: flex-start;
  padding-top: 60px;
}

.overlay-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.overlay-header h2 {
  font-size: 22px;
  flex: 1;
}

.overlay-coins {
  font-size: 18px;
  color: #ffd700;
  font-weight: 700;
}

.btn-close {
  width: 36px;
  height: 36px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
}

.shop-list,
.collection-list,
.daily-list {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.shop-item-info {
  flex: 1;
}

.shop-item-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.shop-item-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.shop-item-level {
  font-size: 11px;
  margin-top: 4px;
}

.shop-buy-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #00d9ff, #0099ff);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.shop-buy-btn.maxed {
  background: rgba(255, 255, 255, 0.1);
  cursor: default;
}

.shop-buy-btn.disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* ---------- 收藏 ---------- */
.collection-section {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.collection-section h3 {
  font-size: 15px;
  color: #00d9ff;
  margin-bottom: 8px;
}

.collection-section p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin: 8px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d9ff, #69f0ae);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ---------- 每日 ---------- */
.daily-section {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.daily-section h3 {
  font-size: 15px;
  color: #ab47bc;
  margin-bottom: 8px;
}

.daily-section p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}
