:root {
  --bg: #faf8f5;
  --ink: #2a2620;
  --muted: #8a8378;
  --accent: #c47a5a;
  --accent-soft: #f0d9cc;
  --bubble-user: #2a2620;
  --bubble-user-text: #faf8f5;
  --bubble-navo: #ffffff;
  --border: #e8e2d8;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100vh;
  overflow: hidden;
}

#app {
  height: 100vh;
}

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

.hidden {
  display: none !important;
}

/* --- auth --- */

#auth-screen {
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 320px;
  text-align: center;
}

.auth-card h1 {
  font-size: 2.2rem;
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  background: white;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-form button {
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 6px;
}

.auth-form button:hover {
  opacity: 0.9;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -4px 0 0;
  text-align: left;
}

.switch {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 18px;
}

.switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.error {
  color: #b3413a;
  font-size: 0.82rem;
  min-height: 1.1em;
  margin: 2px 0 0;
  text-align: left;
}

/* --- chat --- */

.chat-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.companion-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 72%;
  padding: 10px 15px;
  border-radius: var(--radius);
  line-height: 1.45;
  font-size: 0.96rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: rise 0.18s ease-out;
}

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

.bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: var(--bubble-user-text);
  border-bottom-right-radius: 4px;
  position: relative;
}

/* Navo's emoji reaction, pinned to the bubble's bottom-left corner */
.reaction {
  position: absolute;
  bottom: -10px;
  left: -6px;
  background: var(--bubble-navo, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 0.8rem;
  line-height: 1.3;
  animation: rise 0.18s ease-out;
}

.bubble.navo {
  align-self: flex-start;
  background: var(--bubble-navo);
  color: var(--ink);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.typing-indicator {
  align-self: flex-start;
  margin: 0 20px 10px;
  padding: 12px 16px;
  background: var(--bubble-navo);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  width: fit-content;
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite ease-in-out;
}

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

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

.message-form {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.message-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
}

.message-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.message-form button {
  padding: 0 20px;
  border: none;
  border-radius: 24px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.message-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
