/* Betsy — warm, clean, mobile-first */

:root {
  --cream: #FAF6EF;
  --card: #FFFFFF;
  --ink: #3D3833;
  --ink-soft: #6B635B;
  --coral: #E07856;
  --coral-deep: #C9603F;
  --coral-tint: #FBEDE6;
  --sage: #8FA98B;
  --sun: #F2C94C;
  --danger: #B4472F;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(61, 56, 51, 0.08);
}

* { box-sizing: border-box; }

/* Keep [hidden] working even on elements whose class sets display */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login / welcome page ---------- */

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(16px + env(safe-area-inset-bottom));
  gap: 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.card.center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.betsy-mark { margin-bottom: 8px; }
.betsy-mark.small { margin-bottom: 4px; }

h1 {
  font-size: 1.65rem;
  font-weight: 800;
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--ink-soft);
  margin: 0 0 24px;
  font-size: 1.02rem;
}

.field-label {
  display: block;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.text-input {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  padding: 14px 16px;
  min-height: 52px;
  border: 2px solid #E7DFD4;
  border-radius: 12px;
  background: #FFFDFA;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  letter-spacing: 0.02em;
}

.text-input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px var(--coral-tint);
}

.text-input::placeholder { color: #B8AEA2; letter-spacing: 0; }

.pin-input { letter-spacing: 0.4em; font-size: 1.3rem; }

.field-gap { margin-top: 18px; }

.username-reveal {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 20px;
  word-break: break-all;
}

.btn-primary {
  width: 100%;
  margin-top: 16px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: var(--coral);
  border: none;
  border-radius: 999px;
  padding: 15px 24px;
  min-height: 54px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover { background: var(--coral-deep); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-ghost {
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--coral-deep);
  background: var(--coral-tint);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  margin-top: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-ghost:hover { background: #F6DDD1; }

.btn-link {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 10px 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover { color: var(--ink); }
.btn-link.inline { padding: 0; font-size: inherit; }
.back-btn { margin-top: 14px; }

.error-msg {
  color: var(--danger);
  background: #FBEAE4;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  margin: 12px 0 0;
  text-align: left;
}

.help-text {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 22px 0 0;
  line-height: 1.6;
}

.site-footer {
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
  width: 100%;
  max-width: 420px;
  padding: 16px 20px;
  /* White panel: the partner logo has a solid white background. */
  background: var(--card);
  border-radius: var(--radius);
}

.site-footer p { margin: 8px 0 0; }

.partner-logos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px 20px;
}

/* Same height so the two marks read as a pair; width follows each logo. */
.partner-logos img {
  height: 46px;
  width: auto;
  max-width: 100%;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--coral-tint);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Chat page ---------- */

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--cream);
  border-bottom: 1px solid #EFE7DB;
  flex-shrink: 0;
}

.chat-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.chat-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-username {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-frame-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  background: #fff;
}

.chat-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: var(--cream);
}

.placeholder-note {
  font-size: 0.85rem;
  opacity: 0.75;
}

.chat-placeholder code {
  background: var(--coral-tint);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

/* ---------- Small screens ---------- */

@media (max-width: 380px) {
  .card { padding: 28px 20px; }
  h1 { font-size: 1.45rem; }
}
