:root {
  --bg-obsidian: #08080B;
  --bg-card: rgba(18, 18, 26, 0.75);
  --border-card: rgba(212, 175, 55, 0.25);
  --gold-primary: #D4AF37;
  --gold-glow: rgba(212, 175, 55, 0.4);
  --emerald-active: #10B981;
  --emerald-glow: rgba(16, 185, 129, 0.4);
  --ruby-alert: #EF4444;
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --font-display: 'Syne', sans-serif;
  --font-sans: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

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

.call-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1rem 1.5rem;
  background: radial-gradient(circle at 50% 30%, #151522 0%, #08080B 75%);
  position: relative;
}

/* Header */
.call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--emerald-active);
  letter-spacing: 0.05em;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--emerald-active);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--emerald-glow);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.call-timer {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
}

.channel-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  text-transform: uppercase;
}

/* Stage & Orb */
.call-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  gap: 1.25rem;
}

.persona-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.persona-avatar-wrap {
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#orbCanvas {
  width: 240px;
  height: 240px;
  border-radius: 50%;
}

.persona-name {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #FFF 20%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 0.5rem;
}

.persona-role {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Transcript Viewport */
.transcript-viewport {
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem;
}

.turn-bubble {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
  animation: fade-slide 0.25s ease-out;
}

@keyframes fade-slide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.turn-speaker {
  display: block;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: 0.05em;
}

.agent-turn {
  background: rgba(30, 30, 45, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.25);
  align-self: flex-start;
  color: #F9FAFB;
}

.agent-turn .turn-speaker {
  color: var(--gold-primary);
}

.user-turn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  align-self: flex-end;
  color: #ECFDF5;
}

.user-turn .turn-speaker {
  color: var(--emerald-active);
  text-align: right;
}

.mic-live-indicator {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--emerald-active);
  font-weight: 700;
  letter-spacing: 0.05em;
  animation: pulse-live 1.2s infinite;
}

@keyframes pulse-live {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* Controls */
.call-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding-top: 0.5rem;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 1rem;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ctrl-btn:active {
  transform: scale(0.92);
}

.secondary-btn {
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 600;
  gap: 0.4rem;
  border-radius: 12px;
}

.mic-btn {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #10B981 0%, #047857 100%);
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
  position: relative;
  font-size: 1.75rem;
}

.mic-btn.speaking {
  background: linear-gradient(135deg, var(--gold-primary) 0%, #92400E 100%);
  box-shadow: 0 0 35px var(--gold-glow);
}

.mic-btn.muted {
  background: #374151;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.15);
}

.mic-ripple {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border: 2px solid var(--emerald-active);
  border-radius: 50%;
  animation: ripple 2s infinite;
  pointer-events: none;
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.35); opacity: 0; }
}

.end-call-btn {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, #EF4444 0%, #991B1B 100%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
  font-size: 1.25rem;
  flex-direction: column;
}

.end-call-btn .btn-label {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: -2px;
}

.call-footer-note {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 999;
}

.modal-card {
  background: #11111A;
  border: 1px solid var(--gold-primary);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 40px var(--gold-glow);
}

.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.modal-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.modal-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.modal-debrief-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  color: #D1D5DB;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  text-align: left;
}

.modal-btn {
  background: var(--gold-primary);
  color: #000;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
}

/* Floating Emergency Unmute Banner */
.unmute-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 440px;
  background: rgba(18, 18, 28, 0.96);
  border: 1.5px solid var(--gold-primary);
  border-radius: 9999px;
  box-shadow: 0 0 30px var(--gold-glow);
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  z-index: 1000;
  animation: pulse-banner 1.8s infinite alternate;
}

@keyframes pulse-banner {
  0% { box-shadow: 0 0 15px rgba(212, 175, 55, 0.3); }
  100% { box-shadow: 0 0 35px rgba(212, 175, 55, 0.8); }
}

.unmute-banner-icon {
  font-size: 1.25rem;
}

.unmute-banner-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

.unmute-banner-btn {
  background: var(--gold-primary);
  color: #000;
  border: none;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Header actions & test button */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.test-speaker-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.test-speaker-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
}

/* Turn header & replay button */
.turn-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.turn-replay-btn {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-primary);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.turn-replay-btn:hover {
  background: rgba(212, 175, 55, 0.3);
}

/* Quick text fallback input */
.text-fallback-wrap {
  width: 100%;
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(18, 18, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.text-fallback-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  padding: 0.4rem 0.5rem;
}

.text-fallback-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.text-fallback-send {
  background: var(--gold-primary);
  color: #000;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Join Overlay */
.call-join-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 11, 0.94);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 990;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.join-card {
  background: linear-gradient(145deg, rgba(26, 26, 38, 0.9) 0%, rgba(12, 12, 18, 0.95) 100%);
  border: 1.5px solid var(--gold-primary);
  border-radius: 24px;
  padding: 2.25rem 1.75rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 50px var(--gold-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.join-orb-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #D4AF37 0%, #1A1A28 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1.25rem;
}

.join-orb-pulse {
  position: absolute;
  inset: -8px;
  border: 2px solid var(--gold-primary);
  border-radius: 50%;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.join-orb-icon {
  font-size: 2.25rem;
}

.join-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
  margin-bottom: 0.35rem;
}

.join-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.gold-text {
  color: var(--gold-primary);
  font-weight: 700;
}

.join-btn {
  background: linear-gradient(135deg, var(--gold-primary) 0%, #B8860B 100%);
  color: #08080B;
  border: none;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 1rem 1.5rem;
  border-radius: 14px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 0 30px var(--gold-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.join-btn:active {
  transform: scale(0.96);
}

.join-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1.25rem;
}

