:root {
  --bg-color: #05070f;
  --panel-bg: rgba(12, 18, 34, 0.75);
  --border-color: rgba(0, 240, 255, 0.2);
  --primary-cyan: #00f0ff;
  --primary-blue: #0072ff;
  --accent-purple: #7000ff;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --success: #00ff88;
  --warning: #ffb700;
  --danger: #ff3366;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: env(safe-area-inset-top, 16px) 16px env(safe-area-inset-bottom, 20px) 16px;
  position: relative;
  background: radial-gradient(circle at 50% 40%, rgba(0, 114, 255, 0.08) 0%, rgba(5, 7, 15, 1) 75%);
}

/* 顶部状态栏 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-cyan);
  box-shadow: 0 0 10px var(--primary-cyan);
  animation: pulse 2s infinite ease-in-out;
}

.title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #00f0ff, #0072ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--primary-cyan);
  letter-spacing: 1px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  transition: all 0.3s ease;
}

.status-chip.connected .status-indicator {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.status-chip.connected {
  color: var(--text-main);
  border-color: rgba(0, 255, 136, 0.3);
}

.status-chip.speaking .status-indicator {
  background: var(--primary-cyan);
  box-shadow: 0 0 10px var(--primary-cyan);
  animation: blink 0.8s infinite alternate;
}

/* 核心视觉能量球 */
.visualizer-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#orbCanvas {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.orb-overlay {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  margin-top: 240px;
}

.state-label {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-main);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
  margin-bottom: 6px;
  transition: all 0.3s;
}

.sub-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* 底部区域 */
.footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

/* 实时事件卡片 */
.event-card {
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid var(--primary-cyan);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(15px);
  box-shadow: 0 4px 20px rgba(0, 240, 255, 0.15);
  animation: slideUp 0.3s ease;
}

.event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-cyan);
  margin-bottom: 4px;
}

.event-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #c9d1d9;
  max-height: 70px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* 控制按钮栏 */
.controls-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(0, 240, 255, 0.15);
}

.icon-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.icon-btn.active {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(255, 51, 102, 0.15);
}

/* 主麦克风按钮 (方舟反应炉动效) */
.main-mic-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #0d1e3d 0%, #060b18 100%);
  border: 2px solid var(--primary-cyan);
  color: var(--primary-cyan);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.3), inset 0 0 15px rgba(0, 240, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.main-mic-btn:active {
  transform: scale(0.95);
}

.main-mic-btn.active {
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 0 35px rgba(0, 255, 136, 0.5), inset 0 0 20px rgba(0, 255, 136, 0.4);
  animation: glowPulse 2s infinite;
}

.mic-glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 240, 255, 0.4);
  animation: rotate 12s linear infinite;
}

.main-mic-btn.active .mic-glow {
  border-color: rgba(0, 255, 136, 0.6);
}

/* 抽屉面板 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.drawer-overlay.open {
  display: flex;
  opacity: 1;
}

.drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70vh;
  background: #090d1a;
  border-top: 1px solid var(--primary-cyan);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  padding: 16px;
}

.drawer-overlay.open .drawer {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  margin-bottom: 12px;
}

.drawer-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.close-btn {
  position: absolute;
  right: 0;
  top: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.log-item {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--border-color);
}

.log-item.tool-log {
  border-left-color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.log-item.assistant-log {
  border-left-color: var(--primary-blue);
}

.log-item.error-log {
  border-left-color: var(--danger);
  color: var(--danger);
}

.log-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(0, 240, 255, 0.2);
  border-top-color: var(--primary-cyan);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

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

@keyframes blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 25px rgba(0, 255, 136, 0.4); }
  50% { box-shadow: 0 0 45px rgba(0, 255, 136, 0.8); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
