﻿@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --bg: #181818;
  --bg2: #202020;
  --txt: #f8f8f8;
  --muted: #b7b7b7;
  --primary: #7c4dff;
  --danger: #ff1744;
  --border: #000;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* إزالة المستطيل الأزرق عند الضغط على الجوال */
  -webkit-touch-callout: none;              /* منع قائمة النسخ عند الضغط المطول */
}

/* الأزرار وعناصر التفاعل: تجربة تطبيق جوال */
button, a, [role="button"],
.btn, .color-dot, .emoji-item,
.tab-btn, .leaderboard-row,
.room-item, .modal-close {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary);
}

html, body {
  overscroll-behavior-x: none; /* Disable horizontal swipe-to-go-back */
  overscroll-behavior-y: none; /* Disable vertical pull-to-refresh */
}

body {
  margin: 0;
  font-family: 'Noto Sans Arabic', 'Cairo', sans-serif;
  background: radial-gradient(circle at top right, #292929, var(--bg));
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--txt);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 10px;
}
*:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
*:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
::-webkit-scrollbar-button {
  display: none;
}

.hidden { display: none !important; }

.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px 50px;
  display: grid;
  gap: 16px;
}

.toon {
  border: 3px solid var(--border);
  border-radius: 18px;
  box-shadow: 7px 7px 0 #000;
}

