:root {
  --bg: #FAFAF5;
  --text: #1A1A1A;
  --text-soft: #6B6B6B;
  --bubble-claude: #F0EEE5;
  --bubble-claude-border: #E6E4DA;
  --bubble-eden: #FFFFFF;
  --bubble-eden-text: #1A1A1A;
  --bubble-eden-border: #E2E0D6;
  --btn: #1A1A1A;
  --btn-text: #FAFAF5;
  --mic-active: #C44545;
  --border-soft: #E2E0D6;
  --composer-bg: #FFFFFF;
  --radius-bubble: 20px;
  --radius-button: 999px;
  --radius-input: 24px;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

.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;
}

.logo {
  width: 44px;
  height: 44px;
  color: var(--text);
  display: block;
}

.logo-large { width: 112px; height: 112px; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.login-shell {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.login-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 28px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.login-sub {
  color: var(--text-soft);
  margin: 0 0 36px;
  font-size: 15px;
  font-style: italic;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-form input[type="password"] {
  background: var(--composer-bg);
  border: 1px solid var(--border-soft);
  padding: 14px 20px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--text);
  border-radius: var(--radius-button);
  width: 100%;
  -webkit-appearance: none;
}

.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--text);
}

.login-form button {
  background: var(--btn);
  color: var(--btn-text);
  border: none;
  padding: 14px 24px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-button);
  cursor: pointer;
  -webkit-appearance: none;
}

.login-form button:hover { opacity: 0.92; }
.login-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.login-error {
  color: var(--mic-active);
  font-size: 14px;
  min-height: 20px;
  margin: 4px 0 0;
  font-style: italic;
  text-align: center;
}

/* ---------- App shell ---------- */
.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 120px;
}

.app-header {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 4px 0 28px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-sm {
  width: 26px;
  height: 26px;
}

.app-brand-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: -0.01em;
}

.test-badge {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--mic-active);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.app-main {
  width: 100%;
  max-width: 820px;
  flex: 1;
}

.app-loading {
  color: var(--text-soft);
  text-align: center;
  font-style: italic;
  margin-top: 80px;
}

/* ---------- Progress dots ---------- */
.progress-dots {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin: 4px 0 20px;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
  opacity: 0.22;
  transition: opacity 0.3s ease, background 0.3s ease, width 0.3s ease;
}

.progress-dot.complete {
  opacity: 0.55;
  background: var(--text);
}

.progress-dot.active {
  opacity: 1;
  background: var(--text);
  width: 18px;
  border-radius: 999px;
}

.section-label {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 28px;
  font-weight: 500;
}

/* ---------- Chat layout ---------- */
.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-msg {
  display: flex;
  width: 100%;
}

.chat-msg.from-claude { justify-content: flex-start; }
.chat-msg.from-eden   { justify-content: flex-end; }

.chat-bubble {
  max-width: 82%;
  padding: 14px 18px;
  border-radius: var(--radius-bubble);
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-bubble.claude {
  background: var(--bubble-claude);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.003em;
}

.chat-bubble.eden {
  background: var(--bubble-eden);
  color: var(--bubble-eden-text);
  border: 1px solid var(--bubble-eden-border);
  font-family: var(--sans);
  font-size: 16px;
}

.chat-bubble p {
  margin: 0 0 10px;
}

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

.chat-bubble strong { font-weight: 600; }

.chat-bubble.claude.large-intro {
  font-size: 19px;
  padding: 20px 22px;
}

.chat-bubble.skipped {
  background: transparent;
  color: var(--text-soft);
  font-style: italic;
  border: 1px dashed var(--border-soft);
  padding: 10px 16px;
}

/* Typing indicator */
.chat-msg.typing .chat-bubble {
  background: var(--bubble-claude);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-soft);
  opacity: 0.4;
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Composer (chat input) ---------- */
.composer-wrap {
  position: sticky;
  bottom: 16px;
  margin: 28px 0 8px;
  background: var(--bg);
  padding-top: 8px;
}

.composer {
  background: var(--composer-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-input);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 8px 24px rgba(0,0,0,0.04);
}

.composer:focus-within {
  border-color: var(--text);
}

.composer textarea {
  border: none;
  background: transparent;
  resize: none;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  outline: none;
  width: 100%;
  min-height: 56px;
  padding: 8px 6px;
}

.composer textarea::placeholder {
  color: var(--text-soft);
  opacity: 0.7;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-actions-left,
.composer-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mic-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: all 0.18s ease;
  padding: 0;
}

.mic-btn:hover:not(:disabled) {
  background: rgba(26,26,26,0.06);
  color: var(--text);
}

.mic-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mic-btn.recording {
  background: var(--mic-active);
  color: white;
  animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 69, 69, 0.4); }
  50% { box-shadow: 0 0 0 9px rgba(196, 69, 69, 0); }
}

.mic-btn svg {
  width: 20px;
  height: 20px;
}

.send-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--btn);
  color: var(--btn-text);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, transform 0.15s ease;
  padding: 0;
}

.send-btn:hover:not(:disabled) { opacity: 0.9; }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.send-btn svg { width: 18px; height: 18px; }

.skip-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.skip-link {
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 14px;
  font-style: italic;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-button);
  transition: color 0.15s ease, background 0.15s ease;
}

.skip-link:hover {
  color: var(--text);
  background: rgba(26,26,26,0.05);
}

.composer-hint {
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  margin: 8px 0 0;
  font-style: italic;
}

/* ---------- Buttons (for choice screens) ---------- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 18px;
}

.btn-row.center {
  justify-content: center;
}

.btn-row.right {
  justify-content: flex-end;
}

/* Constrain a button row to the chat bubble width so a right-aligned button
   lines up with the bubble's right edge instead of the full column edge. */
.btn-row.bubble-width {
  max-width: 82%;
}

.btn {
  background: var(--btn);
  color: var(--btn-text);
  border: none;
  padding: 12px 22px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-button);
  cursor: pointer;
  -webkit-appearance: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-soft);
}

.btn.ghost:hover {
  background: rgba(26,26,26,0.04);
}

/* ---------- Be love (final clean screen) ---------- */
.be-love {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.be-love span {
  font-family: var(--serif);
  font-size: 34px;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ---------- Inline error ---------- */
.inline-error {
  color: var(--mic-active);
  font-size: 14px;
  margin: 8px 0 0;
  font-style: italic;
  text-align: center;
}

/* ---------- Login identity buttons ---------- */
/* Eden's button keeps the default dark primary style; Evan's is secondary so
   she is unlikely to pick the test identity by mistake. */
.login-form button.identity-btn-test {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border-soft);
}

.login-form button.identity-btn-test:hover {
  background: rgba(26,26,26,0.04);
  color: var(--text);
  opacity: 1;
}

/* ---------- Start over (header utility) ---------- */
.start-over-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-button);
  opacity: 0.6;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.start-over-btn:hover {
  opacity: 1;
  background: rgba(26,26,26,0.05);
  color: var(--text);
}

/* ---------- Confirmation modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 28px 26px 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.modal-text {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 22px;
  color: var(--text);
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .app-body { padding: 16px 14px 100px; }
  .chat-bubble { max-width: 88%; font-size: 15px; padding: 12px 16px; }
  .btn-row.bubble-width { max-width: 88%; }
  .chat-bubble.claude.large-intro { font-size: 16px; padding: 16px 18px; }
  .btn { padding: 11px 18px; font-size: 14px; }
  .composer { padding: 10px 12px 8px; }
  .composer textarea { font-size: 16px; min-height: 48px; }
}
