:root {
  --bg: #fff7ec;
  --card: #ffffff;
  --cream: #fff8ee;
  --cream-deep: #fff1d8;
  --line: #f0dfc9;
  --line-strong: #e3c99e;
  --red: #b71c1c;
  --red-deep: #8e1414;
  --red-soft: #fdecea;
  --gold: #c99700;
  --gold-light: #ffe9a8;
  --text: #33302b;
  --muted: #8d8577;
  --green: #2e9e5b;
  --danger: #b71c1c;
  --shadow-soft: 0 6px 22px rgba(140, 90, 20, 0.12);
  --shadow-deep: 0 22px 60px rgba(120, 70, 20, 0.22);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Cairo", "Tajawal", "Segoe UI", Tahoma, system-ui, sans-serif;
}

html, body { min-height: 100%; }

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(560px 360px at 10% -8%, rgba(255, 193, 7, 0.22), transparent 62%),
    radial-gradient(620px 420px at 98% 108%, rgba(183, 28, 28, 0.12), transparent 60%),
    radial-gradient(rgba(183, 28, 28, 0.05) 1px, transparent 1.4px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
}

.hidden { display: none !important; }
.screen { width: 100%; }

button { font-family: inherit; }
button:disabled { opacity: 0.6; cursor: wait !important; }

/* ---------- Login ---------- */

#login-screen {
  min-height: calc(100vh - 40px);
  display: flex;
  justify-content: center;
  align-items: center;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35)),
    url('interface-bg.jpg');
  background-size: cover;
  background-position: center;
  backdrop-filter: blur(2px);
  border-radius: var(--radius-lg);
}

.login-box {
  position: relative;
  width: min(100%, 400px);
  padding: 38px 30px 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.78);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 22px 60px rgba(60, 10, 60, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: riseIn 0.55s ease both;
}

.login-box::before {
  content: none;
  display: none;
}

.login-emblem {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  color: #ffffff;
  background-color: var(--red);
  border-radius: 50%;
  border: 3px solid var(--gold-light);
  box-shadow: 0 0 0 6px rgba(201, 151, 0, 0.14), 0 10px 28px rgba(183, 28, 28, 0.28), inset 0 2px 6px rgba(255, 255, 255, 0.30);
  animation: floatGlow 4s ease-in-out infinite;
}

.emblem-spark {
  position: absolute;
  color: var(--gold-light);
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(201, 151, 0, 0.8);
}
.sparkle-1 { top: 8px; inset-inline-start: 12px; }
.sparkle-2 { bottom: 10px; inset-inline-end: 12px; font-size: 10px; }

.login-box h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--red);
  text-shadow: 0 0 22px rgba(183, 28, 28, 0.10);
  margin-bottom: 8px;
}

.login-box p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 18px;
}

#auth-form { display: grid; gap: 12px; }

.login-box input {
  width: 100%;
  padding: 13px 16px;
  color: var(--text);
  background: #fffbf3;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-box input::placeholder { color: rgba(51, 48, 43, 0.42); }

.login-box input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.14), 0 0 18px rgba(201, 151, 0, 0.12);
}

#auth-submit {
  position: relative;
  overflow: hidden;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  color: #ffffff;
  background-color: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(183, 28, 28, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, background-color 0.2s ease;
}

#auth-submit::before {
  content: "★";
  font-size: 12px;
  line-height: 1;
  color: var(--gold-light);
}

#auth-submit::after {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  inset-inline-start: -20%;
  width: 34%;
  background: rgba(255, 255, 255, 0.35);
  transform: skewX(-18deg) translateX(-140%);
  animation: shineSweep 3.4s ease-in-out infinite;
  pointer-events: none;
}

#auth-submit:hover { background-color: var(--red-deep); transform: translateY(-1px); }
#auth-submit:active { transform: translateY(0); }

.auth-switch {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.link-button {
  width: auto !important;
  padding: 0 !important;
  background: none !important;
  border: none;
  color: var(--red) !important;
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(201, 151, 0, 0.65);
  cursor: pointer;
  transition: color 0.2s ease;
}

.link-button:hover { color: var(--red-deep) !important; }

.status {
  min-height: 1.25em;
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.status.success { color: var(--green); }

/* ---------- Chat layout ---------- */

#chat-screen {
  position: relative;
  display: flex;
  width: min(100%, 1060px);
  height: min(88vh, 780px);
  min-height: 480px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  animation: riseIn 0.55s ease both;
}

.sidebar {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  inset-inline-start: auto;
  z-index: 35;
  width: min(290px, calc(100% - 24px));
  max-height: min(78%, 540px);
  padding: 16px;
  overflow-y: auto;
  background: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-deep);
}

.sidebar-close {
  flex: 0 0 auto;
  margin-inline-start: auto;
  width: 30px;
  height: 30px;
  color: #ffffff;
  background: var(--red);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.online-toggle-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  color: var(--red);
  background: #fff8e8;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
  box-shadow: 0 0 12px 2px rgba(212, 175, 55, 0.3);
}
.online-toggle-btn:hover { border-color: var(--red); }
.online-toggle-btn[aria-expanded="true"] { background: var(--red); color: #ffffff; text-shadow: none; }

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sidebar-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: #ffffff;
  background-color: var(--red);
  border: 2px solid var(--gold-light);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(183, 28, 28, 0.22);
}

