/* =========================================================
   情人节 · 手势烟花与爱心 — 视觉样式
   深空夜色 + 极光 + 玻璃质感 UI
   ========================================================= */

:root {
  --bg-deep: #0b0412;
  --bg-mid: #1a0820;
  --bg-low: #2a0f1e;
  --pink: #ff4d7d;
  --pink-2: #ff8fb3;
  --rose: #ffb3c6;
  --gold: #ffd166;
  --violet: #b57bff;
  --text: #fff3f6;
  --text-soft: rgba(255, 243, 246, 0.72);
  --line: rgba(255, 179, 198, 0.18);
  --glass: rgba(255, 255, 255, 0.055);
  --glow-pink: 0 0 32px rgba(255, 77, 125, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 120% 75% at 50% -18%, rgba(255, 77, 125, 0.3), transparent 58%),
    radial-gradient(ellipse 95% 60% at 84% 116%, rgba(147, 51, 234, 0.28), transparent 58%),
    radial-gradient(ellipse 75% 52% at 12% 92%, rgba(255, 111, 145, 0.2), transparent 55%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 48%, var(--bg-low) 100%);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* ---------- 极光 ---------- */

.aurora {
  position: fixed;
  inset: -20%;
  z-index: 0;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: aurora-float 16s ease-in-out infinite;
}

.aurora span:nth-child(1) {
  width: 52vw;
  height: 52vw;
  left: -8%;
  top: -12%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 77, 125, 0.55), transparent 65%);
}

.aurora span:nth-child(2) {
  width: 46vw;
  height: 46vw;
  right: -10%;
  bottom: -16%;
  background: radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.5), transparent 65%);
  animation-delay: -5s;
}

.aurora span:nth-child(3) {
  width: 38vw;
  height: 38vw;
  left: 30%;
  bottom: -20%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 111, 145, 0.45), transparent 65%);
  animation-delay: -9s;
}

@keyframes aurora-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  33% {
    transform: translate3d(6vw, -4vh, 0) scale(1.12);
  }
  66% {
    transform: translate3d(-5vw, 5vh, 0) scale(0.94);
  }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 45%, transparent 58%, rgba(4, 0, 8, 0.55) 100%);
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  pointer-events: none;
}

.hud-top {
  top: 0;
}

.hud-bottom {
  bottom: 0;
}

.hud > * {
  pointer-events: auto;
}

.brand {
  color: var(--rose);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 22px rgba(255, 77, 125, 0.6);
}

.hud-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  color: var(--text);
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 179, 198, 0.5);
  box-shadow: 0 6px 18px rgba(255, 77, 125, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chip[aria-pressed="false"] {
  opacity: 0.48;
}

.hint {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  max-width: min(600px, 82vw);
  text-align: center;
}

.mode-badge {
  background: linear-gradient(135deg, rgba(255, 77, 125, 0.28), rgba(181, 123, 255, 0.2));
  border: 1px solid rgba(255, 143, 179, 0.45);
  color: var(--rose);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 650;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 77, 125, 0.5);
}

/* ---------- 开始界面 ---------- */

.start.hidden {
  display: none;
}

