/* Nova — warm sanctuary. Cream + soft gold, serif voice, letter-like spacing. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #f4ede0;
  color: #3a2e22;
  font-family: ui-serif, "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
}

#app { flex: 1; display: flex; flex-direction: column; min-height: 100%; }

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.screen.visible { display: flex; }
.hidden { display: none !important; }

/* ── Login ── */

#login-screen { align-items: center; justify-content: center; }
.login-card {
  width: 84%;
  max-width: 340px;
  text-align: center;
}
.logo {
  font-family: ui-serif, "Iowan Old Style", Baskerville, serif;
  font-weight: 400;
  font-size: 3rem;
  letter-spacing: 0.04em;
  margin: 0 0 2.5rem;
  color: #3a2e22;
  font-style: italic;
}
#login-form { display: flex; flex-direction: column; gap: 0.9rem; }
#password {
  background: #fdf8ee;
  border: 1px solid #e2d7c1;
  color: #3a2e22;
  padding: 0.95rem 1.1rem;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
#password:focus { border-color: #c9a368; }
#login-btn {
  background: #c9a368;
  color: #fdf8ee;
  border: none;
  padding: 0.95rem;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.03em;
}
#login-btn:active { transform: scale(0.98); }
.error {
  color: #a8593c;
  font-size: 0.9rem;
  min-height: 1em;
  margin: 0.6rem 0 0;
  font-style: italic;
}

/* ── Session ── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid rgba(58, 46, 34, 0.06);
}
.brand {
  font-style: italic;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: #6b5946;
}
.topbar-right { display: flex; gap: 0.25rem; }

.icon-btn {
  background: none;
  border: none;
  color: #8a7660;
  font-size: 1.3rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
}
.icon-btn:hover { color: #3a2e22; }
.icon-btn:active { background: rgba(201, 163, 104, 0.12); }

#transcript {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.4rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  scroll-behavior: smooth;
}

.turn {
  max-width: 92%;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.7;
}
.turn.user {
  align-self: flex-end;
  color: #6b5946;
  font-style: italic;
  font-size: 0.96rem;
  max-width: 86%;
}
.turn.user::before { content: "— "; opacity: 0.55; }
.turn.assistant {
  align-self: flex-start;
  color: #3a2e22;
}
.turn.pending {
  opacity: 0.4;
}
.turn.opener {
  /* The verbatim first-launch opener — give it a touch more breathing room. */
  margin-top: 0.5rem;
  padding-top: 0.4rem;
}

.controls {
  padding: 0.8rem 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border-top: 1px solid rgba(58, 46, 34, 0.06);
}
.mic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.spacer { width: 44px; flex: 0 0 44px; }
.mic {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #c9a368;
  color: #fdf8ee;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, background 0.18s;
  box-shadow: 0 0 0 0 rgba(201, 163, 104, 0.4);
}
.mic.recording {
  background: #a8593c;
  animation: pulse 1.3s infinite;
}
.mic.thinking {
  background: #8a7660;
  animation: thinking 1.6s linear infinite;
}
.mic:active { transform: scale(0.95); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 89, 60, 0.55); }
  50%      { box-shadow: 0 0 0 18px rgba(168, 89, 60, 0); }
}
@keyframes thinking {
  0%   { opacity: 0.55; }
  50%  { opacity: 1; }
  100% { opacity: 0.55; }
}

.text-form {
  display: flex;
  gap: 0.5rem;
}
.text-form input {
  flex: 1;
  background: #fdf8ee;
  border: 1px solid #e2d7c1;
  color: #3a2e22;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.98rem;
  font-family: inherit;
  outline: none;
}
.text-form input:focus { border-color: #c9a368; }
.text-form button {
  background: #c9a368;
  color: #fdf8ee;
  border: none;
  padding: 0 1.4rem;
  border-radius: 12px;
  font-family: inherit;
  cursor: pointer;
}
.status {
  color: #8a7660;
  font-size: 0.82rem;
  min-height: 1em;
  text-align: center;
  margin: 0;
  font-style: italic;
}

/* ── Menu drawer ── */

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(86%, 380px);
  background: #fdf8ee;
  border-left: 1px solid rgba(58, 46, 34, 0.08);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: translateX(0); }
.drawer header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(58, 46, 34, 0.06);
}
.drawer h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: #6b5946;
}
.menu-list {
  list-style: none;
  margin: 0;
  padding: 0.6rem 0;
  overflow-y: auto;
}
.menu-list li { padding: 0; }
.menu-item {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 0.9rem 1.2rem 0.25rem;
  color: #3a2e22;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}
.menu-item:hover { background: rgba(201, 163, 104, 0.07); }
.menu-item.danger { color: #a8593c; }
.menu-help {
  margin: 0 1.2rem 0.6rem;
  color: #8a7660;
  font-size: 0.84rem;
  font-style: italic;
  line-height: 1.45;
}
.menu-divider {
  height: 1px;
  background: rgba(58, 46, 34, 0.06);
  margin: 0.6rem 1.2rem;
}