.sidebar h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--red);
}

.sidebar ul { list-style: none; display: grid; gap: 8px; }

.sidebar li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-inline-start: 4px solid hsl(var(--hue, 45) 70% 55%);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.sidebar li:hover { transform: translateX(-2px); box-shadow: var(--shadow-soft); }

.online-dot {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 11px;
  text-shadow: 0 0 10px rgba(46, 158, 91, 0.7);
  animation: pulseDot 2.2s ease-in-out infinite;
}

.chat-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fffdf8;
}

/* ---------- Header ---------- */

.chat-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  background-color: var(--red);
  border-bottom: 3px solid var(--gold);
  overflow: hidden;
}

.chat-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(380px 120px at 18% 0%, rgba(255, 233, 168, 0.22), transparent 70%);
  pointer-events: none;
}

.chat-head-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.head-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 233, 168, 0.5);
  border-radius: 14px;
}

.head-text { min-width: 0; }

#chat-title {
  display: block;
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.30);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#chat-title::after {
  content: " ★";
  color: var(--gold-light);
  font-size: 13px;
}

.current-user {
  display: block;
  margin-top: 2px;
  color: #ffd9d9;
  font-size: 12px;
  font-weight: 600;
}

.logout-button {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 233, 168, 0.55);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.logout-button:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-1px); }

/* ---------- Rooms ---------- */

.room-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}

.room-bar label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.room-bar label svg { color: var(--gold); }

/* Green verified badge next to room label — no glow, transparent background */
.room-verified-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  object-fit: contain;
  background: transparent;
}

.room-bar select, .room-current-btn {
  flex: 1;
  min-width: 0;
  max-width: 380px;
  padding: 10px 14px;
  padding-inline-start: 38px;
  color: var(--red);
  background-color: #fff8e8;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: start;
  font-family: inherit;
  /* Glowing current-room name (steady light) */
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.75);
  box-shadow: 0 0 12px 2px rgba(212, 175, 55, 0.35);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%23b71c1c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.room-bar select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.12);
}

.room-bar select option { background: #ffffff; color: var(--text); }

/* ---------- Messages ---------- */

#messages-container {
  flex: 1;
  min-height: 0;
  padding: 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: rgba(183, 28, 28, 0.30) transparent;
}

.message {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 9px 13px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: 0 3px 12px rgba(140, 90, 20, 0.08);
  animation: messageIn 0.3s ease both;
}

.message.mine {
  align-self: flex-end;
  background: var(--cream-deep);
  border-color: #e8cf9e;
}

.message.other {
  align-self: flex-start;
}

.avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  color: #ffffff;
  background-color: hsl(var(--hue, 45) 65% 52%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
}

.msg-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.message .meta {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 10px;
  color: hsl(var(--hue, 45) 55% 30%);
  background-color: transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1px;
  overflow-wrap: anywhere;
}

.admin-coins-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.admin-coins-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 900; font-size: 13px; color: var(--text); }
.admin-coins-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; font-family: inherit; }
.admin-coins-status { min-height: 18px; font-size: 13px; font-weight: 800; color: #1a7f37; text-align: center; }

.msg-text {
  display: block;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--text);
}

/* ---------- Buyer glow in chat (steady light, no blinking) ---------- */
/* Chat bubble tinted with the equipped shop color (same hue as the shop item) */
.message.buyer {
  background: linear-gradient(135deg, hsl(var(--hue, 45) 92% 94%), hsl(var(--hue, 45) 85% 89%));
  border-color: hsl(var(--hue, 45) 75% 62% / 0.7);
  box-shadow: 0 0 6px 1px hsl(var(--hue, 45) 70% 60% / 0.35), 0 2px 6px rgba(0, 0, 0, 0.06);
}
.message.buyer.mine {
  background: linear-gradient(135deg, hsl(var(--hue, 45) 88% 90%), hsl(var(--hue, 45) 80% 85%));
  border-color: hsl(var(--hue, 45) 75% 58% / 0.8);
  box-shadow: 0 0 7px 1px hsl(var(--hue, 45) 70% 60% / 0.4), 0 2px 6px rgba(0, 0, 0, 0.07);
}
.message.buyer .msg-text {
  color: hsl(var(--hue, 45) 45% 22%);
  font-weight: 700;
}
.message.buyer .meta {
  color: hsl(var(--hue, 45) 65% 50%);
  background-color: transparent;
}
.message.black-buyer {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.06);
}
.message.black-buyer.mine {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  border-color: rgba(0, 0, 0, 0.45);
}
.message.black-buyer .msg-text { color: #111827; }
.message.black-buyer .avatar { box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.3); }
.message.black-buyer .meta {
  color: #111111;
}
.message.black-buyer .meta-name {
  color: #111111;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 0, 0, 0.2);
}
.sidebar li.black-buyer {
  border-color: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.25);
}
.shop-name-preview.black-name {
  color: #111111;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 0, 0, 0.2);
}
.message.white-buyer {
  background: linear-gradient(135deg, #374151, #111827);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.message.white-buyer.mine {
  background: linear-gradient(135deg, #4b5563, #1f2937);
  border-color: rgba(255, 255, 255, 0.5);
}
.message.white-buyer .msg-text { color: #f9fafb; }
.message.white-buyer .avatar { box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.4); }
.message.white-buyer .meta {
  color: #ffffff;
}
.message.white-buyer .meta-name {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 18px rgba(255, 255, 255, 0.5), 0 0 6px rgba(0, 0, 0, 0.45);
}
.sidebar li.white-buyer {
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.25);
}
.shop-name-preview.white-name {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.4), 0 0 18px rgba(0, 0, 0, 0.25);
}
.meta-name-wrap { display: inline-flex; flex-direction: column; line-height: 1.05; vertical-align: top; }
.meta-user-id { color: inherit; font-size: 10px; font-weight: 700; opacity: 0.75; }

