: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;
  --cal-invert: 1;
  --link: #5ca8ff;
  --link-hover: #8ec3ff;
}
/* الوضع الفاتح */
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;
  --cal-invert: 0;
  --link: #2563eb;
  --link-hover: #1d4ed8;
}

* { 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; }
.logo svg { width: 60%; height: 60%; display: block; }
.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; }
.badge-mod { background: #6c8cff; color: #fff; }
.badge-ban { background: #ff6b6b; color: #fff; }
.ban-info { margin: 6px auto 2px; max-width: 360px; font-size: 12px; color: #ff6b6b; background: rgba(255,107,107,.1); padding: 6px 10px; border-radius: 10px; }
.mod-panel { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.mod-role { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.btn-ghost.danger { color: #ff6b6b; }
.banned-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--card); }
.banned-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.banned-name { cursor: pointer; }
.banned-name:hover { text-decoration: underline; }
.banned-meta { font-size: 12px; color: var(--muted); }
.ban-field { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; }
.users-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-search { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--solid); color: var(--text); font-family: inherit; font-size: 14px; }
.user-search:focus { outline: none; border-color: var(--brand); }
.users-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--card); cursor: pointer; transition: border-color .15s; }
.user-row:hover { border-color: var(--brand); }
.urow-avatar { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); background-size: cover; background-position: center; }
.urow-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.urow-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.urow-name { font-size: 14px; }
.urow-meta { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.urow-uid { font-family: monospace; opacity: .7; }
.user-row.ucard { flex-direction: column; align-items: stretch; cursor: default; gap: 10px; }
.user-row .urow-head { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.user-row .ufields { display: flex; flex-direction: column; gap: 6px; }
.ufield { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.ufield-label { font-weight: 700; }
.ufield-val { color: var(--text); word-break: break-all; }
.ufield-val.mono { font-family: monospace; }
.ufield-muted { font-style: italic; }
.ucopy { border: 1px solid var(--border); background: var(--card-2); color: var(--text); border-radius: 6px; cursor: pointer; width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }
.ucopy:hover { border-color: var(--brand); }
.urow-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.urow-acts .small { padding: 6px 12px; font-size: 13px; }
.urow-acts .danger { color: #ff6b6b; }
.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); }

/* Prominent section titles (feed + admin) */
.sec-title { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; position: relative; padding-inline-start: 12px; }
.sec-title::before { content: ''; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%); width: 4px; height: 1.05em; border-radius: 3px; background: linear-gradient(180deg, var(--brand), var(--brand-2)); }
.sec-ico { font-size: 1.05em; line-height: 1; }
/* Distinct, separated admin dashboard sections */
#viewAdmin .admin-sec { margin-top: 26px; padding-top: 18px; border-top: 2px solid var(--border); }
.announce-font-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.fmt-font { height: 30px; max-width: 150px; background-color: var(--solid); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: 13px; padding: 0 8px; cursor: pointer; }
.fmt-font:focus { outline: none; border-color: var(--brand); }
.announce-preview-box { margin-top: 12px; padding: 12px; background: var(--card-2); border: 1px dashed var(--border); border-radius: 12px; }
.announce-preview-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.announce-preview-banner { margin: 0; }

/* 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-title { font-family: 'Tajawal', 'Cairo', system-ui, sans-serif; font-size: 23px; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; margin: 4px 0 12px; padding-inline-start: 12px; border-inline-start: 4px solid var(--brand); color: var(--text); word-break: break-word; }
.post-title-input { width: 100%; box-sizing: border-box; margin: 10px 0 0; padding: 10px 12px; font-family: 'Tajawal', 'Cairo', system-ui, sans-serif; font-size: 16px; font-weight: 700; color: var(--text); background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; }
.post-title-input:focus { outline: none; border-color: var(--brand); }
.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-family: 'Tajawal', 'Cairo', system-ui, sans-serif; font-size: 16px; line-height: 1.75; 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; }

/* تفاعلات المنشور (إعجاب/حب/...) */
.react-wrap { position: relative; display: inline-flex; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.react-wrap::after { content: ''; position: absolute; bottom: 100%; inset-inline: 0; height: 10px; }
.react-wrap .action.like { gap: 5px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.react-emoji { font-size: 15px; line-height: 1; display: inline-flex; align-items: center; gap: 5px; }
.rx-pair { display: inline-flex; align-items: center; gap: 2px; }
.rx-c { font-size: 12px; color: var(--muted); font-weight: 600; }
.action.like.liked .rx-c { color: inherit; }
.react-pop {
  position: absolute; bottom: calc(100% + 8px); inset-inline-start: 0;
  display: flex; gap: 2px; padding: 6px;
  background: var(--solid); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0,0,0,.4); z-index: 50;
  opacity: 0; transform: translateY(6px) scale(.92); transform-origin: bottom center;
  pointer-events: none; transition: opacity .14s ease, transform .14s ease;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.react-wrap.show-pop .react-pop { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.react-opt {
  border: none; background: transparent; cursor: pointer; font-size: 22px; line-height: 1;
  padding: 4px; border-radius: 50%; transition: transform .12s ease;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.react-opt:hover { transform: scale(1.35) translateY(-2px); }
.action.save.saved { color: var(--brand); border-color: var(--brand); background: rgba(46,230,197,0.12); }

/* قائمة إكمال الإشارات @ */
.mention-pop {
  position: fixed; z-index: 300; min-width: 200px; max-width: 280px; max-height: 260px; overflow-y: auto;
  background: var(--solid); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45); padding: 5px;
}
.mention-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: start;
  padding: 7px 9px; border: none; border-radius: 9px; background: transparent;
  color: var(--text); cursor: pointer; font-family: inherit; font-size: 14px;
}
.mention-item:hover, .mention-item.active { background: var(--card-2); }
.mention-av {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
}
.mention-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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-family: 'Tajawal', 'Cairo', system-ui, sans-serif; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }

/* معاينة الخط أسفل المُحدِّد */
.announce-font-sample { margin: 4px 0 8px; padding: 8px 12px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; font-size: 17px; line-height: 1.5; color: var(--text); }
.announce-font-sample span { color: var(--muted); font-size: 12px; font-family: 'Cairo', system-ui, sans-serif; }
.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; }
.cact.like { display: inline-flex; align-items: center; gap: 4px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cact.like .react-emoji { font-size: 13px; line-height: 1; }
.cact.like .rx-c { font-size: 11px; }
.react-wrap-c { vertical-align: middle; }
.react-wrap-c .react-pop { padding: 5px; gap: 1px; }
.react-wrap-c .react-opt { font-size: 19px; padding: 3px; }
.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 .rimages { display: flex; flex-direction: column; gap: 8px; }
.report-card .rimg-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.report-card .rthumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.report-card .rthumb { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.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; }
.back-to-top {
  position: fixed;
  inset-block-end: calc(22px + env(safe-area-inset-bottom, 0px));
  inset-inline-end: calc(22px + env(safe-area-inset-right, 0px));
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  z-index: 150;
  opacity: 0; visibility: hidden;
  transform: translateY(18px) scale(.85);
  transition: opacity .28s ease, transform .28s cubic-bezier(.34, 1.56, .64, 1), visibility .28s, box-shadow .2s ease, filter .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.back-to-top:hover { filter: brightness(1.08); box-shadow: 0 12px 30px rgba(0, 0, 0, .45), 0 3px 8px rgba(0, 0, 0, .3); transform: translateY(-3px) scale(1.05); }
.back-to-top:active { transform: translateY(-1px) scale(.96); }
.back-to-top:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 3px; }
.back-to-top svg { display: block; }
.offline-bar {
  position: fixed; inset-inline: 0; top: 0; z-index: 250;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px;
  background: #b3261e; color: #fff;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  transform: translateY(-100%);
  transition: transform .3s ease;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
}
.offline-bar.show { transform: translateY(0); }
.offline-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; opacity: .9; animation: offlinePulse 1.4s ease-in-out infinite; }
@keyframes offlinePulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .offline-bar { transition: none; } .offline-dot { animation: none; } }

