:root {
  /* ============ InstaPub design tokens ============ */
  color-scheme: light;
  /* brand identity (Instagram-inspired) */
  --grad1: #feda75;
  --grad2: #d62976;
  --grad3: #962fbf;
  --grad4: #4f5bd5;
  --brand: #d62976;
  --brand-2: #962fbf;
  --accent: #0095f6;
  --accent-hover: #4cb5f4;
  --danger: #ed4956;
  --success: #22a06b;
  --warning: #f5a623;
  /* surfaces */
  --bg: #ffffff;
  --card: #ffffff;
  --surface: #fafafa;
  --surface-2: #efefef;
  --surface-3: #efefef;
  /* borders */
  --border: #dbdbdb;
  --border-strong: #c7c7c7;
  /* text */
  --fg: #262626;
  --fg-2: #8e8e8e;
  --muted: #8e8e8e;
  --on-accent: #ffffff;
  /* elevations */
  --sh-sm: 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 2px 8px rgba(0,0,0,.06);
  --sh-lg: 0 8px 24px rgba(0,0,0,.08);
  --sh-accent: 0 8px 24px rgba(213,41,118,.30);
  /* radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 999px;
  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  /* type */
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-lg: clamp(28px, 5vw, 40px);
  /* motion */
  --t-fast: .14s ease;
  --t-base: .22s cubic-bezier(.4,0,.2,1);
  /* layout */
  --container: 935px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  height: 100vh;
  overflow-y: auto;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }

/* Auth screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fafafa 0%, #efeef4 100%);
  padding: 20px;
}
.auth-card {
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-border);
  border-radius: 18px;
  width: 392px;
  max-width: 100%;
  padding: 44px 36px 32px;
  text-align: center;
  box-shadow: var(--sh-lg), 0 0 0 1px rgba(214,41,118,.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
:root { --auth-card-bg: rgba(255,255,255,.92); --auth-card-border: rgba(255,255,255,.7); }
html[data-theme="dark"] { --auth-card-bg: rgba(26,26,26,.9); --auth-card-border: rgba(255,255,255,.14); }
.telegram-login { margin: 0 auto 6px; min-height: 40px; display: flex; justify-content: center; }
.telegram-login iframe { border-radius: 8px; box-shadow: var(--sh-sm); }
.auth-divider { margin: 18px 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.brand-name {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 40px;
  letter-spacing: -1px;
  margin: 6px 0 2px;
  background: linear-gradient(90deg, var(--grad1), var(--grad2), var(--grad3), var(--grad4));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-tagline { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-form input {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 14px;
}
.btn-primary {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  margin-top: 14px;
  font-weight: 600;
}
.auth-error { color: var(--danger); font-size: 13px; margin: 8px 0 0; min-height: 16px; }

/* App topbar */
.app { display: flex; flex-direction: column; }
.topbar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 975px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}
.logo {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(90deg, var(--grad1), var(--grad2), var(--grad3), var(--grad4));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.nav-actions { display: flex; gap: 16px; align-items: center; }
.nav-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--fg);
  text-decoration: none;
}
.nav-btn.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.main {
  max-width: 975px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 16px 80px;
}

/* Feed card */
.post-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
  max-width: 614px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}
