:root {
  --brand: #7c5cff;
  --brand-2: #ff5c9d;
  --accent: #2ee6c5;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* الوضع الداكن (افتراضي) */
html[data-theme="dark"] {
  --bg: #0f1226;
  --bg-2: #161a3a;
  --card: rgba(255, 255, 255, 0.06);
  --card-2: rgba(0, 0, 0, 0.25);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef0ff;
  --muted: #9aa0c7;
  --topbar: rgba(15, 18, 38, 0.6);
  --solid: #1b1f44;
}
/* الوضع الفاتح */
html[data-theme="light"] {
  --bg: #f3f4fb;
  --bg-2: #e9ebf7;
  --card: #ffffff;
  --card-2: #f1f2fa;
  --border: rgba(20, 24, 60, 0.12);
  --text: #1b1f3a;
  --muted: #69708f;
  --topbar: rgba(255, 255, 255, 0.75);
  --shadow: 0 14px 30px rgba(40, 50, 100, 0.12);
  --solid: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cairo', system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 92, 255, 0.30), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(255, 92, 157, 0.22), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
}

/* Header */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px); background: var(--topbar);
  border-bottom: 1px solid var(--border);
  transition: padding .22s ease, box-shadow .22s ease;
}
.topbar.compact { padding-top: 6px; padding-bottom: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28); }
/* زر إظهار/إخفاء الشريط العلوي (الجوال فقط) */
.bar-toggle { display: none; position: fixed; top: 10px; inset-inline-end: 10px; z-index: 60; width: 44px; height: 44px; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--solid); color: var(--text); font-size: 20px; box-shadow: var(--shadow); cursor: pointer; }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.logo { width: 44px; height: 44px; display: grid; place-items: center; font-size: 24px; font-weight: 900; color: #fff; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 24px rgba(124, 92, 255, 0.5); transition: width .22s ease, height .22s ease, font-size .22s ease, border-radius .22s ease; }
.brand-text h1 { font-size: 20px; font-weight: 900; transition: font-size .22s ease; }
.brand-text span { font-size: 12px; color: var(--muted); }
.topbar.compact .logo { width: 36px; height: 36px; font-size: 20px; border-radius: 11px; box-shadow: 0 6px 16px rgba(124, 92, 255, 0.45); }
.topbar.compact .brand-text h1 { font-size: 17px; }
.topbar.compact .brand-text span { display: none; }

.search-wrap { position: relative; flex: 1; max-width: 420px; display: flex; align-items: center; }
.search-input { width: 100%; height: 40px; background: var(--card-2); border: 1px solid var(--border); border-radius: 999px; color: var(--text); padding: 0 40px; font-family: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s; }
.search-input:focus { outline: none; border-color: var(--brand); background: var(--card); box-shadow: 0 0 0 3px rgba(124,92,255,0.18); }
.search-icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .7; pointer-events: none; }
.search-clear { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: grid; place-items: center; border: none; border-radius: 50%; background: var(--border); color: var(--text); cursor: pointer; font-size: 12px; padding: 0; }
.search-clear:hover { background: var(--brand-2); color: #fff; }
.search-dropdown { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; inset-inline-end: 0; background: var(--solid); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.45); max-height: 360px; overflow-y: auto; z-index: 60; padding: 6px; }
.search-result { padding: 9px 11px; border-radius: 9px; cursor: pointer; transition: background .12s; }
.search-result:hover { background: var(--card-2); }
.sr-text { font-size: 14px; color: var(--text); line-height: 1.4; word-break: break-word; }
.sr-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.search-dropdown mark { background: var(--brand-2); color: #fff; border-radius: 3px; padding: 0 2px; }
.search-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.share-menu { position: fixed; z-index: 200; min-width: 190px; background: var(--solid); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.45); padding: 6px; }
.share-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: transparent; color: var(--text); font-size: 14px; text-align: start; border-radius: 9px; cursor: pointer; transition: background .12s; }
.share-opt:hover { background: var(--card-2); }
.share-ic { font-size: 16px; width: 20px; text-align: center; }
.focus-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-size: 14px; color: var(--text); }
.focus-bar button { white-space: nowrap; }
.img-btn { background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 16px; padding: 6px 9px; line-height: 1; transition: background .12s; }
.img-btn:hover { background: var(--brand-2); }
.img-preview { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.prev-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.prev-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prev-thumb button { position: absolute; top: 2px; inset-inline-end: 2px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 11px; display: grid; place-items: center; padding: 0; }
.post-images { display: grid; gap: 6px; margin: 8px 0; border-radius: 12px; overflow: hidden; }
.post-images.one { grid-template-columns: 1fr; }
.post-images[hidden] { display: none !important; }
.img-attach { margin: 8px 0; }
.img-attach-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--border); color: var(--text); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 13px; transition: background .12s; }
.img-attach-btn:hover, .img-attach-btn.open { background: var(--brand-2); }
.img-attach .post-images { margin-top: 8px; }
.post-images.two { grid-template-columns: 1fr 1fr; }
.post-images.many { grid-template-columns: 1fr 1fr 1fr; }
.post-img { width: 100%; max-height: 420px; object-fit: cover; cursor: zoom-in; display: block; background: var(--card-2); }
.post-images.one .post-img { max-height: 540px; object-fit: contain; }
.comment-bubble .post-images { margin: 6px 0 2px; }
.comment-bubble .post-img { max-height: 240px; }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: 92vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
.lb-close { position: fixed; top: 16px; inset-inline-end: 18px; width: 42px; height: 42px; border: none; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 20px; cursor: pointer; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: none; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 30px; cursor: pointer; display: grid; place-items: center; }
.lb-prev { inset-inline-start: 14px; }
.lb-next { inset-inline-end: 14px; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.3); }

