:root {
  --paper: #FBFAF8;
  --ink: #23303F;
  --blue: #3A5FA8;
  --rec: #D9534F;
}

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

html, body {
  height: 100%;
  background: var(--paper);
  overflow: hidden;
}

body {
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 整个页面就两块：人物铺满，麦克风浮在右下角 */

.avatar-box {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* pixi 生成的 canvas 由 JS 挂进来，铺满容器 */
.avatar-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ---------- 模型加载态 ---------- */

.l2d-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #5a6b85;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 5;
}

.l2d-loading.gone { opacity: 0; }
.l2d-loading.err .l2d-load-text { color: var(--rec); }

.l2d-loading .l2d-load-bar {
  width: 150px;
  height: 3px;
  border-radius: 2px;
  background: rgba(90, 107, 133, 0.16);
  overflow: hidden;
}

.l2d-loading .l2d-load-bar > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: #3f6fd8;
  transition: width 0.25s ease;
}

/* ---------- 语音输入开关 ---------- */

.mic {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 6px 20px rgba(58, 95, 168, 0.28);
  -webkit-tap-highlight-color: transparent;
}

.mic:hover { transform: translateY(-2px); }
.mic:active { transform: scale(0.94); }

/* 录音中：变红 + 呼吸光圈 */
.mic.rec {
  background: var(--rec);
  animation: micPulse 1.4s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 83, 79, 0.42), 0 6px 20px rgba(58, 95, 168, 0.2); }
  50% { box-shadow: 0 0 0 16px rgba(217, 83, 79, 0), 0 6px 20px rgba(58, 95, 168, 0.2); }
}

/* 处理中（ASR/LLM 等待）：灰色半透明 */
.mic.busy {
  background: #C6CDD8;
  box-shadow: none;
  cursor: default;
  animation: none;
  opacity: 0.75;
}

.mic:disabled {
  background: #C6CDD8;
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
}

/* 说话时按钮做轻微呼吸，暗示「它在说」 */
.mic.talking {
  animation: micBreathe 1.8s ease-in-out infinite;
}

@keyframes micBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.mic-ripple {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(58, 95, 168, 0.28);
  opacity: 0;
  pointer-events: none;
}

.mic.rec .mic-ripple {
  border-color: rgba(217, 83, 79, 0.42);
  animation: ripple 1.4s ease-out infinite;
}

@keyframes ripple {
  0% { opacity: 0.7; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.35); }
}

/* ---------- 移动端 ---------- */

@media (max-width: 480px) {
  .mic { width: 62px; height: 62px; }
}