.message.buyer .meta-name {
  color: hsl(var(--hue, 45) 65% 50%);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.1px;
  text-shadow: 0 0 8px hsl(var(--hue, 45) 70% 60% / 0.8), 0 0 18px hsl(var(--hue, 45) 70% 60% / 0.45);
}
.buyer .avatar {
  box-shadow: 0 0 6px 1px hsl(var(--hue, 45) 70% 60% / 0.45);
}
.sidebar li.buyer {
  border-color: hsl(var(--hue, 45) 70% 60% / 0.6);
  box-shadow: 0 0 12px 2px hsl(var(--hue, 45) 70% 60% / 0.35);
}

.system-msg {
  align-self: center;
  padding: 6px 16px;
  color: #8d6e2b;
  background: #fff4cf;
  border: 1px solid #ead28a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
/* Royal elegant join notice */
.system-msg.join-notice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 22px;
  color: #ffe9a8;
  background: linear-gradient(135deg, #2b0a4a, #5b21b6 55%, #2b0a4a);
  border: 1px solid #d4af37;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.45), 0 4px 14px rgba(43, 10, 74, 0.35);
  animation: joinIn 0.5s ease both;
}
.join-notice .join-crown { font-size: 16px; line-height: 1; }
.join-notice .join-name {
  color: hsl(var(--hue, 45) 95% 78%);
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 0 8px hsl(var(--hue, 45) 90% 65% / 0.85);
  overflow-wrap: anywhere;
}
@keyframes joinIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.empty-state {
  margin: auto;
  max-width: 330px;
  padding: 26px 28px;
  color: var(--muted);
  background: #fff8ee;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- Composer ---------- */

.composer-wrap {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--cream);
  border-top: 2px solid var(--line);
}

.composer-wrap .status { text-align: start; }

#message-form { display: flex; gap: 10px; }

#message-input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#message-input::placeholder { color: rgba(51, 48, 43, 0.42); }

#message-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.12);
}

#send-button {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 96px;
  padding: 12px 22px;
  overflow: hidden;
  color: #ffffff;
  background-color: var(--red);
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(183, 28, 28, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, background-color 0.2s ease;
}

#send-button::after {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  inset-inline-start: -20%;
  width: 34%;
  background: rgba(255, 255, 255, 0.38);
  transform: skewX(-18deg) translateX(-140%);
  animation: shineSweep 3.8s ease-in-out infinite;
  pointer-events: none;
}

#send-button:hover { background-color: var(--red-deep); transform: translateY(-1px); }
#send-button:active { transform: translateY(0); }

/* ---------- Animations ---------- */

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatGlow {
  0%, 100% { box-shadow: 0 0 0 6px rgba(201, 151, 0, 0.14), 0 10px 28px rgba(183, 28, 28, 0.28), inset 0 2px 6px rgba(255, 255, 255, 0.30); }
  50% { box-shadow: 0 0 0 10px rgba(201, 151, 0, 0.18), 0 14px 36px rgba(183, 28, 28, 0.38), inset 0 2px 6px rgba(255, 255, 255, 0.34); }
}

