:root {
  --bg-color: #08090d;
  --surface-color: rgba(255, 255, 255, 0.04);
  --surface-border: rgba(255, 255, 255, 0.08);
  --primary-accent: #00f2fe;
  --primary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --listening-accent: #00f5a0;
  --thinking-accent: #fbc531;
  --speaking-accent: #ff007f;
  --text-main: #f0f2f5;
  --text-muted: #8b92a5;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  user-select: none;
}

.app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 920px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  position: relative;
  background: radial-gradient(circle at 50% 30%, rgba(20, 30, 60, 0.4) 0%, rgba(8, 9, 13, 0.98) 75%);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  padding-bottom: 12px;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

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

.logo-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
}

.selectors-container {
  display: flex;
  gap: 8px;
}

.control-pill {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  padding: 4px 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
}

.pill-label {
  font-size: 11px;
  color: var(--text-muted);
}

.control-pill select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.control-pill select option {
  background: #141721;
  color: #fff;
}

/* Central Sphere Area */
.sphere-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

.sphere-glow-underlay {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.18) 0%, rgba(155, 81, 224, 0.1) 50%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  transition: all 0.5s ease;
}

#voiceCanvas {
  width: 320px;
  height: 320px;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.3s ease;
}

#voiceCanvas:active {
  transform: scale(0.97);
}

/* Status Indicator */
.status-indicator {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--surface-border);
  z-index: 3;
}

.status-icon {
  font-size: 10px;
  color: var(--primary-accent);
}

.status-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Live Subtitle */
.live-subtitle {
  min-height: 48px;
  margin-top: 12px;
  padding: 0 16px;
  text-align: center;
  max-width: 90%;
  z-index: 3;
}

.subtitle-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  opacity: 0.9;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Text Input Bar */
.text-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  border-radius: 28px;
  padding: 5px 6px 5px 16px;
  margin: 8px 0 10px 0;
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  z-index: 10;
  width: 100%;
}

.text-input-bar:focus-within {
  border-color: rgba(0, 242, 254, 0.5);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.15);
}

.text-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
}

.text-input-bar input::placeholder {
  color: var(--text-muted);
}

.text-input-bar button {
  background: var(--primary-gradient);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.text-input-bar button:hover {
  transform: scale(1.06);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
}

.text-input-bar button:active {
  transform: scale(0.92);
}

/* Footer / Controls */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  z-index: 10;
}

.mode-switch {
  display: flex;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  padding: 3px;
  border-radius: 24px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Main Action Mic Button */
.main-action {
  position: relative;
}

.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-gradient);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.4);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.6);
}

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

.action-btn.recording {
  background: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
  box-shadow: 0 0 30px rgba(255, 8, 68, 0.6);
}

.action-btn.recording .mic-svg {
  animation: pulse-mic 1s infinite alternate;
}

.mic-svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
}

.icon-btn {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* Drawer */
.history-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70%;
  background: #11131c;
  border-top: 1px solid var(--surface-border);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  z-index: 100;
  transform: translateY(105%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
}

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

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

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

.close-drawer-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 85%;
}

.chat-bubble.user {
  align-self: flex-end;
  background: #202636;
  color: #e2e8f0;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.empty-history {
  color: var(--text-muted);
  text-align: center;
  margin-top: 40px;
  font-size: 13px;
}

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

@keyframes pulse-mic {
  0% { transform: scale(0.92); }
  100% { transform: scale(1.08); }
}

/* Key Pill Button */
.key-pill {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  position: relative;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.key-pill:hover {
  background: rgba(255, 255, 255, 0.1);
}

.key-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ff4757;
}

.key-status-dot.active {
  background-color: #00f5a0;
  box-shadow: 0 0 6px #00f5a0;
}

/* Modal Overlay & Box */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #12141f;
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-desc a {
  color: var(--primary-accent);
  text-decoration: underline;
}

.input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  margin-bottom: 16px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.modal-btn.primary {
  background: var(--primary-gradient);
  color: #fff;
}

