:root {
  --bg0: #070a10;
  --bg1: #0c1817;
  --fg: #edf2f7;
  --muted: #8b9aab;
  --accent: #00B8A8;
  --accent2: #3DD4C5;
  --ok: #2f9e5f;
  --danger: #c44b4b;
  --panel: rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 50% 0%, #143532 0%, transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  color: var(--fg);
  font-family: "SF Pro Display", "Segoe UI", "Helvetica Neue", sans-serif;
}

.conv {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
  gap: 1.25rem;
  text-align: center;
}

.brand {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

.orb {
  position: relative;
  width: min(42vw, 180px);
  height: min(42vw, 180px);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0.5rem 0 0.25rem;
}

.orb-core {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7aefe4, var(--accent) 45%, #007a70 100%);
  box-shadow: 0 0 40px rgba(0, 184, 168, 0.35);
  transition: transform 0.35s ease, box-shadow 0.35s ease, filter 0.35s ease;
}

.orb-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(61, 212, 197, 0.35);
  opacity: 0.35;
}

.orb-ring.delay { inset: 0; opacity: 0.18; }

.orb[data-state="listening"] .orb-core {
  animation: pulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 55px rgba(0, 184, 168, 0.55);
}
.orb[data-state="listening"] .orb-ring {
  animation: ring 1.8s ease-out infinite;
}
.orb[data-state="listening"] .orb-ring.delay {
  animation: ring 1.8s ease-out 0.4s infinite;
}

.orb[data-state="processing"] .orb-core {
  animation: spinGlow 1.2s linear infinite;
  filter: saturate(1.2);
}

.orb[data-state="speaking"] .orb-core {
  animation: speak 0.9s ease-in-out infinite;
  box-shadow: 0 0 60px rgba(61, 212, 197, 0.6);
}

.orb[data-state="error"] .orb-core {
  background: radial-gradient(circle at 35% 30%, #ffb0b0, var(--danger));
  box-shadow: 0 0 40px rgba(196, 75, 75, 0.45);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes ring {
  0% { transform: scale(0.85); opacity: 0.45; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes spinGlow {
  0% { transform: scale(0.96) rotate(0deg); }
  50% { transform: scale(1.02) rotate(180deg); }
  100% { transform: scale(0.96) rotate(360deg); }
}
@keyframes speak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.status-line {
  margin: 0;
  min-height: 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.conv-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 2.5rem;
}

.ghost, .confirm button, .fallback button, .row button {
  font: inherit;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
}

.ghost {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,0.08);
}
.ghost[aria-pressed="true"] {
  background: rgba(196, 75, 75, 0.2);
  border-color: rgba(196, 75, 75, 0.45);
}
.ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.confirm { display: flex; gap: 0.5rem; }
#btnConfirm { background: var(--ok); color: #fff; }
#btnCancel { background: var(--danger); color: #fff; }
.hidden { display: none !important; }

.debug {
  width: min(640px, 100%);
  margin-top: 1.5rem;
  text-align: left;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 1rem;
}
.debug h2 { margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.box {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  white-space: pre-wrap;
  min-height: 2.5rem;
}
.meta { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.78rem; word-break: break-all; }
.fallback label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.row { display: flex; gap: 0.5rem; }
.row input {
  flex: 1;
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.25);
  color: var(--fg);
}
@media (prefers-reduced-motion: reduce) {
  .orb-core, .orb-ring { animation: none !important; }
}