@keyframes shineSweep {
  0%, 55% { transform: skewX(-18deg) translateX(-160%); }
  80%, 100% { transform: skewX(-18deg) translateX(360%); }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  body { padding: 0; align-items: stretch; }

  #login-screen { min-height: 100vh; min-height: 100dvh; padding: 18px; }

  #chat-screen {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border: none;
    border-radius: 0;
    flex-direction: column;
  }

  .sidebar {
    top: 10px;
    inset-inline-end: 10px;
    width: min(300px, calc(100% - 20px));
    max-height: 62%;
    padding: 12px;
  }

  .sidebar-head { margin-bottom: 8px; }
  .sidebar-icon { width: 32px; height: 32px; border-radius: 10px; }
  .sidebar-icon svg { width: 16px; height: 16px; }
  .sidebar h3 { font-size: 13px; }

  .sidebar ul {
    display: grid;
    gap: 8px;
    max-height: 46vh;
    overflow-y: auto;
  }
  .online-toggle-btn { padding: 9px 12px; font-size: 12px; }

  .sidebar li { flex: 0 0 auto; padding: 7px 12px; }
  .sidebar li:hover { transform: none; }

  .chat-area { order: 1; flex: 1; min-height: 0; }

  .chat-header { padding: 11px 14px; }
  .head-icon { width: 36px; height: 36px; border-radius: 12px; }
  #chat-title { font-size: 15px; }
  .logout-button { padding: 8px 13px; font-size: 12px; }

  .room-bar { padding: 9px 14px; gap: 8px; }
  .room-bar label { font-size: 12px; }
  .room-bar select { max-width: none; padding: 9px 12px; padding-inline-start: 34px; font-size: 13px; }

  #messages-container { padding: 16px 14px; }
  .message { width: 100%; max-width: 100%; }
  .avatar { width: 28px; height: 28px; font-size: 12px; }

  .composer-wrap { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  #message-input { padding: 11px 16px; }
  #send-button { min-width: 84px; padding: 11px 18px; }
}

/* ---------- Shop ---------- */

.head-actions {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.coins-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  color: #5b3a00;
  background: #ffe9a8;
  border: 1px solid #e3c565;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.shop-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 233, 168, 0.55);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.shop-button:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-1px); }

.badge-chip {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
  vertical-align: 1px;
}

.badge-vip {
  color: #7a5b00;
  background: #ffe9a8;
  border: 1px solid #d4af37;
}

.shop-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20, 10, 5, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.shop-panel {
  width: min(100%, 520px);
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 22px 20px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-deep);
  animation: riseIn 0.4s ease both;
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.shop-head h3 {
  font-size: 20px;
  font-weight: 900;
  color: var(--red);
}

.shop-head h3::after {
  content: " ★";
  color: var(--gold);
  font-size: 14px;
}

.shop-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: #ffffff;
  background: var(--red);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.shop-balance {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.shop-balance strong {
  color: #5b3a00;
  background: #ffe9a8;
  border: 1px solid #e3c565;
  border-radius: 999px;
  padding: 2px 12px;
}

.shop-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  text-align: center;
  background: #fffbf3;
  border: 1px solid var(--line);
  border-radius: 16px;
}

/* Username preview alone: glowing name text only, no background pill (buyer sees the exact chat look) */
.shop-name-preview {
  display: inline-block;
  max-width: 100%;
  padding: 0;
  background: transparent;
  color: hsl(var(--hue, 45) 65% 50%);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.1px;
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 8px hsl(var(--hue, 45) 70% 60% / 0.8), 0 0 18px hsl(var(--hue, 45) 70% 60% / 0.45);
}
/* Mini chat-bubble preview in the shop card: same bubble colors as in chat */
.shop-bubble-preview {
  display: inline-block;
  max-width: 100%;
  padding: 5px 12px;
  color: hsl(var(--hue, 45) 45% 22%);
  background: linear-gradient(135deg, hsl(var(--hue, 45) 92% 94%), hsl(var(--hue, 45) 85% 89%));
  border: 1px solid hsl(var(--hue, 45) 75% 62% / 0.7);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 0 12px 1px hsl(var(--hue, 45) 70% 60% / 0.45);
}
.shop-name-preview--plain {
  color: var(--text);
  background: transparent;
  text-shadow: none;
}

.shop-item-name { font-size: 13px; font-weight: 800; color: var(--text); min-height: 2.2em; }

.shop-price {
  color: #5b3a00;
  background: #ffe9a8;
  border: 1px solid #e3c565;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 900;
}

.shop-buy-btn,
.shop-equip-btn {
  width: 100%;
  padding: 8px 10px;
  color: #ffffff;
  background: var(--red);
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.shop-equip-btn { background: #7a5b00; }

.shop-buy-btn:disabled,
.shop-equip-btn:disabled { opacity: 0.55; cursor: default; }

.coins-offer-amount {
  font-size: 18px;
  font-weight: 900;
  color: #5b3a00;
}
.coins-buy-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  background: #128c4a;
}
.coins-buy-btn:hover { background: #0f7a3f; }
.shop-owned-label { color: var(--green); font-size: 12px; font-weight: 800; }

.shop-equipped-label { color: var(--gold); font-size: 12px; font-weight: 800; }

@media (max-width: 640px) {
  .head-actions { gap: 6px; }
  .coins-pill { padding: 6px 10px; font-size: 12px; }
  .shop-button { padding: 8px 12px; font-size: 12px; }
  .shop-panel { padding: 18px 15px 14px; }
}

/* ---------- Top icon bar ---------- */

.top-bar {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 8px 10px;
  overflow-x: auto;
  background: #fff2e2;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.top-bar::-webkit-scrollbar { display: none; }

.top-icon-btn {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 56px;
  padding: 7px 8px;
  color: #ffffff;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(183, 28, 28, 0.22);
}

.top-icon-btn:hover {
  background: #8f1218;
  border-color: #8f1218;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(183, 28, 28, 0.3);
}

.top-icon-btn.active { background: var(--red); color: #ffffff; }

.top-icon-btn svg { width: 20px; height: 20px; }

/* ---------- Composer icons + emoji panel ---------- */

.composer-icon-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--red);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.composer-icon-btn:hover { background: var(--cream); transform: translateY(-1px); }
.composer-icon-btn.listening { background: var(--red); color: #ffffff; }

.emoji-panel {
  position: fixed;
  inset-inline: 12px;
  bottom: 96px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 4px;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-deep);
}

.emoji-panel button {
  padding: 6px 0;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 22px;
  cursor: pointer;
}

.emoji-panel button:hover { background: var(--cream); }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 14px;
  background: #fffbf3;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
}

.settings-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--red);
  cursor: pointer;
}

.report-form { display: grid; gap: 10px; margin-top: 10px; }

.report-form input,
.report-form textarea {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: #fffbf3;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
}

.report-form input:focus,
.report-form textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.12);
}

