/* 点亮圣诞树 · 网页版 —— 整屏圣诞夜 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #040918;
  color: #eaf2ff;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}

/* ---------- 顶部文字 ---------- */
.overlay-text {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 22px;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .55);
}
.overlay-text h1 {
  font-family: "Snell Roundhand", "Brush Script MT", "Segoe Script", "STKaiti", "KaiTi", cursive;
  font-weight: 600;
  font-size: clamp(30px, 5.2vw, 54px);
  color: #ffe9b0;
  letter-spacing: .5px;
}
#countdown {
  margin-top: 6px;
  font-size: clamp(12px, 1.6vw, 15px);
  color: rgba(210, 228, 255, .92);
  letter-spacing: 1px;
}
#blessing-line {
  margin-top: 5px;
  font-size: clamp(17px, 2.6vw, 26px);
  font-weight: 600;
  color: #fff8e7;
}

/* ---------- 手势状态 ---------- */
.gesture-chip {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(8, 22, 51, .62);
  border: 1px solid rgba(150, 190, 255, .28);
  font-size: 13px;
  color: #cfe2ff;
  backdrop-filter: blur(4px);
}
.gesture-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5b729e;
  flex: none;
}
.gesture-chip.live .dot { background: #3fe0a8; box-shadow: 0 0 8px #3fe0a8; }
.gesture-chip.hit .dot { background: #ffd34d; box-shadow: 0 0 10px #ffd34d; }

/* ---------- 摄像头预览 ---------- */
#cam-preview {
  position: fixed;
  right: 16px;
  bottom: 92px;
  width: 148px;
  height: 111px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(150, 190, 255, .4);
  transform: scaleX(-1);
  background: #000;
  z-index: 6;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}
#cam-preview[hidden] { display: none; }

/* ---------- 底部控制条 ---------- */
.controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  max-width: min(96vw, 860px);
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(6, 15, 34, .66);
  border: 1px solid rgba(150, 190, 255, .18);
  backdrop-filter: blur(6px);
}
.controls .sep {
  width: 1px;
  align-self: stretch;
  background: rgba(150, 190, 255, .18);
  margin: 2px 1px;
}
button, .btn-file {
  appearance: none;
  border: 1px solid rgba(170, 205, 255, .35);
  background: rgba(16, 36, 74, .85);
  color: #eaf2ff;
  font-size: 14px;
  font-family: inherit;
  padding: 8px 15px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.25;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
button:hover, .btn-file:hover { background: rgba(30, 58, 112, .9); }
button:active, .btn-file:active { transform: scale(.96); }
button.active {
  background: linear-gradient(180deg, #ffcf5c, #f0a92e);
  border-color: #ffd977;
  color: #402a02;
  font-weight: 700;
}
button:disabled { opacity: .38; cursor: default; transform: none; }
.btn-file input { display: none; }

/* ---------- 页脚 ---------- */
.footer-note {
  position: fixed;
  left: 0; right: 0;
  bottom: 2px;
  z-index: 4;
  text-align: center;
  font-size: 11px;
  color: rgba(170, 195, 235, .5);
  pointer-events: none;
  padding: 0 12px;
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(8px);
  z-index: 20;
  max-width: 88vw;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(10, 24, 52, .92);
  border: 1px solid rgba(255, 217, 119, .45);
  color: #ffedb5;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 设置面板 ---------- */
.panel-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(2, 6, 18, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.panel-mask[hidden] { display: none; }
.panel {
  width: min(92vw, 400px);
  background: linear-gradient(180deg, #0d1f42, #081630);
  border: 1px solid rgba(150, 190, 255, .3);
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.panel h2 { font-size: 17px; color: #ffe9b0; margin-bottom: 4px; }
.panel .hint { font-size: 12px; color: rgba(190, 210, 245, .75); margin-bottom: 14px; }
.panel label {
  display: block;
  font-size: 13px;
  color: #cfe2ff;
  margin: 12px 0 6px;
}
.panel label .count { float: right; color: rgba(160, 190, 235, .6); }
.panel input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(150, 190, 255, .35);
  background: rgba(4, 10, 26, .8);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.panel input:focus { border-color: #ffd977; }
.panel .preview {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 217, 119, .08);
  border: 1px dashed rgba(255, 217, 119, .35);
  font-size: 15px;
  color: #ffedb5;
  text-align: center;
}
.panel .row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.panel .row button { flex: 1; padding: 10px 0; }
.panel .row .primary {
  background: linear-gradient(180deg, #ffcf5c, #f0a92e);
  border-color: #ffd977;
  color: #402a02;
  font-weight: 700;
}

@media (max-width: 560px) {
  .overlay-text { left: 14px; top: max(12px, env(safe-area-inset-top)); }
  .gesture-chip { top: auto; bottom: 168px; right: 12px; font-size: 12px; }
  #cam-preview { width: 104px; height: 78px; bottom: 206px; right: 12px; }
  .controls { gap: 6px; padding: 8px; }
  button, .btn-file { font-size: 13px; padding: 7px 11px; }
}
