/* ===== 棱镜花园 Prism Garden ===== */
:root {
  --teal: #2dd4bf;
  --pink: #f472b6;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --ink: #4b5563;
  --ink-soft: #6b7280;
  --bg: #f7f5f2;
  --card: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 50px rgba(120, 130, 160, 0.18);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* 主场景 */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* 背景柔光斑（由 canvas 画，这里留兜底） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60vw 60vw at 15% 10%, rgba(45, 212, 191, 0.10), transparent 60%),
    radial-gradient(55vw 55vw at 88% 20%, rgba(244, 114, 182, 0.10), transparent 60%),
    radial-gradient(60vw 60vw at 70% 95%, rgba(96, 165, 250, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.hidden { display: none !important; }

/* ===== 落地页 ===== */
#landing {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 46px 24px 40px;
  text-align: center;
}

.brand {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 26px;
}

.title {
  line-height: 1.25;
  margin-bottom: 18px;
}
.title .zh {
  display: block;
  font-size: clamp(30px, 4.6vw, 52px);
  font-weight: 800;
  letter-spacing: 1px;
}
.title .accent {
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--purple), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title .en {
  display: block;
  margin-top: 12px;
  font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: 3px;
  color: var(--ink-soft);
  font-weight: 600;
}
.title .en em { font-style: normal; color: var(--pink); }

.sub {
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-soft);
  margin-bottom: 30px;
}

/* 手势卡片 */
.gesture-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: min(1080px, 100%);
  margin-bottom: 34px;
}
.gesture-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transition: transform .25s ease;
}
.gesture-card:hover { transform: translateY(-5px); }
.gesture-card.wide { grid-column: span 4; }
.g-emoji { font-size: 34px; margin-bottom: 8px; }
.g-name { font-size: 17px; font-weight: 700; }
.g-en { font-size: 11px; letter-spacing: 1.5px; color: var(--teal); font-weight: 700; margin: 4px 0 8px; }
.g-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }

/* 开始按钮 */
.start-btn {
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  padding: 17px 58px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--purple), var(--pink));
  background-size: 220% 220%;
  box-shadow: 0 14px 34px rgba(120, 130, 180, 0.35);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: flow 6s ease infinite;
}
.start-btn:hover { transform: translateY(-3px) scale(1.03); }
@keyframes flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.privacy {
  margin-top: 22px;
  font-size: 12px;
  line-height: 1.9;
  color: #9ca3af;
}

/* ===== 细节优化 ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
#landing > * { animation: fadeUp .7s ease both; }
#landing > .brand { animation-delay: .05s; }
#landing > .title { animation-delay: .15s; }
#landing > .sub { animation-delay: .25s; }
#landing > .gesture-grid { animation-delay: .35s; }
#landing > .start-btn { animation-delay: .45s; }
#landing > .privacy { animation-delay: .55s; }

.title .zh { letter-spacing: 2px; }
.title .en { margin-top: 14px; }

/* 手势卡片：顶部彩色点缀 + 悬停浮起 */
.gesture-card { position: relative; overflow: hidden; }
.gesture-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent, var(--teal)), transparent);
  opacity: .75;
}
.gesture-card:nth-child(1) { --accent: #2dd4bf; }
.gesture-card:nth-child(2) { --accent: #f472b6; }
.gesture-card:nth-child(3) { --accent: #60a5fa; }
.gesture-card:nth-child(4) { --accent: #a78bfa; }
.gesture-card:nth-child(5) { --accent: #fbbf24; }
.gesture-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 48px rgba(120, 130, 170, 0.26);
}
.gesture-card:hover .g-emoji { transform: scale(1.12); }
.g-emoji { transition: transform .25s ease; }
.g-en { color: var(--accent, var(--teal)); }

/* 开始按钮：呼吸光晕 */
.start-btn { position: relative; }
.start-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid rgba(120, 180, 255, 0.35);
  animation: pulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0% { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.12); }
}

/* 键盘可达焦点 */
.start-btn:focus-visible,
.hud-btn:focus-visible,
.test-btns button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* 落地页滚动条 */
#landing::-webkit-scrollbar { width: 8px; }
#landing::-webkit-scrollbar-thumb {
  background: rgba(150, 160, 190, 0.35);
  border-radius: 99px;
}

/* ===== HUD ===== */
#hud {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.hud-badge {
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
}
.hud-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hud-btn {
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 14px;
  transition: transform .15s ease;
}
.hud-btn:hover { transform: translateY(-2px); }

/* ===== 摄像头小窗 ===== */
#cam-wrap {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 8;
  width: 230px;
  height: 172px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  background: #e9ecef;
}
#cam, #cam-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
#cam-tag {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.32);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ===== 测试面板 ===== */
#test-panel {
  position: fixed;
  left: 18px;
  bottom: 200px;
  z-index: 8;
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.test-title { font-size: 11px; color: var(--ink-soft); margin-bottom: 10px; letter-spacing: 1px; }
.test-btns { display: flex; flex-direction: column; gap: 7px; }
.test-btns button {
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  padding: 7px 12px;
  text-align: left;
  transition: transform .12s ease;
}
.test-btns button:hover { transform: translateX(3px); }
.test-btns button.active {
  background: linear-gradient(90deg, var(--teal), var(--blue));
  color: #fff;
}

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .gesture-grid { grid-template-columns: repeat(2, 1fr); }
  .gesture-card.wide { grid-column: span 2; }
  #cam-wrap { width: 150px; height: 112px; }
  #test-panel { bottom: 140px; }
}
