/* ═══════════════════════════════════════════════════════════
   base.css: هيكل اللوحة ومكوناتها فقط.
   الألوان والخطوط والزوايا والظلال تجي من الثيم (themes/*.css) عن طريق المتغيرات تحت.
   لا تحط لون أو خط ثابت هنا: كل شي يمر من متغير عشان أي ثيم يقدر يغيره.
   ═══════════════════════════════════════════════════════════ */
@font-face { font-family: 'Plex'; src: url('/assets/fonts/IBMPlexSansArabic-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('/assets/fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }
@font-face { font-family: 'Lalezar'; src: url('/assets/fonts/lalezar-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: 'Mont'; src: url('/assets/fonts/Montserrat-Variable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  /* ── ألوان (الثيم يغيرها) ── */
  --bg: #0b0d12; --bg2: #0e1117; --panel: #13161d; --panel2: #191d26; --panel3: #212633;
  --text: #eef1f6; --muted: #9aa3b2; --dim: #6b7383;
  --line: rgba(var(--acc-rgb), .18); --line2: rgba(255, 255, 255, .07);
  --acc-rgb: 88, 101, 242; --acc: #5865f2; --acc2: color-mix(in srgb, var(--acc) 65%, #fff);
  --acc-soft: rgba(var(--acc-rgb), .13); --acc-glow: rgba(var(--acc-rgb), .35); --on-acc: #fff;
  --danger: #ff6a5f; --warn: #ffc95f; --ok: #3ee69a;
  /* ── خطوط ── */
  --font-body: 'Plex', system-ui, sans-serif;
  --font-display: 'Plex', system-ui, sans-serif; --display-weight: 800; --display-spacing: 0;
  --font-num: 'Mont', 'Plex', sans-serif;
  --font-en: 'Mont', sans-serif;
  /* ── أشكال ── */
  --r: 16px; --r-sm: 10px; --r-lg: 22px; --border-w: 1px;
  --card-bg: linear-gradient(180deg, var(--panel), var(--bg2));
  --side-bg: color-mix(in srgb, var(--panel) 85%, transparent);
  --login-card-bg: color-mix(in srgb, var(--panel) 92%, transparent);
  --shadow: 0 20px 50px rgba(0, 0, 0, .35);
  --btn-primary-bg: linear-gradient(135deg, var(--acc), color-mix(in srgb, var(--acc) 75%, #000));
  --btn-primary-shadow: 0 8px 26px rgba(var(--acc-rgb), .28);
  --blur: blur(10px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-on-bg: var(--acc-soft); --nav-on-color: var(--acc);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--acc); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea, select { font: inherit; color: var(--text); }
::selection { background: var(--acc); color: var(--on-acc); }
::-webkit-scrollbar { width: 9px; height: 9px; } ::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 9px; } ::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.h-display, .page-head h2, .hero h2, .brand b, .modal h3 { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-spacing); }
.en { font-family: var(--font-en); letter-spacing: .32em; text-transform: uppercase; font-size: 11px; color: var(--muted); direction: ltr; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───── Splash ───── */
#splash { position: fixed; inset: 0; display: grid; place-items: center; z-index: 100; background: var(--bg); transition: opacity .5s; }
#splash img { width: 88px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ───── Login ───── */
#login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); background: var(--login-card-bg); border: var(--border-w) solid var(--line); border-radius: var(--r-lg); padding: 40px 34px; text-align: center; position: relative; backdrop-filter: var(--blur); box-shadow: var(--shadow); animation: rise .7s var(--ease); }
.login-card .logo { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; }
.login-card h1 { font-size: 32px; line-height: 1.2; margin-bottom: 4px; }
.login-card p { color: var(--muted); margin: 14px 0 26px; }
.btn-discord { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px 20px; border-radius: var(--r); background: #5865f2; color: #fff; font-weight: 700; font-size: 16px; transition: .25s var(--ease); }
.btn-discord:hover { transform: translateY(-2px); filter: brightness(1.08); }
.denied { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ───── App shell ───── */
#app { position: relative; z-index: 1; display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-inline-end: var(--border-w) solid var(--line2); background: var(--side-bg); backdrop-filter: var(--blur); display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand img { width: 44px; height: 44px; border-radius: 50%; }
.brand b { display: block; font-size: 20px; line-height: 1.15; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; transition: .2s; position: relative; }
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.nav a.on { color: var(--nav-on-color); background: var(--nav-on-bg); }
.nav .badge { margin-inline-start: auto; background: var(--acc); color: var(--on-acc); font-size: 11px; font-weight: 800; border-radius: 20px; padding: 0 7px; line-height: 18px; }
.side .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); background: var(--panel); border: var(--border-w) solid var(--line2); }
.me img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.me .nm { font-weight: 700; font-size: 14px; line-height: 1.2; }
.me .rl { font-size: 12px; color: var(--acc); }
.me a { margin-inline-start: auto; color: var(--muted); padding: 6px; border-radius: 8px; } .me a:hover { color: var(--danger); }
main { padding: 30px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.page { animation: rise .45s var(--ease); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { font-size: 30px; line-height: 1.2; }
.page-head p { color: var(--muted); }

/* ───── Cards & controls ───── */
.card { background: var(--card-bg); border: var(--border-w) solid var(--line2); border-radius: var(--r); padding: 20px; position: relative; box-shadow: var(--card-shadow, none); }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--r-sm); font-weight: 700; font-size: 14px; transition: .2s var(--ease); border: var(--border-w) solid var(--line2); background: var(--panel2); white-space: nowrap; }
.btn:hover { border-color: var(--line); background: var(--panel3); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--btn-primary-bg); color: var(--on-acc); border-color: transparent; box-shadow: var(--btn-primary-shadow); }
.btn-primary:hover { background: var(--btn-primary-bg); filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); } .btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.in { width: 100%; background: var(--bg); border: var(--border-w) solid var(--line2); border-radius: var(--r-sm); padding: 11px 14px; outline: none; transition: .2s; }
.in:focus { border-color: var(--acc); box-shadow: 0 0 0 4px rgba(var(--acc-rgb), .12); }
.in:disabled { opacity: .6; }
textarea.in { min-height: 150px; resize: vertical; line-height: 1.7; }
.in.ltr { direction: ltr; text-align: left; }
select.in { appearance: none; cursor: pointer; }
.row { display: grid; gap: 14px; } .row-2 { grid-template-columns: 1fr 1fr; } .row-3 { grid-template-columns: repeat(3, 1fr); }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 5px; }
.seg { display: inline-flex; background: var(--bg); border: var(--border-w) solid var(--line2); border-radius: var(--r-sm); padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { padding: 7px 14px; border-radius: calc(var(--r-sm) - 3px); font-weight: 600; font-size: 13px; color: var(--muted); transition: .2s; }
.seg button.on { background: var(--acc-soft); color: var(--acc); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 30px; font-size: 12px; font-weight: 700; border: 1px solid; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty img { width: 64px; opacity: .5; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.copy { display: flex; gap: 8px; } .copy .in { font-family: var(--font-num); font-size: 12px; }

/* ───── Home ───── */
.hero { position: relative; border-radius: var(--r-lg); overflow: hidden; padding: 26px; border: var(--border-w) solid var(--line); margin-bottom: 22px; background: var(--hero-bg, var(--card-bg)); box-shadow: var(--card-shadow, none); }
.hero h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.2; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px 20px; overflow: hidden; }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .k i { width: 30px; height: 30px; border-radius: calc(var(--r-sm) - 1px); display: grid; place-items: center; background: var(--acc-soft); font-style: normal; }
.stat .v { font-family: var(--font-num); font-weight: 800; font-size: 30px; margin-top: 8px; direction: ltr; text-align: right; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 18px; }
.chart .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 44px; border-radius: calc(var(--r-sm) - 2px) calc(var(--r-sm) - 2px) 3px 3px; background: var(--bar-bg, linear-gradient(180deg, var(--acc), rgba(var(--acc-rgb), .2))); min-height: 4px; transition: height .8s var(--ease); position: relative; }
.chart .bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-family: var(--font-num); color: var(--acc); font-weight: 700; }
.chart .d { font-size: 11px; color: var(--dim); }
.log { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line2); }
.log:last-child { border-bottom: 0; }
.log .meta { font-size: 12px; color: var(--dim); display: flex; gap: 10px; }
.log .dt { font-size: 13px; color: var(--muted); word-break: break-word; }

