/* 日光倾城 · 样式
   Tailwind CDN（按需引入基础样式） */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

:root {
  /* 演示版式：画面宽度 = 浏览器的一半，水平居中，两侧用虚化背景补边。
     想铺满整个浏览器窗口时改回 100vw 即可 */
  --stage-w: 50vw;
  --primary-warm: #FFD9A0;
  --primary-soft: #FFF3D6;
  --primary-cool: #A8D8E8;
  --bg-day: #BEE7F0;
  --bg-night: #2B2A4C;
  --text-main: #3A3F5C;
  --text-light: #FFFFFF;
  --accent: #FFB765;
  --accent-deep: #5A6B8C;
  --glow: #FFE8B0;
  --font-main: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-day);
  font-family: var(--font-main);
  color: var(--text-main);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

/* 两侧补边：同一张背景图虚化压暗，让半宽画布看起来是刻意的设计版式 */
#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url('../assets/bg.jpg') center / cover no-repeat, var(--bg-day);
  filter: blur(26px) brightness(0.68) saturate(1.05);
  transform: scale(1.1); /* 盖住 blur 产生的边缘透明带 */
}

#stage {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--stage-w);
  height: 100%;
  display: block;
  cursor: crosshair;
  z-index: 1;
}

/* ---------- 摄像头预览小窗（贴住画布左上角，而不是页面左上角） ---------- */
#cam-preview {
  position: fixed;
  top: 16px;
  left: calc((100% - var(--stage-w)) / 2 + 16px);
  width: 148px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: 0 6px 24px rgba(58,63,92,.25);
  background: rgba(43,42,76,.35);
  backdrop-filter: blur(8px);
  z-index: 30;
  transition: opacity .4s ease;
}
#cam-preview.hidden { opacity: 0; pointer-events: none; }
#cam {
  width: 100%;
  display: block;
  transform: scaleX(-1); /* 镜像，符合直觉 */
}
.cam-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 11px;
  color: #fff;
  background: rgba(43,42,76,.55);
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #888;
  flex-shrink: 0;
  transition: background .3s;
}
.dot.ok { background: #7be0a0; box-shadow: 0 0 6px #7be0a0; }
.dot.warn { background: #ffb765; box-shadow: 0 0 6px #ffb765; }
.dot.err { background: #ff7d7d; box-shadow: 0 0 6px #ff7d7d; }

/* ---------- 底部提示胶囊 ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  max-width: calc(var(--stage-w) - 32px);
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--text-main);
  background: rgba(255,255,255,.42);
  border: 1px solid rgba(255,255,255,.5);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(58,63,92,.12);
  z-index: 25;
  opacity: 1;
  transition: opacity 1.2s ease, bottom .4s ease;
}
.hint.fade { opacity: 0; bottom: 10px; pointer-events: none; }
.hint.hidden { display: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 13.5px;
  color: #fff;
  background: rgba(43,42,76,.82);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 50;
  animation: toast-in .35s ease both;
}
.toast.hidden { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 摄像头开关按钮（右上角，随时切换） ---------- */
.cam-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  font-family: var(--font-main);
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--text-main);
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(58,63,92,.15);
  cursor: pointer;
  transition: background .25s ease, transform .2s ease, box-shadow .25s ease;
}
.cam-toggle:hover { transform: translateY(-1px); background: rgba(255,255,255,.75); }
.cam-toggle:active { transform: scale(.96); }
.cam-toggle:disabled { opacity: .55; cursor: wait; transform: none; }
.cam-toggle.on {
  color: #5a4518;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-warm));
  border-color: rgba(255,183,101,.8);
  box-shadow: 0 4px 18px rgba(255,183,101,.45);
}
.cam-ico { font-size: 15px; }
.privacy-note {
  position: fixed;
  top: 52px;
  right: 14px;
  z-index: 35;
  max-width: 190px;
  font-size: 10.5px;
  line-height: 1.5;
  text-align: right;
  color: rgba(90,107,140,.8);
  pointer-events: none;
}

/* 手机/窄屏：画布铺满全屏（演示半宽版式仅用于桌面） */
@media (max-width: 820px) {
  :root { --stage-w: 100vw; }
  #backdrop { display: none; }
  .privacy-note { display: none; }
}

/* 窄屏适配 */
@media (max-width: 560px) {
  #cam-preview { width: 104px; }
  .hint { font-size: 11px; gap: 3px 10px; border-radius: 18px; padding: 8px 14px; }
}