.start {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 2, 12, 0.42);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.start-card {
  position: relative;
  text-align: center;
  max-width: 560px;
  width: 100%;
  padding: 46px 36px 34px;
  border: 1px solid rgba(255, 179, 198, 0.28);
  border-radius: 30px;
  background:
    radial-gradient(600px 300px at 50% -10%, rgba(255, 77, 125, 0.24), transparent 65%),
    radial-gradient(400px 260px at 50% 115%, rgba(181, 123, 255, 0.2), transparent 65%),
    linear-gradient(180deg, rgba(42, 14, 32, 0.9), rgba(18, 6, 24, 0.92));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.6),
    0 0 100px rgba(255, 77, 125, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.start-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 179, 198, 0.6), transparent 40%, transparent 60%, rgba(181, 123, 255, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.start-orb {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 38px;
  color: #fff;
  background: linear-gradient(135deg, #ff4d7d, #ff7a9e);
  box-shadow: 0 0 40px rgba(255, 77, 125, 0.7), 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: orb-beat 1.4s ease-in-out infinite;
}

@keyframes orb-beat {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  30% {
    transform: translateX(-50%) scale(1.1);
  }
  50% {
    transform: translateX(-50%) scale(0.96);
  }
}

.kicker {
  margin: 0 0 14px;
  letter-spacing: 0.3em;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.start-card h1 {
  font-size: 46px;
  margin: 0 0 10px;
  font-weight: 800;
  line-height: 1.12;
}

.title-grad {
  background: linear-gradient(120deg, #ffd6e0 0%, #ff8fb3 30%, #ff4d7d 55%, #ffd166 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(255, 77, 125, 0.25);
}

.start-card h1 .heart {
  color: var(--pink);
  display: inline-block;
  animation: beat 1.2s infinite;
  filter: drop-shadow(0 0 14px rgba(255, 77, 125, 0.8));
}

@keyframes beat {
  0%,
  100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.28);
  }
  45% {
    transform: scale(1);
  }
  60% {
    transform: scale(1.16);
  }
}

.sub {
  color: var(--text-soft);
  font-size: 16px;
  margin: 0 0 28px;
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 13px;
  align-items: center;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 14px 30px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}

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

.btn-primary {
  background: linear-gradient(135deg, #ff4d7d, #ff7a9e);
  color: #fff;
  box-shadow: 0 14px 36px rgba(255, 77, 125, 0.42), 0 0 30px rgba(255, 77, 125, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(255, 77, 125, 0.52), 0 0 44px rgba(255, 77, 125, 0.4);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 179, 198, 0.3);
}

.btn-ghost:hover {
  border-color: rgba(255, 179, 198, 0.55);
  background: rgba(255, 255, 255, 0.1);
}

.privacy {
  color: var(--text-soft);
  font-size: 12px;
  margin: 20px 0 0;
  opacity: 0.75;
}

.load-state {
  color: var(--gold);
  font-size: 13px;
  margin: 16px 0 0;
  animation: pulse 1.4s infinite;
}

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

/* ---------- 摄像头小窗 ---------- */

.cam-panel {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  width: 172px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 179, 198, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 26px rgba(255, 77, 125, 0.22);
  background: #000;
}

.cam-panel video {
  width: 100%;
  display: block;
  transform: scaleX(-1);
}

/* ---------- 玩法说明 ---------- */

.help {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 2, 12, 0.6);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.help-card {
  position: relative;
  max-width: 480px;
  width: 100%;
  padding: 34px 30px;
  border-radius: 24px;
  border: 1px solid rgba(255, 179, 198, 0.28);
  background: linear-gradient(180deg, rgba(42, 14, 32, 0.96), rgba(18, 6, 24, 0.96));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 77, 125, 0.14);
}

.help-card h2 {
  margin: 0 0 18px;
  font-size: 22px;
}

.help-card h2 .heart {
  color: var(--pink);
  filter: drop-shadow(0 0 10px rgba(255, 77, 125, 0.7));
}

.help-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 13px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.help-card ul b {
  display: inline-block;
  width: 30px;
  font-weight: 700;
  color: var(--rose);
}

.help-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
}

/* ---------- 浮动文字 / 提示 ---------- */

.float-text {
  position: fixed;
  z-index: 6;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 800;
  color: var(--rose);
  text-shadow: 0 0 26px rgba(255, 77, 125, 0.9), 0 0 60px rgba(255, 77, 125, 0.5);
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
  font-family: "Snell Roundhand", "Bradley Hand", "Segoe Script", cursive, "PingFang SC", sans-serif;
  white-space: nowrap;
}

.float-text.show {
  opacity: 1;
  transform: translate(-50%, -100px);
}

.toast {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: rgba(30, 8, 20, 0.94);
  border: 1px solid rgba(255, 179, 198, 0.35);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toast.show {
  opacity: 1;
}

/* ---------- 隐藏状态 ---------- */

[hidden] {
  display: none !important;
}

/* ---------- 小屏适配 ---------- */

@media (max-width: 640px) {
  .hud {
    padding: 14px 14px;
  }
  .brand {
    font-size: 14px;
  }
  .chip {
    padding: 7px 11px;
    font-size: 12px;
  }
  .mode-badge {
    padding: 7px 12px;
    font-size: 12px;
  }
  .hint {
    font-size: 12px;
    padding: 8px 14px;
    max-width: 60vw;
  }
  .start-card {
    padding: 42px 22px 28px;
  }
  .start-card h1 {
    font-size: 34px;
  }
  .cam-panel {
    width: 116px;
    left: 12px;
    bottom: 12px;
  }
  .float-text {
    font-size: 24px;
  }
}
