:root {
  --bg-color: #090d16;
  --bg-gradient: radial-gradient(circle at 50% 40%, #151c2e 0%, #090d16 80%);
  --card-bg: rgba(22, 30, 49, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-color: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --active-speaking: #10b981;
  --active-speaking-glow: rgba(16, 185, 129, 0.4);
  --active-listening: #6366f1;
  --active-listening-glow: rgba(99, 102, 241, 0.4);
  --error-color: #ef4444;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  font-family: var(--font-family);
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

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

.logo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

/* Main Talk Screen */
.talk-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.agent-banner {
  position: absolute;
  top: 15px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
}

/* Orb & Visualizer */
.orb-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.orb-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(0, 0, 0, 0) 70%);
  opacity: 0.6;
  transition: all 0.5s ease;
  animation: pulse-slow 4s ease-in-out infinite alternate;
}

.orb-canvas {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  z-index: 2;
  position: relative;
}

.orb-touch-target {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 50%;
}

/* Status & Controls */
.status-text {
  margin-top: 36px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.subtext {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
}

.controls-bar {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Transcript Container */
.transcript-drawer {
  width: 90%;
  max-width: 480px;
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  transition: all 0.3s ease;
}

.transcript-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.transcript-drawer.open .transcript-header {
  border-bottom-color: var(--card-border);
}

.transcript-body {
  max-height: 0;
  overflow-y: auto;
  transition: max-height 0.3s ease;
  padding: 0 16px;
}

.transcript-drawer.open .transcript-body {
  max-height: 180px;
  padding: 12px 16px;
}

.transcript-msg {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.transcript-msg.user {
  color: var(--accent-color);
}

.transcript-msg.agent {
  color: var(--text-primary);
}

/* Settings View - Isolated Page Area */
.settings-view-isolated {
  background: #070b14;
  background-image: radial-gradient(circle at 50% 0%, #151c33 0%, #070b14 75%);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.settings-navbar {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.settings-nav-title {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.settings-nav-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.settings-brand-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-color);
  font-weight: 600;
}

.settings-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 40px;
  max-width: 580px;
  margin: 0 auto;
  width: 100%;
}

.scope-badge {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  display: inline-block;
  margin-bottom: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 20px;
  backdrop-filter: blur(16px);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

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

.btn-primary {
  width: 100%;
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

#qr-canvas {
  background: white;
  padding: 10px;
  border-radius: 12px;
}

.history-list {
  font-size: 13px;
  color: var(--text-secondary);
}

.history-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
}

/* Animations */
@keyframes pulse-slow {
  0% { transform: scale(0.95); opacity: 0.4; }
  100% { transform: scale(1.15); opacity: 0.8; }
}

.override-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fef08a;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