/* ───── Theme picker (الإعدادات) ───── */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { border-radius: var(--r-sm); border: 2px solid var(--line2); overflow: hidden; text-align: start; transition: .2s; background: var(--bg); }
.theme-card:hover { border-color: var(--line); transform: translateY(-2px); }
.theme-card.on { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.theme-card .sw { height: 70px; display: grid; grid-template-columns: 30% 1fr; }
.theme-card .sw i { display: block; }
.theme-card .sw div { padding: 10px; display: grid; gap: 6px; align-content: start; }
.theme-card .sw b { display: block; height: 8px; border-radius: 4px; }
.theme-card .nm { padding: 8px 10px; font-size: 13px; font-weight: 700; }
.theme-card .nm small { display: block; font-weight: 400; color: var(--dim); font-size: 11px; }

/* ───── Discord preview (ثابت بألوان ديسكورد مهما كان الثيم) ───── */
.dc { background: #313338; border-radius: var(--r); overflow: hidden; border: 1px solid #1e1f22; font-family: 'Plex', 'gg sans', sans-serif; direction: rtl; padding: 16px; color: #dbdee1; }
.dc-msg { display: flex; gap: 14px; }
.dc-msg > img { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.dc-name { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.dc-name b { color: #f2f3f5; font-weight: 600; }
.dc-name .app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 0 5px; line-height: 16px; font-family: 'Mont'; }
.dc-content { color: #dbdee1; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.55; margin-top: 2px; }
.embed { margin-top: 6px; max-width: 470px; background: #2b2d31; border-radius: 4px; border-inline-start: 4px solid var(--acc); padding: 10px 16px 14px 14px; display: grid; grid-template-columns: 1fr auto; gap: 0 14px; }
.embed .tt { font-weight: 700; color: #f2f3f5; font-size: 16px; margin-top: 6px; }
.embed .ds { color: #dbdee1; font-size: 14px; margin-top: 6px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; }
.embed .im { grid-column: 1 / -1; width: 100%; border-radius: 4px; margin-top: 14px; display: block; }
.embed .ft { grid-column: 1 / -1; font-size: 12px; color: #b5bac1; margin-top: 10px; }
.embed .dim { color: #80848e; }
.embed .tt, .embed .ds, .embed .dim { grid-column: 1; }
.dc-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dc-btns span { background: #4e5058; color: #fff; padding: 6px 14px; border-radius: 4px; font-size: 14px; font-weight: 500; }
.mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }

/* ───── Modal / toast / misc ───── */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, 100%); background: var(--panel); border: var(--border-w) solid var(--line); border-radius: var(--r-lg); padding: 26px; animation: rise .35s var(--ease); box-shadow: var(--shadow); }
.modal h3 { font-size: 24px; margin-bottom: 8px; }
.modal .ft { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
#toasts { position: fixed; bottom: 20px; left: 20px; z-index: 60; display: grid; gap: 10px; }
.toast { padding: 12px 18px; border-radius: var(--r); background: var(--panel2); border: var(--border-w) solid var(--line); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: rise .3s var(--ease); display: flex; gap: 10px; align-items: center; max-width: 380px; }
.toast.err { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.toast.ok::before { content: '✓'; color: var(--acc); font-weight: 900; }
.demo-bar { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); padding: 8px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--panel2), var(--panel3), var(--panel2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-sm); }
@keyframes sk { to { background-position: -200% 0; } }

/* ───── Responsive ───── */
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; z-index: 20; flex-direction: row; padding: 8px; border-top: var(--border-w) solid var(--line); border-inline-end: 0; }
  .side .brand, .side .grow, .side .me { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  main { padding-bottom: 100px; }
  .stats { grid-template-columns: 1fr 1fr; } .row-2, .row-3 { grid-template-columns: 1fr; } .log { grid-template-columns: 1fr; }
}

/* ───── fx.js: الموشن والأصوات ─────
   الثيم يحدد الشخصية بـ --fx-motion / --fx-sound / --fx-burst (الافتراضي تحت). */
:root { --fx-motion: glide; --fx-sound: nebula; --fx-burst: sparks; }
/* لما fx.js شغال هو اللي يحرك الصفحة والنوافذ والتنبيهات، فنوقف حركات CSS البسيطة عشان ما يتكررون */
html.fx-on .page, html.fx-on .modal, html.fx-on .toast, html.fx-on .login-card { animation: none; }
.btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.fx-ripple { position: absolute; border-radius: 50%; background: currentColor; pointer-events: none; z-index: -1; opacity: 0; }
.fx-p { position: fixed; z-index: 90; pointer-events: none; width: 8px; height: 8px; border-radius: 2px; }
.fx-confetti { width: 7px; height: 12px; }
.fx-gold { width: 7px; height: 7px; transform: rotate(45deg); border-radius: 0; }
.fx-triangles { width: 10px; height: 9px; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.fx-pixels { width: 6px; height: 6px; border-radius: 0; }
.fx-dots { border-radius: 50%; }
.fx-sparks { width: 3px; height: 10px; border-radius: 3px; }
.fx-wave { position: fixed; z-index: 80; pointer-events: none; border-radius: 50%; background: radial-gradient(circle, var(--acc) 0%, rgba(var(--acc-rgb), .35) 45%, transparent 70%); transform: translate(-50%, -50%); }
.fx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.fx-sw { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.fx-sw input { position: absolute; opacity: 0; pointer-events: none; }
.fx-sw span { width: 40px; height: 22px; border-radius: 22px; background: var(--panel3); border: var(--border-w) solid var(--line2); position: relative; transition: .25s var(--ease); flex: none; }
.fx-sw span::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .25s var(--ease); }
.fx-sw input:checked + span { background: var(--acc); border-color: transparent; }
.fx-sw input:checked + span::after { background: var(--on-acc); inset-inline-start: 20px; }
.fx-sw input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px; }
.fx-sw input:disabled + span { opacity: .45; }
.fx-vol { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.fx-vol input { accent-color: var(--acc); width: 130px; }
.me .fx-mute { color: var(--muted); padding: 6px; border-radius: 8px; font-size: 15px; line-height: 1; }
.me .fx-mute:hover { color: var(--acc); }
.me .fx-mute + a { margin-inline-start: 0; }
.me .fx-mute { margin-inline-start: auto; }
.fx-blocks { width: 12px; height: 12px; border-radius: 0; border: 2px solid #000; }
.fx-lines { width: 18px; height: 2px; border-radius: 0; }
.fx-bubbles { width: 12px; height: 12px; border-radius: 50%; opacity: .8; box-shadow: inset -2px -2px 4px rgba(0,0,0,.12), 2px 2px 6px rgba(0,0,0,.12); }
.fx-stars { width: 14px; height: 14px; border-radius: 0; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.fx-leaves { width: 12px; height: 12px; border-radius: 0 100% 0 100%; }
.fx-blobs { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset -3px -3px 5px rgba(0,0,0,.15), inset 3px 3px 5px rgba(255,255,255,.7); }
.fx-coins { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset -2px -2px 0 rgba(0,0,0,.25), inset 2px 2px 0 rgba(255,255,255,.55); }
.fx-shapes { width: 12px; height: 12px; border-radius: 50%; }
.fx-shapes[data-s="1"] { border-radius: 0; }
.fx-shapes[data-s="2"] { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 14px; }
.fx-shapes[data-s="3"] { background: transparent !important; border: 3px solid #111; }
.fx-arcade { width: 8px; height: 8px; border-radius: 0; }
.fx-rings { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid; box-shadow: 0 0 6px currentColor; }
.fx-ink { width: 5px; height: 5px; border-radius: 50%; }
.fx-drops { width: 11px; height: 11px; border-radius: 50% 50% 50% 0; opacity: .85; box-shadow: inset 2px 2px 3px rgba(255,255,255,.8), 0 2px 6px rgba(0,0,0,.15); }
.fx-tiles { width: 11px; height: 11px; border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   الترتيب (Layout): مكان القائمة وترتيب الرئيسية. مستقل عن الشكل والألوان.
   كل ثيم يحدد ترتيبه الافتراضي بـ --layout، والأدمن يقدر يغيره من الإعدادات، و ?layout= للمعاينة.
     side     قائمة جانبية كاملة (الافتراضي)
     float    قائمة جانبية عائمة كبطاقة، والإحصائيات عمود جنب المحتوى
     top      شريط علوي، والترحيب والإحصائيات جنب بعض
     rail     شريط أيقونات ضيق، والإحصائيات أول شي (لوحة محترفين)
     dock     قائمة عائمة تحت بالنص مثل ألعاب ونظام ماك، والمحتوى بالوسط
     magazine رأس مجلة بالنص وتبويبات تحته، ومحتوى ضيق تحريري
   على الجوال (تحت 900px) كلها ترجع لشريط سفلي.
   ═══════════════════════════════════════════════════════════ */
:root { --layout: side; }
@media (min-width: 901px) {
  /* ── عائم ── */
  html[data-layout="float"] #app { grid-template-columns: 280px 1fr; }
  html[data-layout="float"] .side { top: 16px; height: calc(100vh - 32px); margin: 16px; margin-inline-end: 0; border-radius: var(--r-lg); border: var(--border-w) solid var(--line2); box-shadow: var(--card-shadow, var(--shadow)); }
  html[data-layout="float"] .page:has(> .hero) { display: grid; grid-template-columns: minmax(0, 1fr) 270px; grid-template-areas: "demo demo" "hero stats" "grid stats"; gap: 0 18px; align-items: start; }
  html[data-layout="float"] .page:has(> .hero) > .demo-bar { grid-area: demo; }
  html[data-layout="float"] .page:has(> .hero) > .hero { grid-area: hero; }
  html[data-layout="float"] .page:has(> .hero) > .stats { grid-area: stats; grid-template-columns: 1fr; position: sticky; top: 16px; }
  html[data-layout="float"] .page:has(> .hero) > .grid-2 { grid-area: grid; grid-template-columns: 1fr; }

  /* ── شريط علوي ── */
  html[data-layout="top"] #app, html[data-layout="magazine"] #app, html[data-layout="dock"] #app { grid-template-columns: 1fr; }
  html[data-layout="top"] .side { flex-direction: row; align-items: center; height: auto; width: 100%; padding: 10px clamp(16px, 3vw, 40px); z-index: 20; border: 0; border-bottom: var(--border-w) solid var(--line2); gap: 18px; }
  html[data-layout="top"] .side .brand { padding: 0; }
  html[data-layout="top"] .nav { display: flex; gap: 4px; }
  html[data-layout="top"] .nav a { padding: 8px 14px; }
  html[data-layout="top"] .side .me { padding: 6px 10px; }
  html[data-layout="top"] main { width: 100%; max-width: 1280px; margin: 0 auto; }
  html[data-layout="top"] .page:has(> .hero) { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "demo demo" "hero stats" "grid grid"; gap: 0 18px; align-items: stretch; }
  html[data-layout="top"] .page:has(> .hero) > .demo-bar { grid-area: demo; }
  html[data-layout="top"] .page:has(> .hero) > .hero { grid-area: hero; display: flex; align-items: center; }
  html[data-layout="top"] .page:has(> .hero) > .stats { grid-area: stats; grid-template-columns: 1fr 1fr; }
  html[data-layout="top"] .page:has(> .hero) > .grid-2 { grid-area: grid; }

  /* ── شريط أيقونات ── */
  html[data-layout="rail"] #app { grid-template-columns: 84px 1fr; }
  html[data-layout="rail"] .side { padding: 16px 10px; align-items: center; }
  html[data-layout="rail"] .side .brand { padding: 0 0 18px; }
  html[data-layout="rail"] .side .brand > div, html[data-layout="rail"] .nav a span, html[data-layout="rail"] .side .me > div { display: none; }
  html[data-layout="rail"] .nav { display: grid; gap: 8px; }
  html[data-layout="rail"] .nav a { justify-content: center; padding: 12px; }
  html[data-layout="rail"] .nav a svg { width: 22px; height: 22px; }
  html[data-layout="rail"] .side .me { flex-direction: column; padding: 8px 6px; gap: 6px; }
  html[data-layout="rail"] .side .me .fx-mute, html[data-layout="rail"] .side .me a { margin: 0; }
  html[data-layout="rail"] .page:has(> .hero) { display: flex; flex-direction: column; }
  html[data-layout="rail"] .page:has(> .hero) > .demo-bar { order: 0; }
  html[data-layout="rail"] .page:has(> .hero) > .stats { order: 1; }
  html[data-layout="rail"] .page:has(> .hero) > .grid-2 { order: 2; grid-template-columns: 1.4fr 1fr; }
  html[data-layout="rail"] .page:has(> .hero) > .hero { order: 3; padding: 14px 20px; margin: 22px 0 0; }
  html[data-layout="rail"] .page:has(> .hero) > .hero > div { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  html[data-layout="rail"] .page:has(> .hero) > .hero h2 { font-size: 20px; }
  html[data-layout="rail"] .page:has(> .hero) > .hero .muted { margin: 0 !important; flex: 1; }
  html[data-layout="rail"] .page:has(> .hero) > .hero .en { display: none; }

  /* ── قائمة عائمة تحت ── */
  html[data-layout="dock"] .side { position: fixed; top: auto; bottom: 18px; left: 50%; transform: translateX(-50%); height: auto; width: auto; max-width: calc(100vw - 32px); flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; z-index: 30; border: var(--border-w) solid var(--line2); border-radius: calc(var(--r-lg) + 8px); box-shadow: var(--shadow); }
  html[data-layout="dock"] .side .brand { padding: 0 4px; }
  html[data-layout="dock"] .side .brand > div, html[data-layout="dock"] .side .grow, html[data-layout="dock"] .side .me > div { display: none; }
  html[data-layout="dock"] .nav { display: flex; gap: 4px; }
  html[data-layout="dock"] .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 8px 14px; }
  html[data-layout="dock"] .side .me { padding: 4px 8px; background: transparent; border: 0; box-shadow: none; }
  html[data-layout="dock"] main { width: 100%; max-width: 1180px; margin: 0 auto; padding-bottom: 130px; }
  html[data-layout="dock"] .page:has(> .hero) > .hero { text-align: center; padding: 44px 26px; }
  html[data-layout="dock"] .page:has(> .hero) > .hero h2 { font-size: clamp(32px, 4vw, 48px); }

  /* ── مجلة ── */
  html[data-layout="magazine"] .side { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; height: auto; width: 100%; padding: 22px 24px 0; gap: 8px; border: 0; border-bottom: var(--border-w) solid var(--line2); position: relative; }
  html[data-layout="magazine"] .side .brand { width: 100%; justify-content: center; padding: 0 0 8px; }
  html[data-layout="magazine"] .side .brand b { font-size: 32px; }
  html[data-layout="magazine"] .side .grow { display: none; }
  html[data-layout="magazine"] .nav { display: flex; gap: 6px; }
  html[data-layout="magazine"] .nav a { border-radius: 0; padding: 10px 16px; background: transparent; box-shadow: none; }
  html[data-layout="magazine"] .nav a.on { background: transparent; box-shadow: inset 0 -3px 0 var(--acc); color: var(--text); }
  html[data-layout="magazine"] .side .me { position: absolute; top: 18px; inset-inline-end: 24px; padding: 6px 10px; }
  html[data-layout="magazine"] main { width: 100%; max-width: 980px; margin: 0 auto; }
  html[data-layout="magazine"] .page:has(> .hero) > .hero { background: transparent; border: 0; box-shadow: none; padding: 10px 0 26px; text-align: center; }
  html[data-layout="magazine"] .page:has(> .hero) > .hero h2 { font-size: clamp(34px, 4.4vw, 54px); }
  html[data-layout="magazine"] .page:has(> .hero) > .stats { gap: 0; border-block: var(--border-w) solid var(--line2); padding: 6px 0; }
  html[data-layout="magazine"] .page:has(> .hero) > .stats > .card { background: transparent; border: 0; box-shadow: none; border-radius: 0; text-align: center; transform: none; }
  html[data-layout="magazine"] .page:has(> .hero) > .stats > .card + .card { border-inline-start: var(--border-w) solid var(--line2); }
  html[data-layout="magazine"] .page:has(> .hero) > .stats .k { justify-content: center; }
  html[data-layout="magazine"] .page:has(> .hero) > .stats .v { text-align: center; }
  html[data-layout="magazine"] .page:has(> .hero) > .grid-2 { grid-template-columns: 1fr; }

  /* الثيمات اللي ترتب بطاقات الإحصائيات بنفسها (مثل بنتو) ترجع عادية في الترتيبات اللي تغير شبكتها */
  html[data-layout="float"] .stats > .card, html[data-layout="top"] .stats > .card, html[data-layout="magazine"] .stats > .card { grid-column: auto; grid-row: auto; }
  /* زخارف القائمة الجانبية الطويلة ما تناسب الشريط */
  html[data-layout="top"] .side::after, html[data-layout="dock"] .side::after, html[data-layout="magazine"] .side::after, html[data-layout="rail"] .side::after { display: none; }
}

/* ───── مكونات لوحة الحانة (أعضاء، رومات، رتب، سجلات) — تشتغل مع أي ثيم ───── */
.nav .grp { font-size: 12px; font-weight: 700; color: var(--dim); padding: 14px 14px 4px; }
html[data-layout]:not([data-layout=side]):not([data-layout=float]) .nav .grp { display: none; }
.list { display: grid; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line2); cursor: pointer; border-radius: var(--r-sm); transition: background .2s; }
.mrow:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.mrow:last-child { border-bottom: 0; }
.mrow .grow { flex: 1; min-width: 0; }
.mrow .nm { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mrow .sub { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; }
.av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; line-height: 20px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip button { color: inherit; opacity: .6; font-size: 11px; } .chip button:hover { opacity: 1; color: var(--danger); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.case-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); flex: none; font-size: 16px; }
.cat { color: var(--muted); font-weight: 700; font-size: 14px; padding: 16px 6px 6px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line2); margin-top: 6px; }
.cat:first-child { border-top: 0; margin-top: 0; }
.room { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); margin-inline-start: 8px; }
.room:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.room .ic { width: 22px; text-align: center; color: var(--dim); font-weight: 700; flex: none; }
.room .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acts { display: inline-flex; gap: 2px; opacity: .6; transition: opacity .2s; }
.room:hover .acts, .cat:hover .acts, .mrow:hover .acts { opacity: 1; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--muted); border: 1px solid transparent; flex: none; }
.icon-btn:hover { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.icon-btn.on { color: var(--acc); }
.icon-btn svg { width: 17px; height: 17px; }
.modal.wide { width: min(720px, 100%); max-height: 90vh; overflow: auto; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .in { flex: 1; min-width: 200px; width: auto; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; max-height: 280px; overflow: auto; }
.checks label { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line2); cursor: pointer; font-size: 14px; }
.poem { font-family: var(--font-display); font-size: 20px; line-height: 1.9; }
.poem .bt { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.poem .bt span:last-child { text-align: left; }
.poem cite { display: block; font-style: normal; font-size: 13px; color: var(--acc); }
@media (max-width: 900px) {
  .nav { overflow-x: auto; justify-content: flex-start; } .nav .grp { display: none; } .nav a { flex: none; }
  .room .chips { display: none; } .mrow .chips { display: none; }
}
@media (max-width: 700px) { .poem .bt { grid-template-columns: 1fr; } .poem .bt span:last-child { text-align: right; padding-inline-start: 26px; } }
