:root {
  color-scheme: light;
  --ink: #291722;
  --muted: #715d69;
  --wine: #7a225d;
  --wine-dark: #591642;
  --pink: #f5c4d9;
  --pink-soft: #fff4f8;
  --cream: #fffaf7;
  --white: #ffffff;
  --line: rgba(122, 34, 93, 0.14);
  --shadow: 0 24px 80px rgba(91, 27, 69, 0.18);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 255, 255, 0.92), transparent 28%),
    linear-gradient(145deg, #f9e5ed 0%, #f6d8e5 48%, #ead0e8 100%);
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.55;
}

.ambient-one { width: 360px; height: 360px; top: -130px; right: -80px; background: #c992c8; }
.ambient-two { width: 300px; height: 300px; bottom: -120px; left: -90px; background: #ffd6c7; }

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.access-card,
.chat-card {
  width: min(100%, 880px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.access-card {
  max-width: 460px;
  padding: clamp(30px, 7vw, 54px);
  border-radius: 32px;
  text-align: center;
}

.brand-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 26px;
  color: var(--white);
  background: linear-gradient(145deg, #9a3978, #64194c);
  box-shadow: 0 14px 30px rgba(122, 34, 93, 0.28);
  font: 700 38px/1 Georgia, serif;
}

.brand-mark-small {
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 17px;
  font-size: 25px;
  box-shadow: 0 8px 18px rgba(122, 34, 93, 0.2);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--wine);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.access-card h1 { margin: 0; font: 700 clamp(2.15rem, 8vw, 3.15rem)/1.05 Georgia, serif; }
.access-copy { max-width: 330px; margin: 16px auto 28px; color: var(--muted); line-height: 1.55; }

.access-form { display: grid; gap: 9px; text-align: left; }
.access-form label { margin-top: 8px; font-size: 0.86rem; font-weight: 700; }
.label-note { color: var(--muted); font-size: 0.72rem; font-weight: 600; }

.access-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px 15px;
  outline: 0;
  color: var(--ink);
  background: var(--cream);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.access-form input:focus,
.composer textarea:focus { border-color: rgba(122, 34, 93, 0.55); box-shadow: 0 0 0 4px rgba(122, 34, 93, 0.09); }

.password-row { position: relative; }
.password-row input { padding-right: 60px; }
.icon-button { position: absolute; right: 8px; top: 7px; border: 0; padding: 8px; color: var(--wine); background: transparent; font-weight: 700; cursor: pointer; }

.field-help { margin: 0 2px 2px; color: var(--muted); font-size: 0.7rem; line-height: 1.4; }

.personal-note,
.use-notice {
  border: 1px solid rgba(122, 34, 93, 0.13);
  color: var(--wine-dark);
  background: var(--pink-soft);
}

.personal-note {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 0.72rem;
  line-height: 1.45;
}

.personal-note span { color: var(--muted); }

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px;
  margin-top: 10px !important;
  color: var(--muted);
  font-size: 0.72rem !important;
  font-weight: 500 !important;
  line-height: 1.45;
}

.consent-row input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--wine);
}

.primary-button {
  margin-top: 14px;
  border: 0;
  border-radius: 16px;
  padding: 15px 18px;
  color: var(--white);
  background: linear-gradient(135deg, var(--wine), var(--wine-dark));
  box-shadow: 0 12px 24px rgba(122, 34, 93, 0.22);
  font-weight: 800;
  cursor: pointer;
}

.primary-button:disabled, .send-button:disabled { opacity: 0.56; cursor: wait; }
.form-error { margin: 7px 0 0; color: #a51939; font-size: 0.86rem; }
.support-copy { margin: 24px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.support-copy a { color: var(--wine); font-weight: 700; }

.chat-card {
  height: min(820px, calc(100dvh - 34px));
  min-height: 580px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
  overflow: hidden;
  border-radius: 30px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 247, 0.8);
}

.zoe-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.zoe-identity h1 { margin: 0; font: 700 1.45rem/1.05 Georgia, serif; }
.zoe-identity p { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; display: inline-block; margin-right: 4px; border-radius: 50%; background: #37a071; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.usage-badge { padding: 7px 9px; border-radius: 999px; color: var(--wine); background: var(--pink-soft); font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.text-button { border: 0; padding: 7px; color: var(--muted); background: transparent; font-size: 0.78rem; cursor: pointer; }

.use-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.35;
}

.use-notice span { color: var(--muted); }

.messages {
  overflow-y: auto;
  padding: 24px clamp(16px, 5vw, 42px) 16px;
  scroll-behavior: smooth;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,250,247,0.55));
}