/* شريط إعلان المشرف */
.announce-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; padding: 13px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f5a623, #ef6c2b 55%, #e2562a);
  color: #fff; font-weight: 600; font-size: 14px; line-height: 1.5;
  box-shadow: 0 10px 26px rgba(226, 86, 42, .34);
}
.announce-banner::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.38), transparent);
  transform: skewX(-20deg); pointer-events: none;
  animation: announceShine 4.5s ease-in-out infinite 1s;
}
.announce-banner.announce-in { animation: announceIn .55s cubic-bezier(.16,.9,.36,1.05); }
.announce-banner .announce-ico { position: relative; z-index: 1; font-size: 19px; flex: none; animation: announceBell 2.6s ease-in-out infinite; transform-origin: 50% 0; }
.announce-banner .announce-text { position: relative; z-index: 1; flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.announce-banner .announce-text a { color: #0a2a72; font-weight: 800; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.announce-banner .announce-text a:hover { color: #06185a; text-decoration-thickness: 2.5px; }
@keyframes announceIn { 0% { opacity: 0; transform: translateY(-18px) scale(.96); } 60% { opacity: 1; transform: translateY(3px) scale(1.01); } 100% { transform: none; } }
@keyframes announceShine { 0% { left: -60%; } 28%, 100% { left: 130%; } }
@keyframes announceBell { 0%, 88%, 100% { transform: rotate(0); } 90% { transform: rotate(14deg); } 94% { transform: rotate(-12deg); } 97% { transform: rotate(7deg); } }
/* روابط داخل المنشورات/التعليقات */
.ext-link {
  color: var(--link); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px;
  word-break: break-word; overflow-wrap: anywhere;
  border-radius: 4px; transition: color .15s ease, text-decoration-thickness .15s ease;
}
.ext-link::after { content: "↗"; font-size: .8em; margin-inline-start: 2px; opacity: .85; text-decoration: none; display: inline-block; }
.ext-link:hover { color: var(--link-hover); text-decoration-thickness: 2.5px; }
.ext-link:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* نافذة إدراج رابط */
.link-pop {
  position: absolute; z-index: 300; display: none;
  background: var(--solid); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 8px; gap: 8px;
}
.link-pop .link-url {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 11px; width: 230px; max-width: 60vw;
}
.link-pop .link-url:focus { outline: none; border-color: var(--brand); }
.link-pop .link-ok {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 9px; padding: 0 14px;
}
/* لوحة تحرير الإعلان */
.announce-admin { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.announce-admin .reply-counter { margin-top: 0; }
.announce-exp { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--border); border-radius: 12px; background: var(--card-2); }
.announce-exp-label { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.announce-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.announce-presets .chip { cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 700; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted); transition: all .14s ease; }
.announce-presets .chip:hover { border-color: var(--brand); color: var(--text); }
.announce-presets .chip.active { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; }
.announce-datetime {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; width: 100%; box-sizing: border-box; cursor: pointer;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.announce-datetime:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,92,255,0.18); }
.announce-datetime::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; filter: invert(var(--cal-invert, 0)); }
.announce-admin .announce-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.announce-admin .btn-ghost.danger { color: var(--brand-2); border-color: var(--brand-2); }