.card {
  background: linear-gradient(180deg, #242424, #1c1c1c);
  padding: 16px;
}

.topbar {
  margin: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #252525, #161616);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.title-wrap h1 { margin: 0; font-size: 1.3rem; }
.title-wrap p { margin: 0; color: var(--muted); }

.btn {
  background: #2d2d2d;
  color: var(--txt);
  border: 2px solid #000;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; border-color: #444; }
.btn.tiny { padding: 5px 8px; font-size: 0.85rem; }
.btn:disabled, .btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; transform: none; }

.badge {
  background: #101010;
  border: 2px solid #000;
  padding: 6px 10px;
  border-radius: 999px;
}

input, select {
  width: 100%;
  background: #101010;
  color: #fff;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 9px;
  font-family: inherit;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.member-item {
  background: #111;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.member-item img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #000;
}

.two-rows {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.board {
  position: relative;
  border: 2px solid #000;
  border-radius: 12px;
  overflow: hidden;
  height: 400px;
  background: #0f0f0f;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: filter 0.4s ease;
}
.board img.diff-blurred {
  filter: blur(10px) brightness(0.5);
}

/* لوحة فارغة - نص انتظار */
.board-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 0;
  text-align: center;
  padding: 12px;
}
.board.board-empty .board-placeholder {
  display: flex;
}
.board.board-empty > img {
  display: none;
}
.board.board-empty .tools {
  opacity: 0.35;
  pointer-events: none;
}

/* رسالة نجاح الإرسال فوق التعتيم */
.submit-success-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.15rem;
  font-weight: bold;
  z-index: 4;
  text-align: center;
  pointer-events: none;
  letter-spacing: 0.02em;
}
.submit-success-overlay.hidden { display: none; }

#drawCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: auto;
  z-index: 1;
}

/* Pinch-zoom wrapper that holds diffImage + canvas */
.board-zoom-wrap {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.board-zoom-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.board.board-empty .board-zoom-wrap img { display: none; }

/* معاينة الحل */
.submit-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.submit-preview-card {
  background: #1e1e1e;
  border: 3px solid #000;
  box-shadow: 6px 6px 0 #000;
  border-radius: 14px;
  padding: 16px;
  max-width: 540px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.submit-preview-card canvas {
  width: 100%;
  border-radius: 8px;
  border: 2px solid #444;
  background: #111;
}
.submit-preview-card .close-btn {
  position: absolute;
  top: 10px;
  left: 10px;
}
.submit-preview-card h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #aaa;
}

.tools {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 5px;
  background: rgba(0,0,0,.7);
  padding: 6px;
  border-radius: 10px;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #000;
  cursor: pointer;
}
.color-dot[data-color="#000"] { background: #000; }
.color-dot[data-color="#fff"] { background: #fff; }
.color-dot[data-color="#00c853"] { background: #00c853; }
.color-dot[data-color="#2979ff"] { background: #2979ff; }
.color-dot[data-color="#ff1744"] { background: #ff1744; }
.color-dot[data-color="#ffd600"] { background: #ffd600; }

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 100;
  display: grid;
  place-items: center;
}

.chat-card {
  width: min(900px, 94vw);
  max-height: 85vh;
  overflow: hidden;
  background: #191919;
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.chat-messages {
  overflow: auto;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 8px;
  background: #191919;
  min-height: 320px;
}
.chat-msg {
  margin-bottom: 2px;
  padding: 4px 8px;
  border-radius: 4px;
  background: transparent;
  border: none;
  transition: background 0.15s;
  position: relative;
  overflow: hidden;
}
.chat-msg:hover {
  background: #1f1f1f;
}
.chat-msg .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0);
  animation: ripple-animation 0.8s linear forwards;
  pointer-events: none;
}
@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}
.chat-meta {
  color: #a6d7ff;
  font-size: .9rem;
}

.chat-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  position: relative;
}

.mention-suggestions {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 4px 4px 0 0;
  max-height: 150px;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.mention-suggestions.hidden {
  display: none;
}
.mention-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dcddde;
}
.mention-item:hover, .mention-item.active {
  background: #393c43;
}
.mention-item img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.chat-msg.mentioned {
  background-color: #332f29 !important;
  transition: background-color 0.2s ease;
}
.chat-msg.mentioned:hover {
  background-color: #2c2823 !important;
}
.mention-tag {
  color: #7289da;
  background: rgba(114, 137, 218, 0.1);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 500;
}

.reply-indicator {
  background: #2f3136;
  padding: 8px 12px;
  border-radius: 4px 4px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #b9bbbe;
  border-bottom: 1px solid #202225;
}
.reply-indicator .close-reply {
  cursor: pointer;
  color: #dcddde;
  font-weight: bold;
}
.reply-indicator .close-reply:hover {
  color: #fff;
}

.replied-msg-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #b9bbbe;
  margin-bottom: 4px;
  position: relative;
  padding-right: 24px;
}
.replied-msg-preview::before {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-right: 2px solid #4f545c;
  border-top: 2px solid #4f545c;
  border-top-right-radius: 4px;
  transform: translateY(-100%);
}
.replied-msg-preview .reply-username {
  font-weight: 600;
  color: #a6d7ff;
}
.replied-msg-preview .reply-content {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.emoji-picker {
  display: flex;
  flex-direction: column;
  padding: 0;
  width: 100%;
  background: #1a1a1a;
  border: 2px solid #333;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  z-index: 50;
}
.emoji-picker-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  border-bottom: 1px solid #2e2e2e;
  flex-shrink: 0;
}
.emoji-nav-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  background: #252525;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  transition: border-color 0.15s;
}
.emoji-nav-btn:hover {
  border-color: var(--primary, #7c4dff);
}
.emoji-nav-btn img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}
.emoji-picker-body {
  overflow-y: auto;
  max-height: 200px;
  padding: 6px;
  position: relative;
}
.emoji-section {
  margin-bottom: 8px;
}
.emoji-section-title {
  font-size: 0.72rem;
  color: #999;
  padding: 4px 0;
  font-weight: 600;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.emoji-item {
  width: 28px;
  height: 28px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}
.emoji-item:hover {
  background: #2a2a2a;
}

.popup-stack {
  position: fixed;
  left: 12px;
  bottom: 12px;
  display: grid;
  gap: 8px;
  z-index: 90;
}
.popup-msg {
  min-width: 250px;
  max-width: 320px;
  background: #111;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 8px;
  animation: slideIn .25s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.logs-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(420px, 90vw);
  height: 100vh;
  background: #141414;
  z-index: 99;
  padding: 12px;
  overflow: auto;
}
.logs-list { display: grid; gap: 8px; }
.log-item {
  border: 2px solid #000;
  border-radius: 10px;
  padding: 8px;
  background: #1d1d1d;
}

.list { display: grid; gap: 8px; margin-top: 10px; }
.list-item {
  border: 2px solid #000;
  border-radius: 10px;
  padding: 8px;
  background: #131313;
}

.error-text { color: #ff8ba0; }
.countdown { text-align: center; font-size: 1.4rem; margin: 10px 0; color: #ffd600; direction: ltr; unicode-bidi: isolate; }

.activity-topbar {
  margin: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #252525, #161616);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.activity-topbar h2 { margin: 0; font-size: 1.1rem; }

.activity-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 12px;
  padding: 0 12px 40px;
}

.boards-wrap { display: grid; gap: 10px; }

.board-label small {
  display: block;
  text-align: center;
  color: var(--muted);
  margin-bottom: 4px;
}

.side-panel { display: grid; gap: 12px; align-content: start; }

@media(max-width: 900px) {
  .activity-body { grid-template-columns: 1fr; }
}

/* === نافذة الصدارة === */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.lb-overlay.hidden { display: none; }

.lb-modal {
  background: #1a1a1a;
  border: 3px solid #000;
  box-shadow: 7px 7px 0 #000;
  border-radius: 16px;
  width: min(94vw, 720px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid #333;
  flex-shrink: 0;
}
.lb-modal-header h3 { margin: 0; font-size: 1.1rem; }

/* منطقة الرسم البياني */
.lb-chart {
  display: flex;
  gap: 18px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-end;
  min-height: 260px;
}

/* عمود كل عضو */
.lb-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
  cursor: default;
}

/* منطقة الشريط الإيجابي */
.lb-bar-pos-wrap {
  width: 28px;
  height: 100px;
  display: flex;
  align-items: flex-end;
}
.lb-bar-pos {
  width: 100%;
  background: linear-gradient(180deg, #00e676, #00c853);
  border-radius: 6px 6px 0 0;
  border: 2px solid #000;
  border-bottom: none;
  transition: height .5s ease;
}

/* خط الصفر */
.lb-zero-line {
  width: 36px;
  height: 3px;
  background: #555;
  border-radius: 2px;
}

/* منطقة الشريط السلبي */
.lb-bar-neg-wrap {
  width: 28px;
  height: 50px;
  display: flex;
  align-items: flex-start;
}
.lb-bar-neg {
  width: 100%;
  background: linear-gradient(180deg, #ff1744, #c62828);
  border-radius: 0 0 6px 6px;
  border: 2px solid #000;
  border-top: none;
  transition: height .5s ease;
}

/* صورة العضو */
.lb-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #000;
  object-fit: cover;
  background: #333;
}

/* اسم العضو */
.lb-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ddd;
}

/* شارة النقاط */
.lb-score-badge {
  font-size: 0.75rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 20px;
  border: 2px solid #000;
}
.lb-score-badge.pos { background: #00c853; color: #000; }
.lb-score-badge.neg { background: #ff1744; color: #fff; }

.lb-empty {
  text-align: center;
  color: #666;
  padding: 24px;
}
.lb-empty.hidden { display: none; }

/* نموذج التعديل (أدمن) */
.lb-score-form {
  border-top: 2px solid #333;
  padding: 14px 16px;
  flex-shrink: 0;
}
.lb-score-form.hidden { display: none; }
.lb-score-form h4 { margin: 0 0 10px; font-size: 0.9rem; }
.lb-score-form select,
.lb-score-form input[type=\"number\"] {
  background: #111;
  border: 2px solid #444;
  border-radius: 8px;
  color: #fff;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.9rem;
}
#scoreIncBtn.active { background: #00c853; color: #000; border-color: #000; }
#scoreDecBtn.active { background: #ff1744; color: #fff; border-color: #000; }

/* ========== داشبورد: شبكة الأزرار ========== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  padding: 28px 0;
}
.dash-btn {
  background: linear-gradient(160deg, #222, #1a1a1a);
  border: 2px solid #333;
  border-radius: 14px;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  color: var(--txt, #fff);
  width: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dash-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border-color: #555;
}
.dash-icon { font-size: 2.6rem; line-height: 1; }

/* ========== مودالات ========== */
.modal-body {
  overflow-y: auto;
  padding: 18px;
  max-height: 72vh;
  display: grid;
  gap: 18px;
}
.modal-section {
  border: 2px solid #2e2e2e;
  border-radius: 12px;
  padding: 16px;
}
.modal-section h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #bbb;
  border-bottom: 1px solid #2e2e2e;
  padding-bottom: 8px;
}
.modal-wide { width: min(96vw, 880px); }

/* ========== شاشة المحادثة الإدارية ========== */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-overlay.hidden { display: none; }
.chat-overlay .chat-card {
  max-height: 90vh;
  height: 85vh;
  width: min(800px, 96vw);
}
/* ========== Chat: 3-dot menu + context menu ========== */
.chat-msg-inner { display: flex; flex-direction: column; gap: 2px; }
.chat-time { font-size: 0.72rem; color: #555; }
.chat-msg-menu-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  opacity: 0;
  font-size: 1.2rem;
  padding: 0 5px;
  border-radius: 4px;
  line-height: 1;
  transition: opacity 0.15s, color 0.15s;
}
.chat-msg:hover .chat-msg-menu-btn { opacity: 1; }
.chat-msg-menu-btn:hover { color: #fff; background: #2a2a2a; }

.grouped-time {
  font-size: 0.75rem;
  color: #888;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-msg:hover .grouped-time {
  opacity: 1;
}

@media (pointer: coarse) {
  .chat-msg-menu-btn { display: none !important; }
}

.chat-msg.system {
  background-color: rgba(30, 60, 100, 0.4);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 4px;
}

.msg-ctx-menu {
  background: #1c1c1c;
  border: 2px solid #333;
  border-radius: 10px;
  padding: 4px;
  min-width: 150px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.msg-ctx-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #eee;
  padding: 9px 14px;
  text-align: right;
  cursor: pointer;
  border-radius: 6px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
}
.msg-ctx-item:hover { background: #2a2a2a; }
.msg-ctx-item.danger:hover { background: #3a0f0f; color: #ff5555; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.chat-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
}

.chat-emoji {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  display: inline-block;
}

.chat-emoji.big-emoji {
  width: 36px;
  height: 36px;
}

/* emoji rendered inside the contenteditable input */
.chat-emoji-in-input {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  display: inline-block;
  cursor: default;
  user-select: none;
}

/* contenteditable chat input styling */
.chat-input-div {
  flex: 1;
  min-width: 0;
  background: #40444b;
  border: 1px solid #202225;
  border-radius: 6px;
  padding: 6px 10px;
  color: #dcddde;
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 34px;
  max-height: 100px;
  overflow-y: auto;
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: text;
}
.chat-input-div:empty::before {
  content: attr(data-placeholder);
  color: #72767d;
  pointer-events: none;
}
.chat-input-div:focus {
  border-color: #7289da;
}

/* ========== Collapsible sections ========== */
.collapsible-toggle {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  color: #ccc;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  gap: 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.collapsible-toggle:hover { color: #fff; }
.collapsible-toggle:focus,
.collapsible-toggle:focus-visible,
.collapsible-toggle:active { outline: none; box-shadow: none; transform: none; }
.collapsible-arrow {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-style: normal;
  line-height: 1;
  color: #888;
  transition: transform 0.25s;
  pointer-events: none;
}
.collapsible-toggle[data-open="1"] .collapsible-arrow { transform: rotate(90deg); }
.collapsible-body { margin-top: 10px; }
.collapsible-body.hidden { display: none; }

/* ========== Collection items ========== */
.collection-item {
  border: 2px solid #222;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}
.collection-header {
  background: #1a1a1a;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.collection-header:hover { background: #202020; }
.collection-header-meta { display: flex; align-items: center; gap: 10px; }
.coll-arrow { font-size: 0.75rem; color: #888; transition: color 0.15s; }
.collection-header:hover .coll-arrow { color: #ccc; }
.collection-rounds { padding: 12px; background: #0f0f0f; }
.collection-rounds.hidden { display: none; }

/* ========== Round preview ========== */
.round-preview {
  border: 2px solid #1e1e1e;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.round-preview-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.round-preview-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.round-img-wrap small {
  color: #888;
  font-size: 0.78rem;
  display: block;
  margin-bottom: 4px;
  text-align: center;
}
.round-img {
  width: 100%;
  border-radius: 6px;
  border: 2px solid #2a2a2a;
  display: block;
  cursor: zoom-in;
}

/* ========== Mobile Chat Slide-in ========== */
@media (max-width: 768px) {
  .chat-overlay {
    display: block !important;
    background: #191919;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 9999;
    padding: 0;
  }
  .chat-overlay.hidden {
    display: block !important;
    transform: translateX(100%);
    pointer-events: none;
  }
  .chat-overlay .chat-card {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    padding: 10px;
    display: flex;
    flex-direction: column;
    background: #191919;
  }
  .chat-overlay .chat-messages {
    flex: 1;
    min-height: 0;
    border: none;
    border-radius: 0;
    padding: 10px 5px;
  }
}
/* Custom Modal Toon Shading */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(4px);
}

.custom-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.custom-modal {
  background: #202020;
  border: 4px solid #000;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 8px 8px 0 #000;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: #fff;
  font-family: 'Noto Sans Arabic', 'Cairo', sans-serif;
}

.custom-modal-overlay.active .custom-modal {
  transform: scale(1);
}

.custom-modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--primary, #7c4dff);
  text-shadow: 2px 2px 0 #000;
  -webkit-text-stroke: 0.5px #000;
}

.custom-modal-message {
  font-size: 1.1rem;
  margin-bottom: 30px;
  line-height: 1.6;
  color: #ddd;
  font-weight: 500;
}

.custom-modal-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.custom-modal-buttons.choice-buttons {
  flex-direction: column;
  gap: 10px;
}

.custom-modal-buttons.choice-buttons .custom-modal-btn {
  width: 100%;
  text-align: center;
}

.custom-modal-btn {
  padding: 12px 28px;
  border: 3px solid #000;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: 'Noto Sans Arabic', 'Cairo', sans-serif;
  font-weight: 700;
  transition: all 0.15s ease;
  position: relative;
  top: 0;
  left: 0;
}

.custom-modal-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 #000;
}

.custom-modal-btn:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.custom-modal-btn.confirm {
  background: var(--primary, #7c4dff);
  color: #fff;
}

.custom-modal-btn.cancel {
  background: #333;
  color: #ccc;
}