.header-tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.icon-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; font-size: 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.icon-btn:hover { border-color: var(--brand); }
.notif-dot { position: absolute; top: 6px; inset-inline-end: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--brand-2); color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 700; }
.notif-wrap { position: relative; }
.dropdown { position: absolute; top: 48px; inset-inline-end: 0; width: 300px; max-height: 380px; overflow-y: auto; background: var(--solid); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); z-index: 40; padding: 8px; }
.lang-select, .sort-select { height: 40px; background-color: var(--solid); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-family: inherit; font-size: 13px; padding: 0 28px 0 10px; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0c7' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
html[dir="rtl"] .lang-select, html[dir="rtl"] .sort-select { padding: 0 10px 0 28px; background-position: left 10px center; }
.lang-select option, .sort-select option { background-color: var(--solid); color: var(--text); }

.auth-area { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); padding: 5px 12px 5px 5px; border-radius: 999px; cursor: pointer; }
.user-chip .uavatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #08111a; background: linear-gradient(135deg, var(--accent), var(--brand)); }
.user-chip .uname { font-size: 13px; font-weight: 700; }
.badge { font-size: 10px; color: #08111a; background: var(--accent); padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.btn-auth { cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; padding: 9px 16px; border-radius: 10px; border: none; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.btn-logout { cursor: pointer; font-family: inherit; font-size: 12px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); }
.btn-logout:hover { color: var(--text); border-color: var(--brand-2); }
.auth-loading { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: auth-spin .7s linear infinite; display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Layout */
.container { max-width: 640px; margin: 22px auto; padding: 0 14px 90px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }

/* Composer */
.composer { padding: 16px; margin-bottom: 18px; }
.composer-locked { text-align: center; padding: 12px; }
.composer-locked .lock-emoji { font-size: 32px; margin-bottom: 8px; }
.composer-locked p { color: var(--muted); margin-bottom: 12px; }
.composer-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 42px; height: 42px; flex: none; display: grid; place-items: center; font-weight: 900; font-size: 17px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--brand)); color: #08111a; }
.composer-name { font-weight: 700; }
.post-input { width: 100%; min-height: 84px; resize: vertical; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 12px; font-family: inherit; font-size: 16px; line-height: 1.6; }
.post-input:focus { outline: none; border-color: var(--brand); }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.composer-right { display: flex; align-items: center; gap: 12px; }
.anon-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.anon-toggle input { width: 16px; height: 16px; accent-color: var(--brand); }
.counter { font-size: 12px; color: var(--muted); }
.btn-post { border: none; cursor: pointer; padding: 10px 22px; border-radius: 11px; font-family: inherit; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 22px rgba(124, 92, 255, 0.4); transition: transform .12s, opacity .12s; }
.btn-post:hover { transform: translateY(-2px); }
.btn-post:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Trending */
.trending { padding: 14px 16px; margin-bottom: 16px; }
.trending h3 { font-size: 15px; margin-bottom: 10px; }

