:root {
  --bg: #faf7fb;
  --card: #ffffff;
  --ink: #2a2531;
  --muted: #8b8494;
  --line: #ece7f0;
  --brand: #d6417f;
  --brand-dark: #b32e66;
  --accent: #7a5bd0;
  --ok: #2f9e6b;
  --danger: #d24a4a;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(70, 30, 60, 0.07);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.05rem; margin: 18px 0 6px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 18px; position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--brand); }
.brand:hover { text-decoration: none; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.nav a { color: var(--ink); font-size: 0.92rem; }
.nav .inline { margin: 0; }
.linkbtn { border: none; background: none; color: var(--ink); font: inherit; cursor: pointer; padding: 0; }
.menu-toggle { display: none; margin-left: auto; border: none; background: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }

.wrap { max-width: 720px; margin: 0 auto; padding: 22px 18px 40px; }

/* Buttons */
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none;
  padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.small { padding: 6px 13px; font-size: 0.85rem; border-radius: 8px; }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 16px 0; }
.card.narrow { max-width: 440px; margin: 24px auto; }
.sub { color: var(--muted); margin-top: 0; }
.muted { color: var(--muted); }
.bio { white-space: pre-wrap; }
.hint { color: var(--muted); font-size: 0.86rem; }
.back { margin: 0 0 4px; }
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
.form-error { background: #fdecec; color: var(--danger); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 0.9rem; }
.flash { border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-size: 0.92rem; }
.flash.success { background: #e8f7ef; color: var(--ok); }
.flash.error { background: #fdecec; color: var(--danger); }

/* Room */
.room-head h1 { margin-bottom: 2px; }
.creators-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.strip-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.creator-chip { background: #fbe9f2; color: var(--brand-dark); padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.creator-chip:hover { background: #f6d6e7; text-decoration: none; }

.room-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 12px 0; }
.room-msgs { height: 54vh; min-height: 320px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rmsg { max-width: 84%; align-self: flex-start; }
.rmsg.mine { align-self: flex-end; text-align: right; }
.rmsg-head { display: flex; align-items: center; gap: 7px; font-size: 0.75rem; color: var(--muted); }
.rmsg.mine .rmsg-head { flex-direction: row-reverse; }
.rmsg-name { font-weight: 700; color: var(--ink); }
.rmsg-name.creator { color: var(--brand-dark); }
.rmsg-dm { font-size: 0.72rem; font-weight: 700; color: var(--brand-dark); background: #fbe9f1; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.rmsg-dm:hover { background: #f6d6e7; text-decoration: none; }
.rmsg-body { background: #f4eff8; border-radius: 12px; padding: 8px 12px; display: inline-block; margin-top: 2px; word-break: break-word; }
.rmsg.mine .rmsg-body { background: #fbe4ef; }

.room-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.room-form input[type=text][name=name] { flex: 0 0 120px; }
.room-form #room-body { flex: 1; }
.room-form .btn { flex: 0 0 auto; }

/* Chat forms & threads (profile + dm) */
.chat-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: flex-end; justify-content: flex-end; }
.chat-form input[type=text] { flex: 1 1 100%; }   /* name field gets its own row */
.chat-form textarea { flex: 1 1 220px; min-width: 0; }  /* grows to fill; buttons wrap below when tight */
.chat-form .emoji-btn, .chat-form .btn { flex: 0 0 auto; }

/* Emoji picker */
.emoji-btn { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 11px; font-size: 1.15rem; line-height: 1.2; cursor: pointer; }
.emoji-btn:hover { background: #faf6fb; }
.emoji-panel { position: fixed; z-index: 60; width: 296px; max-width: calc(100vw - 16px); max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 34px rgba(60,30,50,0.20); padding: 6px 10px 10px; display: none; }
.emoji-group-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; margin: 8px 2px 3px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; }
.emoji-item { border: none; background: none; font-size: 1.3rem; line-height: 1; padding: 5px 0; border-radius: 8px; cursor: pointer; }
.emoji-item:hover { background: #f1eef7; }
.thread, .thread-mini { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.thread { max-height: 50vh; overflow-y: auto; }
.thread.live { min-height: 200px; padding: 4px 2px; }
.msg { max-width: 82%; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg.them { align-self: flex-start; }
.msg .who { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.msg p { margin: 2px 0 0; background: #f4eff8; border-radius: 12px; padding: 8px 12px; display: inline-block; word-break: break-word; }
.msg.mine p { background: #fbe4ef; }

/* Tips */
.tip-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.tip-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tip-lead { font-weight: 700; margin-right: 2px; }
.tip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; color: #fff; }
.tip-btn:hover { opacity: 0.92; text-decoration: none; }
.tip-btn .tip-handle { font-weight: 500; opacity: 0.92; font-size: 0.82rem; }
.tip-btn.cashapp { background: #00c244; }
.tip-btn.venmo { background: #3d95ce; }

.dm-starter { margin-top: 16px; }
.dm-title { margin-bottom: 0; }

/* Inbox list */
.list { padding: 0; }
.list-row { display: block; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #faf6fb; text-decoration: none; }
.list-name { font-weight: 700; }
.list-sub { display: block; color: var(--muted); font-size: 0.86rem; }
.tag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; background: #efeafc; color: var(--accent); padding: 1px 7px; border-radius: 6px; font-weight: 700; }

/* Footer */
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px 18px 30px; }

/* Age gate */
.age-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f6e2ee, #ece4fb); padding: 20px; }
.age-box { background: #fff; border-radius: 18px; padding: 34px; max-width: 420px; text-align: center; box-shadow: 0 10px 40px rgba(80,40,70,0.16); }
.age-box h1 { color: var(--brand); }

/* Mobile */
@media (max-width: 640px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; right: 0; left: 0; flex-direction: column; align-items: flex-start; gap: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 6px 18px 14px; }
  body.nav-open .nav { display: flex; }
  .nav a, .nav .inline { width: 100%; padding: 9px 0; }
  .room-form input[type=text][name=name] { flex: 1 1 100%; }
  .room-form { flex-wrap: wrap; }
}
