/* ============================================================
 * 手心的花园 — 全局样式
 * 风格：现代扁平 + 柔阴影，圆角，柔色，无衬线字体
 * ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1f2a3a;
  color: #2b2b35;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, #1f2a3a 0%, #2b3850 100%);
}

#cam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 横向镜像，符合镜子直觉 */
  transform: scaleX(-1);
  background: #000;
}

#ar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ============================================================
 * HUD
 * ============================================================ */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hint {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
  font-size: 16px;
  font-weight: 500;
  color: #2b2b35;
  pointer-events: auto;
  transition: opacity 0.6s ease, transform 0.6s ease;
  letter-spacing: 0.02em;
}

.hint.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  pointer-events: none;
}

.hint-glyph {
  font-size: 22px;
  line-height: 1;
}

.hint-text {
  white-space: nowrap;
}

.hint.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(-50%) translateX(0); }
  20% { transform: translateX(-50%) translateX(-6px); }
  40% { transform: translateX(-50%) translateX(6px); }
  60% { transform: translateX(-50%) translateX(-4px); }
  80% { transform: translateX(-50%) translateX(4px); }
}

.hud-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #2b2b35;
  font-size: 22px;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14), 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, background 0.2s ease;
}

.hud-btn:hover {
  transform: scale(1.05);
  background: #fff;
}

.hud-btn:active {
  transform: scale(0.95);
}

#btn-mute {
  left: 24px;
  bottom: 24px;
}

/* ============================================================
 * 状态指示器（左下角，与静音按钮分开）
 * ============================================================ */

.status {
  position: absolute;
  left: 24px;
  bottom: 88px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 5;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd66b;
  box-shadow: 0 0 8px rgba(255, 214, 107, 0.6);
  flex-shrink: 0;
}

.status.ok .status-dot {
  background: #7ed87e;
  box-shadow: 0 0 8px rgba(126, 216, 126, 0.6);
}

.status.err .status-dot {
  background: #ff7a7a;
  box-shadow: 0 0 8px rgba(255, 122, 122, 0.6);
}

#btn-restart {
  right: 24px;
  top: 24px;
  font-size: 26px;
  background: rgba(255, 224, 178, 0.95);
  color: #6f4a1f;
}

#btn-restart:hover {
  background: #ffe4b8;
}

.hidden {
  display: none !important;
}

/* ============================================================
 * 启动 / 错误 / 加载浮层
 * ============================================================ */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fef5e7 0%, #ffe2cf 100%);
  z-index: 100;
  padding: 24px;
}

.overlay.hidden {
  display: none;
}

.card {
  max-width: 460px;
  width: 100%;
  padding: 36px 32px 28px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(80, 40, 10, 0.12), 0 4px 12px rgba(80, 40, 10, 0.06);
  text-align: center;
}

.card h1 {
  font-size: 28px;
  font-weight: 700;
  color: #2b2b35;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.card .lede {
  font-size: 14px;
  color: #8b7355;
  margin-bottom: 20px;
  letter-spacing: 0.1em;
}

.card .desc {
  font-size: 15px;
  line-height: 1.7;
  color: #5a5a66;
  margin-bottom: 24px;
}

.gestures {
  list-style: none;
  text-align: left;
  margin: 0 auto 28px;
  display: inline-block;
  font-size: 14px;
  color: #4a4a55;
  line-height: 2;
}

.gestures li {
  padding-left: 8px;
}

.gestures b {
  color: #2b2b35;
  font-weight: 600;
  display: inline-block;
  min-width: 80px;
}

.primary {
  display: inline-block;
  padding: 14px 36px;
  border: none;
  border-radius: 999px;
  background: #ffb37a;
  color: #6f4a1f;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 179, 122, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 179, 122, 0.55);
}

.primary:active {
  transform: translateY(0);
}

.legal {
  font-size: 12px;
  color: #9a9aa5;
  margin-top: 18px;
}

.bar {
  width: 240px;
  height: 6px;
  margin: 24px auto 0;
  background: #f0e5d5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  width: 0%;
  height: 100%;
  background: #ffb37a;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ============================================================
 * 小屏适配
 * ============================================================ */

@media (max-width: 720px) {
  .card h1 { font-size: 24px; }
  .hint { font-size: 14px; padding: 10px 16px; }
  .hud-btn { width: 42px; height: 42px; font-size: 20px; }
}
