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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d0d0d;
  color: #e0e0e0;
}

#app {
  width: 100vw;
  height: 100vh;
}

/* -- 全屏画布 -- */
#canvas-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0d0d0d;
}

/* -- video 降级为隐藏解码器（opacity:0 保持解码，Canvas 是唯一可见面） -- */
#stream-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  background: #0d0d0d;
}

#main-canvas {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  /* left, top, width, height 由 JS _fitCanvas() 显式设置（cover 模式） */
}

#click-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  z-index: 60;
}

#click-overlay.no-interact {
  cursor: crosshair;
}

/* -- 连接状态（左上角） -- */
#connection-status {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
}


/* -- 提示词表单（右上角控制栏内） -- */
#prompt-form {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 0 6px 20px;
  border-radius: 24px;
  border: 1px solid transparent;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color 0.35s ease, background 0.35s ease,
              backdrop-filter 0.35s ease;
}

#prompt-form.expanded {
  padding: 6px 6px 6px 20px;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#prompt-input {
  width: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  border: none;
  background: transparent;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: width 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
}

#prompt-form.expanded #prompt-input {
  width: 220px;
  padding: 6px 2px;
  opacity: 1;
}

#prompt-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* -- 全局：移除浏览器 autofill 默认高亮 -- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-webkit-autofill:first-line {
  background-color: #0d0d0d !important;
  -webkit-box-shadow: 0 0 0 1000px #0d0d0d inset !important;
  box-shadow: 0 0 0 1000px #0d0d0d inset !important;
  -webkit-text-fill-color: #e0e0e0 !important;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: #e0e0e0;
  color: #e0e0e0 !important;
}

#submit-btn {
  transition: box-shadow 0.35s ease, border-color 0.35s ease,
              background 0.35s ease, backdrop-filter 0.35s ease;
}

#prompt-form.expanded #submit-btn {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#submit-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#voice-btn {
  width: 0;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 22px;
  transition: width 0.35s ease, opacity 0.25s ease;
}

#prompt-form.expanded #voice-btn {
  width: 34px;
  opacity: 1;
}

#voice-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

#voice-btn.recording {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  animation: voice-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
  50% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }
}

/* -- 连接状态 -- */
.conn-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.conn-status.connected {
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.conn-status.reconnecting {
  background: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
  animation: conn-pulse 0.8s ease-in-out infinite;
}

.conn-status.disconnected {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: conn-pulse 1.5s ease-in-out infinite;
}

@keyframes conn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* -- 右上角控制栏 -- */
#top-right-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 共用圆形按钮（导航、音频、切换） */
.ctrl-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(30, 30, 30, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 26px;
  transition: all 0.2s ease;
}

.ctrl-btn:hover {
  background: rgba(60, 60, 60, 0.85);
  color: #fff;
}

/* glyphs web component 图标修正 */
   - 组件在无 size 属性时设 font-size:auto → 覆盖继承 → 用 !important 强制继承
   - contain:strict → 改为 layout paint 防止裁剪描边
   - :not([hidden]) 防止覆盖 hidden 的 display:none
   - SVG 硬编码 #C2CCDE → 统一覆盖为白色 */
.ctrl-btn > :not([hidden]),
#voice-btn > :not([hidden]) {
  font-size: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctrl-btn span,
#voice-btn span {
  font-size: inherit !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  contain: layout paint !important;
}
.ctrl-btn svg,
#voice-btn svg {
  color: #fff;
}
.ctrl-btn [stroke],
#voice-btn [stroke] {
  stroke: #fff !important;
}
.ctrl-btn [fill]:not([fill="none"]),
#voice-btn [fill]:not([fill="none"]) {
  fill: #fff !important;
}

/* 步骤导航按钮 */
.nav-step-btn {
  display: none;
}

.nav-step-btn.visible {
  display: flex;
}

/* 音频指示器 — 与其余 .ctrl-btn 外观一致，仅图标切换状态 */

/* -- 空状态 -- */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #444;
  pointer-events: none;
  z-index: 1;
}

.empty-state h2 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: #555;
}


.atmosphere-label {
  color: rgba(240, 230, 211, 0.25);
  margin-right: 6px;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 600px) {
  #prompt-form.expanded #prompt-input {
    width: 140px;
  }

}
