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

html, body {
  height: 100%;
  overflow: hidden;
  background: #07050f;
  color: #eef2ff;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ============ HUD ============ */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 30;
}

.hud.hidden-hud .score-card {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.score-card {
  padding: 12px 18px 12px 18px;
  border-radius: 18px;
  background: rgba(20, 16, 45, .45);
  border: 1px solid rgba(150, 170, 255, .16);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .38);
  min-width: 104px;
  transition: opacity .35s ease, transform .35s ease;
}

.score-label {
  font-size: 11px;
  letter-spacing: .22em;
  color: rgba(190, 200, 255, .62);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.score-value {
  font-size: 40px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  background: linear-gradient(160deg, #ffffff 10%, #9fd4ff 60%, #b79bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform .16s cubic-bezier(.2, 1.6, .4, 1);
  transform-origin: left center;
}

.score-value.pop { transform: scale(1.22); }

.score-best {
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(180, 190, 235, .55);
  font-variant-numeric: tabular-nums;
}

/* 摄像头卡片 */
.cam-card {
  pointer-events: auto;
  width: 186px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(20, 16, 45, .5);
  border: 1px solid rgba(150, 170, 255, .16);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .42);
  transition: opacity .3s, transform .3s;
}

.cam-card.hidden {
  opacity: 0;
  transform: translateY(-8px) scale(.96);
  pointer-events: none;
}

.cam-stage {
  position: relative;
  width: 184px;
  height: 138px;
  background: radial-gradient(circle at 50% 40%, #241c4a, #100c22);
  overflow: hidden;
}

.cam-stage video {
  position: absolute;
  inset: 0;
  width: 184px;
  height: 138px;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: .92;
  display: block;
}

.cam-stage canvas {
  position: absolute;
  inset: 0;
  width: 184px;
  height: 138px;
  transform: scaleX(-1);
}

.cam-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 14px;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(200, 210, 255, .8);
  background: rgba(10, 8, 22, .55);
  transition: opacity .35s;
}

.cam-hint.gone { opacity: 0; pointer-events: none; }

.gesture-meter {
  height: 4px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}

.gesture-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #43e8ff, #7c9dff 55%, #ff7ad9);
  transition: transform .08s linear;
  box-shadow: 0 0 12px rgba(90, 200, 255, .8);
}

.cam-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: rgba(180, 190, 235, .68);
  letter-spacing: .02em;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5b6480;
  transition: background .25s, box-shadow .25s;
  flex: none;
}

.dot.on {
  background: #43e8ff;
  box-shadow: 0 0 8px #43e8ff;
}

.dot.warn {
  background: #ffb648;
  box-shadow: 0 0 8px #ffb648;
}

.cam-state { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.hud-right {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mute-btn {
  pointer-events: auto;
  border: 1px solid rgba(150, 170, 255, .22);
  background: rgba(20, 16, 45, .45);
  color: rgba(200, 210, 255, .85);
  font-size: 11px;
  padding: 8px 13px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: .2s;
  flex: none;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.mute-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.mute-btn.off { opacity: .45; }

/* ============ 蓄力条 ============ */
.power {
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: min(340px, 56vw);
  height: 8px;
  margin-left: calc(min(340px, 56vw) / -2);
  border-radius: 99px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(150, 170, 255, .16);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.power.show { opacity: 1; transform: translateY(0); }

.power i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: 99px;
  background: #43e8ff;
  box-shadow: 0 0 16px currentColor;
}

/* 落点辅助：正中窗口 + 中心刻度（仅键鼠模式显示） */
.power b {
  position: absolute;
  top: 0;
  bottom: 0;
  display: none;
  pointer-events: none;
}

.power.guided b { display: block; }

.power .power-guide {
  background: rgba(255, 240, 190, .38);
  box-shadow: inset 0 0 0 1px rgba(255, 240, 190, .75);
}

.power .power-mark {
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 8px 1px rgba(255, 236, 170, 1);
}

.power-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 6px);
  font-size: 11.5px;
  letter-spacing: .06em;
  color: rgba(255, 236, 170, .9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}

.power-hint.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 面板 ============ */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(12, 8, 28, .55), rgba(5, 3, 12, .82));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity .35s ease, visibility .35s;
  z-index: 20;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel {
  width: min(460px, 100%);
  padding: 34px 34px 28px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(165deg, rgba(38, 30, 78, .82), rgba(18, 13, 40, .9));
  border: 1px solid rgba(160, 175, 255, .18);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: panelIn .5s cubic-bezier(.2, 1.2, .35, 1) both;
}

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

.panel-eyebrow {
  font-size: 10.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(140, 210, 255, .72);
  margin-bottom: 12px;
}

.panel-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.15;
  background: linear-gradient(150deg, #ffffff 15%, #a9d8ff 55%, #c4a4ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}

.panel-sub {
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(196, 204, 240, .74);
  margin-bottom: 24px;
  padding: 0 6px;
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 22px;
}

.steps.gone { display: none; }

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(160, 175, 255, .12);
}

.step-icon { width: 34px; height: 34px; color: #7fd4ff; }
.step-icon svg { width: 100%; height: 100%; display: block; }

.step-text { display: flex; flex-direction: column; gap: 1px; }
.step-text b { font-size: 13px; font-weight: 600; color: #eaf0ff; }
.step-text small { font-size: 10.5px; color: rgba(170, 180, 225, .62); }

.step-arrow {
  width: 12px;
  height: 1px;
  background: linear-gradient(90deg, rgba(140, 200, 255, .5), rgba(190, 160, 255, .25));
  flex: none;
}

.panel-stat {
  min-height: 20px;
  font-size: 12px;
  color: rgba(160, 220, 255, .85);
  margin-bottom: 16px;
  letter-spacing: .02em;
}

.panel-stat.err { color: #ffab8f; }

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 15px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #07142a;
  cursor: pointer;
  background: linear-gradient(120deg, #66e6ff, #8fb4ff 48%, #c39dff);
  box-shadow: 0 10px 30px rgba(90, 190, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .15s, box-shadow .2s, filter .2s;
}

.btn:hover { transform: translateY(-1.5px); box-shadow: 0 16px 38px rgba(90, 190, 255, .42); filter: brightness(1.05); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled {
  cursor: progress;
  filter: grayscale(.55) brightness(.75);
  box-shadow: none;
  transform: none;
}

.btn.ghost {
  margin-top: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #cfe2ff;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(150, 180, 255, .26);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, .12);
  box-shadow: none;
  filter: none;
}

.panel-tip {
  margin-top: 14px;
  font-size: 11px;
  color: rgba(160, 170, 215, .5);
  letter-spacing: .03em;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid rgba(180, 195, 255, .28);
  background: rgba(255, 255, 255, .07);
  font-family: inherit;
  font-size: 10.5px;
  color: rgba(210, 220, 255, .85);
}

@media (max-width: 900px) {
  .hud.hidden-hud .cam-card {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 560px) {
  .panel { padding: 26px 20px 22px; border-radius: 22px; }
  .panel-title { font-size: 26px; }
  .steps { gap: 4px; }
  .step { padding: 10px 3px; }
  .step-icon { width: 26px; height: 26px; }
  .cam-card { width: 128px; }
  .cam-stage, .cam-stage video, .cam-stage canvas { width: 126px; height: 95px; }
  .score-value { font-size: 32px; }
}
