/* قالب الشبكة الذكية لكل الصفحات: مربعات بزوايا دائرية وأزرق واحد. يتحمل بعد قالب البوستر */
:root {
  --night: #eceef2; --deep: #e3e6ec; --panel: #fff; --panel-2: #f3f4f7;
  --felt: rgba(15, 19, 32, .05); --felt-2: rgba(15, 19, 32, .09); --line: #e2e5eb;
  --gold: #2746f2; --gold-2: #1a2fb5; --gold-soft: rgba(39, 70, 242, .12);
  --ink: #0f1320; --muted: #6c7384; --green: #12a150; --amber: #2746f2; --red: #d92d20;
  --display: 'Almarai', system-ui, sans-serif; --body: 'Almarai', system-ui, sans-serif;
  --tile-round: 24px;
  --tile-shadow: 0 1px 2px rgba(15, 19, 32, .05), 0 14px 30px -22px rgba(15, 19, 32, .35);
  --float-shadow: 0 24px 60px -18px rgba(15, 19, 32, .45);
}
html, body { background: #eceef2 !important; }
body { -webkit-font-smoothing: antialiased; }
:focus-visible, .online-now:focus-visible, .copy-link:focus-visible, .player-chip:focus-visible { outline: 2px solid #2746f2; outline-offset: 2px; }

/* ===== الشريط العلوي ===== */
.site-bar { background: rgba(236, 238, 242, .86); border-bottom: 0; box-shadow: none; backdrop-filter: blur(12px); }
.site-bar-inner { max-width: 1160px; margin-inline: auto; padding-inline: 12px; }
.site-bar .logo { color: #0f1320; font-weight: 800; }
.site-bar .logo-mark { width: 36px; height: 36px; border-radius: 12px; background: #0f1320; color: #fff; }
.admin-open, .site-bar .site-nav > a, .site-bar .copy-link, .site-bar .site-nav .score-menu-btn, .site-bar .online-now {
  min-height: 36px; padding: 6px 12px; border: 0; border-radius: 99px; background: #fff; color: #0f1320; font-size: 13px; font-weight: 700;
}
.site-bar .site-nav { gap: 6px; }
.site-bar .online-now b, .site-bar .online-now.owner-view > .wide-only { color: #12a150; }
.site-bar .online-now i { background: #12a150; }
.site-bar .online-now .online-admins b, .site-bar .online-now .online-admins > span { color: #d92d20; }
.site-bar .online-now .online-admins i { background: #d92d20; }
@media (hover: hover) {
  .admin-open:hover, .site-bar .site-nav > a:hover, .site-bar .copy-link:hover, .site-bar .site-nav .score-menu-btn:hover, .site-bar .online-now:hover { background: #0f1320; color: #fff; }
  .site-bar .online-now:hover b { color: #fff; }
  .site-bar .online-now:hover i { background: #fff; }
}
.site-bar .site-nav > a:active, .site-bar .copy-link:active, .site-bar .site-nav .score-menu-btn:active, .site-bar .online-now:active,
.site-bar .site-nav .score-menu-btn[aria-expanded="true"], .site-bar .online-now[aria-expanded="true"] { background: #0f1320; color: #fff; }
@media (max-width: 620px) {
  .site-bar .site-nav { gap: 4px; }
  .admin-open, .site-bar .copy-link, .site-bar .site-nav .score-menu-btn, .site-bar .online-now { min-height: 34px; padding: 5px 9px; font-size: 12px; }
  .site-bar .site-nav .score-menu-btn::after { display: none; }
}

/* ===== القوائم والنوافذ ===== */
.chat-open { min-height: 40px; padding: 6px 13px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .94); color: #0f1320; box-shadow: var(--tile-shadow); font-size: 13px; }
.chat-badge { border-radius: 99px; background: #d92d20; }
.online-panel, .score-menu-list, .avatar-panel { border: 0; border-radius: 18px; background: #fff; color: #0f1320; box-shadow: var(--float-shadow); }
.score-menu-list a, .score-menu-list button, .score-menu-list [data-menu-game] { --c: #2746f2; border-radius: 12px; color: #0f1320; }
.score-menu-list a:hover, .score-menu-list button:hover, .score-menu-list a:focus-visible, .score-menu-list button:focus-visible { background: #2746f2; color: #fff; }
.rank-avatar, .player-chip i, .online-panel .rank-avatar { border-radius: 11px; }
.online-title, .online-panel small { color: #0f1320; }
.online-notes { color: #6c7384; }

.btn { border: 1px solid #dfe2e8; border-radius: 14px; background: #fff; color: #0f1320; }
.btn:hover { background: #eceef2; color: #0f1320; transform: none; }
.btn.primary { border: 0; background: #2746f2; color: #fff; box-shadow: none; }
.btn.primary:hover { background: #1a2fb5; color: #fff; box-shadow: none; transform: none; }
.btn.admin-danger, .btn.danger { border: 0; background: #d92d20; color: #fff; }

.admin-dialog, .welcome, .room-dialog, dialog.score-popup, .chat-dialog { border: 0; border-radius: 24px; background: #fff; color: #0f1320; box-shadow: var(--float-shadow); }
.admin-dialog::backdrop, .welcome::backdrop, .room-dialog::backdrop, dialog.score-popup::backdrop, .chat-dialog::backdrop { background: rgba(15, 19, 32, .45); backdrop-filter: blur(4px); }
.admin-step input[type="password"], .admin-code-edit input, .admin-add input, .welcome input, .room-dialog input { border: 1px solid #dfe2e8; border-radius: 12px; background: #f7f8fa; color: #0f1320; }
.admin-step label[for], .welcome p, .admin-codes p:not(.admin-msg), .avatar-panel p { color: #0f1320; }
.admin-games label, .admin-room-game { border: 1px solid #dfe2e8; border-radius: 14px; background: #fff; color: #0f1320; }
.admin-games label:has(input:checked), .admin-room-game:hover { border-color: #2746f2; background: #2746f2; color: #fff; }
.admin-games small { color: #6c7384; }
.admin-games label:has(input:checked) small { color: #fff; }
.admin-msg, .welcome .welcome-note { color: #d92d20; }
.admin-codes { border-top: 1px solid #eef0f4; }
.admin-code-list li { border-radius: 14px; background: #f3f4f7; }
#adminCodeList li { border: 1px solid #dfe2e8; border-radius: 14px; background: #fff; }
#adminCodeList .admin-code-who { color: #0f1320; }
#adminCodeList .admin-code-who b { color: #6c7384; }
.admin-edit { border-radius: 10px; background: #2746f2; color: #fff; }
.admin-remove { border-radius: 10px; background: #0f1320; color: #fff; }
.avatar-pick-btn { border-radius: 14px; background: #eceef2; color: #0f1320; }
.avatar-grid button { border-radius: 14px; }
.avatar-grid button[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2746f2; }
.avatar-panel p.avatar-group, .welcome p.avatar-group { color: #2746f2; }

/* قائمة الشعار */
body .site-menu { border: 0; border-radius: 18px; box-shadow: var(--float-shadow); }
body .site-menu a, body .site-menu button { border-radius: 12px; color: #0f1320; font-size: 15px; }
body .site-menu a:hover, body .site-menu button:hover, body .site-menu a:focus-visible, body .site-menu button:focus-visible { background: #2746f2; color: #fff; }

/* الدردشة */
.chat-head { border-bottom: 1px solid #eef0f4; }
.chat-head h2, .chat-with, .chat-online { color: #0f1320; }
.chat-room, .chat-copy, .chat-invite { border: 0; border-radius: 12px; background: #2746f2; color: #fff; }
.chat-room:disabled { background: #eceef2; color: #6c7384; }
.chat-close, .chat-back, .chat-enter { border: 1px solid #dfe2e8; border-radius: 12px; background: #fff; color: #0f1320; }
.chat-kick { border: 0; border-radius: 10px; background: #d92d20; color: #fff; }
.chat-offline { border: 0; border-radius: 12px; background: #f3f4f7; color: #0f1320; }
.chat-thread { border: 1px solid #e2e5eb; border-radius: 14px; }
.chat-thread:hover { background: #f3f4f7; }
.chat-face { border-radius: 11px; background: #eceef2; }
.chat-msg { border: 0; border-radius: 16px; }
.chat-msg.mine { background: #2746f2; color: #fff; }
.chat-msg.theirs { background: #eceef2; color: #0f1320; }
.chat-code strong { color: #2746f2; }
a.chat-invite { background: #eceef2; color: #0f1320; }

/* شريط الدعوة */
#inviteBanner { border: 0 !important; border-radius: 18px !important; box-shadow: var(--float-shadow) !important; color: #0f1320 !important; }
#inviteBanner a { border: 0 !important; border-radius: 12px !important; background: #2746f2 !important; }
#inviteBanner button { border: 1px solid #dfe2e8 !important; border-radius: 12px !important; color: #0f1320 !important; }

/* ===== شريط صفحات الألعاب ===== */
.site-bar .btn, .site-bar .btn.small { min-height: 34px; border: 0; border-radius: 99px; background: #fff; color: #0f1320; }
@media (hover: hover) { .site-bar .btn:hover { background: #0f1320; color: #fff; } }
.site-bar .btn:active { background: #0f1320; color: #fff; }

/* ===== السكورات في كل الصفحات ===== */
.rank-list { --muted: #6c7384; --ink: #0f1320; border: 0; border-radius: 20px; background: #fff; color: #0f1320; box-shadow: var(--tile-shadow); }
.rank-list.compact { border-radius: 16px; box-shadow: none; }
.rank-row { border-top: 1px solid #eef0f4; border-radius: 0; }
.rank-no { color: #9aa1af; }
.rank-pts, .rank-row.top .rank-no { color: #2746f2; }
.rank-row.me { background: rgba(39, 70, 242, .1); color: #0f1320; }
.rank-row.me .rank-no, .rank-row.me .rank-pts { color: #2746f2; }
.rank-row:not(.me):active, .rank-row:not(.me):hover { background: #f3f4f7; color: #0f1320; }
.rank-row:not(.me):active .rank-no, .rank-row:not(.me):hover .rank-no { color: #0f1320; }
.rank-row:not(.me):active .rank-pts, .rank-row:not(.me):hover .rank-pts { color: #2746f2; }
/* منصة الثلاثة الأوائل: الأول في الوسط، والثاني يمين، والثالث يسار */
.rank-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 8px; padding: 16px 10px 0; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; grid-row: 1; text-align: center; }
.podium-col.place-2 { grid-column: 1; }
.podium-col.place-1 { grid-column: 2; }
.podium-col.place-3 { grid-column: 3; }
.rank-podium .podium-col .rank-avatar { width: 54px; height: 54px; border: 2px solid #c9ced8; border-radius: 50%; font-size: 21px; }
.rank-podium .podium-col.place-1 .rank-avatar { width: 70px; height: 70px; border: 3px solid #e3a81f; font-size: 27px; }
.rank-podium .podium-col.me .rank-avatar { border-color: #2746f2; }
.podium-name { display: block; max-width: 100%; overflow: hidden; color: #0f1320; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.podium-col.me .podium-name { color: #2746f2; }
.podium-pts { color: #2746f2; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.podium-col.place-1 .podium-pts { color: #b57f06; font-size: 18px; }
.podium-col .rank-stats { display: flex; gap: 6px; justify-content: center; color: #6c7384; font-size: 11px; }
.podium-step { display: grid; place-items: center; width: 100%; height: 44px; margin-top: 4px; border-radius: 12px 12px 0 0; background: #eceef2; color: #6c7384; font-size: 18px; font-style: normal; font-weight: 800; }
.podium-col.place-1 .podium-step { height: 70px; background: #f2c14e; color: #0f1320; }
.podium-col.place-3 .podium-step { height: 32px; }
.scores-list .rank-podium { padding-inline: 0; }
/* محاولات اللاعبين وسكورات بداية اللعبة */
.attempts-box h3 { margin: 16px 0 8px; color: #0f1320; font-size: 16px; font-weight: 800; }
.attempt-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid #eef0f4; }
.attempt-row:first-child { border-top: 0; }
.attempt-who { display: flex; flex: 1; flex-direction: column; min-width: 0; font-size: 14.5px; font-weight: 700; }
.attempt-who bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attempt-who small { color: #6c7384; font-size: 12px; font-weight: 400; }
.attempt-pts { flex: none; color: #2746f2; font-weight: 800; font-variant-numeric: tabular-nums; }
.arena-scores { margin-top: 14px; }
.arena-scores h2 { margin: 0 0 8px; color: #0f1320; font-size: 18px; font-weight: 800; }
.arena-scores-empty { color: #6c7384; font-size: 14px; text-align: center; }
.score-menu-btn.big { border: 0; border-radius: 99px; background: #fff; color: #0f1320; }
.visitors, .scores-empty { color: #6c7384; }
.visitors b { color: #2746f2; }
.lead { color: #0f1320 !important; }
.chip { border: 1px solid #dfe2e8; border-radius: 12px; background: #fff; color: #0f1320; }
.chip:hover:not(:disabled) { background: #f3f4f7; }
.chip[aria-pressed="true"], .chip.easy[aria-pressed="true"], .chip.medium[aria-pressed="true"], .chip.hard[aria-pressed="true"] { border-color: #2746f2; background: #2746f2; color: #fff; }

/* ===== مساحات اللعب: اللعبة تبقى على خلفيتها الداكنة ===== */
.arena-stage, .stage { overflow: hidden; border: 0; border-radius: 20px; box-shadow: var(--float-shadow); }
.arena-overlay, .overlay { --gold: #a9b8ff; --display: 'Alexandria', 'Almarai', system-ui, sans-serif; }
.arena-overlay .btn:not(.primary), .overlay .btn:not(.primary) { border: 0; background: #fff; color: #0f1320; }
.arena-overlay .btn:not(.primary):hover, .overlay .btn:not(.primary):hover { background: #e8ebf3; color: #0f1320; }
.breath { overflow: hidden; border: 0; border-radius: 99px; background: #fff; }
.breath-fill { background: #2746f2; }
.breath-fill.low { background: #d92d20; }
.share .whatsapp, .whatsapp, .share { background: #0f1320 !important; color: #fff !important; }

/* ===== مسابقة الاختلافات ===== */
.panel p, .big { color: #0f1320; }
.form input, .link-box input { border: 1px solid #dfe2e8; border-radius: 14px; background: #fff; color: #0f1320; }
.form input::placeholder { color: #6c7384; }
.room-tile { border: 0; border-radius: 20px; background: #fff; color: #0f1320; box-shadow: var(--tile-shadow); }
.room-tile small { color: #6c7384; }
.room-tile .room-status { color: #2746f2; }
.room-tile.playing .room-status { color: #12a150; font-weight: 700; }
.room-dialog-note { color: #d92d20; }
.entry-label { color: #0f1320; }
#foundCount { color: #12a150; }
.timer.low b { color: #d92d20; }
.pic { border-radius: 16px; box-shadow: var(--tile-shadow); }
.board li { border-bottom-color: #eef0f4; }
.board li.me { border-radius: 12px; background: #2746f2; color: #fff; }
.score-title, .score-rank, .score-num, .score-wrong { color: #6c7384; }
.score-row { border-radius: 12px; color: #0f1320; }
.score-row:hover { background: #f3f4f7; color: #0f1320; }
.score-row:hover .score-rank, .score-row:hover .score-num, .score-row:hover .score-wrong { color: #6c7384; }
.score-row.me { outline-color: #2746f2; }
.score-row.first .score-rank { color: #2746f2; }
.score-face { border-radius: 11px; background: #eceef2; color: #0f1320; }
.score-dot { border-color: #fff; border-radius: 50%; }
.score-dot.on { background: #12a150; }
.score-kick { border: 1px solid #dfe2e8; border-radius: 10px; background: #fff; }
.score-kick:hover, .score-kick:focus-visible { background: #d92d20; color: #fff; }
.score-wrong.stopped { color: #d92d20; }
.score-num.plus { color: #2746f2; }
.score-popup h2 { color: #2746f2; }
.score-popup > p { color: #6c7384; }
.score-popup .close { border: 0; border-radius: 14px; background: #2746f2; color: #fff; }

/* ===== لوحة الادمن والدعوات ===== */
.admin-top .btn:not(.admin-room) { border: 1px solid #dfe2e8; }
.invite-box { border-top: 1px solid #eef0f4; }
.invite-list label { border: 1px solid #dfe2e8; border-radius: 12px; background: #fff; }
.invite-list label:has(input:checked) { border-color: #2746f2; background: #2746f2; color: #fff; }
.invite-list input { accent-color: #fff; }
.invite-list p { color: #6c7384; }
.invite-box #inviteSend:not(:disabled) { border: 0; background: #2746f2; color: #fff; }
.invite-note { color: #2746f2; }

/* ===== لوحة إدارة الغرفة ===== */
body:has(> header.bar) { background: #eceef2 !important; }
.bar { border-bottom: 0; background: rgba(236, 238, 242, .9); color: #0f1320; backdrop-filter: blur(12px); }
.bar-btn { border: 0; border-radius: 99px; background: #fff; color: #0f1320; }
.bar-btn:hover { background: #0f1320; color: #fff; }
.card { border: 0; border-radius: 22px; background: #fff; box-shadow: var(--tile-shadow); }
.topic-button, .action, .copy, .end, .room-link, .login input { border: 1px solid #dfe2e8; border-radius: 14px; background: #fff; color: #0f1320; }
.topic-menu { border: 0; border-radius: 16px; background: #fff; box-shadow: var(--float-shadow); }
.topic-row { border-radius: 10px; }
.topic-row:hover { background: #f3f4f7; }
.topic-row.first { border-bottom-color: #eef0f4; border-radius: 10px; }
.switch-track { border-radius: 99px; background: rgba(15, 19, 32, .2); }
.switch-track::after { border-radius: 50%; }
input:checked + .switch-track { background: #2746f2; }
.action:hover:not(:disabled) { background: #f3f4f7; }
.action.start, .action.start:hover:not(:disabled) { border: 0; background: #2746f2; color: #fff; box-shadow: none; }
.action.stop, .action.stop:hover:not(:disabled), .end.yes { border: 0; background: #0f1320; color: #fff; }
.copy:hover, .end:hover:not(:disabled) { background: #f3f4f7; }
.state { border-radius: 99px; background: #eceef2; color: #0f1320; }
.state.playing { background: #2746f2; color: #fff; }
.state.ended { background: #0f1320; color: #fff; }
.login-note, .hint { color: #d92d20; }