/* Filter bar */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.scope-tabs, .profile-tabs { display: flex; gap: 8px; }
.chip { cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted); }
.chip.active { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; }
.active-hashtag { margin-bottom: 12px; }
.active-hashtag .tag { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--brand); color: var(--brand); padding: 6px 14px; border-radius: 999px; font-weight: 700; }
.active-hashtag .tag button { background: none; border: none; color: inherit; cursor: pointer; font-size: 14px; }

.feed-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 12px; }
.feed-head h2 { font-size: 17px; font-weight: 700; }
.feed-head .stat { font-size: 13px; color: var(--muted); background: var(--card); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }
.feed-head strong { color: var(--accent); }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 14px; }
.post { padding: 15px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); animation: pop .25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post-avatar, .comment-avatar { flex: none; display: grid; place-items: center; font-weight: 900; border-radius: 50%; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; cursor: pointer; }
.post-avatar { width: 40px; height: 40px; }
.anon-avatar { background: linear-gradient(135deg, #555, #333); font-size: 20px; cursor: default; }
.composer-cat { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
.composer-cat label { font-size: 13px; color: var(--muted); font-weight: 700; }
.cat-select { flex: 1; max-width: 260px; height: 38px; background-color: var(--solid); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 14px; padding: 0 12px; cursor: pointer; }
.cat-select:focus { outline: none; border-color: var(--brand); }
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 12px; }
.cat-bar .cat-chip { white-space: nowrap; flex: 0 0 auto; }
.cat-tag { display: inline-block; margin: 0 0 8px; padding: 3px 11px; font-size: 12px; font-weight: 700; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.cat-tag:hover { border-color: var(--brand); color: var(--text); }
.post-meta { display: flex; flex-direction: column; }
.post-name { font-weight: 700; font-size: 14px; cursor: pointer; }
.post-name:hover { text-decoration: underline; }
.post-time { font-size: 11px; color: var(--muted); }
.post-body { font-size: 16px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.post-body .hash { color: var(--brand); cursor: pointer; font-weight: 700; }
.post-body .mention, .comment-text .mention {
  color: var(--brand-2); cursor: pointer; font-weight: 700;
  background: rgba(255,92,157,0.12); border-radius: 6px; padding: 0 4px;
}
.post-body .mention:hover, .comment-text .mention:hover { background: rgba(255,92,157,0.22); }
.post-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.action { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; padding: 6px 12px; border-radius: 10px; font-family: inherit; font-size: 13px; transition: all .12s; }
.action:hover { color: var(--text); border-color: var(--brand); }
.action.liked { color: var(--brand-2); border-color: var(--brand-2); background: rgba(255,92,157,0.1); }
.action.active { color: var(--brand); border-color: var(--brand); background: rgba(29,155,240,0.12); font-weight: 700; }
.action.delete:hover { color: #ff6b6b; border-color: #ff6b6b; }
.action:disabled { cursor: default; }

/* Comments */
.comments { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: none; }
.comments.open { display: block; animation: commentsIn .22s ease; }
@keyframes commentsIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.post.comments-open { box-shadow: inset 3px 0 0 var(--brand); }
html[dir="rtl"] .post.comments-open { box-shadow: inset -3px 0 0 var(--brand); }
.comment { display: flex; gap: 8px; padding: 7px 0; }
.comment.nested { margin-inline-start: 30px; }
.comment-avatar { width: 28px; height: 28px; font-size: 12px; }
.comment-bubble { background: var(--card-2); border: 1px solid var(--border); border-radius: 11px; padding: 7px 11px; flex: 1; }
.comment-name { font-weight: 700; font-size: 13px; cursor: pointer; }
.comment-time { font-size: 10px; color: var(--muted); margin-inline-start: 6px; }
.comment-text { font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.comment-acts { display: flex; gap: 10px; margin-top: 5px; }
.cact { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.cact:hover { color: var(--text); }
.cact.liked { color: var(--brand-2); }
.cact.del:hover { color: #ff6b6b; }
.reply-box { display: flex; gap: 8px; margin-top: 10px; }
.reply-box input { flex: 1; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 9px 12px; font-family: inherit; font-size: 14px; }
.reply-box .reply-input { flex: 1; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 9px 12px; font-size: 14px; min-height: 38px; max-height: 160px; overflow-y: auto; line-height: 1.5; }
.reply-input:focus { outline: none; border-color: var(--brand); }
.reply-toolbar { margin-top: 8px; margin-bottom: 0; }
.reply-toolbar .fmt-btn { min-width: 30px; height: 28px; font-size: 13px; }
.reply-box input:focus { outline: none; border-color: var(--brand); }
.reply-box button { border: none; cursor: pointer; padding: 0 16px; border-radius: 10px; font-family: inherit; font-weight: 700; color: #fff; background: var(--brand); }
.reply-locked { font-size: 13px; color: var(--muted); margin-top: 10px; }
.reply-counter { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: end; }

/* Profile */
.back-btn { margin-bottom: 14px; }
.profile-header { padding: 20px; margin-bottom: 16px; text-align: center; }
.profile-header .pavatar { width: 80px; height: 80px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.profile-header .pname { font-size: 22px; font-weight: 900; }
.profile-header .pbio { color: var(--muted); margin-top: 6px; font-size: 14px; }
.profile-header .pstats { display: flex; justify-content: center; gap: 22px; margin: 14px 0; }
.profile-header .pstats div strong { display: block; font-size: 18px; color: var(--accent); }
.profile-header .pstats div span { font-size: 12px; color: var(--muted); }
.profile-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.profile-edit { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.profile-edit input, .profile-edit textarea { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 10px 12px; font-family: inherit; font-size: 14px; }
.profile-tabs { justify-content: center; margin-bottom: 16px; }

/* Reports */
#reportsList { display: flex; flex-direction: column; gap: 14px; }
.reports-count { font-size: 13px; color: var(--muted); font-weight: 700; }
.report-card { padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.report-card .rtop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.report-card .rbadge { font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(255,92,157,0.15); color: var(--brand-2); }
.report-card .rbadge.comment { background: rgba(46,230,197,0.15); color: var(--accent); }
.report-card .rauthor { font-size: 13px; font-weight: 700; }
.report-card .rtime { font-size: 12px; color: var(--muted); margin-inline-start: auto; }
.report-card .rcontent { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.report-card .rmissing { color: var(--muted); font-style: italic; }
.report-card .rreason { margin-top: 8px; font-size: 13px; line-height: 1.5; }
.report-card .rreason-label { color: var(--muted); font-weight: 700; }
.report-card .racts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.report-card .racts .danger { color: #ff6b6b; }
.report-card .racts .small { padding: 6px 14px; font-size: 13px; }
.report-hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
.edit-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.real-hint { font-size: 12px; color: #f0a500; background: rgba(240,165,0,.12); padding: 1px 7px; border-radius: 10px; margin: 0 4px; white-space: nowrap; }
.confirm-card { max-width: 360px; text-align: center; }
.confirm-message { color: var(--muted); margin: 12px 0 18px; line-height: 1.6; }
.confirm-card .edit-actions { justify-content: center; }
.confirm-danger { background: #e0245e; }
.toast-wrap { position: fixed; bottom: 20px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--solid); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transform: translateY(16px); transition: opacity .3s ease, transform .3s ease; max-width: 90%; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--accent); }
.toast.error { border-color: #ff6b6b; }
.profile-sort { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.pcard .pcard-stats { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.pcard .pcard-stats .action { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 4px 12px; font-family: inherit; font-size: 12px; cursor: pointer; }
.pcard .pcard-stats .action:hover { background: var(--card-2); }
.flash { animation: flashHi 2s ease; }
@keyframes flashHi { 0%, 40% { box-shadow: 0 0 0 2px var(--brand), 0 0 24px rgba(124,92,255,0.55); } 100% { box-shadow: none; } }

/* Notifications dropdown items */
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.notif-head-title { font-weight: 700; font-size: 14px; }
.notif-clear { background: transparent; border: none; color: var(--brand); font-family: inherit; font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.notif-clear:hover { background: var(--card-2); }
.notif-item { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 10px; font-size: 13px; cursor: pointer; }
.notif-item:hover { background: var(--card-2); }
.notif-item.unread { background: rgba(124,92,255,0.12); }
.notif-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--card-2); border-radius: 50%; font-size: 13px; }
.notif-ava-wrap { flex: 0 0 36px; position: relative; width: 36px; height: 36px; }
.notif-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--brand-2), var(--brand)); background-size: cover; background-position: center; }
.notif-avatar.has-photo { color: transparent; }
.notif-badge { position: absolute; bottom: -2px; inset-inline-end: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--solid); border: 1px solid var(--border); display: grid; place-items: center; font-size: 10px; }
.notif-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-body > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 11px; color: var(--muted); }
.notif-del { flex: 0 0 auto; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 4px 6px; border-radius: 8px; opacity: 0; transition: opacity .12s; }
.notif-item:hover .notif-del { opacity: 1; }
.notif-del:hover { color: #ff6b6b; background: var(--card-2); }
.notif-empty { padding: 24px 18px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; }
@media (max-width: 480px) { .dropdown { width: calc(100vw - 24px); inset-inline-end: -8px; } }

/* قائمة المتابعين/المتابَعين */
.people-card { max-width: 380px; }
.people-list { max-height: 60vh; overflow-y: auto; margin-top: 12px; }
.people-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.people-row:hover { background: var(--card-2); }
.people-avatar { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; }
.people-name { font-weight: 600; }
.profile-header .pstat { cursor: pointer; border-radius: 10px; padding: 4px 10px; transition: background .12s; }
.profile-header .pstat:hover { background: var(--card-2); }
.profile-header .pstat.static { cursor: default; }
.profile-header .pstat.static:hover { background: transparent; }

/* الرائج اليوم */
.trend-item { display: flex; align-items: center; gap: 10px; padding: 9px 6px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 1px solid var(--border); }
.trend-item:last-child { border-bottom: none; }
.trend-item:hover { color: var(--text); }
.trend-rank { flex: 0 0 24px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; }
.trend-item:first-child .trend-rank { background: linear-gradient(135deg,#ffb700,#ff7a00); }
.trend-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-stats { flex: 0 0 auto; display: flex; gap: 8px; font-size: 12px; font-weight: 700; }
.trend-stats .ts-like { color: var(--brand-2); }
.trend-stats .ts-cm { color: var(--brand); }
@media (max-width: 480px) { .trend-stats { gap: 6px; font-size: 11px; } .trend-item { gap: 8px; } }

/* Empty + footer + loadmore */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.btn-ghost { background: var(--card); border: 1px solid var(--border); color: var(--muted); cursor: pointer; padding: 9px 16px; border-radius: 10px; font-family: inherit; font-size: 13px; }
.btn-ghost:hover { color: var(--text); border-color: var(--brand); }
.load-more { display: block; width: 100%; max-width: 280px; margin: 18px auto 0; padding: 12px 20px; border-radius: 999px; font-weight: 700; font-size: 15px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s; }
.load-more:hover { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.load-more:active { transform: scale(.97); }
.footer { text-align: center; padding: 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 6, 18, 0.7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { position: relative; width: 100%; max-width: 380px; padding: 26px 22px; }
.modal-close { position: absolute; top: 14px; inset-inline-start: 16px; background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 800; margin: 4px 0 6px; text-align: center; }
.auth-sub { color: var(--muted); font-size: 13px; text-align: center; margin: 0 0 18px; line-height: 1.5; }
.tab { flex: 1; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 15px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; }
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 14px; padding: 11px; border-radius: 12px; border: 1px solid var(--border); background: #fff; color: #222; }
.btn-google:hover { background: #f1f1f1; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.modal-input { width: 100%; height: 46px; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 0 14px; font-family: inherit; font-size: 14px; margin-bottom: 12px; }
.modal-input:focus { outline: none; border-color: var(--brand); }
.modal-submit { width: 100%; }
.auth-error { color: #ff6b6b; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* Avatars with photo */
.has-photo { background-size: cover !important; background-position: center !important; color: transparent !important; }
.pavatar.has-photo, .post-avatar.has-photo, .comment-avatar.has-photo, .uavatar.has-photo, .avatar.has-photo { color: transparent; }

/* Formatting toolbar */
.fmt-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.fmt-btn { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1; display: grid; place-items: center; transition: background .12s; }
.fmt-btn:hover { background: var(--brand-2); }
.fmt-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.comments-loading { padding: 10px 4px; color: var(--muted); font-size: 13px; }
.pavatar.clickable { cursor: pointer; }
.feed-sep { display: flex; align-items: center; text-align: center; gap: 12px; margin: 6px 0 16px; color: var(--muted); font-size: 12px; font-weight: 700; animation: sepIn .4s ease both; }
.feed-sep::before, .feed-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.feed-sep span { white-space: nowrap; padding: 2px 10px; border: 1px dashed var(--border); border-radius: 999px; }
@keyframes sepIn {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: none; }
}
/* Rich contenteditable editors */
.rich { white-space: pre-wrap; overflow-wrap: anywhere; }
.rich:empty:before { content: attr(data-ph); color: var(--muted); pointer-events: none; }
.post-input.rich { min-height: 84px; overflow-y: auto; max-height: 320px; }
.bio-input.rich { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 10px 12px; font-size: 14px; min-height: 60px; max-height: 200px; overflow-y: auto; }
.bio-input.rich:focus { outline: none; border-color: var(--brand); }
.avatar-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pbio b, .pbio strong { font-weight: 800; }
.composer-counter { text-align: end; margin: 2px 0 6px; }
.composer-counter .counter { font-size: 12px; color: var(--muted); }
.img-hint { font-size: 11px; color: var(--muted); }

/* Emoji picker */
.emoji-picker { position: absolute; z-index: 320; width: 280px; max-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.emoji-cell { border: none; background: transparent; cursor: pointer; font-size: 20px; padding: 4px; border-radius: 6px; }
.emoji-cell:hover { background: var(--card-2); }

/* Lightbox fullscreen button */
.lb-full { position: fixed; top: 16px; inset-inline-end: 70px; width: 42px; height: 42px; border: none; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 20px; cursor: pointer; }
.lb-full:hover { background: rgba(255,255,255,.3); }

/* Avatar change button */
.profile-edit #avatarBtn { align-self: center; }

@media (max-width: 560px) {
  .topbar { gap: 10px; }
  .brand-text span { font-size: 11px; }
  .topbar { flex-wrap: wrap; row-gap: 10px; transition: transform .28s ease; will-change: transform; }
  .topbar.bar-hidden { transform: translateY(-130%); }
  body.bar-hidden .bar-toggle { display: grid; }
  .header-tools { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .auth-area { flex-wrap: wrap; justify-content: flex-end; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .user-chip .uname { display: none; }
}

@media (max-width: 640px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .composer { padding: 12px; }
  .composer-bottom { gap: 8px; }
  .composer-right { flex-wrap: wrap; gap: 8px; }
  .composer-right .img-hint { flex-basis: 100%; order: 3; }
  .post-input { font-size: 16px; min-height: 72px; }
  .post-actions { flex-wrap: wrap; gap: 6px; }
  .post-actions .action { font-size: 13px; padding: 6px 8px; }
  .modal { width: calc(100vw - 24px); max-width: 100%; padding: 16px; }
  .emoji-picker { width: calc(100vw - 24px); grid-template-columns: repeat(7, 1fr); }
  .post-img { max-height: 320px; }
  .lb-full { inset-inline-end: 62px; width: 38px; height: 38px; font-size: 18px; }
  .lb-close { width: 38px; height: 38px; font-size: 18px; }
  .lb-nav { width: 40px; height: 40px; font-size: 26px; }
  .reply-box { flex-wrap: wrap; }
  .fmt-btn { min-width: 32px; height: 30px; }
}
