/* الألوان: غيّرها من هنا وتتغير في كل التطبيق ولوحة التحكم */
:root {
  --bg: #120d1f;
  --bg2: #1b1430;
  --card: #241a3d;
  --card-hover: #2e2250;
  --line: #3a2d5c;
  --text: #f3eefe;
  --muted: #a99cc8;
  --accent: #b26bff;
  --accent2: #ff7ac6;
  --ok: #3ddc97;
  --warn: #ffb347;
  --danger: #ff5c7a;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  background: radial-gradient(circle at 80% -10%, #3b1d6e 0%, transparent 45%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
}
button, input, select, textarea { font-family: inherit; font-size: 1rem; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

/* ================= الصفحة الرئيسية ================= */

.view { max-width: 900px; margin: 0 auto; padding: 12px 16px 32px; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 14px; }
.brand { font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); font-size: 1.2rem; overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.me-chip {
  margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px 4px 4px;
  max-width: 45%;
}
.me-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--bg2); font-weight: 800; font-size: .9rem; overflow: hidden;
}
.mini-av img { width: 100%; height: 100%; object-fit: cover; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); flex: none;
  background: var(--card); font-size: 1.15rem; display: grid; place-items: center;
}
.icon-btn.small { width: 38px; height: 38px; font-size: 1.05rem; }
.icon-btn.active { background: var(--danger); border-color: var(--danger); }

