:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #7c3aed;
  --accent2: #db2777;
  --bubble-mine: #7c3aed;
  --bubble-mine-text: #ffffff;
  --bubble-theirs: #f3f4f6;
  --bg2: #f5f5f5;
  --danger: #dc2626;
  --topbar-h: 52px;
}
body.dark {
  --bg: #0b0b10;
  --card: #16161f;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --border: #2a2a35;
  --bubble-theirs: #22222e;
  --bg2: #1e1e28;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; }
.hidden { display: none !important; }
.view { min-height: 100dvh; padding-bottom: 76px; background: var(--bg); }
#auth-view, #story-view, #chat-view, #post-view { padding-bottom: 0; }
.error { color: var(--danger); font-size: 14px; margin-top: 8px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.logo-script {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: 24px; font-weight: 700;
  background: linear-gradient(45deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative;
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text); padding: 4px 8px;
}
.back-btn { font-size: 24px; }

/* bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  max-width: 520px; margin: 0 auto;
  display: flex; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  position: relative; flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 20px; color: var(--text); opacity: .55;
}
.nav-btn span { font-size: 10px; }
.nav-btn.active { opacity: 1; }
.nav-new { color: var(--accent); opacity: 1; }
.nav-badge {
  position: absolute; top: 2px; right: calc(50% - 20px);
  background: var(--accent2); color: #fff; border-radius: 10px;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* auth */
#auth-view { display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 22px; }
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; }
.auth-logo img { width: 44px; height: 44px; }
.auth-logo h1 {
  font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 32px;
  background: linear-gradient(45deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-tag { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 18px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-card input, .newchat-body input, .explore-body input, .prof-edit input, .prof-edit textarea, .newpost-body textarea {
  width: 100%; padding: 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 15px;
  background: var(--bg); color: var(--text);
}
.auth-card button[type=submit], .primary-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(45deg, var(--accent), var(--accent2));
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}

/* avatars */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px; position: relative;
  background: linear-gradient(45deg, var(--accent), var(--accent2));
}
.avatar.small { width: 32px; height: 32px; font-size: 14px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.xl { width: 84px; height: 84px; font-size: 34px; }
.avatar .online-dot {
  position: absolute; bottom: 1px; right: 1px; width: 11px; height: 11px;
  background: #22c55e; border: 2px solid var(--card); border-radius: 50%;
}

/* stories row */
.stories-row {
  display: flex; gap: 14px; overflow-x: auto; padding: 12px;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.story-bubble { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; flex-shrink: 0; background:none;border:none;color:var(--text); }
.story-ring {
  width: 64px; height: 64px; border-radius: 50%; padding: 3px;
  background: linear-gradient(45deg, #fbbf24, #db2777, #7c3aed);
  display: flex; align-items: center; justify-content: center;
}
.story-ring .avatar { width: 56px; height: 56px; border: 3px solid var(--card); font-size: 22px; }
.story-bubble span { font-size: 11px; color: var(--text); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-add { border: 2px dashed var(--border); border-radius: 50%; width: 64px; height: 64px; display:flex; align-items:center; justify-content:center; font-size: 26px; color: var(--muted); background: none; cursor: pointer; }

/* feed */
.feed { display: flex; flex-direction: column; gap: 4px; }
.post { background: var(--card); border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.post-head .puser { font-weight: 700; font-size: 14px; }
.post-head .ptime { font-size: 12px; color: var(--muted); }
.post-img { width: 100%; display: block; background: #000; aspect-ratio: 1; object-fit: cover; }
.post-actions { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0; }
.post-actions .icon-btn { font-size: 24px; padding: 2px 6px; }
.like-btn.liked { color: var(--accent2); }
.save-btn { margin-left: auto; }
.save-btn.saved { color: var(--accent); }
.plikes { padding: 2px 12px; font-weight: 700; font-size: 14px; }
.pcap { padding: 2px 12px; font-size: 14px; line-height: 1.4; overflow-wrap: break-word; }
.pcap b { margin-right: 5px; }
.pviewc { padding: 2px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.big-heart {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0);
  font-size: 90px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.5);
  pointer-events: none; transition: transform .2s;
}
.post-imgwrap { position: relative; }
.empty-list { text-align: center; color: var(--muted); padding: 40px 24px; font-size: 15px; line-height: 1.7; }

/* explore */
.explore-body { padding: 12px; }
.explore-h { margin: 14px 0 10px; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: pointer; background: var(--border); display: block; }
.grid .grid-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px; font-size: 14px; }

/* user result rows */
.result-item { display: flex; align-items: center; gap: 10px; padding: 10px 6px; cursor: pointer; border-radius: 10px; }
.result-item:active { background: var(--bg); }
.result-item .rname { font-weight: 600; font-size: 15px; }
.result-item .ruser { font-size: 13px; color: var(--muted); }
.result-item .grow { flex: 1; }
.follow-btn { padding: 7px 14px; border-radius: 8px; border: none; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--accent); color: #fff; }
.follow-btn.following { background: var(--bg); color: var(--text); border: 1px solid var(--border); }

/* new post */
.newpost-body { padding: 14px; }
.pick-img {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: 14px;
  padding: 40px; color: var(--muted); font-size: 16px; cursor: pointer; margin: 12px 0;
}
.np-preview { width: 100%; border-radius: 12px; margin-bottom: 12px; }

/* activity */
.activity-list { padding: 8px 0; }
.act-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.act-item.unread { background: rgba(124,58,237,.07); }
.act-item .act-text { flex: 1; font-size: 14px; }
.act-item .act-text b { font-weight: 700; }
.act-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.act-item .act-time { font-size: 12px; color: var(--muted); }

/* profile */
.profile-body { padding: 14px; }
.prof-top { display: flex; align-items: center; gap: 24px; }
.prof-stats { display: flex; gap: 22px; flex: 1; justify-content: space-around; }
.stat { text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }
.prof-name { font-weight: 700; margin-top: 12px; font-size: 15px; }
.prof-user { color: var(--muted); font-size: 13px; }
.prof-bio { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.prof-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.prof-actions button { flex: 1; min-width: 100px; padding: 9px; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.prof-actions button.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.prof-edit { margin-bottom: 10px; }
.prof-tabs { display: flex; gap: 8px; margin-bottom: 10px; }

/* post detail + comments */
#post-view, #chat-view { display: flex; flex-direction: column; height: 100dvh; }
#post-detail { flex-shrink: 0; }
.comments-list { flex: 1; overflow-y: auto; padding: 10px 12px; }
.comment { display: flex; gap: 10px; padding: 8px 0; align-items: flex-start; }
.comment .ctext { font-size: 14px; line-height: 1.4; overflow-wrap: break-word; }
.comment .ctime { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* story viewer */
.story-view { position: fixed; inset: 0; background: #000; z-index: 50; max-width: 520px; margin: 0 auto; }
.story-progress { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 4px; z-index: 3; }
.story-progress .seg { flex: 1; height: 3px; background: rgba(255,255,255,.35); border-radius: 2px; overflow: hidden; }
.story-progress .seg .fill { height: 100%; width: 0; background: #fff; }
.story-head { position: absolute; top: 18px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; z-index: 3; color: #fff; }
.story-name { font-weight: 700; font-size: 14px; }
.story-time { font-size: 12px; opacity: .8; }
.story-close { margin-left: auto; color: #fff; }
.story-img { width: 100%; height: 100%; object-fit: contain; }
.story-nav { position: absolute; top: 0; bottom: 0; width: 30%; background: none; border: none; cursor: pointer; z-index: 2; }
.story-nav.prev { left: 0; } .story-nav.next { right: 0; }

/* chats */
.chat-list { padding: 4px 0; }
.chat-item { display: flex; gap: 12px; padding: 12px; cursor: pointer; align-items: center; }
.chat-item:active { background: var(--card); }
.chat-item-text { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; }
.chat-item-name { font-weight: 700; font-size: 15px; }
.chat-item-time { font-size: 12px; color: var(--muted); }
.chat-item-bottom { display: flex; justify-content: space-between; gap: 8px; }
.chat-item-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { background: var(--accent); color: #fff; border-radius: 12px; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.newchat-body { padding: 14px; }
.newchat-body h3 { margin: 8px 0; font-size: 15px; }
.newchat-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* chat screen */
#chat-view .topbar { flex-shrink: 0; }
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-weight: 700; font-size: 16px; }
.chat-sub { font-size: 12px; color: var(--muted); }
.messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 16px;
  font-size: 15px; line-height: 1.35; overflow-wrap: break-word; position: relative;
}
.bubble.mine { align-self: flex-end; background: var(--bubble-mine); color: var(--bubble-mine-text); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: var(--bubble-theirs); border-bottom-left-radius: 4px; }
.sender-name { font-size: 12px; font-weight: 700; color: var(--accent2); margin-bottom: 2px; }
.meta { float: right; font-size: 10px; opacity: .75; margin: 8px 0 -2px 8px; }
.ticks.read { color: #7dd3fc; }
.input-bar { display: flex; gap: 8px; padding: 10px 12px; background: var(--card); border-top: 1px solid var(--border); flex-shrink: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.input-bar input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 22px; font-size: 15px; background: var(--bg); color: var(--text); }
.send-btn { width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 18px; cursor: pointer; transform: rotate(-40deg); padding-right: 10px; }

.lang-btn{font-size:13px;font-weight:700;border:1px solid #cbd5e1;border-radius:14px;padding:4px 10px;background:transparent;color:inherit;cursor:pointer;margin-right:6px}
.lang-auth{position:absolute;top:12px;right:12px;margin:0}
.auth-card{position:relative}

/* ===== v3 additions ===== */
.lang-menu {
  position: fixed; top: 56px; right: 12px; z-index: 90;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); overflow: hidden; min-width: 170px;
}
.lang-menu button {
  display: block; width: 100%; text-align: left; padding: 11px 14px;
  background: none; border: none; color: var(--text); font-size: 15px; cursor: pointer;
}
.lang-menu button:active, .lang-menu button.active { background: rgba(124,58,237,.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn, .chips .chip-btn {
  padding: 7px 12px; border-radius: 18px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.explore-toggle { display: flex; gap: 8px; margin: 10px 0 4px; }
.explore-toggle .tab { flex: 0 1 auto; padding: 8px 16px; border-radius: 18px; }
.vbadge { color: #1d9bf0; font-size: .9em; }

/* create / editor */
.np-carousel { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.np-carousel .nc-item { position: relative; flex-shrink: 0; }
.np-carousel img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; display: block; cursor: pointer; border: 2px solid transparent; }
.np-carousel .nc-item.active img { border-color: var(--accent); }
.np-carousel .nc-del { position: absolute; top: -6px; right: -6px; background: #000a; color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 12px; cursor: pointer; }
.np-editor { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.np-editor img { width: 100%; border-radius: 10px; display: block; }
.ed-row { margin-top: 10px; }
.ed-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.ed-row.sliders label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ed-row.sliders input[type=range] { width: 100%; }
.ed-row input[type=text] { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); margin-bottom: 8px; }
.voice-btn { display: block; margin: 0 0 10px; }
.voice-btn.recording { background: var(--accent2); border-color: var(--accent2); color: #fff; }
#np-collab-row input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); margin-bottom: 10px; }

/* carousel in feed */
.post-imgwrap { overflow: hidden; }
.carousel-track { display: flex; transition: transform .3s ease; }
.carousel-track img { flex-shrink: 0; width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; display: block; }
.carousel-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.carousel-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: #ffffff88; }
.carousel-dots .dot.active { background: #fff; }
.carousel-count { position: absolute; top: 10px; right: 10px; background: #000a; color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 10px; }
.filter-preview { position: absolute; inset: 0; pointer-events: none; }

/* settings */
.settings-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 6px; border-bottom: 1px solid var(--border); font-size: 15px; }
.set-row select { padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14px; }
.link-row { color: var(--accent); font-weight: 600; cursor: pointer; }
.link-row.danger { color: var(--danger); }
.blocked-list { padding: 4px 6px; }
.blocked-list .result-item { justify-content: space-between; }

/* analytics */
.analytics-body { padding: 14px; }
.ana-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.ana-totals .stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 4px; }
.ana-post { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ana-post img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.ana-post .ana-nums { font-size: 13px; color: var(--muted); }

/* activity collab buttons */
.act-actions { display: flex; gap: 6px; }
.act-actions button { padding: 6px 10px; border-radius: 8px; border: none; font-size: 12px; font-weight: 700; cursor: pointer; }
.act-accept { background: var(--accent); color: #fff; }
.act-decline { background: var(--bg); color: var(--text); border: 1px solid var(--border) !important; }

.prof-place { font-size: 12px; color: var(--muted); margin-top: 2px; }
.private-note { text-align: center; color: var(--muted); padding: 24px; font-size: 14px; }
.report-row { padding: 10px 12px; }

.update-banner{position:fixed;top:0;left:0;right:0;z-index:9999;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;background:#7c3aed;color:#fff;font-size:14px}
.update-banner.hidden{display:none}
.update-banner button{background:#fff;color:#7c3aed;border:0;border-radius:8px;padding:6px 14px;font-weight:700}

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); color: var(--text); width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 10px 12px 22px; display: flex; flex-direction: column; }
.sheet-title { font-weight: 700; text-align: center; padding: 8px 0 4px; }
.sheet-note { text-align: center; color: var(--muted); font-size: 13px; padding: 0 12px 10px; }
.sheet-btn { background: none; border: none; border-top: 1px solid var(--border); padding: 14px; font-size: 16px; cursor: pointer; color: inherit; width: 100%; }
.sheet-btn:first-child { border-top: none; }
.sheet-btn.danger { color: var(--danger); font-weight: 600; }
.sheet-textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font: inherit; font-size: 15px; background: var(--bg); color: var(--text); resize: vertical; margin-bottom: 8px; }

.stat.tappable { cursor: pointer; }
.sheet.sheet-list { max-height: 78vh; }
.sheet-scroll { overflow-y: auto; max-height: 62vh; margin: 6px 0; }
.sheet-scroll .result-item { padding: 8px 4px; }
.sheet-scroll .follow-btn.remove { margin-left: 6px; }

.topbar-logo { width: 28px; height: 28px; border-radius: 7px; vertical-align: middle; margin-right: 8px; -webkit-text-fill-color: initial; }
.auth-logo img { border-radius: 10px; }

.edit-user-row{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.edit-user-row input{flex:1}
.edit-user-row .chip-btn{flex:0 0 auto}

.prof-link{margin:2px 0}
.prof-link a{color:var(--accent);text-decoration:none;word-break:break-all;font-size:14px}

/* chat upgrade */
.chats-controls { padding: 8px 12px 0; }
.chats-controls input { width: 100%; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--border, #ddd); background: var(--bg2, #f5f5f5); color: inherit; font-size: 15px; box-sizing: border-box; }
.chats-tabs { display: flex; gap: 8px; margin: 10px 0 2px; }
.chats-tabs .tab { flex: 1; padding: 8px; border-radius: 18px; border: 0; background: var(--bg2, #eee); color: inherit; font-size: 14px; cursor: pointer; }
.chats-tabs .tab.active { background: #7c3aed; color: #fff; }
.request-bar { padding: 14px; background: var(--bg2, #f3f4f6); border-bottom: 1px solid var(--border, #e5e5e5); text-align: center; }
.req-text { margin-bottom: 10px; font-size: 15px; }
.req-btns { display: flex; gap: 10px; justify-content: center; }
.req-btns .chip-btn { padding: 8px 22px; }
.pinned-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg2, #f3f4f6); border-bottom: 1px solid var(--border, #e5e5e5); font-size: 14px; }
.pinned-bar .pin-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--bg2, #f3f4f6); border-top: 1px solid var(--border, #e5e5e5); font-size: 14px; }
.reply-quote { border-left: 3px solid #7c3aed; padding: 4px 8px; margin-bottom: 4px; font-size: 13px; opacity: .85; border-radius: 4px; background: rgba(124,58,237,.08); }
.reply-quote b { display: block; font-size: 12px; color: #7c3aed; }
.bubble.flash { outline: 2px solid #7c3aed; transition: outline .3s; }
.msg-photos { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.photo-cell { position: relative; display: inline-block; }
.msg-photo { max-width: 250px; max-height: 320px; border-radius: 10px; display: block; cursor: pointer; }
.msg-photos .photo-cell:nth-child(n+2) .msg-photo { max-width: 120px; max-height: 120px; object-fit: cover; }
.msg-photo.blurred { filter: blur(18px); }
.tap-full { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 10px; cursor: pointer; z-index: 2; }
.photo-cap { margin-top: 6px; font-size: 15px; }
.once-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 22px; background: rgba(124,58,237,.12); border-radius: 12px; cursor: pointer; font-size: 14px; }
.once-card b { color: #7c3aed; font-size: 13px; }
.once-card.opened { opacity: .6; cursor: default; }
.once-badge { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 10px; }
.loc-card { width: 240px; }
.loc-map { width: 100%; height: 150px; border: 0; border-radius: 10px; display: block; }
.loc-link { display: inline-block; margin-top: 6px; font-size: 14px; color: #7c3aed; }
.share-card { display: block; width: 220px; background: rgba(124,58,237,.08); border: 1px solid rgba(124,58,237,.25); border-radius: 12px; padding: 10px; cursor: pointer; text-align: left; color: inherit; font-size: 14px; }
.share-card-img { width: 100%; border-radius: 8px; margin-bottom: 6px; display: block; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react-chip { background: var(--bg2, #f0f0f0); border: 1px solid var(--border, #ddd); border-radius: 12px; padding: 2px 8px; font-size: 13px; cursor: pointer; }
.react-chip.mine { border-color: #7c3aed; background: rgba(124,58,237,.12); }
.react-row { display: flex; justify-content: space-around; padding: 6px 0 10px; }
.react-btn { background: none; border: 0; font-size: 26px; cursor: pointer; }
.sheet-row { padding: 10px 6px; font-size: 15px; border-bottom: 1px solid var(--border, #eee); }
.admin-tag { font-size: 12px; color: #7c3aed; font-weight: 600; }
.deleted-msg { opacity: .65; }
.edited-tag { font-size: 11px; opacity: .6; }
#emoji-pop { position: absolute; bottom: 54px; left: 8px; right: 8px; background: var(--bg, #fff); border: 1px solid var(--border, #ddd); border-radius: 14px; padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; z-index: 50; box-shadow: 0 -4px 20px rgba(0,0,0,.15); }
.emoji-cell { background: none; border: 0; font-size: 22px; padding: 6px 0; cursor: pointer; border-radius: 8px; }
.emoji-cell:hover { background: var(--bg2, #f0f0f0); }
#send-form { position: relative; }
.photo-viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.photo-viewer img { max-width: 96vw; max-height: 88vh; border-radius: 8px; }
.pv-close { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; z-index: 2; }
.pv-once-tag { position: absolute; top: 20px; left: 16px; color: #fff; font-size: 13px; opacity: .8; }
.composer { position: fixed; inset: 0; background: #000; z-index: 9998; display: flex; flex-direction: column; }
.comp-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; color: #fff; }
.comp-top .icon-btn { color: #fff; font-size: 22px; background: none; border: 0; }
.comp-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
#comp-canvas { max-width: 100vw; max-height: 58vh; touch-action: none; }
.comp-tools { padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.comp-tools .chip-btn { background: rgba(255,255,255,.15); color: #fff; border: 0; padding: 7px 14px; border-radius: 16px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); cursor: pointer; }
.sticker-btn { background: none; border: 0; font-size: 24px; cursor: pointer; }
.comp-bottom { display: flex; gap: 8px; padding: 10px 12px; }
.comp-bottom input { flex: 1; padding: 11px 14px; border-radius: 20px; border: 1px solid var(--border); font-size: 15px; background: var(--bg); color: var(--text); }
.comp-nav { position: absolute; top: 50%; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 8px; pointer-events: none; }
.comp-nav .icon-btn { pointer-events: auto; background: rgba(0,0,0,.4); color: #fff; border: 0; border-radius: 50%; width: 38px; height: 38px; font-size: 20px; }
.album-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; background: var(--bg2, #f5f5f5); border: 0; border-radius: 12px; margin-bottom: 8px; cursor: pointer; color: inherit; font-size: 15px; text-align: left; }
.album-row img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.album-empty { font-size: 30px; }
.album-name { flex: 1; font-weight: 600; }
.album-count { font-size: 13px; opacity: .65; }
.album-body { padding: 12px; }
.album-body .primary-btn { width: 100%; margin-top: 10px; }
#album-add { margin-top: 12px; width: 100%; }
.set-sec { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; opacity: .55; margin: 18px 4px 6px; }
.set-inline { display: flex; gap: 6px; align-items: center; }
.set-inline input { width: 130px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #ddd); background: var(--bg2, #f5f5f5); color: inherit; }
.set-row select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #ddd); background: var(--bg2, #f5f5f5); color: inherit; max-width: 170px; }
#set-pass-box { padding: 8px 4px; }
#set-pass-box input { display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border, #ddd); background: var(--bg2, #f5f5f5); color: inherit; }
.story-share { position: absolute; top: 14px; right: 62px; z-index: 3; background: rgba(0,0,0,.35); color: #fff; border: 0; border-radius: 50%; width: 38px; height: 38px; font-size: 17px; cursor: pointer; }
/* festival chat themes */
#messages.theme-diwali { background: linear-gradient(180deg, #2b1a05 0%, #1a0e02 100%); }
#messages.theme-diwali::before { content: "🪔"; position: fixed; bottom: 70px; right: 14px; font-size: 42px; opacity: .35; pointer-events: none; }
#messages.theme-diwali .bubble.theirs { background: #3a2a10; color: #ffe9c9; }
#messages.theme-holi { background: linear-gradient(135deg, #fce7f3 0%, #ede9fe 50%, #dbeafe 100%); }
#messages.theme-holi::before { content: "🎨"; position: fixed; bottom: 70px; right: 14px; font-size: 42px; opacity: .3; pointer-events: none; }
#messages.theme-eid { background: linear-gradient(180deg, #06281f 0%, #041a15 100%); }
#messages.theme-eid::before { content: "🌙"; position: fixed; bottom: 70px; right: 14px; font-size: 42px; opacity: .35; pointer-events: none; }
#messages.theme-eid .bubble.theirs { background: #0c3a2d; color: #d1fae5; }

::placeholder { color: var(--muted); opacity: 1; }
select option { background: var(--card); color: var(--text); }

.agree-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 10px 2px; text-align: left; line-height: 1.4; }
.agree-row input { width: auto !important; margin-top: 3px; flex: none; }
.agree-row a, .auth-legal a, .sheet-row a { color: var(--accent); font-weight: 600; }
.auth-legal { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 0; line-height: 1.5; }
.creport { cursor: pointer; text-decoration: underline; }
.adm-btns { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.sheet-scroll .sheet-row { line-height: 1.45; }
