:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f7f6f2;
  color: #060606;
  --ink: #060606;
  --muted: #6f6a62;
  --line: #dedbd5;
  --paper: #f7f6f2;
  --panel: #f1f0ec;
  --panel-strong: #ffffff;
  --voice-level: 0;
  --input-level: 0;
  --output-level: 0;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(247, 246, 242, 0.98)),
    #f7f6f2;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 0 22px;
  box-shadow: 0 1px 2px rgba(6, 6, 6, 0.04);
}

button:first-child {
  border-color: #060606;
  background: #060606;
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: clamp(18px, 4vw, 46px);
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: clamp(28px, 5vw, 58px);
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  min-width: 0;
}

h1 {
  max-width: none;
  margin: 0;
  color: var(--ink);
  font-size: clamp(52px, 9vw, 118px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 0.92;
  white-space: nowrap;
}

.status {
  min-width: 150px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 8px rgba(6, 6, 6, 0.04);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8f8a82;
}

.status-dot[data-state="pending"] {
  background: #d9a42d;
}

.status-dot[data-state="ready"] {
  background: #178f68;
}

.status-dot[data-state="error"] {
  background: #d5483e;
}

.experience {
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.voice-panel,
.transcript-panel {
  min-width: 0;
}

.voice-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: clamp(22px, 4vw, 44px);
  border-right: 1px solid var(--line);
}

.voice-visual {
  --orb-size: min(58vh, 440px);
  width: min(100%, 560px);
  min-height: 440px;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  margin: 0 auto;
}

button.voice-visual {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  cursor: pointer;
  padding: 0;
}

button.voice-visual:disabled {
  cursor: wait;
  opacity: 1;
}

button.voice-visual:focus-visible {
  outline: 2px solid #060606;
  outline-offset: 6px;
}

.voice-rings {
  position: absolute;
  inset: 10%;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.voice-rings span {
  position: absolute;
  width: calc(var(--orb-size) * 0.72);
  aspect-ratio: 1;
  border: 1px solid rgba(6, 6, 6, 0.12);
  border-radius: 50%;
  opacity: calc(0.18 + var(--output-level) * 0.38);
  transform: scale(calc(1 + var(--output-level) * 0.26));
  transition:
    opacity 90ms linear,
    transform 90ms linear;
}

.voice-rings span:nth-child(2) {
  width: calc(var(--orb-size) * 0.92);
  opacity: calc(0.12 + var(--output-level) * 0.28);
  transform: scale(calc(1 + var(--output-level) * 0.18));
}

.voice-rings span:nth-child(3) {
  width: calc(var(--orb-size) * 1.12);
  opacity: calc(0.08 + var(--output-level) * 0.2);
  transform: scale(calc(1 + var(--output-level) * 0.12));
}

.voice-orb {
  width: var(--orb-size);
  max-width: 88%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(6, 6, 6, 0.08);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 244, 247, 0.92), rgba(255, 244, 247, 0) 32%),
    radial-gradient(circle at 42% 68%, rgba(255, 112, 82, 0.92), rgba(255, 112, 82, 0) 34%),
    radial-gradient(circle at 70% 30%, rgba(133, 111, 218, 0.82), rgba(133, 111, 218, 0) 36%),
    radial-gradient(circle at 74% 76%, rgba(63, 145, 103, 0.76), rgba(63, 145, 103, 0) 35%),
    #f5ded6;
  box-shadow:
    inset 0 0 64px rgba(255, 255, 255, 0.38),
    0 28px 80px rgba(6, 6, 6, 0.1);
  filter: saturate(calc(1 + var(--voice-level) * 0.75));
  transform: scale(calc(0.96 + var(--voice-level) * 0.08));
  transition:
    filter 90ms linear,
    transform 90ms linear;
}

.orb-shade {
  position: absolute;
  inset: -24%;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0.55) 48%, rgba(255, 255, 255, 0) 66%),
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 42%);
  mix-blend-mode: overlay;
  transform: translateX(calc(var(--output-level) * 24px)) rotate(calc(var(--input-level) * -10deg));
  transition: transform 90ms linear;
}

.orb-center {
  width: 72px;
  aspect-ratio: 1;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: auto;
  border: 1px solid rgba(6, 6, 6, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 34px rgba(6, 6, 6, 0.12);
}

.orb-center span {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid #060606;
}

.voice-visual[data-state="connected"] .orb-center span,
.voice-visual[data-state="speaking"] .orb-center span,
.voice-visual[data-state="listening"] .orb-center span {
  width: 18px;
  height: 18px;
  margin-left: 0;
  border: 0;
  border-radius: 4px;
  background: #060606;
}

.voice-visual[data-state="connecting"] .orb-center {
  animation: pulse-center 900ms ease-in-out infinite alternate;
}

@keyframes pulse-center {
  from {
    transform: scale(0.94);
  }
  to {
    transform: scale(1.04);
  }
}

.voice-bars {
  position: absolute;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(280px, 72%);
  height: 74px;
  justify-content: center;
  transform: translateX(-50%);
}

.voice-bars span {
  width: 10px;
  height: 58px;
  border-radius: 999px;
  background: rgba(6, 6, 6, 0.78);
  transform: scaleY(0.16);
  transform-origin: center;
  transition: transform 70ms linear;
}

.transcript-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(255, 255, 255, 0.46);
}

.panel-heading {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(18px, 3vw, 28px);
}

.panel-heading p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.language-control select {
  min-width: 78px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 0 34px 0 14px;
}

.transcript {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(18px, 3vw, 28px);
}

.empty {
  margin: auto;
  color: var(--muted);
  font-size: 15px;
}

.message {
  width: min(100%, 520px);
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px 14px;
  box-shadow: 0 1px 2px rgba(6, 6, 6, 0.03);
}

.message span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.message p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: end;
  background: #060606;
  border-color: #060606;
}

.message.user span,
.message.user p {
  color: #ffffff;
}

.message.agent {
  align-self: start;
}

.commit-badge {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: rgba(6, 6, 6, 0.68);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1;
  padding: 8px 10px;
  text-decoration: none;
}

.commit-badge:hover {
  color: var(--ink);
  border-color: rgba(6, 6, 6, 0.24);
}

@media (max-width: 860px) {
  .shell {
    align-items: start;
    padding: 18px;
  }

  .topbar {
    gap: 18px;
  }

  .experience {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .voice-panel {
    min-height: 480px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .voice-visual {
    min-height: 340px;
    --orb-size: min(76vw, 320px);
  }

  .transcript-panel {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    width: fit-content;
  }

  h1 {
    font-size: clamp(48px, 18vw, 84px);
  }

  .voice-panel {
    min-height: 420px;
    padding: 18px;
  }

  .voice-visual {
    min-height: 310px;
  }

  .panel-heading {
    min-height: 56px;
  }

  .transcript {
    padding: 16px;
  }

  .commit-badge {
    right: 10px;
    bottom: 8px;
    font-size: 11px;
  }
}
