:root {
  --bg-deep: #050508;
  --bg-panel: rgba(15, 15, 25, 0.72);
  --bg-elevated: rgba(25, 25, 40, 0.86);
  --text-primary: #fff;
  --text-secondary: #b8bac8;
  --text-muted: #76798a;
  --neon-mint: #00f5d4;
  --neon-cyan: #00bbf9;
  --neon-magenta: #ff006e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 60px rgba(0, 245, 212, 0.22);
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background-image:
    linear-gradient(rgba(0, 245, 212, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 212, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 42%, transparent 82%);
}

body::after {
  background:
    radial-gradient(760px 560px at 16% 18%, rgba(255, 0, 110, 0.16), transparent 68%),
    radial-gradient(720px 520px at 82% 78%, rgba(0, 245, 212, 0.15), transparent 62%);
}

button,
input {
  font: inherit;
}

.voice-app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  background: linear-gradient(135deg, rgba(5, 5, 8, 0.92), rgba(8, 10, 22, 0.82));
}

.voice-header,
.voice-footer {
  flex: 0 0 auto;
  border-color: var(--border-subtle);
  background: rgba(5, 5, 8, 0.76);
  backdrop-filter: blur(18px);
}

.voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 14px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0, 245, 212, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.18), rgba(255, 0, 110, 0.15));
  box-shadow: var(--shadow-glow);
}

.brand-mark img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.brand small {
  max-width: 54vw;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.86rem;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--text-muted);
}

.voice-app[data-state="active"] .status-dot,
.voice-app[data-state="connecting"] .status-dot {
  background: var(--neon-mint);
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.75);
}

.voice-app[data-state="error"] .status-dot {
  background: var(--neon-magenta);
  box-shadow: 0 0 18px rgba(255, 0, 110, 0.75);
}

.voice-main {
  display: grid;
  grid-template-columns: minmax(280px, 0.76fr) minmax(0, 1.24fr);
  gap: clamp(18px, 4vw, 44px);
  flex: 1 1 auto;
  min-height: 0;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px);
}

.hero-panel {
  align-self: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--neon-mint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-panel h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.lead {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.6vw, 1.24rem);
  line-height: 1.65;
}

.transcript-shell {
  min-height: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  background: var(--bg-panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  min-height: 0;
  padding: clamp(18px, 3vw, 32px);
  overflow-y: auto;
  scrollbar-color: rgba(0, 245, 212, 0.35) transparent;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.message.is-interrupted {
  opacity: 0.5;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.message.user .avatar {
  background: linear-gradient(135deg, rgba(0, 187, 249, 0.9), rgba(0, 245, 212, 0.7));
  color: #021111;
}

.message.assistant .avatar {
  background: linear-gradient(135deg, rgba(255, 0, 110, 0.8), rgba(155, 93, 229, 0.7));
}

.message-body {
  min-width: 0;
  padding-top: 2px;
}

.message-role {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.message p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user p {
  color: var(--text-primary);
}

.voice-footer {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 14px max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  border-top: 1px solid var(--border-subtle);
}

.mic-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.orb-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
}

.orb,
.orb-ring {
  position: absolute;
  border-radius: 999px;
}

.orb-ring {
  inset: 0;
  border: 1px solid rgba(0, 245, 212, 0.22);
}

.orb {
  width: 38px;
  height: 38px;
  background: radial-gradient(circle at 35% 35%, #fff, var(--neon-mint) 28%, var(--neon-cyan) 62%, rgba(255, 0, 110, 0.8));
  box-shadow: 0 0 40px rgba(0, 245, 212, 0.5);
  transform: scale(var(--level-scale, 0.74));
  transition: transform 90ms linear, opacity 180ms ease;
  opacity: 0.72;
}

.voice-app[data-state="active"] .orb,
.voice-app[data-state="connecting"] .orb {
  opacity: 1;
}

.voice-app[data-state="active"] .orb-ring,
.voice-app[data-state="connecting"] .orb-ring {
  animation: pulseRing 1.5s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% {
    transform: scale(0.86);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.mic-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 210px;
  min-height: 62px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--neon-mint), var(--neon-cyan));
  color: #021111;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 16px 50px rgba(0, 245, 212, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.mic-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 58px rgba(0, 245, 212, 0.3);
}

.mic-button:active {
  transform: translateY(1px) scale(0.99);
}

.voice-app[data-state="active"] .mic-button,
.voice-app[data-state="connecting"] .mic-button {
  background: linear-gradient(135deg, var(--neon-magenta), #9b5de5);
  color: #fff;
  box-shadow: 0 16px 58px rgba(255, 0, 110, 0.26);
}

.mic-button[disabled] {
  cursor: not-allowed;
  filter: saturate(0.5);
  opacity: 0.72;
}

.text-form {
  display: flex;
  width: min(760px, 100%);
  gap: 10px;
}

.text-form[hidden] {
  display: none;
}

.text-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  outline: none;
  padding: 13px 18px;
}

.text-form input:focus {
  border-color: rgba(0, 245, 212, 0.42);
  box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.12);
}

.text-form button {
  border: 1px solid rgba(0, 245, 212, 0.32);
  border-radius: 999px;
  background: rgba(0, 245, 212, 0.12);
  color: var(--neon-mint);
  cursor: pointer;
  font-weight: 800;
  padding: 0 18px;
}

.error-text {
  max-width: min(760px, 100%);
  margin: 0;
  color: #ff8db9;
  font-size: 0.92rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .voice-main {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .hero-panel {
    align-self: start;
  }

  .hero-panel h1 {
    font-size: clamp(2.15rem, 12vw, 4.4rem);
  }

  .lead {
    margin-top: 14px;
  }

  .transcript-shell {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .brand small {
    display: none;
  }

  .status-pill {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .voice-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mic-stage {
    width: 100%;
    gap: 10px;
  }

  .orb-wrap {
    width: 58px;
    height: 58px;
  }

  .mic-button {
    flex: 1;
    min-width: 0;
  }
}
