:root {
  color-scheme: light;
  --bg: #F7F7F8;
  --panel: #FFFFFF;
  --ink: #111111;
  --muted: #5F6368;
  --line: #D9DCE1;
  --line-strong: #AEB4BD;
  --accent: #002FA7;
  --error: #E4002B;
  font-family:
    "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg);
  background-size: 72px 72px;
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

button {
  min-height: 48px;
  padding: 0 18px;
  color: #FFFFFF;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

button.secondary {
  color: var(--ink);
  background: #FFFFFF;
  border-color: var(--line-strong);
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(3.6rem, 8vw, 7.8rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.96;
}

.agent-shell {
  width: 100vw;
  height: 100vh;
}

.stage-screen {
  width: min(1280px, calc(100vw - 48px));
  height: calc(100vh - 48px);
  margin: 24px auto;
}

.upload-screen {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(440px, 1.2fr);
  gap: 24px;
  align-items: stretch;
}

.stage-copy,
.drop-zone,
.loading-screen,
.mode-screen,
.chat-screen,
.voice-screen {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px;
  border-left: 8px solid var(--accent);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lead {
  max-width: 48ch;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.45;
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 20px;
  padding: 28px;
  border-left: 8px solid var(--accent);
}

.drop-zone.is-dragging {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-zone button {
  position: relative;
  z-index: 1;
  justify-self: start;
}

.step-number {
  color: var(--accent);
  font-size: clamp(6rem, 18vw, 13rem);
  font-weight: 900;
  line-height: 0.78;
}

.drop-zone h2 {
  margin-top: 24px;
}

.drop-zone p:last-child {
  max-width: 42ch;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.error-text {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 18px;
  padding: 12px 16px;
  color: var(--error);
  background: #FFFFFF;
  border: 1px solid var(--error);
  border-radius: 8px;
  font-weight: 800;
}

.loading-screen {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 34px;
  padding: 48px;
  border-left: 8px solid var(--accent);
}

.loading-mark {
  display: grid;
  place-items: center;
  width: min(30vw, 220px);
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.loading-mark span {
  width: 58%;
  aspect-ratio: 1;
  border: 18px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-copy {
  display: grid;
  gap: 16px;
  width: min(720px, 100%);
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 280ms ease;
}

.mode-screen {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(440px, 1.22fr);
  gap: 24px;
}

.mode-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.mode-card {
  display: grid;
  align-content: space-between;
  justify-items: start;
  min-height: 0;
  padding: 28px;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-left: 8px solid var(--accent);
  border-radius: 8px;
  font-size: clamp(2.2rem, 5vw, 5rem);
  font-weight: 900;
  line-height: 0.95;
  text-align: left;
}

.mode-card span {
  color: var(--accent);
  font-size: clamp(5rem, 16vw, 12rem);
  line-height: 0.8;
}

.chat-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 24px;
  border-left: 8px solid var(--accent);
}

.chat-header,
.voice-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.chat-header h1,
.voice-header h1 {
  font-size: clamp(2.6rem, 6vw, 6rem);
}

.voice-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 24px;
  border-left: 8px solid var(--accent);
}

.call-stage {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 26px;
  min-height: 0;
  padding: 20px;
}

.call-avatar {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(38vh, 320px);
  aspect-ratio: 1;
  background: #FFFFFF;
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.call-avatar::after {
  position: absolute;
  inset: -10px;
  content: "";
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
}

.call-avatar[data-state="listening"],
.call-avatar[data-state="silence"] {
  border-color: var(--accent);
}

.call-avatar[data-state="listening"]::after,
.call-avatar[data-state="speaking"]::after {
  animation: pulse 1.15s ease-in-out infinite;
}

.call-avatar[data-state="speaking"] {
  color: #FFFFFF;
  background: var(--accent);
  border-color: var(--accent);
}

.call-avatar[data-state="thinking"] .call-sprite {
  animation: nod 800ms ease-in-out infinite;
}

.call-avatar[data-state="error"] {
  border-color: var(--error);
}

.call-sprite {
  position: relative;
  width: 50%;
  height: 58%;
}

.call-head,
.call-body,
.call-arm {
  position: absolute;
  display: block;
  background: currentColor;
}

.call-head {
  top: 0;
  left: 50%;
  width: 28%;
  aspect-ratio: 1;
  border: 3px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
}

.call-body {
  bottom: 6%;
  left: 50%;
  width: 36%;
  height: 58%;
  border: 3px solid currentColor;
  border-radius: 10px;
  transform: translateX(-50%);
}

.call-arm {
  top: 54%;
  width: 24%;
  height: 3px;
}

.call-arm-left {
  left: 18%;
  transform: rotate(24deg);
}

.call-arm-right {
  right: 18%;
  transform: rotate(-24deg);
}

.call-status {
  max-width: 28ch;
  color: var(--ink);
  font-size: clamp(1.6rem, 3vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.voice-meter {
  width: min(460px, 60vw);
  height: 10px;
  margin: 0 auto;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.voice-level {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 80ms linear;
}

.call-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.chat-transcript {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 18px 4px 18px 0;
  overflow: auto;
}

.chat-empty,
.chat-message {
  padding: 16px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-empty {
  color: var(--muted);
  line-height: 1.35;
}

.chat-message {
  display: grid;
  gap: 8px;
  max-width: 78%;
}

.chat-message[data-role="assistant"] {
  border-left: 6px solid var(--accent);
}

.chat-message[data-role="user"] {
  justify-self: end;
  background: #F7F7F8;
}

.chat-message[data-role="error"] {
  border-left: 6px solid var(--error);
}

.chat-message div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chat-message strong,
.chat-message span,
.chat-form label {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-message span {
  color: var(--muted);
}

.chat-message p {
  line-height: 1.42;
}

.chat-form {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.message-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.chat-form textarea {
  width: 100%;
  min-height: 92px;
  max-height: 150px;
  resize: vertical;
  padding: 12px;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  line-height: 1.4;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0;
    transform: scale(1);
  }

  50% {
    opacity: 0.34;
    transform: scale(1.08);
  }
}

@keyframes nod {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(4px);
  }
}

@media (max-width: 820px) {
  .stage-screen {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    margin: 12px;
  }

  .upload-screen,
  .mode-screen {
    grid-template-columns: 1fr;
  }

  .stage-copy {
    min-height: 220px;
  }

  .message-row,
  .chat-header,
  .voice-header,
  .call-stage {
    grid-template-columns: 1fr;
    display: grid;
  }

  .mode-card {
    min-height: 180px;
  }

  .call-avatar {
    width: min(34vh, 260px);
  }

  .chat-message {
    max-width: 100%;
  }
}
