@media (max-width: 640px) {
  html,
  body,
  #root {
    min-width: 0;
    min-height: 100%;
  }

  body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  .min-h-screen {
    min-height: 100dvh;
  }

  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  [class~="px-8"],
  [class~="px-6"] {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  [class~="pb-12"] {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important;
  }

  [class~="min-w-[350px]"],
  [class~="min-w-[280px]"] {
    min-width: 100% !important;
  }

  [class~="w-[72px]"] {
    width: 4rem !important;
  }

  [class~="h-[72px]"] {
    height: 4rem !important;
  }
}

#platform-launcher {
  position: fixed;
  right: 1.25rem;
  top: 1.25rem;
  z-index: 1200;
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0.85rem;
  color: #e2e8f0;
  background: #0f766e;
  border: 1px solid #5eead4;
  border-radius: 0.75rem;
  box-shadow: 0 14px 30px rgba(2, 44, 34, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  text-decoration: none;
}

#platform-launcher span {
  color: #99f6e4;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#platform-launcher strong {
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  #platform-launcher {
    right: 0.75rem;
    top: max(0.75rem, env(safe-area-inset-top));
  }
}

/* The deployed Agent component fixes its phone UI at 393px plus borders. */
@media (max-width: 430px) {
  [style*="min-width: 393px"] {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 393px !important;
    touch-action: manipulation !important;
  }

  [class~="w-[393px]"] {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 393px !important;
  }
}

.agent-call-console {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1000;
  width: min(360px, calc(100vw - 2rem));
  padding: 1.125rem;
  color: #e2e8f0;
  background: linear-gradient(145deg, #111c33, #0b1220 72%);
  border: 1px solid #334155;
  border-radius: 1.25rem;
  box-shadow: 0 22px 50px rgba(2, 6, 23, 0.48);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.agent-call-console[data-status="ringing"] {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25), 0 22px 50px rgba(2, 6, 23, 0.48);
}

.agent-call-console[data-status="active"] {
  border-color: #10b981;
}

.agent-call-console__header,
.agent-call-console__actions,
.agent-call-console__toggle {
  display: flex;
  align-items: center;
}

.agent-call-console__header {
  gap: 0.5rem;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agent-call-console__signal {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.agent-call-console[data-status="ringing"] .agent-call-console__signal {
  background: #f59e0b;
  animation: agent-call-pulse 1s infinite;
}

.agent-call-console__timer {
  margin-left: auto;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.agent-call-console__caller {
  margin-top: 0.75rem;
  overflow: hidden;
  color: #f8fafc;
  font-size: 1.25rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-call-console__mode,
.agent-call-console__warning {
  margin: 0.35rem 0 0;
  color: #94a3b8;
  font-size: 0.8rem;
}

.agent-call-console__mode + .agent-call-console__mode {
  color: #5eead4;
}

.agent-call-console__warning {
  color: #fbbf24;
}

.agent-call-console__actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.agent-call-console button {
  min-height: 2.7rem;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-radius: 0.75rem;
  color: #f8fafc;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 750;
}

.agent-call-console__answer {
  flex: 1 1 150px;
  background: #059669;
}

.agent-call-console__end {
  flex: 1 1 150px;
  background: #dc2626;
}

.agent-call-console__utility {
  flex: 1 1 130px;
  background: #24334d;
}

.agent-call-console__test {
  width: 100%;
  margin-top: 0.5rem;
  background: #1d4ed8;
}

.agent-call-console__test:disabled {
  cursor: wait;
  opacity: 0.7;
}

.agent-call-console__toggle {
  gap: 0.65rem;
  margin-top: 0.9rem;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 650;
}

.agent-call-console__toggle input {
  width: 1rem;
  min-height: 1rem;
  height: 1rem;
  accent-color: #10b981;
}

@keyframes agent-call-pulse {
  50% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.04);
  }
}

@media (max-width: 640px) {
  .agent-call-console {
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 1rem;
    width: auto;
  }
}