@media (max-width: 640px) {
  .composer-icon-btn { width: 38px; height: 38px; }
  .emoji-panel { bottom: 88px; }
}


/* ---------- Profile ---------- */
.profile-panel { background:linear-gradient(135deg, rgba(183,28,28,.18), rgba(255,255,255,.78)); border:1px solid rgba(183,28,28,.35); box-shadow:0 22px 60px rgba(120,20,20,.18); font-family:"Cairo", Tahoma, sans-serif; }
.profile-preview {
  display: flex; align-items: center; gap: 14px;
  font-family:"Cairo", Tahoma, sans-serif;
  margin: 6px 0 14px; padding: 14px;
  background: linear-gradient(135deg, rgba(183,28,28,.14), rgba(255,255,255,.65)); border: 1px solid rgba(183,28,28,.30); border-radius: 18px; backdrop-filter: blur(8px);
}
.profile-avatar-btn {
  position: relative; flex: 0 0 auto;
  width: 64px; height: 64px; padding: 0;
  background: #ffffff; color: #333333;
  border: 2px solid #e5e5e5; border-radius: 50%;
  font-size: 26px; font-weight: 900; cursor: pointer; overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.profile-avatar-btn img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-preview-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-preview-meta > strong {
  color: hsl(var(--hue, 45) 65% 50%);
  font-size: 16px; font-weight: 900; letter-spacing: 0.1px; overflow-wrap: anywhere;
  text-shadow: 0 0 8px hsl(var(--hue, 45) 70% 60% / 0.8), 0 0 18px hsl(var(--hue, 45) 70% 60% / 0.45);
}
.profile-preview-meta > strong.black-name { color: #111111; text-shadow: 0 0 8px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 0, 0, 0.2); }
.profile-preview-meta > strong.white-name { color: #ffffff; text-shadow: 0 0 8px rgba(0, 0, 0, 0.4), 0 0 18px rgba(0, 0, 0, 0.25); }
.profile-preview-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.profile-preview-role { display: inline-flex; align-items: center; gap: 6px; }
.profile-preview-role:empty { display: none; }
.profile-preview-role .role-tag { color: #ffffff; margin-inline-start: 0; }
.profile-preview-facts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.profile-preview-facts > strong { color: #5b3a00; background: #ffe9a8; border: 1px solid #e3c565; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 900; }
.profile-preview-meta span { color: var(--muted); font-size: 13px; font-weight: 700; }
.profile-preview-id { color: var(--red); font-size: 12px; font-weight: 900; }
.profile-form { display: flex; flex-direction: column; gap: 12px; font-family:"Cairo", Tahoma, sans-serif; }
.profile-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 800; color: var(--text); }
.profile-form input, .profile-form select {
  padding: 11px 14px; background: #fff; border: 1px solid var(--line-strong);
  border-radius: 14px; font: inherit; font-weight: 700; color: var(--text); outline: none;
}
.profile-form input:focus, .profile-form select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(183,28,28,.12); }

/* ---------- VIP levels (VIP 1 .. VIP 12, luxurious flat gradients) ---------- */
.badge-vip_1 { color: #fff; background: linear-gradient(135deg, #10b981, #065f46); }
.badge-vip_2 { color: #fff; background: linear-gradient(135deg, #3b82f6, #1e3a8a); }
.badge-vip_3 { color: #fff; background: linear-gradient(135deg, #e11d48, #881337); }
.badge-vip_4 { color: #fff; background: linear-gradient(135deg, #c084fc, #6b21a8); }
.badge-vip_5 { color: #3b2f00; background: linear-gradient(135deg, #fbbf24, #b45309); }
.badge-vip_6 { color: #fff; background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.badge-vip_7 { color: #fff; background: linear-gradient(135deg, #f472b6, #a21caf); }
.badge-vip_8 { color: #fff; background: linear-gradient(135deg, #f87171, #991b1b); }
.badge-vip_9 { color: #1f2937; background: linear-gradient(135deg, #e5e7eb, #94a3b8); }
.badge-vip_10 { color: #fff; background: linear-gradient(135deg, #a5b4fc, #4c1d95); }
.badge-vip_11 { color: #fff; background: linear-gradient(135deg, #d97706, #78350f); }
.badge-vip_12 { color: #fbbf24; background: linear-gradient(135deg, #374151, #000000); }
.vip-badge-preview { font-size: 13px; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ---------- Crop editor ---------- */
.crop-panel { border-color: #e8cf9e; }
.crop-stage {
  position: relative; overflow: hidden; touch-action: none;
  height: 320px; background: #1c1a1a; border-radius: 18px;
  border: 1px solid var(--line-strong); margin: 8px 0 12px;
}
.crop-stage img {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  max-width: none; max-height: none; user-select: none; -webkit-user-drag: none;
  cursor: grab;
}
.crop-stage img.dragging { cursor: grabbing; }
.crop-frame {
  position: absolute; left: 50%; top: 50%;
  width: min(78%, 260px); aspect-ratio: 1/1; transform: translate(-50%, -50%);
  border: 3px solid #ffffff; border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(10,6,6,.55), 0 0 24px rgba(255,255,255,.35) inset;
  pointer-events: none;
}
.crop-zoom-label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 800; }
.crop-zoom-label input[type=range] { width: 100%; accent-color: var(--red); }
.crop-actions { display: flex; gap: 10px; margin-top: 12px; }
.crop-actions button { flex: 1; }
/* ---------- Private chat (DM) ---------- */
.sidebar li.dm-clickable { cursor: pointer; }
.sidebar li.dm-clickable:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.sidebar li.active-dm {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.12), 0 0 12px 2px hsl(var(--hue, 45) 70% 60% / 0.35);
}
.sidebar li.me { cursor: default; }

.dm-unread-badge {
  flex: 0 0 auto;
  margin-inline-start: auto;
  min-width: 22px;
  padding: 1px 7px;
  color: #ffffff;
  background: var(--red);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 0 8px rgba(183, 28, 28, 0.45);
}

.dm-back-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
  color: #ffffff;
  background: var(--red);
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.top-icon-btn { position: relative; }
.dm-top-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 4px;
  min-width: 18px;
  padding: 0 5px;
  color: #ffffff;
  background: var(--red);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
}

.dm-toast {
  position: fixed;
  top: 64px;
  inset-inline: 12px;
  z-index: 45;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #7b1fa2, #b71c1c);
  border: 1px solid #ffd700;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 18px rgba(212, 175, 55, 0.45);
}

.dm-list { display: grid; gap: 8px; margin-top: 12px; }
.dm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: #fffbf3;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  text-align: start;
  cursor: pointer;
}
.dm-row:hover { border-color: var(--red); }
.dm-row-snippet {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-row .dm-unread-badge { margin-inline-start: 0; }

/* ---------- Egypt glass cover (مصر أم الدنيا) ---------- */
.room-poster-btn.egypt-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62)),
    url('egypt-flag.jpg');
  background-size: cover;
  background-position: center;
  border-color: #d4af37;
  color: #0d1b4c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 10px rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.egypt-glass.active {
  background-image:
    linear-gradient(rgba(183, 28, 28, 0.42), rgba(183, 28, 28, 0.42)),
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62)),
    url('egypt-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65), 0 0 8px rgba(255, 255, 255, 0.65);
}
.room-current-btn.egypt-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.68)),
    url('egypt-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.egypt-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.80)),
    url('egypt-flag.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Qatar glass cover (قطر) ---------- */
.room-poster-btn.qatar-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.42)),
    url('qatar-flag.jpg');
  background-size: cover;
  background-position: center;
  border-color: #8e0e3e;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.qatar-glass.active {
  background-image:
    linear-gradient(rgba(142, 14, 62, 0.45), rgba(142, 14, 62, 0.45)),
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.42)),
    url('qatar-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
}
.room-current-btn.qatar-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.48)),
    url('qatar-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.qatar-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.74)),
    url('qatar-flag.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Syria + Iraq glass covers (سوريا، العراق) ---------- */
.room-poster-btn.syria-glass,
.room-poster-btn.iraq-glass {
  background-size: cover;
  background-position: center;
  border-color: #c9a227;
  color: #1a1a1a;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85), 0 0 8px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.syria-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('syria-flag.jpg');
}
.room-poster-btn.iraq-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('iraq-flag.jpg');
}
.room-poster-btn.syria-glass.active,
.room-poster-btn.iraq-glass.active {
  background-image:
    linear-gradient(rgba(201, 162, 39, 0.45), rgba(201, 162, 39, 0.45)),
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('syria-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
}
.room-poster-btn.iraq-glass.active {
  background-image:
    linear-gradient(rgba(201, 162, 39, 0.45), rgba(201, 162, 39, 0.45)),
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('iraq-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
}
.room-current-btn.syria-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    url('syria-flag.jpg');
  background-size: cover;
  background-position: center;
}
.room-current-btn.iraq-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    url('iraq-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.syria-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.80)),
    url('syria-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.iraq-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.80)),
    url('iraq-flag.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Saudi glass cover (السعودية) ---------- */
.room-poster-btn.saudi-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.70), rgba(255, 255, 255, 0.55)),
    url('saudi-flag.jpg');
  background-size: cover;
  background-position: center;
  border-color: #006c35;
  color: #0b3d1e;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85), 0 0 8px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.saudi-glass.active {
  background-image:
    linear-gradient(rgba(0, 108, 53, 0.50), rgba(0, 108, 53, 0.50)),
    linear-gradient(rgba(255, 255, 255, 0.70), rgba(255, 255, 255, 0.55)),
    url('saudi-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
}
.room-current-btn.saudi-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.62)),
    url('saudi-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.saudi-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.76)),
    url('saudi-flag.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Lebanon glass cover (لبنان) ---------- */
.room-poster-btn.lebanon-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('lebanon-flag.jpg');
  background-size: cover;
  background-position: center;
  border-color: #ce1126;
  color: #1a1a1a;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85), 0 0 8px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.lebanon-glass.active {
  background-image:
    linear-gradient(rgba(206, 17, 38, 0.45), rgba(206, 17, 38, 0.45)),
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('lebanon-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
}
.room-current-btn.lebanon-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    url('lebanon-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.lebanon-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.80)),
    url('lebanon-flag.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Algeria glass cover (الجزائر) ---------- */
.room-poster-btn.algeria-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('algeria-flag.jpg');
  background-size: cover;
  background-position: center;
  border-color: #006633;
  color: #1a1a1a;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85), 0 0 8px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.algeria-glass.active {
  background-image:
    linear-gradient(rgba(0, 102, 51, 0.45), rgba(0, 102, 51, 0.45)),
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.62)),
    url('algeria-flag.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
}
.room-current-btn.algeria-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    url('algeria-flag.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.algeria-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.80)),
    url('algeria-flag.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Public room glass cover (غرفة عامة) ---------- */
.room-poster-btn.public-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.56)),
    url('public-room.jpg');
  background-size: cover;
  background-position: center;
  border-color: #7a1e2b;
  color: #1a1a1a;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85), 0 0 8px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.room-poster-btn.public-glass.active {
  background-image:
    linear-gradient(rgba(122, 30, 43, 0.45), rgba(122, 30, 43, 0.45)),
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.56)),
    url('public-room.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
}
.room-current-btn.public-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.64)),
    url('public-room.jpg');
  background-size: cover;
  background-position: center;
}
#messages-container.public-glass {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.76)),
    url('public-room.jpg');
  background-size: cover;
  background-position: center;
}

