* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: #000; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Helvetica Neue", sans-serif;
}
#preview {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #000;
  transition: transform 0.25s ease;
}
.panel {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; color: #fff; text-align: center;
}
.panel h1 { margin: 0; font-size: 26px; letter-spacing: 1px; }
.panel .hint { margin: 0 0 8px; color: #ccc; font-size: 14px; }
.panel .hint.small { font-size: 12px; color: #888; max-width: 260px; margin-top: 4px; }
.panel input {
  width: 240px; padding: 12px 14px; border-radius: 10px; border: none;
  font-size: 18px; text-align: center; outline: none;
}
.panel form { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.panel button {
  width: 240px; padding: 12px 14px; border-radius: 10px; border: none;
  font-size: 17px; font-weight: 600; background: #0a84ff; color: #fff;
}
.panel button:active { opacity: 0.8; }
.panel button.secondary {
  background: transparent; color: #6fb2ff; font-size: 14px; font-weight: 500; padding: 4px 14px;
}
.status { min-height: 20px; font-size: 14px; color: #ff6961; }

.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.brand-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 6px 18px rgba(10,159,192,0.35);
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.joining-notice {
  color: #6fb2ff; font-size: 14px; background: rgba(10,132,255,0.12);
  padding: 8px 14px; border-radius: 10px;
}
.joining-notice.hidden { display: none; }

/* 「黑屏」：不管是手機自己按月亮鍵、還是電腦端遙控 X 鍵觸發，都是同一個狀態（blackoutOn）。
   z-index 故意比 .hud 高，蓋住整個畫面（含上方狀態列、下方控制列），從外觀上看起來就是「手機螢幕整個是黑的」，
   不會留下任何看得到的按鈕可以按——因為解除黑屏設計成「螢幕往上滑滿 5 下」的隱藏手勢（見 app.js），
   不是靠按按鈕，所以按鈕本來就不需要露出來。純 CSS 疊層，不會動到 getUserMedia 的 track，
   電腦端收到的即時畫面完全不受影響。overlay 本身要接收 pointer 事件才能偵測滑動手勢，所以不能設 pointer-events:none。 */
.blackout-overlay { position: fixed; inset: 0; z-index: 6; background: #000; touch-action: none; }
.blackout-overlay.hidden { display: none; }

.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud.hidden { display: none; }

.top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0));
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.status-line { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 15px; font-weight: 500; }
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #8e8e93; flex: none;
}
.status-dot.live { background: #ff3b30; box-shadow: 0 0 6px rgba(255,59,48,0.85); }
.status-dot.connecting { background: #ff9f0a; }
.status-dot.warn { background: #ff453a; }
.top-actions { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 15px;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.icon-btn:active { background: rgba(255,255,255,0.34); }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 18px 24px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.62));
  pointer-events: none;
}
.bottom-row {
  position: relative; display: flex; align-items: center; justify-content: center;
  gap: 60px; min-height: 76px;
}
.record-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: auto; }
.record-btn {
  width: 68px; height: 68px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.85);
  background: transparent; display: flex; align-items: center; justify-content: center; padding: 0;
}
.record-btn span { width: 26px; height: 26px; border-radius: 6px; background: #ff3b30; }
.record-btn:active { opacity: 0.7; }
.facing-label { color: #eee; font-size: 13px; }
.moon-btn {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.14); font-size: 22px; line-height: 1; color: #fff;
  display: flex; align-items: center; justify-content: center; pointer-events: auto; backdrop-filter: blur(4px);
}
.moon-btn:active { background: rgba(255,255,255,0.32); }
.flip-btn {
  position: absolute; right: -4px; bottom: -6px;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.14); font-size: 18px; color: #fff;
  display: flex; align-items: center; justify-content: center; pointer-events: auto; backdrop-filter: blur(4px);
}
.flip-btn:active { background: rgba(255,255,255,0.32); }
