:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: #f8fafc;
  color: #0f172a;
  --color-primary: #2563eb;
  --color-bg: #eef2ff;
  --color-card: #ffffff;
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-bot-bubble: #eff6ff;
  --color-user-bubble: #e5e7eb;
  --color-disabled: #cbd5e1;
  --color-surface-tint: #f1f5ff;
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--color-bg);
  color: var(--color-text);
}

.app-shell {
  width: min(720px, 100%);
  background: var(--color-card);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--color-text);
}

h1,
h2,
h3 {
  color: var(--color-text);
}

.hero {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1rem;
  background: var(--color-card);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hero__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero__logo {
  width: 72px;
  height: auto;
}

.hero__brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.hero__tagline {
  margin: 0.2rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.hero__disclaimer {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-left: none;
}

.hero__disclaimer p {
  margin: 0 0 0.6rem;
}

.hero__disclaimer p:last-child {
  margin-bottom: 0;
}

.hero__disclaimer strong {
  color: var(--color-text);
  font-weight: 600;
}

.chat-window {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1rem;
  overflow-y: auto;
  background: var(--color-card);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.bubble {
  padding: 0.75rem 1rem;
  border-radius: 18px;
  max-width: 90%;
  line-height: 1.55;
  font-size: 0.96875rem;
  border: 1px solid var(--color-border);
  animation: bubble-in 180ms ease-out;
}

.bubble.user {
  align-self: flex-end;
  background: var(--color-user-bubble);
  color: var(--color-text);
  font-weight: 400;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--color-bot-bubble);
  color: var(--color-text);
  font-weight: 400;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.chat-form input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-card);
}

.chat-form input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.chat-form input::placeholder {
  color: var(--color-text-muted);
}

.mic-button {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  padding: 0;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.2);
  transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.mic-button:hover,
.mic-button:focus {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
  outline: none;
}

.mic-button.recording {
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.35);
  transform: scale(1.04);
}

.mic-button:disabled {
  cursor: not-allowed;
  background: var(--color-disabled);
  box-shadow: none;
}

.mic-icon {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
}

.send-button {
  background: var(--color-primary);
  border: none;
  border-radius: 12px;
  padding: 0;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.2);
  transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.send-button:hover,
.send-button:focus {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
  outline: none;
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: not-allowed;
  background: var(--color-disabled);
  box-shadow: none;
}

.send-icon {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
}

@media (max-width: 600px) {
  .mic-button,
  .send-button {
    flex: 1 1 100%;
    justify-content: center;
  }
}

.reset-button {
  border: none;
  background: var(--color-card);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 12px;
  padding: 0;
  width: 44px;
  height: 44px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.reset-button:hover,
.reset-button:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  border-color: var(--color-primary);
  outline: none;
  transform: translateY(-1px);
}

.typing {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.reset-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.bubble:focus-within,
.chat-form button:focus-visible,
.reset-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble {
    animation: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Recording indicator styles */
.mic-button.recording-pulse {
  animation: pulse-recording 1.5s ease-in-out infinite;
  background: #dc2626;
}

.mic-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--color-disabled);
}

@keyframes pulse-recording {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
  }
}

.recording-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
  animation: fade-in 200ms ease-out;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: #dc2626;
  border-radius: 50%;
  animation: blink-dot 1s ease-in-out infinite;
}

@keyframes blink-dot {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
