/* CFace.work — 数字分身创建平台 */
:root {
  --primary: #639922;
  --primary-light: #4ADE80;
  --primary-dark: #4a7a1a;
  --accent: #22D3EE;
  --bg-dark: #0a1628;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --danger: #ef4444;
  --gold: #FCD34D;
}

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

body {
  font-family: -apple-system, 'Noto Sans SC', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== 阶段切换 ==================== */
.phase { display: none; min-height: 100vh; }
.phase.active { display: flex; flex-direction: column; }

/* ==================== 阶段1：创建分身 ==================== */
.create-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.camera-area {
  width: 100%;
  aspect-ratio: 3/4;
  max-height: 50vh;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: #000;
  margin-bottom: 16px;
}

.camera-area video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  text-align: center;
}

.camera-prompt {
  color: var(--primary-light);
  font-size: 14px;
}

.chat-area {
  width: 100%;
  flex: 1;
}

.bot-message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.bot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bot-text {
  background: var(--bg-card);
  border-radius: 16px 16px 16px 4px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.6;
  max-width: 85%;
}

.bot-text strong { color: var(--primary-light); }
.hint { font-size: 12px; color: var(--text-secondary); }

.user-input-area {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.text-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--bg-input);
  background: var(--bg-input);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.text-input:focus { border-color: var(--primary); }

.btn-record {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-record:active, .btn-record.recording {
  background: var(--danger);
  transform: scale(0.95);
}

.btn-send {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}

.btn-start {
  width: 100%;
  max-width: 400px;
  padding: 18px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--bg-dark);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s;
}

.btn-start:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,153,34,0.4); }

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  margin: 12px 0 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s;
}

/* ==================== 阶段2：对话 ==================== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.avatar-area {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 40vh;
  background: #000;
}

.avatar-area video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0,0,0,0.7);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-light);
}

.ai-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(239,68,68,0.9);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.msg.bot {
  background: var(--bg-card);
  align-self: flex-start;
  border-radius: 16px 16px 16px 4px;
}

.msg.user {
  background: var(--primary);
  color: var(--bg-dark);
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  font-weight: 600;
}

.input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  background: var(--bg-input);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.btn-voice {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-voice.active { background: var(--danger); animation: pulse 1s infinite; }

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

.toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 16px 16px;
  background: var(--bg-card);
  justify-content: center;
}

.btn-tool {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--bg-input);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.btn-tool:hover { border-color: var(--primary); color: var(--primary-light); }

/* ==================== 定价弹窗 ==================== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px;
  max-width: 600px;
  width: 100%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
}

.pricing-cards {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.pricing-card {
  flex: 1;
  background: var(--bg-dark);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
}

.pricing-card.pro {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(99,153,34,0.2);
}

.pricing-card .badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--bg-dark);
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}

.pricing-card h3 { font-size: 16px; margin-bottom: 8px; }
.pricing-card .price { font-size: 32px; font-weight: 900; margin: 8px 0; }
.pricing-card .price span { font-size: 14px; font-weight: 400; color: var(--text-secondary); }

.pricing-card ul {
  list-style: none;
  text-align: left;
  margin: 16px 0;
  font-size: 13px;
  line-height: 2;
  color: var(--text-secondary);
}

.btn-plan {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-plan:not(.current) {
  background: var(--primary);
  color: var(--bg-dark);
}

/* ==================== 合规提示 ==================== */
.compliance-notice {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.3);
}

.compliance-notice a { color: var(--primary-light); }

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
  .pricing-cards { flex-direction: column; }
  .camera-area { max-height: 40vh; }
}