@media (max-width: 560px) {
  .back-to-top { width: 46px; height: 46px; inset-block-end: calc(16px + env(safe-area-inset-bottom, 0px)); inset-inline-end: calc(16px + env(safe-area-inset-right, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: opacity .2s ease, visibility .2s; transform: none; }
  .back-to-top.show { transform: none; }
  .back-to-top:hover, .back-to-top:active { transform: 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: 560px) { .dropdown { position: fixed; inset-inline: 12px; width: auto; max-height: 70vh; z-index: 60; } }

/* قائمة المتابعين/المتابَعين */
.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); }
.brand-signoff { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.brand-signoff-logo { width: 52px; height: 52px; border-radius: 16px; }
.brand-signoff-name { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.brand-signoff-tagline { font-size: 13px; color: var(--muted); }

/* 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; }
.google-wrap { position: relative; max-width: 360px; margin: 0 auto; }
.gsi-btn-holder { position: absolute; inset: 0; z-index: 3; opacity: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.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; }
html[dir="rtl"] .rich:empty { text-align: right; direction: rtl; }
html[dir="ltr"] .rich:empty { text-align: left; direction: ltr; }
.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; }

/* Self-service account data (export + delete) */
.account-data { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.account-data-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.account-data-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* First-login onboarding modal */
.onboard-card { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.onboard-avatar { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.onboard-pic { width: 84px; height: 84px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--border); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; color: var(--muted); }
.onboard-pic.has-photo { color: transparent; }
.onboard-label { font-size: 13px; font-weight: 700; color: var(--muted); text-align: start; }
.onboard-consent { display: flex; align-items: flex-start; gap: 8px; text-align: start; font-size: 13px; color: var(--text); cursor: pointer; }
.onboard-consent input { margin-top: 3px; flex-shrink: 0; }
.onboard-consent a { color: var(--brand); text-decoration: underline; }

@media (max-width: 560px) {
  .topbar { gap: 10px; }
  .brand-text span { font-size: 11px; }
  .topbar { flex-wrap: wrap; row-gap: 10px; transition: transform .28s ease; }
  .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; }
}

/* تذييل الصفحة: روابط الخصوصية والشروط */
.site-footer { max-width: 680px; margin: 24px auto 90px; padding: 16px 18px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }
.site-footer .foot-sep { opacity: .5; }
.site-footer .foot-rights { width: 100%; opacity: .8; margin-top: 2px; }
