:root {
  --t3-blue: #1b4d89;
  --t3-blue-dark: #123760;
  --t3-accent: #f2a43a;
  --t3-ink: #172033;
  --t3-muted: #667085;
  --t3-line: #d9e0ea;
  --t3-bg: #f7f9fc;
  --t3-panel: #ffffff;
}

.t3-page {
  min-height: 100vh;
  background: var(--t3-bg);
  color: var(--t3-ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.t3-page h1,
.t3-page h2 {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0;
}

.t3-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--t3-line);
  background: rgba(255, 255, 255, 0.92);
}

.t3-back {
  color: var(--t3-blue);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.t3-kicker {
  margin: 0 0 4px;
  color: var(--t3-blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.t3-header h1 {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 34px);
  line-height: 1.1;
}

.connection-pill {
  border: 1px solid var(--t3-line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--t3-muted);
  font-size: 13px;
  font-weight: 700;
}

.connection-pill.listening,
.connection-pill.speaking {
  color: var(--t3-blue-dark);
  border-color: rgba(27, 77, 137, 0.34);
  background: #eef5ff;
}

.connection-pill.error {
  color: #9f1239;
  border-color: #fecdd3;
  background: #fff1f2;
}

.t3-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 48px) clamp(14px, 3vw, 24px) 96px;
  display: grid;
  gap: 22px;
}

.voice-stage,
.transcript-panel {
  background: var(--t3-panel);
  border: 1px solid var(--t3-line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(18, 55, 96, 0.08);
}

.voice-stage {
  min-height: 390px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 32px 18px;
}

.audio-orb {
  width: min(42vw, 184px);
  min-width: 138px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 32%),
    radial-gradient(circle, rgba(242, 164, 58, 0.42), rgba(27, 77, 137, 0.92) 72%);
  box-shadow: 0 24px 65px rgba(27, 77, 137, 0.26);
  transform: scale(var(--orb-scale, 1));
  transition: transform 90ms linear, filter 180ms ease;
}

.audio-orb:focus-visible {
  outline: 4px solid rgba(242, 164, 58, 0.55);
  outline-offset: 8px;
}

.audio-orb.thinking {
  animation: breathe 1.35s ease-in-out infinite;
  filter: saturate(0.92);
}

.audio-orb.error {
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 32%),
    radial-gradient(circle, #fb7185, #9f1239 72%);
}

.audio-orb.muted {
  filter: grayscale(0.8);
  opacity: 0.72;
}

.orb-core {
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 24px rgba(27, 77, 137, 0.22);
}

.talk-button,
.modal-primary {
  border: 0;
  border-radius: 999px;
  background: var(--t3-blue);
  color: #fff;
  min-height: 48px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.talk-button:disabled,
.modal-primary:disabled,
.control-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.state-label {
  margin: 0;
  max-width: 540px;
  color: var(--t3-muted);
  text-align: center;
  line-height: 1.45;
}

.prompt-chips,
.modal-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.prompt-chips button,
.modal-chips button {
  border: 1px solid #cdd8e7;
  border-radius: 999px;
  background: #fff;
  color: var(--t3-blue-dark);
  padding: 10px 13px;
  font-weight: 700;
  cursor: pointer;
}

.transcript-panel {
  padding: 0;
  min-height: 230px;
  max-height: 36vh;
  overflow: auto;
}

.transcript {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.empty-transcript {
  margin: 0;
  color: var(--t3-muted);
}

.turn {
  display: grid;
  gap: 4px;
  max-width: 78ch;
}

.turn.user {
  margin-left: auto;
  text-align: right;
}

.turn .speaker {
  color: var(--t3-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.turn .text {
  border-radius: 8px;
  padding: 11px 13px;
  background: #f1f5f9;
  line-height: 1.45;
}

.turn.user .text {
  background: #e8f1ff;
}

.turn.agent .text {
  background: #fff6e8;
}

.t3-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--t3-line);
  background: rgba(255, 255, 255, 0.96);
}

.control-button {
  border: 1px solid #cdd8e7;
  border-radius: 999px;
  background: #fff;
  color: var(--t3-blue-dark);
  min-width: 72px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.control-button[aria-pressed="true"] {
  background: var(--t3-blue);
  border-color: var(--t3-blue);
  color: #fff;
}

.control-button.danger {
  color: #9f1239;
  border-color: #fecdd3;
}

.demo-note {
  color: var(--t3-muted);
  font-size: 12px;
  margin-left: 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(12, 24, 42, 0.54);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(100%, 520px);
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--t3-line);
  padding: 26px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.modal p {
  color: #475467;
  line-height: 1.5;
}

.modal-primary {
  width: 100%;
  margin-top: 18px;
}

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

@media (max-width: 700px) {
  .t3-header {
    grid-template-columns: 1fr auto;
  }

  .t3-back {
    grid-column: 1 / -1;
  }

  .voice-stage {
    min-height: 350px;
  }

  .transcript-panel {
    max-height: 32vh;
  }

  .demo-note {
    width: 100%;
    text-align: center;
    margin-left: 0;
  }

  .control-button {
    flex: 1 1 70px;
  }
}
