:root {
  --bg: #070b17;
  --fg: #eef4ff;
  --muted: rgba(238, 244, 255, 0.62);
  --accent: #4be3b0;
  --accent-2: #ffd166;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

/* ---------------- 顶部计分 ---------------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 22px 0;
  pointer-events: none;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-item--right {
  align-items: flex-end;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.hud-value {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 24px rgba(75, 227, 176, 0.35);
}

.hud-value--sm {
  font-size: 22px;
  color: var(--accent-2);
  text-shadow: none;
}

/* ---------------- 底部提示 ---------------- */
.hint {
  position: absolute;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  pointer-events: none;
  animation: hintFloat 2.4s ease-in-out infinite;
}

@keyframes hintFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.85; }
  50% { transform: translateX(-50%) translateY(-4px); opacity: 1; }
}

/* ---------------- 结束面板 ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 9, 20, 0.62);
  backdrop-filter: blur(7px);
  animation: fadeIn 0.22s ease-out;
}

.panel {
  width: min(340px, 100%);
  padding: 28px 26px 22px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(170deg, rgba(38, 52, 88, 0.95), rgba(16, 23, 43, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: popIn 0.26s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.panel-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.panel-score {
  margin: 6px 0 10px;
  font-size: 62px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel-score small {
  margin-left: 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

.panel-best {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.panel-best strong {
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #06251b;
  cursor: pointer;
  background: linear-gradient(180deg, #78f3c9, var(--accent));
  box-shadow: 0 12px 26px rgba(75, 227, 176, 0.32);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 16px 30px rgba(75, 227, 176, 0.42);
}

.btn:active {
  transform: translateY(2px) scale(0.99);
}

.btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.panel-tip {
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(238, 244, 255, 0.42);
}

[hidden] {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-height: 460px) {
  .hud-value { font-size: 30px; }
  .panel { padding: 20px 20px 16px; }
  .panel-score { font-size: 46px; }
  .panel-best { margin-bottom: 14px; }
}
