* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1321;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

.hidden {
  display: none !important;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: 14px 16px;
  z-index: 10;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.score-line {
  font-size: clamp(30px, 6vw, 52px);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}

.sub-line {
  margin-top: 5px;
  font-size: clamp(13px, 2.4vw, 17px);
  color: #dbe4f0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hud-right {
  text-align: right;
}

#combo {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  font-size: clamp(18px, 3.4vw, 28px);
  font-weight: 700;
  color: #ffd75e;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  background: rgba(20, 28, 44, 0.5);
  padding: 6px 18px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

#combo.pop {
  animation: combo-pop 0.3s ease-out;
}

@keyframes combo-pop {
  0% { transform: translateX(-50%) scale(1.35); }
  100% { transform: translateX(-50%) scale(1); }
}

.icon-btn {
  position: absolute;
  top: 14px;
  pointer-events: auto;
  background: rgba(20, 28, 44, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.icon-btn:hover {
  background: rgba(40, 54, 82, 0.7);
}

#btn-mute {
  right: 86px;
}

#btn-pause {
  right: 16px;
}

.panel {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse at center, rgba(13, 19, 33, 0.35), rgba(13, 19, 33, 0.65));
  backdrop-filter: blur(2px);
  z-index: 20;
  text-align: center;
  padding: 20px;
}

#menu h1 {
  font-size: clamp(42px, 10vw, 84px);
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #ffd75e, #ff8a3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 24px rgba(255, 138, 61, 0.35);
}

.tagline {
  font-size: clamp(14px, 2.6vw, 18px);
  color: #dbe4f0;
  letter-spacing: 2px;
}

.controls {
  display: grid;
  gap: 8px;
  font-size: clamp(13px, 2.4vw, 16px);
  color: #b9c6d8;
  background: rgba(20, 28, 44, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 16px 28px;
  border-radius: 14px;
}

button.primary {
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 700;
  color: #1c1206;
  background: linear-gradient(180deg, #ffd75e, #ff9a3d);
  border: none;
  padding: 14px 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 154, 61, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 28px rgba(255, 154, 61, 0.55);
}

button.primary:active {
  transform: scale(0.97);
}

#over h2, #pause h2 {
  font-size: clamp(34px, 8vw, 60px);
  font-weight: 800;
  letter-spacing: 4px;
}

.over-stats {
  display: flex;
  gap: 28px;
  font-size: clamp(14px, 2.6vw, 18px);
  color: #dbe4f0;
}

.over-stats span {
  font-weight: 800;
  color: #ffd75e;
}

#new-best {
  color: #ff5e4a;
  font-weight: 800;
  font-size: clamp(18px, 3.4vw, 26px);
  animation: best-glow 0.8s ease-in-out infinite alternate;
}

@keyframes best-glow {
  from { text-shadow: 0 0 8px rgba(255, 94, 74, 0.5); }
  to { text-shadow: 0 0 22px rgba(255, 94, 74, 0.95); }
}

@media (max-width: 640px) {
  .controls {
    display: none;
  }
}

#debug {
  position: fixed;
  left: 10px;
  bottom: 10px;
  font: 12px/1.6 Consolas, monospace;
  color: #9fe8ff;
  background: rgba(10, 16, 28, 0.75);
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 50;
  pointer-events: none;
  white-space: pre;
}

#lives {
  color: #ff8fa3;
  font-weight: 700;
}

#fx {
  position: absolute;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 92%;
  z-index: 12;
}

.fx-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 24, 40, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 4px 12px 4px 6px;
  font-size: clamp(12px, 2.2vw, 15px);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  animation: fx-pop 0.25s ease-out;
}

.fx-pill img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: block;
}

.fx-pill b {
  font-weight: 700;
  color: #ffd75e;
}

.fx-time {
  color: #9fe8ff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@keyframes fx-pop {
  0% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