.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--grad1), var(--grad2), var(--grad3));
  background-size: cover;
  background-position: center;
  display: inline-block;
  flex-shrink: 0;
}
.post-username { font-weight: 600; cursor: pointer; color: var(--fg); }
.post-img-wrap {
  background: #000;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.post-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-actions { display: flex; gap: 14px; padding: 10px 14px 0; }
.action-btn {
  background: none;
  border: none;
  font-size: 25px;
  cursor: pointer;
  line-height: 1;
  color: var(--fg);
  transition: transform 0.1s;
}
.action-btn:active { transform: scale(1.2); }
.action-btn.liked { color: var(--danger); }
.post-likes { padding: 6px 14px; font-weight: 600; font-size: 14px; }
.post-caption { padding: 0 14px 12px; font-size: 14px; line-height: 1.4; }
.post-caption .post-username { margin-right: 6px; }
.post-caption .time { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }

/* Profile page */
.profile-head {
  display: flex;
  gap: 32px;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.avatar-lg {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--grad1), var(--grad2), var(--grad3));
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.profile-username { font-size: 22px; font-weight: 300; }
.profile-bio { margin-top: 8px; font-size: 14px; white-space: pre-wrap; }
.profile-stats {
  display: flex;
  gap: 32px;
  margin: 12px 0;
  text-align: center;
}
.stat-num { font-weight: 600; font-size: 16px; }
.stat-label { color: var(--muted); font-size: 13px; }
.profile-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.btn-outline {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--fg);
}
.btn-outline.active { background: var(--fg); color: #fff; }
.btn-danger {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 12px;
}
.grid-item {
  aspect-ratio: 1 / 1;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid-item:hover .grid-ov { opacity: 1; }
.grid-ov {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 18px;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 18px;
}
.grid-item { position: relative; }

/* Composer */
.composer {
  max-width: 614px;
  margin: 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.composer-head {
  padding: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.composer-body { padding: 18px; text-align: center; }
.composer-drop {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 60px 20px;
  margin-bottom: 16px;
  cursor: pointer;
  color: var(--muted);
}
.composer-drop img { max-width: 280px; border-radius: 6px; display: block; margin: 0 auto; }
.composer textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}
.composer .actions { display: flex; justify-content: flex-end; margin-top: 12px; gap: 8px; }

/* Explore */
.explore-list { max-width: 614px; margin: 0 auto; }
.explore-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.explore-form {
  max-width: 614px;
  margin: 0 auto 20px;
  display: flex;
  gap: 8px;
}
.explore-form input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

/* Post detail */
.post-detail { max-width: 614px; margin: 0 auto; }

/* Feed empty */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 16px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #262626;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Loading / misc */
.loading { text-align: center; color: var(--muted); padding: 40px; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt { margin-top: 12px; }

/* Responsive */
@media (max-width: 640px) {
  .profile-head { flex-direction: column; gap: 12px; text-align: center; }
  .profile-stats { justify-content: center; }
  .main { padding: 12px 8px 80px; }
}
/* ---- notifications UI ---- */
.nav-btn { position: relative; }
.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #ed4956; color: #fff;
  border-radius: 10px;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px;
  text-align: center;
}
.notif-title { padding: 8px 4px; }
.notif {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 8px; border-bottom: 1px solid #efefef;
}
.notif-body { flex: 1; font-size: 14px; line-height: 1.4; }
.notif-user { font-weight: 600; margin-right: 4px; }
.notif-post {
  margin-top: 6px; padding: 8px 10px; background: #fafafa;
  border: 1px solid #efefef; border-radius: 8px;
  font-size: 13px; color: #555;
}

/* ---- hashtag / mention links ---- */
.tag-link, .mention-link { color: #00376b; text-decoration: none; }
.tag-link:hover, .mention-link:hover { text-decoration: underline; }

/* ---- search UI ---- */
.search-form { display: flex; flex: 1; max-width: 300px; margin: 0 12px; }
.search-form input {
  flex: 1; padding: 6px 12px; border: 1px solid #dbdbdb;
  border-radius: 8px; font-size: 13px; background: #fafafa; outline: none;
}
.search-item {
  display: flex; gap: 12px; align-items: center; padding: 10px 8px;
  border-bottom: 1px solid #efefef; text-decoration: none; color: inherit;
}
.srch-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; background: #efefef; }
.srch-thumb.noimg { display: inline-flex; align-items: center; justify-content: center; }
.search-item span { font-size: 14px; }

/* ---- comment replies / thread ---- */
.comment-reply {
  background: none; border: none; color: #00376b;
  font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 0; margin-top: 2px;
}
.comment-reply:hover { text-decoration: underline; }
.reply-box { margin-top: 4px; }
.comment { margin-bottom: 6px; }

/* ---- multi-image carousel ---- */
.carousel { position: relative; }
.post-img.carousel-slide { display: none; }
.post-img.carousel-slide.active { display: block; }
.car-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.5); color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2; line-height: 1;
}
.car-nav.prev { left: 8px; }
.car-nav.next { right: 8px; }
.car-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; z-index: 2; }
.car-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; }
.car-dot.active { background: var(--surface-2); }
/* ---- composer multi-preview ---- */
.preview-row { display: flex; flex-wrap: wrap; gap: 6px; }
.preview-thumb { width: 78px; height: 78px; object-fit: cover; border-radius: 8px; background: #efefef; }

/* ---- admin / moderation UI ---- */
.admin-hint { padding: 0 8px; font-size: 12px; }
.admin-user {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 8px; border-bottom: 1px solid #efefef;
}
.role-row { display: flex; gap: 6px; }
.role-pill {
  padding: 5px 10px; border-radius: 999px; border: 1px solid #dbdbdb;
  background: var(--surface-2); color: #555; font-size: 12px; cursor: pointer;
}
.role-pill.active { background: #0095f6; border-color: #0095f6; color: #fff; }
.role-pill:disabled { cursor: default; opacity: .7; }

/* ---- moderation queue ---- */
.mod-post {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 8px; border-bottom: 1px solid #efefef;
}
.mod-post.is-hidden { opacity: .6; background: #fafafa; }
.mod-post-body { flex: 1; }
.mod-post-auth { font-size: 12px; margin-top: 2px; }
.mod-btn {
  padding: 6px 12px; border-radius: 999px; border: 1px solid #dbdbdb;
  background: var(--surface-2); color: #555; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.mod-btn.hidden-st { background: #0095f6; border-color: #0095f6; color: #fff; }
.mod-btn:disabled { opacity: .6; cursor: default; }

/* ---- discover / trending hashtags ---- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid #dbdbdb;
  background: #fafafa; color: #00376b; font-size: 13px; text-decoration: none;
}
.tag-chip:hover { background: #eef2f7; }


/* ================= stories (ephemeral) ================= */
.story-ring { display:flex; gap:14px; overflow-x:auto; padding:12px 6px; border-bottom:1px solid #efefef; background:#fff; }
.story-ring::-webkit-scrollbar { display:none; }
.story-add, .story-item { background:none; border:none; cursor:pointer; flex:0 0 auto; display:flex; flex-direction:column; align-items:center; gap:4px; padding:0; width:66px; }
.story-ring-img { width:60px; height:60px; border-radius:50%; background-size:cover; background-position:center; border:3px solid #fff; box-shadow:0 0 0 2px #d62976; }
.story-ring-empty { background:linear-gradient(45deg,#feda75,#d62976,#962fbf); }
.story-plus { width:60px; height:60px; border-radius:50%; border:2px dashed #d62976; display:flex; align-items:center; justify-content:center; font-size:32px; color:#d62976; background:#fff; font-weight:300; }
.story-caption { font-size:11px; color:#333; max-width:66px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.story-loading { font-size:13px; color:#999; }

.story-overlay { position:fixed; inset:0; background:#000; z-index:3000; display:none; flex-direction:column; }
.story-overlay.open { display:flex; }
.story-top { position:absolute; top:0; left:0; right:0; padding:12px; display:flex; flex-direction:column; gap:14px; z-index:2; }
.story-bars { display:flex; gap:4px; }
.story-bar { height:3px; border-radius:2px; background:rgba(255,255,255,.35); flex:1; width:0; }
.story-bar.active, .story-bar.done { background:rgba(255,255,255,.9); }
.story-meta { display:flex; align-items:center; justify-content:space-between; }
.story-author-name { color:#fff; font-weight:600; font-size:14px; }
.story-close { background:none; border:none; color:#fff; font-size:22px; cursor:pointer; padding:0; line-height:1; }
.story-stage { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.story-media { max-width:100%; max-height:100vh; object-fit:contain; }

/* ================= reels (vertical video) ================= */
.reels-toolbar { padding:10px 6px; border-bottom:1px solid #efefef; background:#fff; text-align:center; }
.reels-list { display:flex; flex-direction:column; align-items:center; gap:20px; padding:16px 8px; }
.reel-item { width:100%; max-width:420px; background:#111; border-radius:16px; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.reel-frame { aspect-ratio:9 / 16; width:100%; background:#000; position:relative; }
.reel-video { width:100%; height:100%; object-fit:cover; display:block; background:#000; }
.reel-caption { padding:10px 12px; background:#fff; color:#444; font-size:14px; }
.reel-caption strong { color:#222; margin-right:4px; }


/* ================= live ================= */
.live-toolbar { padding:10px 6px; border-bottom:1px solid #efefef; background:#fff; text-align:center; }
.live-list { padding:16px 8px; display:flex; flex-direction:column; gap:12px; }
.live-card { display:flex; align-items:center; gap:8px; padding:14px 12px; background:#fff; border:1px solid #efefef; border-radius:12px; text-decoration:none; color:#222; }
.live-card:hover { background:#fafafa; }
.live-dot { width:10px; height:10px; border-radius:50%; background:#ff3344; box-shadow:0 0 0 0 rgba(255,51,68,.5); animation:live-pulse 1.4s infinite; flex:none; }
@keyframes live-pulse { 0% { box-shadow:0 0 0 0 rgba(255,51,68,.5);} 70% { box-shadow:0 0 0 8px rgba(255,51,68,0);} 100% { box-shadow:0 0 0 0 rgba(255,51,68,0);} }
.live-broadcast { max-width:460px; margin:0 auto; padding:16px; }
.live-broadcast video { width:100%; aspect-ratio:9 / 16; background:#000; border-radius:16px; object-fit:cover; }
#live-title { width:100%; margin:12px 0; }
.live-btns { text-align:center; margin:8px 0; }
.live-watch { max-width:500px; margin:0 auto; padding:12px; }
.live-watch video { width:100%; aspect-ratio:9 / 16; background:#000; border-radius:16px; }

.live-remote { padding:4px 8px 16px; }
.live-remote-title { font-weight:600; color:#666; padding:10px 4px; font-size:13px; text-transform:uppercase; letter-spacing:.4px; }

/* =====================================================================
   InstaPub Design System - professional refine (cascade layer)
   Visual language upgrade. Functional/layout rules below are preserved;
   this later layer wins for the properties it sets.
   ===================================================================== */

/* ---------- global polish ---------- */
* { -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--fg);
  background: var(--bg);
}
::selection { background: rgba(214,41,118,.16); }
a, button, .action-btn { }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- auth / onboarding ---------- */
.auth-screen {
  background:
    radial-gradient(at 18% 18%, rgba(253,218,117,.16), transparent 46%),
    radial-gradient(at 82% 12%, rgba(214,41,118,.13), transparent 46%),
    radial-gradient(at 72% 92%, rgba(79,91,213,.14), transparent 46%),
    var(--bg);
}
.auth-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  background: var(--card);
  overflow: hidden;
}
.auth-card::before {
  content: '';
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--grad1), var(--grad2), var(--grad3), var(--grad4));
}
.brand-icon {
  width: 76px; height: 76px; margin: 2px auto 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 34px; line-height: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad1), var(--grad2), var(--grad3), var(--grad4));
  box-shadow: var(--sh-accent);
}
.brand-name { font-size: var(--font-lg); font-weight: 800; letter-spacing: -.5px; }
.brand-tagline { color: var(--fg-2); font-size: 13px; }
.auth-form input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.auth-form input:focus, .auth-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(42,109,244,.14);
}

/* ---------- buttons ---------- */
.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-radius: var(--r-sm);
  box-shadow: var(--sh-accent);
  letter-spacing: .2px;
  transition: filter var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(213,41,118,.34); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(.99); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }

/* Telegram login widget */
.telegram-login { display: flex; justify-content: center; margin: 6px 0 10px; }
.telegram-login iframe { border: 0; border-radius: 8px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: #999; font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(128,128,128,.25); }
.btn-link { color: var(--accent); }
.btn-link:hover { text-decoration: underline; }
.btn-outline { border: 1px solid var(--border-strong); background: var(--card); color: var(--fg-2); transition: border-color var(--t-fast), color var(--t-fast), background-color var(--t-fast); }
.btn-outline:hover { border-color: var(--fg-2); color: var(--fg); }
.btn-outline.active { background: var(--fg); border-color: var(--fg); color: var(--card); }
.btn-danger { border: none; background: linear-gradient(135deg, #f0606c, var(--danger)); box-shadow: 0 6px 16px rgba(224,62,78,.26); transition: filter var(--t-fast), transform var(--t-fast); }
.btn-danger:hover { filter: brightness(1.06); }

/* ---------- topbar ---------- */
.topbar { background: rgba(255,255,255,.84); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--border); }
.logo { font-weight: 800; }
.search-form input {
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--fg);
  border-radius: var(--r-full);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.search-form input:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px rgba(42,109,244,.14); }
.nav-btn { transition: transform var(--t-fast), color var(--t-fast); }
.nav-btn:hover { transform: translateY(-1px); }
.nav-btn:active { transform: translateY(0) scale(.92); }
.nav-btn.avatar { box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--border-strong); }

/* ---------- generic button base (conservative) ---------- */
.btn { border: none; font-family: inherit; cursor: pointer; }

/* ---------- feed / post cards ---------- */
.post-card { border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.post-head { gap: 12px; }
.avatar-sm, .avatar-lg {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(214,41,118,.4);
}
.action-btn { transition: transform var(--t-fast), color var(--t-fast); }
.action-btn:hover { transform: translateY(-2px); }
.action-btn.liked { color: var(--danger); }
.post-likes { font-family: var(--font); }
.post-caption { font-size: 14px; color: var(--fg); }
.post-caption .time { color: var(--muted); }
.post-caption .hashtag, .post-caption a { color: var(--accent); }

/* ---------- profile ---------- */
.profile-head { padding: var(--sp-5) 0; }
.avatar-lg { box-shadow: 0 0 0 4px var(--card), 0 0 0 5px rgba(214,41,118,.35); }
.profile-username { font-weight: 600; letter-spacing: -.3px; }
.profile-bio { color: var(--fg-2); }
.stat-num { font-weight: 700; }
.stat-label { color: var(--muted); }
.profile-actions .btn { min-height: 34px; }
.post-grid { gap: 4px; }
.grid-item { border-radius: var(--r-sm); overflow: hidden; transition: transform var(--t-fast), box-shadow var(--t-fast); }
.grid-item:hover { transform: scale(1.01); box-shadow: var(--sh-md); z-index: 1; }
.grid-ov { background: rgba(13,13,13,.42); border-radius: inherit; }

/* ---------- composer ---------- */
.composer { border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.composer-head { font-weight: 700; color: var(--fg-2); font-size: 15px; letter-spacing: .2px; }
.composer-drop { border-color: var(--border-strong); background: var(--surface-2); transition: border-color var(--t-fast), background-color var(--t-fast); }
.composer-drop:hover { border-color: var(--accent); background: var(--surface); }
.composer textarea { border: 1px solid var(--border); color: var(--fg); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42,109,244,.14); }
.preview-thumb { box-shadow: var(--sh-sm); }

/* ---------- empty / loading ---------- */
.empty { color: var(--fg-2); font-size: 15px; }
.loading { color: var(--fg-2); }

/* ---------- toast ---------- */
.toast {
  background: rgba(23,25,29,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--sh-lg);
  animation: toast-in .25s cubic-bezier(.4,0,.2,1);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---------- generic inputs (views) ---------- */
.input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px rgba(42,109,244,.14); }

/* ---------- explore ---------- */
.explore-item { border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.explore-form input { border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); border-radius: var(--r-sm); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.explore-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42,109,244,.14); }

/* ---------- search ---------- */
.search-item { transition: background-color var(--t-fast); }
.search-item:hover { background: var(--surface-2); }
.srch-thumb { border-radius: var(--r-sm); box-shadow: var(--sh-sm); }

/* ---------- hashtags / mentions ---------- */
.tag-link, .mention-link { color: var(--accent); font-weight: 500; }
.tag-link:hover, .mention-link:hover { text-decoration: underline; }
.tag-chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--accent); transition: background-color var(--t-fast), border-color var(--t-fast); }
.tag-chip:hover { background: var(--surface-3); border-color: var(--border-strong); }

/* ---------- notifications ---------- */
.notif-title { color: var(--fg-2); font-weight: 700; }
.notif { padding: 14px 12px; transition: background-color var(--t-fast); }
.notif:hover { background: var(--surface-2); }
.notif-body { color: var(--fg); }
.notif-user { color: var(--fg); }
.notif-post { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--fg-2); }

/* ---------- comments ---------- */
.comment-reply { color: var(--accent); }
.comment-user { font-weight: 600; color: var(--fg); }
.comment-body { color: var(--fg-2); }
.comment-muted { color: var(--muted); }
.comment-box, .comment-input { border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); border-radius: var(--r-full); padding: 8px 14px; font-family: inherit; font-size: 14px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.comment-box:focus, .comment-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42,109,244,.12); }
.comment-send { color: var(--accent); font-weight: 600; }

/* ---------- admin / moderation ---------- */
.admin-hint { color: var(--muted); }
.admin-user { padding: 12px; border-radius: var(--r-sm); }
.admin-user:hover { background: var(--surface-2); }
.role-pill, .mod-btn { border: 1px solid var(--border-strong); background: var(--card); color: var(--fg-2); transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.role-pill.active, .mod-btn.hidden-st { background: linear-gradient(135deg, var(--brand-2), var(--brand)); border-color: transparent; color: #fff; }
.role-pill:hover:not(:disabled):not(.active), .mod-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.mod-post { padding: 12px; border-radius: var(--r-sm); }
.mod-post.is-hidden { background: var(--surface-2); }
.mod-post-auth { color: var(--muted); }

/* ---------- stories ring (brand-coherent) ---------- */
.story-ring { background: var(--card); border-bottom: 1px solid var(--border); }
.story-ring-img { box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(214,41,118,.55); }
.story-ring-empty { background: linear-gradient(135deg, var(--grad1), var(--grad2), var(--grad3), var(--grad4)); }
.story-plus { border: 2px dashed rgba(214,41,118,.6); color: var(--brand); background: var(--card); }
.story-caption { color: var(--fg-2); }
.story-loading { color: var(--muted); }
.story-overlay { background: #0b0b0f; }
.story-bar { background: rgba(255,255,255,.28); }
.story-bar.active, .story-bar.done { background: rgba(255,255,255,.96); }
.story-author-name { color: #fff; }
.story-close { color: #fff; transition: transform var(--t-fast); }
.story-close:hover { transform: scale(1.15); }

/* ---------- reels ---------- */
.reels-toolbar { background: var(--card); border-bottom: 1px solid var(--border); }
.reel-item { border-radius: var(--r-lg); box-shadow: var(--sh-md); }
.reel-frame { background: #0b0b0f; }
.reel-caption { background: var(--card); color: var(--fg-2); }
.reel-caption strong { color: var(--fg); }
.reel-new-btn { background: linear-gradient(135deg, var(--brand-2), var(--brand)); border-radius: var(--r-sm); box-shadow: var(--sh-accent); }

/* ---------- live ---------- */
.live-toolbar { background: var(--card); border-bottom: 1px solid var(--border); }
.live-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--fg); transition: box-shadow var(--t-fast), transform var(--t-fast), background-color var(--t-fast); }
.live-card:hover { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--sh-md); }
.live-dot { background: #ff3344; box-shadow: 0 0 0 0 rgba(255,51,68,.5); }
.live-remote-title { color: var(--fg-2); }
.live-broadcast video, .live-watch video { border-radius: var(--r-lg); box-shadow: var(--sh-md); }
.live-btns .btn { min-height: 40px; padding: 0 20px; }
.live-broadcast, .live-watch, .live-list { }

/* ---------- surface consistency (theme-safe surfaces) ---------- */
.post-card, .composer, .explore-item { background: var(--card); }
.topbar { background: var(--surface); }

/* ---------- dark theme (tokens only; surfaces resolve via tokens) ---------- */
/* controlled by a data-theme attribute on <html>; defaults follow the OS via JS */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000;
  --card: #0a0a0a;
  --surface: #0a0a0a;
  --surface-2: #1a1a1a;
  --surface-3: #262626;
  --border: #363636;
  --border-strong: #4a4a4a;
  --fg: #fafafa;
  --fg-2: #a8a8a8;
  --muted: #b0b0b0;
  --on-accent: #ffffff;
  --sh-sm: 0 1px 2px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.4);
  --sh-md: 0 4px 14px rgba(0,0,0,.45);
  --sh-lg: 0 14px 40px rgba(0,0,0,.55);
  --sh-accent: 0 8px 24px rgba(214,41,118,.42);
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border-strong); border-color: var(--bg); }

/* ---------- theme toggle button ---------- */
#theme-btn { font-size: 20px; line-height: 1; }

/* ---------- accessibility: respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- themed overrides for inline-styled widgets (dark-safe) ---------- */
#edit-display { border: 1px solid var(--border) !important; background: var(--surface-2); color: var(--fg); border-radius: var(--r-sm); }
#edit-bio { background: var(--surface-2); color: var(--fg); }

/* ---------- loading spinner (unified loading treatment) ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dsh-spin .8s linear infinite;
  flex: none;
}
@keyframes dsh-spin { to { transform: rotate(360deg); } }

/* ---------- skeleton shimmer component (design-system utility) ---------- */
:root { --dsh-shimmer: rgba(255,255,255,.5); }
html[data-theme="dark"] { --dsh-shimmer: rgba(255,255,255,.05); }
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--dsh-shimmer), transparent);
  animation: dsh-shimmer 1.6s infinite;
}
@keyframes dsh-shimmer { 100% { transform: translateX(100%); } }

/* ---------- micro-interaction polish ---------- */
.post-card { transition: box-shadow var(--t-base), border-color var(--t-base); }
.post-card:hover { box-shadow: var(--sh-md); }
.avatar-sm, .avatar-lg { transition: transform var(--t-fast); }


/* ---------- responsive refinements (mobile-safe tightning) ---------- */
@media (max-width: 700px) {
  .topbar-inner { padding: 8px 10px; gap: 6px; }
  .logo { font-size: 20px; }
  .nav-actions { gap: 7px; }
  .nav-btn { font-size: 19px; }
  .search-form { max-width: none; margin: 0 4px; min-width: 0; }
  .search-form input { padding: 6px 10px; font-size: 13px; min-width: 0; }
  .profile-stats { gap: 20px; }
  .post-actions { gap: 10px; }
}
@media (max-width: 420px) {
  .nav-btn { font-size: 17px; }
  .search-form input { width: 90px; }
  .logo { font-size: 17px; letter-spacing: -.3px; }
}

/* ---------- live statistics panel (PeerTube-style) ---------- */
.live-stats {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 12px;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, ui-monospace, monospace;
}
.live-stats-title {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.lst-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.lst-k { color: var(--fg-2); }
.lst-v { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- live video effects (Instagram-style filters + stickers) ---------- */
.fx-stage { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--r-md); overflow: hidden; }
.fx-canvas { width: 100%; height: 100%; display: block; }
.fx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.fx-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--fg-2); font-weight: 700; }
.fx-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-filter { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer; transition: all var(--t-fast); }
.fx-filter:hover { border-color: var(--accent); }
.fx-filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fx-sticker-add { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fx-emoji { font-size: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; padding: 2px 6px; line-height: 1.2; }
.fx-emoji:hover { border-color: var(--accent); transform: scale(1.08); }
.fx-text { padding: 6px 10px; font-size: 13px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--fg); width: 120px; }

/* ---------- Instagram-style integrated vertical player ---------- */
.ig-player { position: relative; width: 100%; max-width: 460px; margin: 0 auto; background: #000; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-lg); }
.ig-screen { position: relative; width: 100%; aspect-ratio: 9 / 16; background: #000; }
.ig-screen .fx-canvas { width: 100%; height: 100%; display: block; }
.ig-top { position: absolute; top: 10px; left: 10px; right: 66px; display: flex; gap: 8px; align-items: center; z-index: 6; }
.ig-live-dot { background: #e0245e; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .4px; }
.ig-badge { background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 4px 9px; border-radius: 999px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-icon { position: absolute; top: 10px; right: 10px; z-index: 6; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 50%; width: 34px; height: 34px; font-size: 15px; cursor: pointer; line-height: 1; }
.live-stats.ig-stats { position: absolute; top: 52px; right: 8px; z-index: 6; background: rgba(0,0,0,.68); color: #eee; max-width: 210px; font-size: 10px; padding: 8px 10px; border-radius: 10px; box-shadow: var(--sh-md); }
.live-stats.ig-stats .lst-row { border-bottom-color: rgba(255,255,255,.12); }
.ig-ctrl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 14px 10px 10px; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.72)); display: flex; flex-direction: column; gap: 8px; }
.ig-title-row { display: flex; gap: 8px; align-items: center; }
.ig-title { flex: 1; min-width: 0; font-size: 13px; }
.ig-fx { display: flex; flex-direction: column; gap: 6px; }
.ig-fx .fx-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.ig-fx .fx-filter { font-size: 11px; padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.14); color: #fff; cursor: pointer; transition: all var(--t-fast); }
.ig-fx .fx-filter:hover { border-color: #fff; }
.ig-fx .fx-filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fx-emoji-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ig-fx .fx-emoji { font-size: 18px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-radius: 8px; cursor: pointer; padding: 1px 6px; line-height: 1.3; transition: all var(--t-fast); }
.ig-fx .fx-emoji:hover { transform: scale(1.12); background: rgba(255,255,255,.3); }
.ig-fx .fx-text { padding: 5px 9px; font-size: 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.28); background: rgba(0,0,0,.45); color: #fff; width: 120px; }
.ig-fx .fx-text::placeholder { color: rgba(255,255,255,.5); }

/* ---------- viewer live player: chat, reactions, floating emoji ---------- */
.ig-video { width: 100%; height: 100%; display: block; object-fit: cover; background: #000; }
.ig-live-dot.on { background: #e0245e; }
.emoji-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 8; }
.rise { position: absolute; bottom: 120px; font-size: 34px; animation: riseUp 2.5s ease-out forwards; will-change: transform, opacity; }
@keyframes riseUp { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(-420px); opacity: 0; } }
.ig-react-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: rgba(255,255,255,.75); font-weight: 700; margin-right: 4px; }
.ig-ctrl.viewer .fx-emoji { font-size: 18px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-radius: 8px; cursor: pointer; padding: 1px 6px; line-height: 1.3; transition: all var(--t-fast); }
.ig-ctrl.viewer .fx-emoji:hover { transform: scale(1.12); background: rgba(255,255,255,.3); }
.chat-panel { position: absolute; left: 10px; right: 10px; bottom: 66px; height: 34%; max-height: 210px; display: flex; flex-direction: column; z-index: 7; background: rgba(0,0,0,.38); border-radius: 12px; overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; -webkit-overflow-scrolling: touch; }
.chat-msg { color: #fff; line-height: 1.35; word-break: break-word; }
.chat-msg.self .chat-name { color: #7dd3fc; }
.chat-name { font-weight: 700; color: #fda4af; margin-right: 4px; }
.chat-input { display: flex; gap: 6px; padding: 6px; background: rgba(0,0,0,.5); }
.chat-text { flex: 1; min-width: 0; }
.ig-ctrl.viewer { align-items: flex-start; }

/* ---------- Professional Instagram-style polish (safe override of flat chrome) ---------- */
.ig-player { border-radius: 20px; box-shadow: 0 22px 60px rgba(0,0,0,.38); outline: 1px solid rgba(255,255,255,.07); }
.ig-top { z-index: 12; }
.ig-live-dot { background: linear-gradient(135deg,#f5476a,#e0245e); box-shadow: 0 4px 16px rgba(224,36,94,.55); padding: 5px 12px; font-size: 11px; letter-spacing: .5px; }
.ig-badge { background: rgba(18,18,24,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.14); padding: 5px 11px; box-shadow: 0 4px 14px rgba(0,0,0,.22); }
.ig-icon { background: rgba(18,18,24,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 4px 14px rgba(0,0,0,.24); transition: transform var(--t-fast), background var(--t-fast); }
.ig-icon:hover { transform: scale(1.08); background: rgba(18,18,24,.6); }
/* reaction emoji float ABOVE all overlays (chat, stats, controls) — never covered */
.emoji-layer { z-index: 40; }
.rise { bottom: 24px; }
.ig-ctrl { background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.78) 72%); }
.ig-ctrl.viewer { background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.82) 74%); }
.ig-react-label { background: rgba(255,255,255,.1); padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(6px); font-size: 10px; letter-spacing: .6px; }
/* soft pill emoji/effect buttons (not flat squares) */
.ig-ctrl.viewer .fx-emoji, .ig-fx .fx-emoji {
  background: linear-gradient(rgba(255,255,255,.2), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.18); border-radius: 14px;
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 21px; padding: 0; line-height: 1;
  box-shadow: 0 3px 10px rgba(0,0,0,.28); backdrop-filter: blur(6px);
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.ig-ctrl.viewer .fx-emoji:hover, .ig-fx .fx-emoji:hover { transform: translateY(-3px) scale(1.1); background: linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.16)); box-shadow: 0 9px 22px rgba(0,0,0,.4); }
.ig-ctrl.viewer .fx-emoji:active, .ig-fx .fx-emoji:active { transform: translateY(0) scale(.92); }
/* filter pills */
.ig-fx .fx-filter { background: rgba(255,255,255,.12); backdrop-filter: blur(6px); border-radius: 999px; padding: 6px 13px; font-size: 11px; letter-spacing: .3px; border: 1px solid rgba(255,255,255,.16); transition: all var(--t-fast); }
.ig-fx .fx-filter:hover { background: rgba(255,255,255,.22); transform: translateY(-1px); }
.ig-fx .fx-filter.active { background: linear-gradient(135deg,#f5476a,#d62976); border-color: rgba(255,255,255,.3); box-shadow: 0 4px 16px rgba(214,41,118,.5); }
/* inputs */
.ig-fx .fx-text, .chat-text { background: rgba(18,18,24,.5); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 9px 15px; color: #fff; font-size: 12px; }
.ig-fx .fx-text::placeholder, .chat-text::placeholder { color: rgba(255,255,255,.45); }
/* chat — soft glass, clearly above the reaction dock, never overlapping it */
.chat-panel { bottom: 80px; background: rgba(10,10,14,.4); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; box-shadow: 0 10px 34px rgba(0,0,0,.32); }
.chat-msgs { gap: 6px; padding: 10px 10px 4px; }
.chat-msg { animation: msgIn .25s ease; background: rgba(255,255,255,.06); padding: 6px 11px; border-radius: 12px; font-size: 12px; max-width: 100%; }
.chat-msg.self { background: rgba(56,130,246,.24); }
.chat-msg.self .chat-name { color: #93c5fd; }
.chat-input { background: transparent; padding: 8px; gap: 8px; }
#chat-send { border-radius: 999px; padding: 8px 16px; font-weight: 700; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.live-stats.ig-stats { background: rgba(10,10,14,.6); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.35); z-index: 12; }

/* ---------- chat/emoji UX refinements ---------- */
.ig-ctrl.viewer .fx-emoji, .ig-fx .fx-emoji {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.ig-ctrl.viewer .fx-emoji[data-emoji="❤"], .ig-fx .fx-emoji[data-emoji="❤"] { background: rgba(255,45,85,.22); border-color: rgba(255,45,85,.35); }
.ig-ctrl.viewer .fx-emoji[data-emoji="❤"]:hover, .ig-fx .fx-emoji[data-emoji="❤"]:hover { background: rgba(255,45,85,.36); box-shadow: 0 6px 22px rgba(255,45,85,.45); }
.chat-panel { background: rgba(10,10,14,.16); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); border-color: rgba(255,255,255,.08); box-shadow: 0 6px 22px rgba(0,0,0,.2); }

/* ---------- ephemeral chat + reaction animation (JS-driven) ---------- */
.chat-toggle-btn { top: 54px !important; }
.chat-toggle-btn.active { background: rgba(56,130,246,.7); }
.chat-float { position: absolute; left: 12px; right: 12px; bottom: 64px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; z-index: 9; }
.ig-player.chat-open .chat-float { bottom: 150px; }
.cmsg { background: rgba(255,255,255,.09); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 6px 11px; border-radius: 12px; font-size: 12px; color: #fff; max-width: 82%; animation: msgUp .3s ease; }
.cmsg.self { background: rgba(56,130,246,.2); }
.cmsg .cname { font-weight: 700; color: #fda4af; }
.cmsg.self .cname { color: #93c5fd; }
.cmsg.out { animation: msgDissolve .75s ease forwards; }
@keyframes msgUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes msgDissolve { to { opacity: 0; transform: translateY(-16px); } }
.chat-compose { position: absolute; left: 12px; right: 12px; bottom: 64px; display: flex; gap: 8px; align-items: center; background: rgba(10,10,14,.25); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 8px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity var(--t-base), transform var(--t-base); z-index: 10; }
.chat-compose.open { opacity: 1; transform: none; pointer-events: auto; }
.chat-compose .chat-text { flex: 1; min-width: 0; }
.rise { animation: none; }

/* ---------- transparent emoji buttons + red bloom hover (all) ---------- */
.ig-ctrl.viewer .fx-emoji, .ig-fx .fx-emoji { background: transparent; border: none; box-shadow: none; backdrop-filter: none; }
.ig-ctrl.viewer .fx-emoji[data-emoji="❤"], .ig-fx .fx-emoji[data-emoji="❤"] { background: transparent; border: none; box-shadow: none; }
.ig-ctrl.viewer .fx-emoji:hover, .ig-fx .fx-emoji:hover {
  transform: translateY(-3px) scale(1.16);
  background: radial-gradient(circle, rgba(255,45,85,.36), rgba(255,45,85,0) 66%);
  box-shadow: 0 0 16px rgba(255,45,85,.55);
}
.ig-ctrl.viewer .fx-emoji:active, .ig-fx .fx-emoji:active { transform: translateY(0) scale(.94); }

/* ---------- scrollable chat history (open) ---------- */
.chat-hist { position: absolute; left: 10px; right: 10px; bottom: 122px; max-height: 50%; overflow-y: auto; pointer-events: auto; background: rgba(10,10,14,.14); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); border-radius: 16px; border: 1px solid rgba(255,255,255,.06); padding: 8px 10px; z-index: 9; display: none; opacity: 0; transition: opacity var(--t-base); }
.ig-player.chat-open .chat-hist { display: block; opacity: 1; }
.ig-player.chat-open .chat-float { display: none; }
.chat-line { padding: 5px 2px; font-size: 12px; color: #fff; line-height: 1.4; border-bottom: 1px solid rgba(255,255,255,.05); }
.chat-line:last-of-type { border-bottom: none; }
.chat-line .cname { font-weight: 700; color: #fda4af; }
.chat-line.self .cname { color: #93c5fd; }

/* ---------- live ended / offline state ---------- */
.ig-live-dot.off { background: rgba(128,128,136,.28); color: #cfcfd6; box-shadow: none; animation: none; }

/* ---------- end live button ---------- */
.btn.end-live { background: linear-gradient(135deg,#ff2d55,#e0245e); border-color: transparent; color: #fff; }
.btn.end-live:hover { background: linear-gradient(135deg,#ff4d6d,#ef3c68); box-shadow: 0 6px 18px rgba(255,45,85,.4); }

/* ---------- host chat over broadcast controls ---------- */
.ig-player.live-broadcast .chat-float { bottom: 148px; }
.ig-player.live-broadcast .host-compose { bottom: 108px; z-index: 11; }