/* Peachy — the app shell. One palette, lifted from the Peachy welcome handoff
   (tools/design-references/peachy-welcome-2026-08-31 in the monorepo): warm
   peach light, dark warm ink, Nunito. No media queries: clamp() and flex do
   the sizing. Every tap target is 44px or taller. */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/nunito-latin-var.woff2") format("woff2");
}

:root {
  --accent: #e9835a;
  --accent-2: #f7a277;
  --link: #c4562f;
  --link-hover: #a8431f;
  --bg-1: #fdeee3;
  --bg-2: #f8e2d3;
  --bg-3: #f2d6c4;
  --ink: #3e332d;
  --ink-soft: #7a6a60;
  --ink-faint: #a9998e;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #fff9f5;
  --hair: #f0dbcd;
  --user-bubble: #fbe0d0;
  --ok: #4e8a5f;
  --warn: #b3541e;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(62, 40, 30, 0.12);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(16px, 2.6vw, 18px);
  line-height: 1.5;
  background: #f8e2d3 radial-gradient(130% 90% at 50% -10%, var(--bg-1), var(--bg-2) 50%, var(--bg-3)) fixed;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── layout ─────────────────────────────────────────────────────────────── */
.room-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 18px 10px;
  flex: 0 0 auto;
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1em;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.mark img { width: 28px; height: 28px; border-radius: 8px; }
.where {
  font-size: 0.85em;
  color: var(--ink-soft);
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px;
}

/* ── the doorstep ───────────────────────────────────────────────────────── */
.doorstep {
  max-width: 560px;
  margin: 6vh auto 0;
  padding: 26px 22px 22px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.5s ease-out both;
}
.doorstep .face {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: block;
  margin-bottom: 14px;
  animation: floaty 6s ease-in-out infinite;
}
.opening {
  font-size: 1.16em;
  font-weight: 700;
  line-height: 1.42;
  margin: 0 0 14px;
}
.ask { margin: 0 0 18px; color: var(--ink-soft); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: #fff;
  color: var(--link);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.chip:hover { background: #fff3ea; }
.chip:active { transform: scale(0.97); }
.chip.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; border-color: transparent; }
.fine { margin: 20px 0 0; font-size: 0.8em; color: var(--ink-faint); line-height: 1.45; }
.fine strong { color: var(--ink-soft); }

/* ── the thread ─────────────────────────────────────────────────────────── */
.thread {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: rise 0.25s ease-out both;
}
.bubble.peachy {
  align-self: flex-start;
  background: var(--card-solid);
  border: 1px solid var(--hair);
  border-bottom-left-radius: 6px;
}
.bubble.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 6px;
}
.bubble.chip-said { font-weight: 700; color: var(--link); }
.bubble .stamp {
  display: block;
  margin-top: 6px;
  font-size: 0.72em;
  color: var(--ink-faint);
  font-weight: 600;
}
.typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  background: var(--card-solid);
  border: 1px solid var(--hair);
  color: var(--ink-soft);
  font-size: 0.88em;
  font-weight: 600;
}
.dots { display: inline-flex; gap: 4px; }
.dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }

.notice {
  max-width: 640px;
  margin: 8px auto 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #fff4ec;
  border: 1px solid #f3c9b2;
  color: var(--warn);
  font-weight: 600;
  font-size: 0.92em;
}
.notice a { text-decoration: underline; }

/* ── composer ───────────────────────────────────────────────────────────── */
.composer {
  flex: 0 0 auto;
  padding: 8px 14px calc(12px + var(--safe-b));
  background: linear-gradient(to top, rgba(248, 226, 211, 1), rgba(248, 226, 211, 0.6));
}
.composer .inner { max-width: 640px; margin: 0 auto; position: relative; }
.chips.fork { margin: 0 0 10px; }
.row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: 26px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 4px 16px rgba(62, 40, 30, 0.08);
}
.row textarea {
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  min-height: 36px;
  max-height: 160px;
  padding: 6px 0;
  line-height: 1.4;
}
.row textarea::placeholder { color: var(--ink-faint); }
.send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  font-size: 1.2em;
  font-weight: 900;
  cursor: pointer;
  display: grid; place-items: center;
}
.send:disabled { opacity: 0.5; cursor: default; }
.offline { margin: 8px 4px 0; font-size: 0.85em; color: var(--warn); font-weight: 600; }

/* ── the menu button + pulse ────────────────────────────────────────────── */
.fab {
  position: absolute;
  right: 2px;
  bottom: calc(100% + 12px);
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 20;
}
.fab svg { width: 24px; height: 24px; }
.fab.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  animation: ring 1.1s ease-out infinite;
}
.fab.pulse { animation: nudge 1.1s ease-in-out 6; }

/* ── sheets ─────────────────────────────────────────────────────────────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.scrim {
  position: absolute; inset: 0;
  background: rgba(62, 40, 30, 0.4);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease-out both;
}
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--card-solid);
  border-radius: 30px 30px 0 0;
  padding: 10px 20px calc(22px + var(--safe-b));
  box-shadow: 0 -10px 40px rgba(62, 40, 30, 0.2);
  animation: up 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sheet .handle {
  width: 44px; height: 5px; border-radius: 3px;
  background: var(--hair);
  margin: 4px auto 14px;
}
.sheet h2 { margin: 0 0 6px; font-size: 1.15em; }
.sheet .sub { margin: 0 0 14px; color: var(--ink-soft); font-size: 0.9em; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  margin: 0 0 8px;
  border-radius: 16px;
  border: 1px solid var(--hair);
  background: #fff;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}
.menu-item .hint { display: block; font-size: 0.82em; color: var(--ink-soft); font-weight: 600; }
.menu-item.quiet { color: var(--ink-soft); background: transparent; border-color: transparent; }
.menu-item.hot { border-color: var(--accent); background: #fff3ea; }

/* ── the map ────────────────────────────────────────────────────────────── */
.map .trackline {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--hair);
  font-size: 0.9em;
  color: var(--ink-soft);
  font-weight: 600;
}
.map h3 {
  margin: 14px 0 6px;
  font-size: 0.78em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.map ol { list-style: none; margin: 0; padding: 0; }
.map li {
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 12px;
  align-items: start;
  padding: 8px 0;
  color: var(--ink-faint);
  position: relative;
}
.map li + li::before {
  content: "";
  position: absolute;
  left: 10px; top: -10px;
  width: 2px; height: 18px;
  background: var(--hair);
}
.map .dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--hair);
  background: #fff;
  margin-top: 2px;
}
.map li.done { color: var(--ink-soft); }
.map li.done .dot { background: var(--accent); border-color: var(--accent); }
.map li.here { color: var(--ink); font-weight: 800; }
.map li.here .dot { border-color: var(--accent); box-shadow: 0 0 0 4px #fbe0d0; }
.map .beat {
  display: block;
  font-size: 0.82em;
  color: var(--link);
  font-weight: 700;
}
.map .doorstep-row { margin-bottom: 4px; }


.card {
  max-width: 560px;
  margin: 8vh auto 0;
  padding: 24px 22px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}
.btn.ghost { background: #fff; color: var(--link); border: 1.5px solid var(--accent); }
.btn:disabled { opacity: 0.55; cursor: default; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }
@keyframes nudge { 0%, 100% { transform: none; } 30% { transform: translateY(-6px) scale(1.06); } }

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