:root { --brand:#6d28d9; --brand-soft:#f5f3ff; --line:#ececf1; --muted:#6b7280; --ok:#16a34a; }
* { box-sizing:border-box; }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; max-width:720px; margin:40px auto; padding:0 20px; color:#18181b; line-height:1.5; }
body.wide { max-width:1080px; }
a { color:var(--brand); }
code { background:#f4f4f5; padding:1px 6px; border-radius:6px; font-size:.9em; }
.back { font-size:14px; margin:0 0 18px; }
.back a { text-decoration:none; font-weight:600; }
.hero h1 { font-size:30px; margin:0; }
.hero p.lead { color:var(--muted); margin:8px 0 0; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin:16px 0 4px; }
.chip { font-size:12px; font-weight:600; color:var(--brand); background:var(--brand-soft); border:1px solid #ede9fe; border-radius:999px; padding:4px 11px; }
.note { background:#fafafa; border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin:20px 0; font-size:14px; color:#3f3f46; }
section { border:1px solid var(--line); border-radius:16px; padding:18px 20px; margin:18px 0; }
section > h2 { margin:0 0 4px; font-size:17px; display:flex; align-items:center; gap:8px; }
section > .desc { color:var(--muted); font-size:13px; margin:0 0 14px; }
.tag { font-size:10px; font-weight:700; letter-spacing:.03em; text-transform:uppercase; color:#fff; background:var(--brand); border-radius:6px; padding:2px 7px; }
form { display:grid; gap:10px; }
.row { display:flex; gap:10px; flex-wrap:wrap; }
.row > * { flex:1; min-width:140px; }
input,textarea { padding:11px 12px; border:1px solid #d4d4d8; border-radius:10px; font:inherit; font-size:14px; width:100%; }
textarea { resize:vertical; min-height:60px; }
button { padding:11px 16px; border:0; border-radius:10px; background:var(--brand); color:#fff; font-weight:600; font-size:14px; cursor:pointer; }
button.ghost { background:#fff; color:var(--brand); border:1px solid #ddd6fe; }
button:disabled { opacity:.5; cursor:default; }
.who-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.avatar { width:34px; height:34px; border-radius:50%; background:var(--brand); color:#fff; display:grid; place-items:center; font-weight:700; }
ul { list-style:none; padding:0; margin:14px 0 0; }
li.item { padding:13px 14px; border:1px solid var(--line); border-radius:12px; margin-bottom:10px; }
li .head { display:flex; justify-content:space-between; align-items:baseline; }
li .author { font-weight:600; }
li .time { color:#a1a1aa; font-size:12px; }
li .text { margin:5px 0 0; white-space:pre-wrap; }
li img.post-img { margin-top:10px; max-width:100%; border-radius:10px; border:1px solid var(--line); }
.empty { color:#a1a1aa; text-align:center; padding:18px; }
.live { font-size:12px; font-weight:600; color:var(--ok); display:inline-flex; align-items:center; gap:6px; }
.dot { width:8px; height:8px; border-radius:50%; background:var(--ok); box-shadow:0 0 0 0 rgba(22,163,74,.5); animation:pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(22,163,74,.5)} 70%{box-shadow:0 0 0 8px rgba(22,163,74,0)} 100%{box-shadow:0 0 0 0 rgba(22,163,74,0)} }
.hint { color:var(--muted); font-size:13px; }
.status { font-size:13px; color:var(--muted); }
footer { margin:26px 0 60px; color:#a1a1aa; font-size:13px; text-align:center; }

/* Home page demo cards */
.cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:14px; margin:22px 0; }
.card { display:block; border:1px solid var(--line); border-radius:16px; padding:18px 20px; text-decoration:none; color:inherit; transition:border-color .15s, box-shadow .15s, transform .15s; }
.card:hover { border-color:#ddd6fe; box-shadow:0 4px 18px rgba(109,40,217,.08); transform:translateY(-2px); }
.card .card-emoji { font-size:26px; }
.card h3 { margin:8px 0 4px; font-size:16px; }
.card p { margin:0 0 12px; color:var(--muted); font-size:13px; }
.card .card-tags { display:flex; gap:6px; flex-wrap:wrap; }

/* Chat room */
.chat-box { height:min(520px, 65vh); overflow-y:auto; border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin-bottom:10px; background:#fff; display:flex; flex-direction:column; }
.chat-empty { color:#a1a1aa; text-align:center; padding:30px 0; font-size:13px; align-self:center; margin:auto; }
.chat-msg { position:relative; display:flex; flex-direction:column; align-items:flex-start; align-self:flex-start; max-width:72%; margin-top:12px; font-size:14px; }
.chat-msg.cont { margin-top:2px; }
.chat-msg.me { align-items:flex-end; align-self:flex-end; }
.chat-msg .meta { font-size:11px; color:#8e8e93; margin:0 12px 3px; }
.chat-msg .meta .nick { font-weight:600; margin-right:5px; }
.chat-msg .bubble { background:#e9e9eb; color:#111; padding:7px 12px; border-radius:18px; border-bottom-left-radius:5px; line-height:1.35; overflow-wrap:anywhere; white-space:pre-wrap; }
.chat-msg.me .bubble { background:#007aff; color:#fff; border-radius:18px; border-bottom-right-radius:5px; }
.chat-msg.me .bubble a { color:#fff; }
.chat-msg .bubble code { background:rgba(0,0,0,.08); }
.chat-msg.me .bubble code { background:rgba(255,255,255,.22); color:#fff; }
.typing { color:var(--muted); font-size:12px; font-style:italic; min-height:18px; margin:-2px 0 8px; }
.chat-row { display:flex; gap:8px; flex-wrap:wrap; }
.chat-row input#chat-nick { flex:0 0 120px; min-width:0; }
.chat-row input#chat-text { flex:1; min-width:160px; }
.chat-row button { flex:0 0 auto; }
.online { font-size:12px; font-weight:600; color:var(--muted); display:inline-flex; align-items:center; gap:5px; }
.me-chip { display:inline-flex; align-items:center; gap:8px; font-weight:600; font-size:14px; padding:0 2px; }
.me-chip .avatar { width:28px; height:28px; font-size:13px; }
.icon-btn { background:#fff; border:1px solid var(--line); border-radius:10px; padding:9px 11px; font-size:16px; cursor:pointer; line-height:1; color:#3f3f46; }
.icon-btn:hover { border-color:#ddd6fe; background:var(--brand-soft); }
h2 .icon-btn { margin-left:auto; padding:5px 8px; font-size:14px; }
.chat-box.dragover { outline:2px dashed var(--brand); outline-offset:-6px; background:var(--brand-soft); }
.chat-msg .body a { overflow-wrap:anywhere; }
.chat-msg .media img { display:block; max-width:280px; max-height:240px; border-radius:16px; border:1px solid var(--line); margin-top:3px; }
.chat-msg.system { align-self:center; align-items:center; max-width:90%; color:#8e8e93; font-size:12px; text-align:center; }
.chat-msg .body.rainbow { font-weight:700; background:linear-gradient(90deg,#ef4444,#f59e0b,#22c55e,#3b82f6,#8b5cf6,#ef4444); background-size:300% 100%; -webkit-background-clip:text; background-clip:text; color:transparent; animation:rainbow-slide 2.5s linear infinite; }
.chat-msg.me .body.rainbow { background:linear-gradient(90deg,#fef08a,#fda4af,#a5f3fc,#d9f99d,#fef08a); background-size:300% 100%; -webkit-background-clip:text; background-clip:text; }
@keyframes rainbow-slide { to { background-position:300% 0; } }
.react-row { display:none; gap:4px; margin:3px 6px 0; flex-wrap:wrap; align-items:center; }
.react-row.has-pills { display:flex; }
.react-pill { border:1px solid var(--line); background:#fff; border-radius:999px; padding:2px 8px; font-size:12px; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.react-pill.mine { background:var(--brand-soft); border-color:#ddd6fe; }
.react-tools { position:absolute; bottom:2px; display:flex; gap:4px; align-items:center; white-space:nowrap; visibility:hidden; z-index:2; }
.chat-msg:not(.me) .react-tools { left:100%; padding-left:6px; }
.chat-msg.me .react-tools { right:100%; padding-right:6px; }
.chat-msg:hover .react-tools, .react-tools[data-open="1"] { visibility:visible; }
.react-add { border:1px dashed #d4d4d8; background:#fff; border-radius:999px; width:26px; height:26px; font-size:14px; cursor:pointer; color:var(--muted); line-height:1; padding:0; }
.attach-preview { display:none; align-items:center; gap:10px; margin:0 0 10px; }
.attach-preview img { height:52px; border-radius:8px; border:1px solid var(--line); }
.panel { display:none; border:1px solid var(--line); border-radius:12px; padding:10px; margin:0 0 10px; background:#fff; }
.panel.open { display:block; }
.emoji-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(36px,1fr)); gap:2px; max-height:200px; overflow-y:auto; }
.emoji-grid button { background:none; border:0; font-size:20px; padding:4px; cursor:pointer; border-radius:8px; }
.emoji-grid button:hover { background:var(--brand-soft); }
.gif-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:8px; max-height:240px; overflow-y:auto; margin-top:10px; }
.gif-grid img { width:100%; height:90px; object-fit:cover; border-radius:8px; cursor:pointer; border:1px solid var(--line); }
.gif-grid img:hover { border-color:var(--brand); }
body.shaking { animation:screen-shake .6s ease; }
@keyframes screen-shake { 0%,100%{transform:translate(0)} 10%{transform:translate(-8px,4px)} 20%{transform:translate(8px,-4px)} 30%{transform:translate(-6px,-6px)} 40%{transform:translate(6px,6px)} 50%{transform:translate(-4px,2px)} 60%{transform:translate(4px,-2px)} 70%{transform:translate(-2px,-2px)} 80%{transform:translate(2px,2px)} 90%{transform:translate(-1px,1px)} }
#confetti-canvas { position:fixed; inset:0; pointer-events:none; z-index:9999; }
