/* chat-friend.com /chat — anonymous chat styles.
   Uses the v4 marketing palette tokens, intent kept identical so the two
   pages read as one product. */

:root {
  --blue: #1F4A38;
  --paper: #F8F2E7;
  --ink: #0E2218;
  --seal: #D8945A;
  --match: #5BA8A0;
  --offline: #B8546E;
  --muted: rgba(14, 34, 24, 0.45);
  --line: rgba(14, 34, 24, 0.10);
  --shadow: 0 1px 2px rgba(14, 34, 24, 0.04), 0 8px 32px rgba(14, 34, 24, 0.06);
  --radius-bubble: 18px;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); min-height: 100vh; }

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

/* ── top bar ──────────────────────────────────────────────────────── */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-family: "Bricolage Grotesque", "Plus Jakarta Sans", sans-serif;
  font-weight: 700; letter-spacing: -0.01em; color: var(--ink);
  text-decoration: none; font-size: 22px;
}
.brand b { color: var(--seal); font-weight: 800; }
.status { font-size: 13px; color: var(--muted); transition: color 0.2s ease; }
.status[data-connected] { color: var(--match); }
.status[data-disconnected] { color: var(--offline); }

/* ── stage ────────────────────────────────────────────────────────── */
.stage {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 16px 96px;
  flex: 1;
}
.panel {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 16px;
}
.panel h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700; letter-spacing: -0.02em;
  margin: 0;
  font-size: clamp(34px, 6vw, 48px);
}
.panel h2 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700; letter-spacing: -0.02em;
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
}
.lede {
  font-family: "Newsreader", Georgia, serif;
  font-size: 17px;
  color: rgba(14, 34, 24, 0.7);
  margin: 0;
  max-width: 36ch;
  line-height: 1.45;
}

/* ── lobby: interests ────────────────────────────────────────────── */
.interests { width: 100%; max-width: 480px; }
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 32px;
  margin-bottom: 12px;
  justify-content: center;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(31, 74, 56, 0.10);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink);
}
.chip button {
  background: none; border: 0; color: rgba(14, 34, 24, 0.45);
  font: inherit; cursor: pointer; padding: 0 0 0 4px; font-size: 16px;
  line-height: 1;
}
.chip button:hover { color: var(--offline); }
#interest-input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); background: white;
  border-radius: 12px;
  font: inherit; color: var(--ink); outline: none;
  transition: border-color 0.15s ease;
}
#interest-input:focus { border-color: var(--match); }
.link-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: inherit; text-decoration: underline; text-underline-offset: 4px;
  padding: 4px;
}

/* ── buttons ──────────────────────────────────────────────────────── */
.cta {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--seal); color: white;
  font: inherit; font-weight: 600; font-size: 16px;
  border: 0; border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, background 0.2s ease;
}
.cta:hover { background: #c87a44; }
.cta:active { transform: translateY(1px); }
.cta:disabled { background: var(--muted); cursor: not-allowed; box-shadow: none; }
.ghost {
  background: none; border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px;
  color: var(--ink); cursor: pointer;
  font: inherit; font-size: 14px;
}
.ghost:hover { background: rgba(31, 74, 56, 0.04); }
.fineprint { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ── matching ────────────────────────────────────────────────────── */
.connector { display: flex; align-items: center; gap: 0; padding: 32px 0; }
.connector .dot {
  width: 16px; height: 16px; border-radius: 999px;
  display: inline-block;
}
.connector .dot-a { background: var(--seal); }
.connector .dot-b { background: var(--match); }
.connector .bridge {
  width: 120px; height: 2px; background: var(--line);
  position: relative; overflow: hidden;
  margin: 0 -1px;
}
.connector .bridge-fill {
  position: absolute; inset: 0;
  background: linear-gradient(to right, transparent, var(--match), transparent);
  animation: slide 1.8s linear infinite;
}
@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── chat ─────────────────────────────────────────────────────────── */
.chatting { gap: 12px; align-items: stretch; }
.peer {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}
.peer-dot {
  width: 12px; height: 12px; border-radius: 999px;
  background: var(--match);
  display: inline-block;
}
.peer-name { font-weight: 600; }

.messages {
  flex: 1;
  min-height: 320px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding: 12px 0;
  display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin;
}
.msg {
  display: inline-block;
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-bubble);
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg.you {
  align-self: flex-end;
  background: var(--seal); color: white;
  border-bottom-right-radius: 4px;
}
.msg.them {
  align-self: flex-start;
  background: rgba(91, 168, 160, 0.18); color: var(--ink);
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center;
  background: rgba(31, 74, 56, 0.06);
  color: var(--muted);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
}

.composer {
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; bottom: 0;
  background: var(--paper);
  padding-top: 8px;
}
.composer textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line); background: white;
  border-radius: 14px;
  font: inherit; resize: none;
  outline: none;
  min-height: 56px; max-height: 160px;
  transition: border-color 0.15s ease;
}
.composer textarea:focus { border-color: var(--match); }
.composer-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}

/* ── state colors ───────────────────────────────────────────────── */
.gone h2 { color: var(--offline); }
.gone a { color: var(--blue); }

@media (min-width: 720px) {
  .stage { padding: 56px 24px 96px; }
  .panel { gap: 20px; }
}

/* slight paper texture so it doesn't feel too flat */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% -10%, rgba(91, 168, 160, 0.06), transparent 40%),
              radial-gradient(circle at 110% 110%, rgba(216, 148, 90, 0.07), transparent 50%);
  z-index: -1;
}