.announce {
  background: linear-gradient(90deg, #3a2266, #4a1e4d); border: 1px solid var(--accent);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; line-height: 1.6;
}
.stats-line { color: var(--muted); margin-bottom: 12px; }
.stats-line span { color: var(--ok); font-weight: 800; }

/* الدول */
.countries-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.country-card {
  display: flex; align-items: center; gap: 14px; text-align: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
  transition: background .15s, transform .15s;
}
.country-card:hover { background: var(--card-hover); transform: translateY(-1px); }
.country-info b { display: block; font-size: 1.1rem; }
.country-info small { color: var(--muted); }
.flag {
  border-radius: 50%; overflow: hidden; display: grid; place-items: center; flex: none;
  background: var(--bg2); border: 2px solid var(--line); font-weight: 800;
}
.flag img { width: 100%; height: 100%; object-fit: cover; }

/* الرومات */
.rooms-list { display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex; align-items: center; gap: 12px; text-align: start; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.room-row:hover { background: var(--card-hover); }
.room-row.featured { border-color: #8a6a1f; background: linear-gradient(90deg, #3a2c12, var(--card) 60%); }
.room-row.closed { opacity: .6; }
.room-star { font-size: 1.4rem; width: 36px; text-align: center; flex: none; }
.room-info { flex: 1; min-width: 0; }
.room-info b { display: flex; align-items: center; gap: 6px; font-size: 1.08rem; }
.room-info small { color: var(--muted); font-size: .85rem; }
.tag { font-size: .75rem; background: var(--bg2); border-radius: 8px; padding: 1px 6px; font-weight: 500; }
.tag.red { background: var(--danger); }
.live { color: var(--ok); }
.count-badge { background: var(--bg2); border-radius: 99px; padding: 4px 10px; font-size: .85rem; color: var(--muted); flex: none; }
.empty-note { color: var(--muted); font-size: .9rem; }
.empty-note.big { text-align: center; padding: 40px 0; }

/* ================= الروم ================= */

.room-view { height: 100dvh; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; }
.room-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.room-title { flex: 1; min-width: 0; }
.room-title b { display: block; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-title small { color: var(--muted); }

.speaker-bar {
  display: flex; align-items: center; gap: 12px; margin: 10px 12px 0; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.speaker-av {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 1.5rem; font-weight: 800; overflow: hidden;
  box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--accent); transition: box-shadow .1s;
}
.speaker-av img { width: 100%; height: 100%; object-fit: cover; }
.speaker-av.empty { background: var(--bg2); box-shadow: none; border: 2px dashed var(--line); }
.speaker-av.speaking { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--ok), 0 0 22px var(--ok); }
.speaker-info { flex: 1; min-width: 0; }
.speaker-info b { display: block; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speaker-info small { color: var(--muted); }
.mic-timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.2rem; direction: ltr;
  background: var(--bg2); border-radius: 12px; padding: 6px 12px; color: var(--ok);
}
.mic-timer.low { color: var(--danger); }

.room-main { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 10px 12px 12px; }
.chat-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.welcome {
  background: linear-gradient(90deg, #3a2266, #2a1d45); border: 1px solid #5a3f8f; border-radius: 14px;
  padding: 10px 14px; line-height: 1.7; margin-bottom: 6px; white-space: pre-wrap;
}
.msg { background: var(--bg2); padding: 6px 12px 8px; border-radius: 14px; max-width: 88%; align-self: flex-start; overflow-wrap: anywhere; }
.msg.mine { background: #3a2266; }
.msg-head { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.msg-head time { color: var(--muted); font-size: .72rem; margin-inline-start: 6px; }
.rank-ic { font-size: .75rem; }
.msg-text { white-space: pre-wrap; line-height: 1.55; }
.msg.system { align-self: center; background: none; color: var(--muted); font-size: .8rem; padding: 1px; text-align: center; }

.emoji-panel {
  position: absolute; bottom: 62px; inset-inline: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 8px; max-height: 200px; overflow-y: auto; z-index: 2;
}
.emoji { background: none; border: none; font-size: 1.5rem; padding: 4px; border-radius: 8px; }
.emoji:hover { background: var(--card-hover); }

.composer { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); align-items: center; }
.composer input { flex: 1; min-width: 0; }
.send-btn {
  width: 44px; height: 42px; border-radius: 12px; border: none; flex: none;
  background: var(--accent); color: white; font-size: 1.1rem; transform: scaleX(-1);
}
.hand-btn {
  height: 42px; min-width: 46px; padding: 0 8px; border-radius: 12px; border: none; flex: none; font-size: 1.2rem; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white;
}
.hand-btn.waiting { background: var(--warn); color: #2a1a00; }
.hand-btn.on { background: var(--danger); }

/* المتواجدين */
.users-panel {
  width: 280px; flex: none; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.users-list { flex: 1; overflow-y: auto; padding: 6px; }
.users-sec { color: var(--muted); font-size: .8rem; padding: 10px 8px 4px; }
.user-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  background: none; border: none; border-radius: 12px; padding: 6px 8px;
}
.user-row:hover { background: var(--card-hover); }
.user-row.me { background: #2f2150; }
.user-row.has-cover {
  background: linear-gradient(90deg, rgba(20,14,36,.55), rgba(20,14,36,.9) 70%), var(--cover) center / cover no-repeat;
  margin-bottom: 3px; min-height: 52px;
}
.user-row.has-cover:hover { filter: brightness(1.12); }
.user-row.has-cover .user-info small { color: #e6def8; }
.user-row.ignored { opacity: .45; }
.user-info small.user-bio { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; opacity: .9; }
.av {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 800; overflow: hidden;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { color: var(--muted); font-size: .75rem; }
.user-badge { font-size: .85rem; background: var(--bg2); border-radius: 99px; padding: 2px 8px; }
.only-mobile { display: none; }

@media (max-width: 760px) {
  .users-panel {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 85vw); border-radius: 0; z-index: 5;
    transform: translateX(110%); transition: transform .2s; box-shadow: -10px 0 30px #0008;
  }
  .users-panel.open { transform: none; }
  .only-mobile { display: grid; }
  .room-main { padding: 8px; }
  .speaker-bar { margin: 8px 8px 0; }
}

/* ================= النوافذ والأزرار ================= */

.modal, .blocker {
  position: fixed; inset: 0; background: #0009; display: grid; place-items: center; padding: 16px; z-index: 20;
}
.blocker { background: #000c; z-index: 30; }
.modal-box {
  width: min(440px, 100%); max-height: 90dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
}
.modal-box h3 { margin: 0 0 12px; }
.modal-box label { display: block; color: var(--muted); margin: 10px 0 6px; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 10px 0; }
.form-error { color: var(--danger); min-height: 1.2em; font-size: .9rem; margin-top: 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.menu-actions { display: flex; flex-direction: column; gap: 8px; }

.btn {
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); font-weight: 700;
}
.btn:hover { background: var(--card-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn.small { padding: 6px 12px; font-size: .88rem; border-radius: 10px; }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--card); border: 1px solid var(--accent); padding: 12px 18px; border-radius: 14px;
  max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px #0008;
}

/* ================= الرسائل الخاصة ================= */
.pm-open { position: relative; }
.pm-badge {
  background: var(--danger); color: white; border-radius: 99px; font-size: .7rem; font-weight: 800;
  min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center;
}
.pm-open .pm-badge { position: absolute; top: -6px; left: -6px; }
.pm-box { width: min(480px, 100%); height: min(640px, 90dvh); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pm-head { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.pm-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-list { flex: 1; overflow-y: auto; padding: 6px; }
.pm-list .user-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pm-toggle { display: flex !important; align-items: center; gap: 8px; padding: 10px 14px; margin: 0 !important; border-top: 1px solid var(--line); font-size: .85rem; }
.pm-toggle input { width: 18px; height: 18px; }
.composer input:disabled { opacity: .6; }

/* ================= نافذة الدخول ================= */
.login-box { padding: 0; overflow: hidden; }
.login-room { padding: 12px 16px; font-weight: 800; font-size: 1.05rem; background: var(--bg2); border-bottom: 1px solid var(--line); }
.login-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; padding: 12px 16px 4px; }
.login-tabs button {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-weight: 700; color: var(--muted);
}
.login-tabs button.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: white; }
.login-field { position: relative; margin: 10px 16px 0; }
.login-field .field-ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); opacity: .8; }
.login-field input { padding-inline-start: 40px; }
.login-box .hint, .login-box .form-error { margin-inline: 16px; }
.login-actions { display: flex; align-items: center; gap: 8px; padding: 12px 16px 16px; }
.login-actions .btn.primary { flex: 1; }
.remember { display: flex !important; align-items: center; gap: 6px; margin: 0 auto 0 0 !important; color: var(--muted); font-size: .9rem; cursor: pointer; }
.remember input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ================= الكاميرا ================= */
.video-stage {
  position: relative; margin: 10px 12px 0; border-radius: 18px; overflow: hidden; background: #000;
  border: 1px solid var(--line); height: min(34vh, 320px); flex: none; display: grid; place-items: center;
}
.video-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-stage video.mirror { transform: scaleX(-1); }
.video-wait { position: absolute; color: var(--muted); display: none; }
.video-stage.loading .video-wait { display: block; }
.video-stage.loading video { opacity: 0; }
.video-tag {
  position: absolute; bottom: 10px; inset-inline-start: 10px; background: #000a; padding: 4px 10px;
  border-radius: 99px; font-size: .85rem; font-weight: 700;
}
.video-btn { position: absolute; top: 10px; inset-inline-end: 10px; background: #000a; border-color: #fff3; }
.video-stage:fullscreen { height: 100%; margin: 0; border-radius: 0; border: none; }
.icon-btn.active-on { background: var(--ok); border-color: var(--ok); }
@media (max-width: 760px) { .video-stage { margin: 8px 8px 0; height: 30vh; } }
.video-btn.second { inset-inline-end: 56px; }
.video-stage.mini { height: 110px; }
@media (max-height: 560px) { .video-stage { height: 120px; } }

/* ================= نافذة "أنا" ================= */
.av.face { background: var(--card-hover); font-size: 1.3em; }
.me-box { padding: 0; width: min(440px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.me-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.me-body { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.me-title { text-align: center; font-weight: 800; font-size: 1.15rem; }
.me-top { display: flex; gap: 14px; align-items: flex-start; }
.face-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.face-prev { width: 72px; height: 72px; border-radius: 14px; background: var(--card-hover); border: 1px solid var(--line); display: grid; place-items: center; font-size: 2.4rem; overflow: hidden; }
.face-prev.letter { font-size: 1.8rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), #6b3fd1); }
.face-prev img { width: 100%; height: 100%; object-fit: cover; }
.face-arrows { display: flex; gap: 6px; }
.face-arrows button { width: 32px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1.2rem; cursor: pointer; }
.face-arrows button:disabled { opacity: .35; cursor: default; }
.status-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.status-opt { display: flex !important; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .85rem; margin: 0 !important; }
.status-opt:has(input:checked) { border-color: var(--accent); background: rgba(178,107,255,.15); }
.me-checks { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.me-checks label { display: flex !important; align-items: center; gap: 8px; font-size: .88rem; margin: 0 !important; cursor: pointer; }
.me-checks input, .status-opt input { width: 17px; height: 17px; flex: none; accent-color: var(--accent); }
.me-sliders { display: flex; flex-direction: column; gap: 6px; }
.slider-row { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; font-size: .88rem; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); padding: 0; }
.slider-row output { width: 44px; text-align: center; color: var(--muted); font-size: .8rem; }
.select-row { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; font-size: .88rem; white-space: nowrap; }
.select-row select { flex: 1; min-width: 0; padding: 7px; border-radius: 8px; background: var(--bg2); color: var(--text); border: 1px solid var(--line); font-family: inherit; }
.style-box { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.style-tools { display: flex; gap: 4px; padding: 6px; background: var(--bg2); align-items: center; }
.style-tools .grow { flex: 1; }
.style-tools button { min-width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-family: inherit; }
.style-tools button.on { background: var(--accent); border-color: var(--accent); }
.st-palette { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; background: var(--card); color: var(--muted); font-size: .75rem; }
.st-preview { padding: 14px; min-height: 52px; border-top: 1px solid var(--line); }
.me-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); }

/* ================= المستويات والملف الشخصي والهدايا ================= */
.lvl-chip { display: inline-block; margin-inline-start: 6px; padding: 0 6px; border-radius: 8px; font-size: .68rem; font-weight: 700; color: #1b1430; background: var(--warn); vertical-align: middle; }
.row-badges { margin-inline-start: 4px; font-size: .8rem; }
.my-prof-btn { align-self: center; }
.prof-box { position: relative; width: min(400px, 100%); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.prof-close { position: absolute; top: 10px; left: 10px; z-index: 2; }
.prof-cover { position: relative; flex: none; height: 120px; margin: -18px -18px -64px; border-radius: 18px 18px 0 0; background: linear-gradient(135deg, #5b3a9e, #2e2250) center / cover no-repeat; }
.prof-cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(to bottom, transparent 40%, var(--card, #1e1633)); }
.prof-views { position: absolute; bottom: 8px; right: 10px; z-index: 1; font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; }
.prof-top { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.prof-av { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; overflow: hidden; border: 3px solid var(--accent); }
.prof-av img { width: 100%; height: 100%; object-fit: cover; }
.prof-top b { font-size: 1.25rem; }
.prof-top small { color: var(--muted); }
.prof-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.badge-pill { font-size: .75rem; padding: 3px 8px; border-radius: 10px; background: var(--card-hover); border: 1px solid var(--line); }
.prof-level { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.lvl-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lvl-line small { color: var(--muted); font-size: .75rem; }
.lvl-bar { height: 8px; border-radius: 6px; background: var(--card-hover); margin-top: 6px; overflow: hidden; }
.lvl-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 6px; }
.prof-points { text-align: center; font-weight: 800; color: var(--warn); }
.prof-bio { margin: 0; text-align: center; color: var(--text); white-space: pre-wrap; }
.prof-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat-chip { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.stat-chip small { color: var(--muted); font-size: .7rem; }
.since { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: .8rem; }
.prof-sec { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.prof-gifts { display: flex; flex-wrap: wrap; gap: 6px; }
.gift-cell { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.gift-ic { font-size: 1.4rem; line-height: 1; }
.prof-edit { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.prof-edit textarea { width: 100%; resize: vertical; padding: 8px; border-radius: 10px; background: var(--bg2); color: var(--text); border: 1px solid var(--line); font-family: inherit; }
.prof-photo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.prof-photo-row label { cursor: pointer; }
.prof-actions { display: flex; gap: 8px; justify-content: center; }
.gift-box { width: min(420px, 100%); padding: 0; overflow: hidden; }
.gift-points { text-align: center; font-weight: 800; color: var(--warn); padding: 10px; }
.gift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px 6px; }
.gift-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; font-family: inherit; }
.gift-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--card-hover); }
.gift-opt:disabled { opacity: .4; cursor: not-allowed; }
.gift-opt .gift-ic { font-size: 2rem; }
.gift-opt small { color: var(--warn); font-size: .72rem; }
.gift-box .hint { padding: 0 12px 12px; margin: 0; }
.msg.gift-msg { align-self: center; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 14px; background: rgba(255, 179, 71, .12); border: 1px solid rgba(255, 179, 71, .4); font-size: .85rem; max-width: 92%; }
.gift-fly { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; z-index: 60; }
.gift-fly .fly-ic { font-size: 7rem; filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
.gift-fly .fly-txt { margin-top: 8px; padding: 6px 14px; border-radius: 14px; background: rgba(18, 13, 31, .85); font-weight: 700; }
.gift-fly.go .fly-ic { animation: giftPop 2.5s ease forwards; }
.gift-fly.go .fly-txt { animation: giftFade 2.5s ease forwards; }
@keyframes giftPop {
  0% { transform: scale(.2) translateY(40px); opacity: 0; }
  20% { transform: scale(1.15); opacity: 1; }
  35% { transform: scale(1); }
  80% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(.6) translateY(-120px); opacity: 0; }
}
@keyframes giftFade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gift-fly.go .fly-ic, .gift-fly.go .fly-txt { animation: none; } }

/* ================= خارج الروم: الشريط السفلي، المفضلة، البحث، المزيد ================= */
#lobby { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 130px; }
.lobby-foot { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; }
.bottom-nav {
  display: flex;
  background: linear-gradient(135deg, #3b1d6e, #5a1e57); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px; color: var(--muted); font-weight: 700; font-size: .9rem; background: none; border: 0;
}
.bottom-nav button i { font-style: normal; font-size: 1.35rem; opacity: .55; filter: grayscale(.6); }
.bottom-nav button.on { color: #fff; }
.bottom-nav button.on i { opacity: 1; filter: none; }
.lobby-stats {
  display: flex; justify-content: center; gap: 28px; padding: 7px; font-size: .9rem; color: var(--muted);
  background: var(--bg2); border-top: 1px solid var(--line);
}
.lobby-stats b { color: var(--text); }
.search-box { display: flex; gap: 8px; margin-bottom: 12px; }
.search-box input { flex: 1; }
.more-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.more-list button {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; text-align: start; font-size: 1.05rem;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text);
}
.more-list button:last-child { border-bottom: 0; }
.more-list button:hover { background: var(--card-hover); }
.fav-btn { font-size: 1.25rem; padding: 4px 6px; flex: none; cursor: pointer; opacity: .45; }
.fav-btn.on { opacity: 1; }
.room-country { color: var(--muted); font-size: .8rem; }
.rooms-hint { color: var(--muted); text-align: center; padding: 50px 10px; }

/* الكمبيوتر: شريط أدوات فوق، الدول على الجنب والرومات جنبها */
@media (min-width: 900px) {
  #lobby { max-width: 1300px; padding-bottom: 20px; }
  .lobby-foot { position: static; order: -1; display: flex; flex-direction: column-reverse; }
  .bottom-nav { margin-bottom: 12px; border-radius: 14px; border: 1px solid var(--line);
    justify-content: flex-start; padding: 0 6px;
  }
  .topbar { order: -2; }
  .bottom-nav button { flex: none; flex-direction: row; gap: 8px; padding: 10px 16px; }
  .bottom-nav button i { font-size: 1.1rem; }
  .lobby-stats { position: static; order: -1; justify-content: flex-start; background: none; border: 0; padding: 0 4px 10px; }
  .home-view { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
  .home-view #countriesView, .home-view #roomsView { display: block !important; }
  .home-view #countriesView { position: sticky; top: 10px; max-height: calc(100dvh - 190px); overflow-y: auto; padding-inline-end: 4px; }
  .home-view .countries-grid { grid-template-columns: 1fr; gap: 6px; }
  .home-view .country-card { padding: 8px 10px; border-radius: 12px; }
  .home-view .country-card.on { border-color: var(--accent); background: var(--card-hover); }
  .home-view .country-info b { font-size: 1rem; }
  #roomsList, #favList, #searchList { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
  #lobbyBack { display: none; }
}
@media (min-width: 900px) { .home-view .flag { width: 38px !important; height: 38px !important; } }

/* ================= المكالمة الصوتية ================= */
.call-box {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: 150px;
  width: min(320px, calc(100vw - 32px)); padding: 20px 16px 16px; border-radius: 22px; text-align: center;
  background: linear-gradient(160deg, #2c1a52, #3d1640); border: 1px solid var(--accent);
  box-shadow: 0 20px 50px #0009; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.call-av { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 2rem; font-weight: 800; background: var(--bg2); }
.call-av > * { width: 100%; height: 100%; font-size: 2rem; }
.call-box.ringing .call-av { animation: callPulse 1.2s ease-in-out infinite; }
.call-name { font-size: 1.25rem; }
.call-status { color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.call-btns { display: flex; gap: 18px; margin-top: 10px; }
.call-btn { width: 58px; height: 58px; border-radius: 50%; border: 0; font-size: 1.5rem; display: grid; place-items: center; }
.call-btn.ok { background: #2fb67c; }
.call-btn.end { background: var(--danger); }
.call-btn.mute { background: var(--card); border: 1px solid var(--line); }
.call-btn.mute.on { background: #fff; }
@keyframes callPulse { 0%, 100% { box-shadow: 0 0 0 0 #b26bff88; } 50% { box-shadow: 0 0 0 14px #b26bff00; } }
@media (prefers-reduced-motion: reduce) { .call-box.ringing .call-av { animation: none; } }
@media (min-width: 900px) { .call-box { bottom: 24px; } }

/* ================= كاميرات متعددة ================= */
.video-grid { display: grid; gap: 4px; width: 100%; height: 100%; grid-template-columns: 1fr; }
.video-grid[data-n="2"] { grid-template-columns: 1fr 1fr; }
.video-grid[data-n="3"], .video-grid[data-n="4"] { grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.video-grid[data-n="5"], .video-grid[data-n="6"] { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
.vtile { position: relative; min-height: 0; border-radius: 10px; overflow: hidden; background: #000; }
.vtile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-grid[data-n="1"] .vtile video { object-fit: contain; }
.vtile video.mirror { transform: scaleX(-1); }
.vtile .video-wait { display: none; position: absolute; inset: 0; place-items: center; color: var(--muted); font-size: .85rem; text-align: center; }
.vtile.loading .video-wait { display: grid; }
.vtile.loading video { opacity: 0; }
.vtile .video-tag { position: absolute; bottom: 6px; inset-inline-start: 6px; }
.vtile.big { grid-column: 1 / -1; grid-row: span 2; }

/* ================= إدارة الروم (مالك الروم) ================= */
.mg-box { width: min(920px, 100%); height: min(640px, 92dvh); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mg-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.mg-head b { font-size: 1.1rem; }
.mg-roomname { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-wrap { flex: 1; min-height: 0; display: flex; }
.mg-side { flex: none; width: 190px; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-inline-end: 1px solid var(--line); background: var(--bg2); overflow-y: auto; }
.mg-side button { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; font-weight: 700; color: var(--muted); text-align: start; }
.mg-side button span { font-size: 1.15rem; width: 24px; text-align: center; }
.mg-side button:hover { background: var(--card); }
.mg-side button.on { background: var(--card); border-color: var(--accent); color: var(--text); }
.mg-body { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 18px 0; display: flex; flex-direction: column; }
.mg-pane { flex: 1; padding-bottom: 16px; }
.mg-pane h4 { margin: 14px 0 6px; font-size: 1.05rem; }
.mg-pane label { display: block; margin: 10px 0 6px; color: var(--muted); font-size: .9rem; }
.mg-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 12px 0; background: var(--card); border-top: 1px solid var(--line); margin-top: auto; }
.mg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mg-check { display: flex !important; align-items: center; gap: 10px; color: var(--text) !important; cursor: pointer; }
.mg-check input { width: 20px; height: 20px; flex: none; }
.mg-check.hidden, .mg-color.hidden { display: none !important; }
.mg-add { display: flex; gap: 8px; margin-bottom: 12px; }
.mg-add input { flex: 1; }
.mg-list { display: flex; flex-direction: column; gap: 8px; }
.mg-item { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.mg-info { flex: 1; min-width: 0; }
.mg-info b { display: block; }
.mg-info small { color: var(--muted); font-size: .8rem; }
.perm-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.perm-list .mg-check { margin: 0; padding: 8px 4px; border-bottom: 1px solid var(--line); }

/* التصميم */
.mg-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.mg-presets .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .85rem; color: var(--text); }
.mg-presets .chip.on { border-color: var(--accent); background: var(--card-hover); }
.mg-presets .chip i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid; display: inline-block; }
.mg-design { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; align-items: start; }
.mg-colors { display: flex; flex-direction: column; gap: 4px; }
.mg-color { display: flex !important; align-items: center; gap: 10px; margin: 0 !important; color: var(--text) !important; cursor: pointer; }
.mg-color input { width: 44px; height: 32px; padding: 2px; border-radius: 8px; flex: none; cursor: pointer; }
.mg-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--pline); background: var(--pbg); color: var(--ptext); font-size: .82rem; }
.pv-top { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--pline); }
.pv-title { color: var(--ptitle); font-size: .95rem; }
.pv-top small { opacity: .7; }
.pv-topic { padding: 5px 10px; background: var(--pcard); border-bottom: 1px solid var(--pline); }
.pv-msgs { display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; min-height: 110px; }
.pv-msg { align-self: flex-start; background: var(--pcard); border-radius: 10px; padding: 4px 9px; }
.pv-msg b { color: var(--paccent); margin-inline-end: 4px; }
.pv-sys { align-self: center; opacity: .65; font-size: .75rem; }
.pv-bar { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-top: 1px solid var(--pline); }
.pv-hand, .pv-send { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--paccent); color: #fff; flex: none; }
.pv-input { flex: 1; background: var(--pcard); border: 1px solid var(--pline); border-radius: 10px; padding: 4px 8px; opacity: .8; }

/* السجل */
.mg-log { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mg-logrow { display: flex; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.mg-logrow:nth-child(odd) { background: var(--bg2); }
.mg-logtime { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }

/* عنوان الروم فوق الدردشة */
.room-topic { margin: 8px 12px 0; padding: 7px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* الجوال: القائمة الجانبية تصير شريط فوق */
@media (max-width: 700px) {
  .mg-box { height: 94dvh; }
  .mg-wrap { flex-direction: column; }
  .mg-side { width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .mg-side button { flex: none; padding: 8px 10px; font-size: .88rem; }
  .mg-side button span { width: auto; }
  .mg-body { padding: 0 14px; }
  .mg-design { grid-template-columns: 1fr; }
  .mg-row { grid-template-columns: 1fr; }
}

/* شريط أدوات المتواجدين (الكمبيوتر) */
.mod-bar { display: none; }
@media (min-width: 900px) {
  .mod-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--bg2); }
  .mb-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1rem; display: grid; place-items: center; padding: 0; transition: transform .1s; }
  .mb-btn:not(:disabled):hover { border-color: var(--accent); transform: scale(1.08); }
  .mb-btn:disabled { opacity: .3; cursor: default; filter: grayscale(1); }
  .mb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
  .mb-who { flex-basis: 100%; font-size: .78rem; color: var(--muted); padding: 2px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-row.sel { background: var(--card-hover); outline: 2px solid var(--accent); outline-offset: -2px; }
}

/* اسم المتكلم ووقته فوق (الجوال) */
.top-speaker { display: none; }
@media (max-width: 899px) {
  .room-title { text-align: center; }
  .room-title.speaking > #roomName, .room-title.speaking > small { display: none; }
  .room-title.speaking .top-speaker:not(.hidden) { display: block; }
  .top-speaker b { font-size: 1.05rem; }
  .top-speaker small { display: block; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
  .room-view.has-speaker .speaker-bar { display: none; }
}
@media (max-width: 899px) {
  .room-top { gap: 4px; padding: 8px; }
  .room-top .icon-btn { width: 34px; height: 34px; min-width: 34px; font-size: .95rem; padding: 0; }
  .top-speaker b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* رتب الروم */
.rank-ladder { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 6px 0 10px; }
.rank-ladder div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.rank-ladder div:last-child { border-bottom: 0; }
.rank-ladder div:nth-child(odd) { background: var(--bg2); }
.rank-ladder small { color: var(--muted); text-align: end; }
.mg-role { width: auto; flex: none; }
.mg-lbl { display: block; margin: 6px 0; color: var(--muted); font-size: .9rem; }
.role-chip { font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--card-hover); color: var(--text); font-weight: 700; vertical-align: middle; }
.role-chip.master { background: #6b3fa0; }
.role-chip.super { background: #1f6f80; }
.role-chip.moderator { background: #1f6b4a; }

/* ================= ألعاب الروم ================= */
.msg.system.game { color: var(--text); background: rgba(255, 179, 71, .1); border: 1px solid rgba(255, 179, 71, .35); border-radius: 12px; padding: 5px 12px; font-size: .88rem; max-width: 92%; }
#gamesBtn.active-on { border-color: var(--warn); box-shadow: 0 0 0 2px rgba(255, 179, 71, .35); }
.games-box { width: min(520px, 100%); }
.games-now { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; margin: 8px 0; border-radius: 12px; background: rgba(255, 179, 71, .12); border: 1px solid rgba(255, 179, 71, .4); font-size: .9rem; }
.game-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.game-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.gc-ic { font-size: 1.8rem; width: 40px; text-align: center; flex: none; }
.gc-info { flex: 1; min-width: 0; }
.gc-info b { display: block; }
.gc-info small { color: var(--muted); font-size: .8rem; }
.gc-rounds { width: auto; min-width: 86px; flex: none; padding: 8px 10px; }
.game-card .btn:disabled { opacity: .4; cursor: default; }

.game-bar { margin: 8px 12px 0; padding: 10px 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(255, 179, 71, .14), rgba(178, 107, 255, .14)); border: 1px solid rgba(255, 179, 71, .45); text-align: center; }
.gb-head { display: flex; align-items: center; gap: 8px; }
.gb-head b { flex: 1; text-align: start; }
.gb-round { font-size: .8rem; color: var(--muted); }
.gb-timer { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 44px; }
.gb-timer.low { color: var(--danger); }
.gb-stop { background: none; border: 0; font-size: 1rem; padding: 2px; }
.gb-prompt { font-size: 1.15rem; font-weight: 800; margin: 8px 0 4px; line-height: 1.6; }
.gb-prompt.small { font-size: .95rem; font-weight: 700; }
.gb-prompt.letters { font-size: 1.6rem; letter-spacing: 4px; color: var(--warn); }
.gb-hint { font-size: .85rem; color: var(--warn); }
.gb-tip { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.gb-players { font-size: .8rem; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-join { margin-top: 6px; }
@media (max-width: 899px) { .game-bar { margin: 6px 8px 0; padding: 8px 10px; } .gb-prompt { font-size: 1.05rem; } }

/* ================= روابط الدعوة ================= */
.invite-box { width: min(460px, 100%); }
.invite-room { font-weight: 800; font-size: 1.05rem; margin: 6px 0 10px; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; direction: ltr; text-align: left; font-size: .85rem; }
.invite-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.invite-btns .wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.invite-btns .tg { background: #2a8bd2; border-color: #2a8bd2; color: #fff; }

/* ================= الواجهة الجديدة للرومات ================= */
/* بطاقة الروم (الجوال والكمبيوتر) */
.room-row { position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s, background .15s; }
.room-row::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--ra); opacity: .9; }
.room-row.featured { border-color: rgba(255, 196, 0, .55); background: linear-gradient(100deg, rgba(255, 196, 0, .16), var(--card) 55%); }
.room-av {
  position: relative; width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 1.25rem; color: #fff;
  background: linear-gradient(135deg, var(--ra), color-mix(in srgb, var(--ra) 45%, #1b1430));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ra) 35%, transparent);
}
.room-av-star { position: absolute; top: -7px; inset-inline-end: -7px; font-style: normal; font-size: .9rem; filter: drop-shadow(0 1px 2px #0008); }
.room-row.is-live .room-av::after {
  content: ""; position: absolute; inset: -4px; border-radius: 17px; border: 2px solid var(--ok);
  animation: livePulse 1.6s ease-out infinite;
}
@keyframes livePulse { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.18); } }
.room-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.room-chips span { font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); }
.room-chips .chip-live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.room-chips .chip-cam { color: #7cc7ff; border-color: #2a6c99; }
.room-chips .chip-game { color: var(--warn); border-color: #8a6a1f; background: rgba(255, 179, 71, .1); }
.room-meta { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: none; }
.fill-bar { width: 64px; height: 4px; border-radius: 4px; background: var(--bg2); overflow: hidden; }
.fill-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--warn)); border-radius: 4px; }
.enter-hint { display: none; }
.country-stats { display: flex; gap: 10px; }
.country-card { position: relative; }
.live-dot { position: absolute; top: 10px; inset-inline-end: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: dotPulse 2s infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.country-card.virtual .flag { font-size: 1.6rem; border-color: transparent; }
.country-card.v-featured { background: linear-gradient(100deg, rgba(255, 196, 0, .18), var(--card) 70%); border-color: rgba(255, 196, 0, .45); }
.country-card.v-featured .flag { background: linear-gradient(135deg, #ffd54a, #ff9f1a); }
.country-card.v-hot { background: linear-gradient(100deg, rgba(255, 92, 122, .18), var(--card) 70%); border-color: rgba(255, 92, 122, .45); }
.country-card.v-hot .flag { background: linear-gradient(135deg, #ff7a59, #ff3d7f); }
.desk-search, .desk-only, .rooms-hero { display: none; }

/* الكمبيوتر: شكل تطبيق كامل */
@media (min-width: 900px) {
  body:has(#lobby:not(.hidden)) { overflow: hidden; }
  #lobby:not(.hidden) { display: flex; flex-direction: column; height: 100dvh; max-width: 1400px; padding: 12px 18px 0; }
  .topbar { padding: 4px 0 12px; gap: 12px; }
  .brand { font-size: 1.5rem; }
  .brand .logo { box-shadow: 0 6px 20px rgba(178, 107, 255, .35); }
  .desk-search { display: block; flex: 1; max-width: 460px; margin-inline-start: auto; }
  .desk-search input { border-radius: 999px; padding: 10px 18px; background: var(--card); }
  .topbar .pm-open { margin-inline-start: 0; }

  .lobby-foot { display: contents; }
  .bottom-nav { order: -1; margin: 0 0 12px; padding: 4px; gap: 4px; border-radius: 16px; background: var(--bg2); width: fit-content; }
  .bottom-nav button { border-radius: 12px; padding: 9px 18px; }
  .bottom-nav button.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 4px 14px rgba(178, 107, 255, .35); }
  .lobby-stats {
    order: 99; position: static; display: flex; justify-content: flex-start; gap: 22px; margin: 0 -18px; padding: 8px 22px;
    background: var(--bg2); border-top: 1px solid var(--line); font-size: .85rem;
  }
  .desk-only { display: inline; }
  .lobby-stats .conn { margin-inline-start: auto; color: var(--ok); }

  #homeView, #favView, #searchView, #moreView { flex: 1; min-height: 0; }
  #favView, #searchView, #moreView { overflow-y: auto; padding-bottom: 14px; }
  #searchView .search-box { display: none; }
  .home-view:not(.hidden) { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: stretch; }
  .home-view #countriesView {
    position: static; max-height: none; height: 100%; overflow-y: auto; padding: 10px; border-radius: 18px;
    background: var(--bg2); border: 1px solid var(--line);
  }
  .home-view .stats-line { padding: 2px 6px 8px; margin: 0; font-size: .9rem; }
  .home-view .country-card { padding: 9px 12px; border-radius: 14px; background: transparent; border-color: transparent; }
  .home-view .country-card:hover { background: var(--card); transform: none; }
  .home-view .country-card.on { background: var(--card-hover); border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
  .home-view .country-card.v-featured, .home-view .country-card.v-hot { margin-bottom: 4px; }
  .home-view .country-card.v-featured:not(.on) { background: linear-gradient(100deg, rgba(255, 196, 0, .12), transparent 80%); }
  .home-view .country-card.v-hot:not(.on) { background: linear-gradient(100deg, rgba(255, 92, 122, .12), transparent 80%); }
  .home-view .country-stats { font-size: .78rem; }
  .home-view #roomsView { height: 100%; overflow-y: auto; padding: 0 4px 16px; }

  .rooms-hero {
    display: flex; align-items: center; gap: 18px; padding: 18px 22px; margin-bottom: 14px; border-radius: 20px;
    background: radial-gradient(circle at 90% 0%, rgba(178, 107, 255, .45), transparent 55%), linear-gradient(120deg, #2c1d52, #1b1430);
    border: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
  }
  .rooms-hero.v-featured { background: radial-gradient(circle at 90% 0%, rgba(255, 196, 0, .35), transparent 55%), linear-gradient(120deg, #3a2c12, #1b1430); }
  .rooms-hero.v-hot { background: radial-gradient(circle at 90% 0%, rgba(255, 92, 122, .4), transparent 55%), linear-gradient(120deg, #4a1a2e, #1b1430); }
  .rooms-hero .flag { border-width: 3px; box-shadow: 0 6px 24px #0008; font-size: 2.2rem; }
  .hero-info h2 { margin: 0 0 6px; font-size: 1.6rem; }
  .hero-stats { display: flex; flex-wrap: wrap; gap: 8px; }
  .hero-stats span { padding: 4px 12px; border-radius: 99px; background: rgba(0, 0, 0, .25); font-size: .88rem; }
  .hero-stats .hero-live { color: var(--ok); }

  #roomsList, #favList, #searchList { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
  .room-row { padding: 14px 16px 14px 14px; border-radius: 18px; min-height: 88px; }
  .room-row:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ra) 60%, var(--line)); box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 0 0 1px color-mix(in srgb, var(--ra) 25%, transparent); }
  .room-av { width: 54px; height: 54px; border-radius: 16px; font-size: 1.45rem; }
  .room-row .enter-hint {
    display: block; position: absolute; bottom: 8px; inset-inline-end: 14px; font-size: .75rem; font-weight: 800;
    color: var(--ra); opacity: 0; transform: translateX(6px); transition: .15s;
  }
  .room-row:hover .enter-hint { opacity: 1; transform: none; }
  .room-row .fav-btn { align-self: flex-start; }
}
.rooms-hero.v-featured .flag { background: linear-gradient(135deg, #ffd54a, #ff9f1a); border-color: transparent; }
.rooms-hero.v-hot .flag { background: linear-gradient(135deg, #ff7a59, #ff3d7f); border-color: transparent; }

/* الشاشات الكبيرة: الواجهة تملي عرض الشاشة كله بدون فراغ على الجنبين */
@media (min-width: 900px) {
  #lobby:not(.hidden) { max-width: none; width: 100%; padding-inline: 24px; }
  .lobby-stats { margin-inline: -24px; padding-inline: 28px; }
  .room-view { max-width: none; width: 100%; }
  .room-view .users-panel { width: clamp(280px, 22vw, 380px); }
  .home-view:not(.hidden) { grid-template-columns: clamp(280px, 20vw, 360px) 1fr; }
}
@media (min-width: 1600px) {
  #roomsList, #favList, #searchList { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}

/* ================= صفحة المزيد ================= */
.more-wrap { display: flex; flex-direction: column; gap: 14px; }
.more-head {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px;
  background: linear-gradient(120deg, rgba(178, 107, 255, .35), rgba(255, 122, 198, .2) 60%, var(--card));
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.more-av { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700;
  background: var(--bg2); border: 2px solid rgba(255, 255, 255, .25); overflow: hidden; }
.more-av img { width: 100%; height: 100%; object-fit: cover; }
.more-hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.more-hinfo b { font-size: 1.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-hinfo small { color: var(--muted); }
.more-rank { align-self: flex-start; font-size: .8rem; padding: 2px 10px; border-radius: 999px; color: var(--rk);
  background: color-mix(in srgb, var(--rk) 16%, transparent); border: 1px solid color-mix(in srgb, var(--rk) 45%, transparent); }
.more-head .btn { flex: none; }
.more-cols { display: flex; flex-direction: column; gap: 14px; }
.more-title { margin: 0 6px 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.more-list button { gap: 14px; padding: 12px 14px; font-size: 1rem; transition: background .15s; }
.more-list .mi {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-style: normal; font-size: 1.2rem;
  background: color-mix(in srgb, var(--mi) 20%, transparent); border: 1px solid color-mix(in srgb, var(--mi) 40%, transparent);
}
.more-list .mt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.more-list .mt b { font-weight: 600; }
.more-list .mt small { color: var(--muted); font-size: .8rem; }
.more-list .mchev { font-style: normal; color: var(--muted); font-size: 1.3rem; transition: transform .15s; }
.more-list button:hover .mchev { transform: translateX(-4px); color: var(--accent); }
.more-list button.is-on .mi { background: color-mix(in srgb, var(--ok) 25%, transparent); }
@media (min-width: 900px) {
  .more-wrap { max-width: 1100px; margin: 0 auto; width: 100%; }
  .more-cols { display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; }
}

/* ================= عن البرنامج ================= */
.about-box { width: min(560px, 100%); position: relative; padding: 0 0 18px; }
.about-x { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 1; }
.about-hero {
  text-align: center; padding: 28px 18px 18px;
  background: radial-gradient(circle at 50% 0, rgba(178, 107, 255, .45), transparent 70%), linear-gradient(180deg, rgba(255, 122, 198, .12), transparent);
}
.about-logo {
  width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 24px; display: grid; place-items: center; font-size: 2.6rem; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 30px rgba(178, 107, 255, .45);
}
.about-logo img { width: 100%; height: 100%; object-fit: cover; }
.about-hero h2 { margin: 0 0 4px; font-size: 1.6rem; }
.about-tag { margin: 0 0 10px; color: var(--muted); }
.about-ver { display: inline-block; font-size: .78rem; padding: 3px 12px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 18px 6px; }
.about-stat { text-align: center; padding: 10px 6px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.about-stat b { display: block; font-size: 1.35rem; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.about-stat small { color: var(--muted); font-size: .78rem; }
.about-text { margin: 12px 18px 0; padding: 12px 14px; border-radius: 14px; background: var(--bg2); border-inline-start: 3px solid var(--accent); line-height: 1.7; white-space: pre-line; }
.about-h { margin: 18px 18px 8px; font-size: 1rem; }
.about-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 18px; }
.about-feat { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.about-feat i { font-style: normal; font-size: 1.4rem; line-height: 1; }
.about-feat b { display: block; font-size: .9rem; margin-bottom: 2px; }
.about-feat small { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.about-steps, .about-rules { margin: 0 18px; padding-inline-start: 22px; line-height: 1.9; color: var(--text); }
.about-rules li::marker { color: var(--accent2); }
.about-steps li::marker { color: var(--accent); font-weight: 700; }
.about-plats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 18px; }
.about-plats span { padding: 6px 14px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: .88rem; }
.about-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 18px 0; }
.about-acts .btn { flex: 1 1 200px; text-align: center; text-decoration: none; }
.about-contact { overflow-wrap: anywhere; }
.about-foot { text-align: center; color: var(--muted); font-size: .8rem; margin: 16px 18px 0; }
@media (max-width: 480px) { .about-feats { grid-template-columns: 1fr; } }

/* بطاقة دعوة المختبرين */
.tester-card { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, #163a2c, #1e2d4d); border: 1px solid #3fae7a; border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.tester-card.hidden { display: none; }
.tester-card .tc-ic { font-size: 26px; }
.tester-card .tc-t { flex: 1; display: flex; flex-direction: column; line-height: 1.5; }
.tester-card .tc-t small { color: var(--muted); }
.tester-card .tc-go { background: #3fae7a; color: #fff; border: 0; border-radius: 10px; padding: 7px 14px; font: inherit; font-weight: 800; cursor: pointer; }
.tester-card .tc-x { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px; }
.tester-step { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.tester-step .ts-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.tester-step .ts-b { flex: 1; }
.tester-step .ts-b p { margin: 4px 0 8px; color: var(--muted); line-height: 1.6; }
.tester-step .ts-a { display: inline-block; text-decoration: none; }
.tester-note { color: var(--muted); font-size: 13px; text-align: center; }

/* الألقاب الملكية: الاسم يلمع بلونه */
.royal { font-weight: 800; text-shadow: 0 0 10px currentColor, 0 0 2px currentColor; }

/* ================= لوحة الألعاب: لودو، إكس أو، حجرة ورقة مقص ================= */
.gb-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.gb-actions .btn { padding: 6px 14px; }
.board-box { width: min(480px, 100%); display: flex; flex-direction: column; gap: 10px; }
.board-box .me-head { display: flex; align-items: center; gap: 8px; }
.board-box .me-head b { flex: 1; }
.bd-players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bd-pl { padding: 4px 10px; border-radius: 99px; font-size: .82rem; background: var(--bg2); border: 2px solid var(--pc, var(--line)); }
.bd-pl.turn { background: var(--pc, var(--accent)); color: #fff; font-weight: 800; box-shadow: 0 0 12px var(--pc, var(--accent)); }
.bd-pl.left { opacity: .4; text-decoration: line-through; }
.bd-status { text-align: center; font-weight: 700; min-height: 1.4em; }
.bd-wait { text-align: center; color: var(--muted); padding: 18px 0 8px; }
#boardBody { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ludo { position: relative; width: min(100%, 420px); aspect-ratio: 1; display: grid; grid-template: repeat(15, 1fr) / repeat(15, 1fr); background: #f6f1ff; border-radius: 12px; overflow: hidden; border: 3px solid #3a2e64; }
.lc { border: .5px solid #c9bde6; display: grid; place-items: center; font-size: clamp(8px, 2.2vw, 12px); color: #8a7bb5; }
.lc.home { border-color: rgba(0,0,0,.15); }
.lbase { background: var(--pc); border-radius: 4px; position: relative; }
.lbase::after { content: ""; position: absolute; inset: 16%; background: #fff; border-radius: 14px; opacity: .92; }
.lmid { background: conic-gradient(from 45deg, #2e86de 0 25%, #e74c3c 0 50%, #27ae60 0 75%, #f1c40f 0); }
.ltok { position: absolute; z-index: 2; width: 5.4%; aspect-ratio: 1; padding: 0; border-radius: 50%; border: 2px solid #fff; background: var(--pc); box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 -3px 0 rgba(0,0,0,.2); transition: left .35s, top .35s; }
.ltok:disabled { cursor: default; }
.ltok.walking { z-index: 4; transition: left .16s ease-out, top .16s ease-out; }
.ltok.hop { animation: ltokHop .19s ease-out; }
@keyframes ltokHop { 50% { scale: 1.35; box-shadow: 0 8px 10px rgba(0,0,0,.35); } }
.ltok.moved { outline: 2px solid #fff; outline-offset: 1px; }
.ltok.can { z-index: 3; cursor: pointer; animation: ltokPulse .8s ease-in-out infinite; }
@keyframes ltokPulse { 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.85), 0 0 14px var(--pc); } }
.ludo-ctl { display: flex; align-items: center; gap: 12px; width: min(100%, 420px); }
.ludo-dice { --ds: 46px; --dz: 23px; width: 72px; height: 72px; flex: none; border-radius: 18px; border: 3px solid var(--pc, var(--line)); background: radial-gradient(circle at 50% 70%, rgba(0,0,0,.25), transparent 60%), var(--bg2); display: grid; place-items: center; padding: 0; perspective: 300px; }
.ludo-dice.can { cursor: pointer; box-shadow: 0 0 16px var(--pc); }
.ludo-dice.can .dcube { animation: diceWiggle 1s ease-in-out infinite; }
.ludo-dice:disabled { cursor: default; }
.dcube { position: relative; width: var(--ds); height: var(--ds); transform-style: preserve-3d; transform: rotateX(-25deg) rotateY(35deg); }
.dface { position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 15%; border-radius: 22%; background: radial-gradient(circle at 30% 25%, #fff, #ecebf3 70%, #d6d3e3); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), inset 0 -3px 6px rgba(0,0,0,.12); backface-visibility: hidden; }
.pip { width: 74%; aspect-ratio: 1; place-self: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555, #111); box-shadow: inset 0 1px 1px rgba(255,255,255,.25); }
.dface:first-child .pip { background: radial-gradient(circle at 35% 30%, #ff6b6b, #b00000); width: 92%; }
@keyframes diceWiggle { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.lname { position: absolute; z-index: 1; left: 6%; right: 6%; top: 2.5%; height: 11%; display: flex; align-items: center; justify-content: center; padding: 0 6px; border-radius: 99px; background: rgba(0,0,0,.35); color: #fff; font-weight: 800; font-size: clamp(8px, 2.3vw, 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.lname.bottom { top: auto; bottom: 2.5%; }
.lbase.turn { animation: baseGlow 1.1s ease-in-out infinite; }
.lbase.turn .lname { background: #fff; color: #222; }
.lbase.left, .lbase.empty { filter: grayscale(.7) opacity(.55); }
@keyframes baseGlow { 50% { box-shadow: inset 0 0 0 4px #fff, 0 0 14px var(--pc); } }
.ludo-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ludo-info small { color: var(--muted); }
.xo { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; width: min(100%, 300px); aspect-ratio: 1; }
.xo-c { min-width: 0; min-height: 0; aspect-ratio: 1; overflow: hidden; line-height: 1; border-radius: 16px; border: 2px solid var(--line); background: var(--bg2); font-size: clamp(34px, 11vw, 56px); display: grid; place-items: center; padding: 0; }
.xo-c:not(:disabled):hover { background: var(--card-hover); border-color: var(--accent); }
.xo-c:disabled { cursor: default; opacity: 1; }
.xo-c.win { background: rgba(255, 213, 74, .25); border-color: var(--warn); animation: pop .4s; }
.rps-row { display: flex; gap: 10px; justify-content: center; }
.rps-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 96px; padding: 12px 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--bg2); }
.rps-btn:not(:disabled):hover { border-color: var(--accent); transform: translateY(-3px); }
.rps-btn:disabled { opacity: .5; cursor: default; }
.rps-big { font-size: 46px; line-height: 1.1; }
.rps-reveal { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 10px 0; }
.rps-side { display: flex; flex-direction: column; align-items: center; animation: pop .45s; }
.rps-vs { font-weight: 800; color: var(--muted); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
