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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: #04060f;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

canvas#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---------- 覆盖层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10, 14, 40, 0.35), rgba(2, 4, 12, 0.78));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel {
  text-align: center;
  padding: 2.6rem 2.4rem 2.2rem;
  max-width: 30rem;
  width: calc(100vw - 2.4rem);
  border-radius: 20px;
  background: rgba(10, 16, 38, 0.72);
  border: 1px solid rgba(125, 249, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 18px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(64, 120, 255, 0.08);
  animation: panelIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes panelIn {
  from {
    transform: translateY(18px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.title {
  font-size: clamp(2rem, 7vw, 2.9rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
  background: linear-gradient(100deg, #7df9ff 0%, #7dffb0 35%, #ffd166 70%, #ff4dd2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(125, 249, 255, 0.55));
}

.subtitle {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8rem;
  letter-spacing: 0.5em;
  margin-bottom: 1.6rem;
}

.controls p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
  line-height: 1.9;
  margin: 0.1rem 0;
}

.touch-hint {
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 0.85rem !important;
}

kbd {
  padding: 0.1em 0.5em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
}

.result-line {
  font-size: 1rem;
}

.result-line.big {
  font-size: 1.5rem;
  font-weight: 800;
  color: #7df9ff;
  margin-bottom: 0.3rem;
}

.new-best {
  color: #ffd166 !important;
  font-weight: 800;
  font-size: 1.05rem !important;
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.btn {
  margin-top: 1.5rem;
  padding: 0.85rem 3rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #041018;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(100deg, #7df9ff, #7dffb0);
  box-shadow:
    0 0 24px rgba(125, 249, 255, 0.65),
    0 6px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 38px rgba(125, 249, 255, 0.9),
    0 10px 24px rgba(0, 0, 0, 0.5);
}

.btn:active {
  transform: scale(0.97);
}

/* ---------- 触屏按钮 ---------- */
#touchBtns {
  position: fixed;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.round-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(125, 249, 255, 0.4);
  background: rgba(10, 20, 46, 0.65);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 0 16px rgba(125, 249, 255, 0.25);
  touch-action: none;
}

.round-btn.bomb {
  border-color: rgba(255, 209, 102, 0.65);
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.4);
}

.round-btn:active {
  transform: scale(0.9);
}

/* ---------- 暂停标签 ---------- */
#pauseTag {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 24px rgba(125, 249, 255, 0.8);
  pointer-events: none;
}
