/* === Variables === */
:root {
  --bg: #0a0b0f;
  --surface: #14161c;
  --surface-hover: #1c1f2a;
  --border: #22263a;
  --text: #e0e4ea;
  --text-muted: #8891a0;
  --text-dim: #555d6e;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --user-bubble: #1e2340;
  --other-bubble: #1a1d27;
  --radius: 12px;
  --radius-sm: 8px;
}

/* === Reset === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle animated gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(100, 120, 180, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(140, 100, 160, 0.04) 0%, transparent 60%);
  animation: drift 20s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes drift {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.1) translate(-2%, 3%); }
}

a { color: var(--accent-hover); }

/* === Overlay === */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 15, 0.97);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.overlay-content {
  text-align: center;
  max-width: 420px;
  padding: 2rem;
  position: relative;
  z-index: 1;
}
.logo-large {
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.overlay-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 2px;
  transition: width 0.3s;
}
.progress-text {
  color: var(--text-dim);
  font-size: 0.8rem;
}
.privacy-note-small {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 1.5rem;
  opacity: 0.7;
}

/* === Screens === */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* === Centered Card (setup + summary) === */
.centered-card {
  text-align: center;
  max-width: 520px;
  width: 100%;
}
.logo {
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 300;
  margin-bottom: 2.5rem;
}

/* === Setup form === */
.setup-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.setup-form label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}
.setup-form .optional {
  opacity: 0.5;
}
.setup-form textarea,
.setup-form input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}
.setup-form textarea:focus,
.setup-form input[type="text"]:focus {
  border-color: var(--accent);
}
.setup-form .btn-primary {
  margin-top: 0.5rem;
}
.privacy-badge {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* === Buttons === */
.btn-primary {
  padding: 0.7rem 2rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small {
  padding: 0.4rem 0.9rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-small:hover { background: var(--border); color: var(--text); }
.btn-small.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-small.btn-accent:hover { background: var(--accent-hover); }

/* === Conversation === */
.conversation-container {
  width: 100%;
  max-width: 600px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}
.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.situation-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 1rem;
}
.conversation-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}
.message {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.other {
  align-self: flex-start;
  background: var(--other-bubble);
  border-bottom-left-radius: 4px;
}
.message.other .sender {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}
.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}
.message.streaming .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--text-muted);
  margin-left: 2px;
  animation: blink 0.8s infinite;
  vertical-align: text-bottom;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.message.thinking {
  color: var(--text-dim);
  font-style: italic;
}
.message.prompt {
  align-self: center;
  background: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  max-width: 90%;
  padding: 1.5rem 1rem;
}

/* Mic area */
.mic-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 0 0.5rem;
  border-top: 1px solid var(--border);
}
.interim-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  min-height: 1.2em;
  text-align: center;
  max-width: 80%;
}
.mic-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-hover);
  border: 2px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mic-btn:hover {
  background: var(--border);
  color: var(--text);
}
.mic-btn.listening {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}
.mic-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  animation: none;
}
.mic-status {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.text-fallback {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
}
.text-fallback input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}
.text-fallback input:focus { border-color: var(--accent); }

/* === Opener card (summary) === */
.opener-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 2rem 0 1.5rem;
  position: relative;
}
.opener-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
.opener-text {
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.7;
}
.feedback-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.summary-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* === Unsupported === */
.unsupported-msg {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-top: 1.5rem;
}

/* === Footer ad === */
.footer-ad { max-width: 728px; margin: 0 auto; padding: 1rem 2rem 0; }

/* === Footer === */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-content p {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto;
}
.footer-link {
  margin-top: 0.75rem;
}
.footer-link a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}
.footer-link a:hover { color: var(--text-muted); }

/* === Responsive === */
@media (max-width: 600px) {
  .screen { padding: 1rem; }
  .centered-card { max-width: 100%; }
  .conversation-container { padding: 0.5rem 0; }
  .message { max-width: 92%; }
  .logo-large { font-size: 1.8rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
