/* ─── Agent — Yuty Voice AI ─── */

:root {
  --agent-cyan: #22d3ee;
  --agent-purple: #a78bfa;
  --bg: #121212;
  --surface: #181818;
  --surface-2: #1e1e1e;
  --surface-3: #2a2a2a;
  --surface-bright: #333333;
  --text: #ffffff;
  --text-dim: #a0a0a0;
  --text-muted: #666666;
  --ghost-border: rgba(255, 255, 255, 0.05);
  --ghost-border-hover: rgba(255, 255, 255, 0.10);
  --border-focus: rgba(255, 255, 255, 0.15);
  --error: #cf6679;
  --success: #81c784;
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 1rem;
  --font-headline: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
}

body {
  opacity: 0;
  transition: opacity 300ms ease;
}

body.ready {
  opacity: 1;
}

/* ─── Screens ─── */

.screen {
  display: none;
  width: 100%;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ─── Download Screen ─── */

#downloadScreen {
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 60px);
  text-align: center;
  padding: 2rem;
}

.download-card {
  max-width: 460px;
  width: 100%;
}

.download-tag {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ghost-border);
  padding: 6px 16px;
  border-radius: 9999px;
  display: inline-block;
  margin-bottom: 24px;
}

.download-title {
  font-family: var(--font-headline);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 12px;
}

.download-sub {
  font-size: 0.9375rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 32px;
  font-weight: 300;
}

/* ─── Model Cards ─── */

.model-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.model-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius);
  text-align: left;
}

.model-card__check {
  font-size: 1.4rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 300ms ease;
}

.model-card__check.cached {
  color: var(--success);
}

.model-card__info {
  flex: 1;
  min-width: 0;
}

.model-card__name {
  font-family: var(--font-headline);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.model-card__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.model-card__progress {
  font-size: 0.6875rem;
  color: var(--agent-cyan);
  margin-top: 4px;
}

/* ─── Download Button ─── */

.btn-download {
  font-family: var(--font-headline);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--bg);
  background: var(--text);
  border: none;
  padding: 14px 32px;
  border-radius: 9999px;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms ease;
  margin-bottom: 16px;
}

.btn-download:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-download:active {
  transform: translateY(0);
}

.btn-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.download-privacy {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.download-privacy .material-symbols-outlined {
  font-size: 0.875rem;
}

.download-footer {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 24px;
  letter-spacing: 0.04em;
}

/* ─── Chat Screen ─── */

#chatScreen {
  height: calc(100dvh - 60px);
}

/* ─── Agent Header ─── */

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--ghost-border);
  background: var(--surface);
  flex-shrink: 0;
}

.agent-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-avatar .material-symbols-outlined {
  font-size: 1.2rem;
  color: var(--agent-purple);
}

.agent-header__title {
  font-family: var(--font-headline);
  font-size: 0.9375rem;
  font-weight: 600;
}

.agent-header__status {
  font-size: 0.6875rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-header__status .material-symbols-outlined {
  font-size: 0.75rem;
  color: var(--success);
}

.agent-header__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-select-wrap label {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.voice-select-wrap select {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
}

.btn-reset {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--ghost-border);
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 300ms ease, border-color 300ms ease;
}

.btn-reset:hover {
  color: var(--error);
  border-color: rgba(207, 102, 121, 0.3);
}

/* ─── Waveform Bar ─── */

.waveform-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--ghost-border);
  flex-shrink: 0;
}

.waveform-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
}

.waveform-label {
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  width: 60px;
  flex-shrink: 0;
}

.waveform-label .material-symbols-outlined {
  font-size: 0.875rem;
}

.waveform-canvas {
  flex: 1;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* ─── Messages ─── */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
}

.msg {
  max-width: 72%;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--ghost-border);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.65;
  animation: msgIn 0.3s ease;
  word-wrap: break-word;
  white-space: pre-wrap;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--surface-3);
  border-bottom-right-radius: 2px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border-bottom-left-radius: 2px;
}

.msg.generating {
  border-color: rgba(255, 255, 255, 0.15);
}

.msg-role {
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.msg.assistant .msg-role {
  color: var(--text-dim);
}

.msg-content {
  min-height: 1.2em;
}

.msg-stats {
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--ghost-border);
}

.thinking-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-right: 4px;
  animation: dot 1.2s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 0.8; transform: scale(1); }
}

.welcome-msg {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.welcome-msg h3 {
  font-family: var(--font-headline);
  font-size: 1.25rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
}

.welcome-msg p {
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ─── Input Area / Mic Button ─── */

.agent-input-area {
  padding: 20px 24px 24px;
  border-top: 1px solid var(--ghost-border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mic-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--ghost-border-hover);
  background: var(--surface-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 200ms ease;
}

.mic-btn .material-symbols-outlined {
  font-size: 1.75rem;
  z-index: 1;
}

.mic-btn:hover {
  border-color: var(--agent-cyan);
  color: var(--agent-cyan);
  background: rgba(34, 211, 238, 0.05);
}

.mic-btn.active {
  border-color: var(--agent-cyan);
  color: var(--agent-cyan);
  background: rgba(34, 211, 238, 0.1);
}

.mic-btn.active .mic-pulse {
  display: block;
}

.mic-pulse {
  display: none;
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--agent-cyan);
  opacity: 0;
  animation: pulse 1.5s ease-out infinite;
}

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

.mic-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.agent-footer-note {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
  .agent-header {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .agent-header__controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .waveform-bar {
    padding: 8px 16px;
  }

  .chat-messages {
    padding: 16px;
  }

  .msg {
    max-width: 88%;
  }

  .agent-input-area {
    padding: 16px;
  }

  .model-cards {
    gap: 6px;
  }
}
