:root {
  --bg: #0b0b10; --panel: #16161f; --line: #262633; --text: #ececf3; --muted: #8b8b9c;
  --me: #2b2b3a; --accent: #7c5cff; --red: #ff5c5c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: #a99bff; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
h1 { font-size: 1.6rem; margin: .2em 0 .5em; }
.muted { color: var(--muted); font-size: .9rem; }
.error, .red { color: var(--red); }
.page { max-width: 520px; margin: 0 auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.page.wide { max-width: 760px; }
.center { text-align: center; }
.big { font-size: 3rem; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 22px; margin: 8px 4px 0 0; text-decoration: none; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.link { background: none; border: 0; color: #a99bff; padding: 0 4px; }
label { display: block; margin: 12px 0; }
.copy { font-size: .85rem; }

/* ---- setup */
#setup { min-height: 100vh; display: flex; align-items: center; }
.step { width: 100%; max-width: 480px; margin: 0 auto; padding: 24px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0; }
.cell { aspect-ratio: 1; border-radius: 14px; border: 2px solid transparent; background: var(--panel); font-size: 1.5rem; }
.cell.on { border-color: #fff; }
.preview { text-align: center; margin: 8px 0; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; font-size: 1.1rem; vertical-align: middle; }
.big-av { width: 84px; height: 84px; font-size: 2.6rem; }
.vibe { display: block; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; margin: 10px 0; }
.vibe span { display: block; color: var(--muted); font-size: .95rem; margin-top: 2px; }

/* ---- chat */
#chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line); }
.barname { font-weight: 600; flex: 1; }
.iconbtn { background: none; border: 0; font-size: 1.4rem; padding: 4px 8px; }
.log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.log.readonly { overflow: visible; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.msg p { margin: 0; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; background: var(--panel); border-bottom-left-radius: 6px; }
.msg small { display: block; color: var(--muted); margin-top: 4px; font-size: .75rem; }
.msg.me small { color: #e5e0ff; }
.flagged-urgent { outline: 3px solid var(--red); }
.flagged-watch { outline: 2px dashed #f59e0b; }
.typing p { opacity: .6; }
.shot { max-width: 100%; border-radius: 12px; display: block; margin-bottom: 6px; }
.starters { padding: 0 14px; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); }
.composer textarea { resize: none; border-radius: 20px; padding: 10px 14px; }
.send { background: var(--accent); color: #fff; border: 0; border-radius: 50%; width: 42px; height: 42px; flex: none; font-size: 1.2rem; }
.phototag { font-size: .8rem; color: var(--muted); align-self: center; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); z-index: 5; }
.sheet > button, .sheet > a:not(.btn) { display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.helpcard h2 { margin-top: 0; }

/* ---- parent */
.row { display: flex; justify-content: space-between; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 14px 0; }
.card h2 { font-size: 1.1rem; margin: 0 0 8px; }
.card.alert { border-color: var(--red); }
.card.warn { border-color: #f59e0b; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.inline { display: inline; }
