@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg-ink: #061321;
  --bg-teal: #08383e;
  --card: rgba(6, 20, 33, 0.72);
  --line: rgba(159, 206, 210, 0.22);
  --text: #ebfffd;
  --muted: #9ac2c1;
  --accent-listening: #ffcf56;
  --accent-speaking: #11f1d0;
  --accent-idle: #4fc3f7;
  --danger: #f25f5c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(70rem 70rem at -5% -5%, rgba(62, 201, 193, 0.18), transparent 60%),
    radial-gradient(50rem 50rem at 110% 10%, rgba(255, 207, 86, 0.15), transparent 58%),
    linear-gradient(135deg, var(--bg-ink), var(--bg-teal));
}

.app-shell {
  width: min(960px, 92vw);
  margin: 2.4rem auto;
  padding: 1.4rem 1.6rem 2rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(4, 15, 26, 0.82), rgba(4, 19, 25, 0.7));
  backdrop-filter: blur(8px);
}

.hero {
  text-align: center;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-size: 0.75rem;
}

.hero h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.5rem, 2.2vw, 2.2rem);
}

.subtitle {
  margin: 0.7rem auto 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.center-stage {
  display: grid;
  justify-items: center;
  gap: 1rem;
  margin-top: 1.6rem;
}

.setup-panel {
  margin: 1rem auto 0;
  max-width: 760px;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.picker {
  display: grid;
  gap: 0.45rem;
}

.picker label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.picker select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 29, 42, 0.66);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.68rem 0.75rem;
  outline: none;
}

.picker select:disabled {
  opacity: 0.65;
}

.orb {
  position: relative;
  width: clamp(170px, 30vw, 240px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.orb-core,
.orb-ring {
  position: absolute;
  border-radius: 50%;
  transition: all 180ms ease;
}

.orb-core {
  width: 38%;
  height: 38%;
  background: var(--accent-idle);
  filter: blur(0.3px);
  box-shadow: 0 0 55px rgba(79, 195, 247, 0.48);
  animation: floaty 4.2s ease-in-out infinite;
}

.orb-ring {
  width: 92%;
  height: 92%;
  border: 2px solid rgba(79, 195, 247, 0.38);
  box-shadow: 0 0 30px rgba(79, 195, 247, 0.32);
  animation: ringPulse 2s ease-in-out infinite;
}

.orb[data-state="idle"] .orb-core {
  background: var(--accent-idle);
  box-shadow: 0 0 56px rgba(79, 195, 247, 0.45);
}

.orb[data-state="listening"] .orb-core {
  background: var(--accent-listening);
  box-shadow: 0 0 62px rgba(255, 207, 86, 0.62);
}

.orb[data-state="listening"] .orb-ring {
  border-color: rgba(255, 207, 86, 0.55);
  box-shadow: 0 0 28px rgba(255, 207, 86, 0.48);
}

.orb[data-state="speaking"] .orb-core {
  width: 42%;
  height: 42%;
  background: var(--accent-speaking);
  box-shadow: 0 0 76px rgba(17, 241, 208, 0.75);
  animation: glowBeat 640ms ease-in-out infinite;
}

.orb[data-state="speaking"] .orb-ring {
  border-color: rgba(17, 241, 208, 0.65);
  box-shadow: 0 0 34px rgba(17, 241, 208, 0.58);
}

.orb[data-state="connecting"] .orb-core {
  animation: spinIn 900ms linear infinite;
}

.orb[data-state="error"] .orb-core {
  background: var(--danger);
  box-shadow: 0 0 70px rgba(242, 95, 92, 0.75);
}

.orb[data-state="ended"] .orb-core {
  background: #a8bdc6;
  box-shadow: 0 0 40px rgba(168, 189, 198, 0.35);
}

.state-label {
  margin: 0;
  font-size: 0.98rem;
  color: var(--muted);
}

.controls {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action {
  min-width: 180px;
  border-radius: 999px;
  padding: 0.78rem 1.1rem;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 130ms ease, opacity 130ms ease, border-color 130ms ease;
}

.action:hover {
  transform: translateY(-1px);
}

.action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.action.primary {
  background: linear-gradient(120deg, #f6b53d, #ffcf56);
  color: #101010;
}

.action.ghost {
  background: transparent;
  border-color: rgba(235, 255, 253, 0.28);
  color: var(--text);
}

.transcript-panel,
.score-panel {
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 0.9rem;
}

.transcript-panel h2,
.score-panel h2 {
  margin: 0;
  font-size: 0.96rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.transcript {
  margin-top: 0.85rem;
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 0.55rem;
}

.msg {
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  font-size: 0.93rem;
  line-height: 1.3;
}

.msg.assistant {
  background: rgba(17, 241, 208, 0.14);
  border: 1px solid rgba(17, 241, 208, 0.26);
}

.msg.candidate {
  background: rgba(255, 207, 86, 0.12);
  border: 1px solid rgba(255, 207, 86, 0.24);
}

.msg small {
  display: block;
  margin-bottom: 0.22rem;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.67rem;
  letter-spacing: 0.06em;
}

@keyframes ringPulse {
  0%,
  100% {
    transform: scale(0.98);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes glowBeat {
  0%,
  100% {
    transform: scale(0.96);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes spinIn {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .app-shell {
    margin: 1rem auto;
    padding: 1rem 0.9rem 1.3rem;
    border-radius: 18px;
  }

  .setup-panel {
    grid-template-columns: 1fr;
  }

  .action {
    width: 100%;
  }
}
