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

:root {
  --bg: #0a0a12;
  --surface: #141420;
  --surface2: #1c1c2e;
  --border: #252540;
  --text: #f0f0f8;
  --text-dim: #9090a8;
  --primary: #7c3aed;
  --primary-glow: rgba(124, 58, 237, 0.4);
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.3);
  --red: #ef4444;
  --bot-bg: #1a1a30;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
}

.header-tagline {
  font-size: 12px;
  color: var(--text-dim);
}

.status-badge {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text-dim);
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}
.status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}
.status-badge.connecting {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary);
}

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Welcome screen */
.welcome {
  text-align: center;
  padding: 40px 20px;
}

.welcome-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  margin: 0 auto 16px;
  box-shadow: 0 0 30px var(--primary-glow);
}

.welcome-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-tagline {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 30px;
}

.start-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6d28d9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: white;
  margin: 0 auto;
  box-shadow: 0 0 40px var(--primary-glow);
  transition: all 0.3s ease;
}

.start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 60px var(--primary-glow);
}

.start-btn:active {
  transform: scale(0.98);
}

.start-btn.recording {
  background: linear-gradient(135deg, var(--green), #059669);
  box-shadow: 0 0 40px var(--green-glow);
  animation: pulse 1.5s infinite;
}

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

.welcome-status {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 20px;
}

.error-msg {
  color: var(--red);
  font-size: 14px;
  margin-top: 16px;
}

/* Chat area */
.chat-area {
  flex: 1;
  width: 100%;
  max-width: 600px;
  overflow-y: auto;
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 12px;
}

.chat-area.active {
  display: flex;
}

.chat-area::-webkit-scrollbar {
  width: 4px;
}
.chat-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

.message.bot {
  align-self: flex-start;
}
.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message.bot .message-avatar {
  background: var(--surface2);
}
.message.user .message-avatar {
  background: rgba(124, 58, 237, 0.3);
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.message.bot .message-bubble {
  background: var(--bot-bg);
}
.message.user .message-bubble {
  background: rgba(124, 58, 237, 0.15);
}

.message-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Bottom bar */
.bottom-bar {
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  gap: 12px;
}

.bottom-bar.active {
  display: flex;
}

.volume-container {
  flex: 1;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}

.volume-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s;
}

.end-btn {
  min-width: 104px;
  padding: 9px 20px;
  border-radius: 20px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: all 0.2s;
}

.end-btn:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}
.end-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.footer {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* 首页卡片嵌入模式：保留真实语音会话核心，去掉独立页面外壳。 */
.embedded-voice,
html.embedded-voice body {
  min-height: 100%;
  background: #f8fbfa;
}

html.embedded-voice .header,
html.embedded-voice .footer,
.embedded-voice .header,
.embedded-voice .footer {
  display: none;
}

html.embedded-voice .main,
.embedded-voice .main {
  min-height: 0;
  background:
    radial-gradient(
      circle at 50% 35%,
      rgba(37, 129, 102, 0.1),
      transparent 48%
    ),
    #f8fbfa;
}

html.embedded-voice .welcome,
.embedded-voice .welcome {
  width: 100%;
  padding: 18px 14px 22px;
}

body.embedded-voice .welcome-logo {
  width: 46px;
  height: 46px;
  margin-bottom: 9px;
  font-size: 18px;
  background: linear-gradient(135deg, #176b55, #35a47c);
  box-shadow: 0 7px 20px rgba(23, 107, 85, 0.15);
}

.embedded-voice .welcome-name,
html.embedded-voice .welcome-name {
  font-size: 17px;
  margin-bottom: 2px;
}

.embedded-voice .welcome-tagline,
html.embedded-voice .welcome-tagline {
  margin-bottom: 16px;
  font-size: 12px;
}

.embedded-voice .start-btn,
html.embedded-voice .start-btn {
  width: 82px;
  height: 82px;
  font-size: 28px;
  background: linear-gradient(135deg, #176b55, #258166);
  box-shadow: 0 9px 25px rgba(23, 107, 85, 0.2);
}

.embedded-voice .start-btn:hover,
html.embedded-voice .start-btn:hover {
  box-shadow: 0 12px 30px rgba(23, 107, 85, 0.25);
}

.embedded-voice .welcome-status,
html.embedded-voice .welcome-status {
  margin-top: 12px;
  font-size: 12px;
}

.embedded-voice .chat-area,
html.embedded-voice .chat-area {
  max-width: none;
  padding: 15px;
}

.embedded-voice .bottom-bar,
html.embedded-voice .bottom-bar {
  flex: 0 0 auto;
  padding: 10px 14px;
  background: #fff;
}

:root {
  --bg: #f3f8f6;
  --surface: #fff;
  --surface2: #f7faf9;
  --border: #dce5e1;
  --text: #182129;
  --text-dim: #65727c;
  --primary: #176b55;
  --primary-glow: rgba(23, 107, 85, 0.16);
  --green: #258166;
  --green-glow: rgba(37, 129, 102, 0.16);
  --red: #b42318;
  --bot-bg: #f1f7f4;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.header {
  background: #fff;
  border-color: #e2e7ea;
}
.header-logo {
  background: #176b55;
  box-shadow: none;
}
.status-badge {
  background: #eaf4f0;
  color: #176b55;
}
.status-badge.connected {
  background: #eaf4f0;
  color: #258166;
}
.status-badge.error {
  background: #fdf0ef;
  color: #b42318;
}
.status-badge.connecting {
  background: #f3f8f6;
  color: #176b55;
}
.settings-btn,
.intent-toggle,
.dialogue-close-btn {
  background: #f7faf9;
  border-color: #dce5e1;
  color: #53616b;
}
.settings-btn:hover,
.intent-toggle:hover {
  background: #eaf4f0;
  color: #176b55;
}
.voice-visualizer {
  background: #f7faf9;
  border-color: #dce5e1;
  box-shadow: 0 0 30px rgba(23, 107, 85, 0.08);
}
.voice-visualizer::before {
  background: radial-gradient(
    circle,
    rgba(37, 129, 102, 0.16),
    transparent 62%
  );
}
.btn-primary,
.btn-mic {
  background: linear-gradient(135deg, #176b55, #258166);
  box-shadow: 0 8px 20px rgba(23, 107, 85, 0.15);
}
.btn-primary:hover,
.btn-mic:hover {
  background: #125b48;
}
.message.bot {
  background: #f1f7f4;
  border-color: #dce5e1;
}
.message.user {
  background: #eaf4f0;
  border-color: #d7ebe2;
}
.prompt-box,
.dialogue-panel,
.intent-panel,
.settings-panel {
  background: #fff;
  border-color: #dce5e1;
}
.dialogue-panel-header,
.intent-panel-header,
.settings-tabs {
  border-color: #dce5e1;
}
.code-block {
  background: #173c32;
  color: #e9f7f1;
}
.welcome .message-avatar {
  background: #176b55;
}
.user .message-avatar {
  background: #258166;
}

.header-logo,
.welcome-logo {
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
}
.header-logo {
  width: 44px !important;
  height: 44px !important;
}
.header-logo img,
.welcome-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* ===== Standalone mode beautification ===== */
.main {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(23,107,85,.06), transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(37,129,102,.04), transparent 50%),
    var(--bg);
}
.welcome {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(23,107,85,.06), 0 4px 12px rgba(0,0,0,.03);
  max-width: 440px;
  width: calc(100% - 40px);
  padding: 48px 32px 40px;
  animation: welcomeIn .5s ease;
}
@keyframes welcomeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.welcome-logo {
  width: 72px !important;
  height: 72px !important;
  margin-bottom: 20px !important;
  border-radius: 18px !important;
}
.welcome-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 6px;
}
.welcome-tagline {
  font-size: 14px;
  margin-bottom: 36px;
}
.start-btn {
  width: 140px;
  height: 140px;
  font-size: 42px;
  position: relative;
  border: none;
}
.start-btn::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(23,107,85,.15);
  animation: ringPulse 2.5s ease-out infinite;
}
.start-btn::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 2px solid rgba(23,107,85,.08);
  animation: ringPulse 2.5s ease-out infinite .6s;
}
@keyframes ringPulse {
  0% { transform: scale(.92); opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}
.start-btn.recording::before {
  border-color: rgba(37,129,102,.2);
  animation-duration: 1.5s;
}
.start-btn.recording::after {
  border-color: rgba(37,129,102,.12);
  animation-duration: 1.5s;
}
.welcome-status {
  margin-top: 24px;
  font-size: 13px;
  letter-spacing: .3px;
}
.header {
  box-shadow: 0 1px 8px rgba(0,0,0,.03);
}
.header-title {
  font-size: 15px;
}
.header-tagline {
  font-size: 12px;
}
.chat-area {
  max-width: 640px;
  padding: 24px 20px;
}
.chat-area.active {
  animation: chatFadeIn .3s ease;
}
@keyframes chatFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.message {
  gap: 12px;
  animation: msgSlide .3s ease;
}
@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.message-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 1px 3px rgba(0,0,0,.02);
}
.message.bot .message-bubble {
  border-radius: 14px 14px 4px 14px;
}
.message.user .message-bubble {
  border-radius: 14px 14px 14px 4px;
}
.bottom-bar {
  padding: 14px 24px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  border-radius: 0;
  background: var(--surface);
}
.bottom-bar.active {
  animation: barSlideUp .3s ease;
}
@keyframes barSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.volume-container {
  height: 6px;
  border-radius: 3px;
}
.volume-fill {
  border-radius: 3px;
  background: linear-gradient(90deg, #258166, #35a47c);
}
.end-btn {
  min-width: 110px;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(180,35,24,.15);
}
.end-btn:hover {
  box-shadow: 0 4px 12px rgba(180,35,24,.22);
}