/* ---------- Private chat golden frame (إطار الشات الخاص) ---------- */
#messages-container.dm-frame {
  border: 3px solid #6d28d9;
  outline: 2px solid #d4af37;
  outline-offset: -9px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), 0 0 18px rgba(109, 40, 217, 0.45);
  background: linear-gradient(180deg, #f6f0ff 0%, #ffffff 100%);
}
.room-current-btn.dm-frame {
  border-color: #6d28d9;
  box-shadow: 0 0 12px 2px rgba(109, 40, 217, 0.45), 0 0 6px 1px rgba(212, 175, 55, 0.4);
}

/* ---------- Moderation actions (طرد / كتم / حظر) ---------- */
.mod-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.mod-btn {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  color: #b71c1c;
  background: #fff5f5;
  border: 1px solid #e8b4b8;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.admin-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 8px;
}
.admin-role-chip.role-host { background: linear-gradient(135deg, #d4af37, #92600a); }
.admin-role-chip.role-super_admin { background: linear-gradient(135deg, #c026d3, #6d28d9); }
.admin-role-chip.role-admin { background: linear-gradient(135deg, #2563eb, #1e3a8a); }
.role-tag {
  font-size: 9px;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed, #4c1d95);
  padding: 1px 7px;
  border-radius: 999px;
  margin-inline-start: 6px;
  vertical-align: middle;
}
.mod-btn:hover {
  background: #b71c1c;
  color: #ffffff;
}

/* General stacking fix: the crop editor must always render above the profile modal
   (and any other modal), regardless of DOM order. */
#crop-modal { z-index: 60; }
.profile-avatar-editable { outline: none; }
.avatar-edit-badge { display:none !important;
  position: absolute; right: 2px; bottom: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; color: #fff; background: var(--red);
  border: 2px solid #fff; border-radius: 50%;
  font-size: 13px; font-weight: 900; box-shadow: 0 4px 10px rgba(0,0,0,.25);
}
.profile-change-photo {
  margin-top: 6px; padding: 7px 12px; align-self: flex-start;
  color: var(--red); background: #fff; border: 1px solid var(--line-strong);
  border-radius: 999px; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.profile-change-photo:hover { background: var(--cream); }

/* ---------- Rooms mini poster ---------- */
.rooms-poster-panel { text-align: center; }
.rooms-welcome {
  margin: 2px 0 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--red);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}
.rooms-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.room-poster-btn {
  padding: 16px 10px;
  border-radius: 16px;
  border: 2px solid var(--line-strong);
  background: #fff8e8;
  color: var(--red);
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  /* Glowing room names (steady light, no blinking) */
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.75);
  box-shadow: 0 0 10px 2px rgba(212, 175, 55, 0.35);
}
.room-poster-btn.active {
  background: var(--red);
  border-color: #d4af37;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 14px 3px rgba(183, 28, 28, 0.45), 0 0 22px 4px rgba(212, 175, 55, 0.5);
}

/* VIP level bubbles: shine around own and others’ messages (VIP prestige wins) */
.message.vip-bubble-1, .message.vip-bubble-1.mine { background: linear-gradient(135deg, hsl(160 90% 93%), hsl(160 85% 88%)) !important; border-color: hsl(160 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(160 75% 60% / 0.65), 0 0 28px 6px hsl(160 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-2, .message.vip-bubble-2.mine { background: linear-gradient(135deg, hsl(221 90% 93%), hsl(221 85% 88%)) !important; border-color: hsl(221 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(221 75% 60% / 0.65), 0 0 28px 6px hsl(221 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-3, .message.vip-bubble-3.mine { background: linear-gradient(135deg, hsl(346 90% 93%), hsl(346 85% 88%)) !important; border-color: hsl(346 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(346 75% 60% / 0.65), 0 0 28px 6px hsl(346 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-4, .message.vip-bubble-4.mine { background: linear-gradient(135deg, hsl(271 90% 93%), hsl(271 85% 88%)) !important; border-color: hsl(271 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(271 75% 60% / 0.65), 0 0 28px 6px hsl(271 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-5, .message.vip-bubble-5.mine { background: linear-gradient(135deg, hsl(43 90% 93%), hsl(43 85% 88%)) !important; border-color: hsl(43 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(43 75% 60% / 0.65), 0 0 28px 6px hsl(43 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-6, .message.vip-bubble-6.mine { background: linear-gradient(135deg, hsl(174 90% 93%), hsl(174 85% 88%)) !important; border-color: hsl(174 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(174 75% 60% / 0.65), 0 0 28px 6px hsl(174 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-7, .message.vip-bubble-7.mine { background: linear-gradient(135deg, hsl(321 90% 93%), hsl(321 85% 88%)) !important; border-color: hsl(321 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(321 75% 60% / 0.65), 0 0 28px 6px hsl(321 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-8, .message.vip-bubble-8.mine { background: linear-gradient(135deg, hsl(0 90% 93%), hsl(0 85% 88%)) !important; border-color: hsl(0 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(0 75% 60% / 0.65), 0 0 28px 6px hsl(0 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-9, .message.vip-bubble-9.mine { background: linear-gradient(135deg, hsl(215 30% 95%), hsl(215 25% 90%)) !important; border-color: hsl(215 25% 65% / 0.95) !important; box-shadow: 0 0 14px 3px hsl(215 25% 65% / 0.55), 0 0 28px 6px hsl(215 25% 65% / 0.28), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-10, .message.vip-bubble-10.mine { background: linear-gradient(135deg, hsl(234 90% 93%), hsl(234 85% 88%)) !important; border-color: hsl(234 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(234 75% 60% / 0.65), 0 0 28px 6px hsl(234 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-11, .message.vip-bubble-11.mine { background: linear-gradient(135deg, hsl(30 90% 93%), hsl(30 85% 88%)) !important; border-color: hsl(30 80% 60% / 0.9) !important; box-shadow: 0 0 14px 3px hsl(30 75% 60% / 0.65), 0 0 28px 6px hsl(30 70% 60% / 0.3), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-12, .message.vip-bubble-12.mine { background: linear-gradient(135deg, #374151, #111827) !important; border-color: #fbbf24 !important; box-shadow: 0 0 16px 3px rgba(251, 191, 36, 0.7), 0 0 34px 8px rgba(251, 191, 36, 0.32), 0 2px 6px rgba(0, 0, 0, 0.08) !important; }
.message.vip-bubble-1 .msg-text, .message.vip-bubble-2 .msg-text, .message.vip-bubble-3 .msg-text, .message.vip-bubble-4 .msg-text, .message.vip-bubble-5 .msg-text, .message.vip-bubble-6 .msg-text, .message.vip-bubble-7 .msg-text, .message.vip-bubble-8 .msg-text, .message.vip-bubble-9 .msg-text, .message.vip-bubble-10 .msg-text, .message.vip-bubble-11 .msg-text { color: #1f2937; }
.message.vip-bubble-12 .msg-text { color: #f9fafb; }
.message.vip-bubble-12:not(.buyer) .meta { color: #fbbf24; }
.message.vip-bubble-12:not(.buyer) .meta-name { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.8), 0 0 18px rgba(251, 191, 36, 0.4); }

/* Private chat button beside the coins pill in the header */
.dm-header-btn {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 233, 168, 0.55);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.dm-header-btn:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-1px); }
.dm-header-btn svg { width: 18px; height: 18px; }