.message { max-width: min(78%, 600px); margin: 0 0 14px; animation: arrive 180ms ease-out; }
.message-user { margin-left: auto; }
.message-label { display: block; margin: 0 7px 5px; color: var(--muted); font-size: 0.69rem; font-weight: 700; }
.message-user .message-label { text-align: right; }
.bubble { padding: 12px 15px; border-radius: 19px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-assistant .bubble { border: 1px solid var(--line); border-bottom-left-radius: 6px; background: var(--white); }
.message-user .bubble { border-bottom-right-radius: 6px; color: var(--white); background: linear-gradient(145deg, #8a2b69, #68194e); }
.message-photo { width: min(100%, 300px); display: block; margin: 0 0 8px; border-radius: 13px; }
.typing { display: inline-flex; gap: 4px; align-items: center; min-width: 54px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #b98aa4; animation: pulse 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 120ms; }
.typing i:nth-child(3) { animation-delay: 240ms; }

.starter-area { padding: 0 clamp(16px, 5vw, 42px) 12px; background: rgba(255,250,247,0.7); }
.starter-area > p { margin: 0 0 8px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.starter-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.starter-list button { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; color: var(--wine-dark); background: var(--white); font-size: 0.79rem; cursor: pointer; }

.image-preview { margin: 0 16px 9px; padding: 8px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--pink-soft); }
.image-preview[hidden] { display: none; }
.image-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; }
.image-preview div { min-width: 0; flex: 1; }
.image-preview strong, .image-preview span { display: block; }
.image-preview strong { font-size: 0.8rem; }
.image-preview span { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.image-preview button { border: 0; width: 32px; height: 32px; border-radius: 50%; color: var(--wine); background: transparent; font-size: 1.35rem; cursor: pointer; }

.composer { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 8px; margin: 0 16px; padding: 8px; border: 1px solid var(--line); border-radius: 21px; background: var(--white); box-shadow: 0 8px 24px rgba(65, 24, 48, 0.08); }
.composer textarea { max-height: 125px; resize: none; border: 0; padding: 9px 5px; outline: 0; line-height: 1.4; color: var(--ink); background: transparent; }
.photo-button, .send-button { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.photo-button { color: var(--wine); background: var(--pink-soft); font-size: 1.5rem; }
.send-button { border: 0; color: var(--white); background: var(--wine); font-size: 1.25rem; font-weight: 800; }
.disclaimer { margin: 8px 14px calc(10px + var(--safe-bottom)); color: var(--muted); text-align: center; font-size: 0.66rem; }

.toast { position: fixed; z-index: 5; left: 50%; bottom: calc(22px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100vw - 30px); padding: 11px 15px; border-radius: 12px; color: var(--white); background: #3b2532; box-shadow: 0 8px 25px rgba(0,0,0,0.2); font-size: 0.84rem; }
.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; }
[hidden] { display: none !important; }

@keyframes pulse { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-3px); opacity: 1; } }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 640px) {
  .shell { display: block; padding: 0; }
  .access-card { min-height: 100dvh; max-width: none; display: flex; flex-direction: column; justify-content: center; border-radius: 0; }
  .chat-card { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; }
  .chat-header { padding: 12px 13px; }
  .brand-mark-small { width: 43px; height: 43px; border-radius: 15px; }
  .zoe-identity p { font-size: 0.69rem; }
  .usage-badge { max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
  .use-notice { display: grid; gap: 2px; padding: 7px 12px; }
  .message { max-width: 88%; }
  .messages { padding-top: 18px; }
  .composer { margin-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
