/* نظام التصميم (أكتوبر 2026): الألوان والخطوط والمسافات كمتغيرات، وفوقها شكل كل المكونات.
   ينحمّل بعد main.css و room.css وقبل broadcast.css، فيغطي الشكل القديم بدون ما يلمس شاشة البث.
   ما يغيّر أي كلاس أو معرّف يعتمد عليه الكود. للرجوع للشكل القديم: احذف سطر design.css من index.html. */

:root{
  color-scheme: dark;
  /* الأسطح */
  --bg: #060a14;
  --bg-2: #0a1020;
  --surface: #0e1527;
  --surface-2: #131c33;
  --surface-3: #1a2540;
  --glass: rgba(16, 24, 44, .62);
  --glass-strong: rgba(12, 18, 34, .82);
  --line: rgba(148, 163, 184, .12);
  --line-2: rgba(148, 163, 184, .22);
  /* النصوص */
  --text: #f1f5f9;
  --text-2: #a8b3c7;
  --text-3: #6b7890;
  /* الهوية: أزرق الدوري وذهب الكأس */
  --brand: #3b82f6;
  --brand-2: #6366f1;
  --brand-soft: rgba(59, 130, 246, .14);
  --brand-grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --gold: #f5c542;
  --gold-2: #f59e0b;
  --gold-soft: rgba(245, 197, 66, .12);
  --gold-grad: linear-gradient(135deg, #fde68a 0%, #f5c542 45%, #f59e0b 100%);
  --silver: #cbd5e1;
  --bronze: #f0a060;
  --success: #22c55e;
  --danger: #ef4444;
  /* الشكل */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px -8px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.25);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.75), 0 0 0 1px rgba(148,163,184,.08);
  --ring: 0 0 0 3px rgba(59,130,246,.45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Readex Pro", "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* زاوية الحلقة المتحركة حول الشعار (لازم @property عشان تتحرك) */
@property --spin { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

/* ============ الأساس ============ */
html{ background: var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body{
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
}
/* إضاءة خلفية ثابتة خفيفة (شفق أزرق وذهبي) */
body::before{
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 32rem at 85% -10%, rgba(59,130,246,.18), transparent 60%),
    radial-gradient(40rem 26rem at -10% 20%, rgba(99,102,241,.12), transparent 60%),
    radial-gradient(36rem 30rem at 50% 110%, rgba(245,197,66,.07), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
button, input, select, textarea{ font-family: inherit; }
::selection{ background: rgba(59,130,246,.4); color: #fff; }
img{ -webkit-user-drag: none; }
*{ scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

/* ============ الهيدر ============ */
header{
  padding: calc(22px + env(safe-area-inset-top, 0px)) 16px 26px;
  background: transparent;
  border-bottom: 0;
  color: var(--text);
  isolation: isolate;
  view-transition-name: app-header;
}
/* الهيدر في الرئيسية: واجهة البطولة */
header:not(.hdr-compact)::after{
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(28rem 16rem at 50% 30%, rgba(59,130,246,.22), transparent 70%),
    linear-gradient(180deg, rgba(10,16,32,.0), rgba(6,10,20,.0));
  mask-image: linear-gradient(180deg, #000 60%, transparent);
}
.notif-bell-btn{
  top: calc(16px + env(safe-area-inset-top, 0px));
  width: 42px; height: 42px;
  background: var(--glass);
  border: 1px solid var(--line-2);
  color: var(--gold);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  transition: transform .25s var(--spring), background .2s, border-color .2s;
}
.notif-bell-btn:hover{ border-color: rgba(59,130,246,.5); }
.notif-bell-btn:active{ transform: scale(.9); background: var(--surface-2); }
.notif-bell-btn .notif-dot{ top: 8px; right: 9px; border-color: var(--surface); }
.notif-bell-btn.on .notif-dot{ background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,.8); }
.menu-btn{ color: var(--text); }

.logo-box{
  position: relative; width: 116px; height: 116px; margin: 4px auto 16px;
  border-radius: 30px; padding: 3px;
  background: conic-gradient(from var(--spin), #3b82f6, #6366f1, #f5c542, #3b82f6);
  animation: logoSpin 6s linear infinite;
  box-shadow: 0 18px 50px -10px rgba(59,130,246,.55), 0 0 80px -20px rgba(245,197,66,.35);
}
@keyframes logoSpin{ to{ --spin: 360deg; } }
.logo{ border-radius: 27px; box-shadow: none; background: var(--bg-2); display: block; }
.league-name{
  font-size: clamp(22px, 6.4vw, 28px); font-weight: 800; letter-spacing: -.2px;
  background: linear-gradient(180deg, #ffffff 30%, #c7d2fe 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 10px; text-wrap: balance;
}
#adminTitle{
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 2.4px;
  color: var(--gold);
  padding: 6px 14px; border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid rgba(245,197,66,.28);
}
#adminTitle::before{ content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }

/* الهيدر المختصر (باقي الصفحات): شريط زجاجي ثابت فوق */
header.hdr-compact{
  position: sticky; top: 0; z-index: 900;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 64px 10px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
header.hdr-compact .notif-bell-btn{ top: calc(10px + env(safe-area-inset-top, 0px)); width: 40px; height: 40px; }
header.hdr-compact #adminTitle{
  display: inline-flex; line-height: 1; background: none; border: 0; padding: 0;
  font-size: 12px; letter-spacing: 2px; color: var(--text); height: 40px;
}

/* ============ الأزرار والحقول ============ */
:where(.section, .modal-content, .side-menu, .room-screen, header, .admin-controls-box) button,
#resetButton{
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  background-color: var(--brand);
  background-image: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0));
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -6px rgba(59,130,246,.6);
  transition: transform .2s var(--spring), filter .2s, box-shadow .2s, background-color .2s;
  min-height: 40px;
}
:where(.section, .modal-content, .side-menu, .room-screen, header, .admin-controls-box) button:hover{ filter: brightness(1.08); }
:where(.section, .modal-content, .side-menu, .room-screen, header, .admin-controls-box) button:active{ transform: scale(.96); }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible{
  outline: none; box-shadow: var(--ring) !important;
}

.account-box input, .account-box select,
.match-filter-box input, .match-filter-box select,
.video-upload-form input[type="text"], .video-upload-form input[type="file"],
.qbank-add-form input, .ai-gen-row select, .ai-chat-bar input,
.modal-content input[type="text"], .modal-content input[type="email"], .modal-content input[type="password"], .modal-content input[type="number"], .modal-content select, .modal-content textarea{
  background-color: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.account-box input:focus, .account-box select:focus,
.match-filter-box input:focus, .qbank-add-form input:focus, .ai-chat-bar input:focus,
.modal-content input:focus, .modal-content select:focus, .modal-content textarea:focus{
  outline: none; border-color: var(--brand); box-shadow: var(--ring); background-color: var(--surface);
}
::placeholder{ color: var(--text-3); opacity: 1; }
#matchSearchInput{ padding-right: 40px; background-position: right 14px center; }

/* ============ الصفحات ============ */
.section{ padding: 12px 16px; max-width: 560px; margin: 0 auto; box-sizing: border-box; }
@supports not (view-transition-name: none){
  .section.active{ animation: secIn .38s var(--ease) both; }
}
@keyframes secIn{ from{ opacity: 0; transform: translateY(10px); } }

/* انتقال التبويبات (View Transitions): الهيدر والشريط ثابتين والمحتوى يتلاشى ويطلع */
::view-transition-old(root){ animation: vtOut .18s ease-in both; }
::view-transition-new(root){ animation: vtIn .32s var(--ease) both; }
@keyframes vtOut{ to{ opacity: 0; transform: translateY(-6px); } }
@keyframes vtIn{ from{ opacity: 0; transform: translateY(10px); } }

/* عناوين الجولات */
.round-head{
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 22px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .3px;
  color: var(--text-2);
}
.round-head::before, .round-head::after{ content: ""; flex: 1; max-width: 90px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2)); }
.round-head::after{ transform: scaleX(-1); }
.round-head.home{ color: var(--text); font-size: 15px; margin-top: 26px; }
.round-head.home .ic{ color: var(--brand); }
.round-head.past{ color: var(--gold); }
.empty-state{
  text-align: center; padding: 34px 16px; color: var(--text-3); font-size: 14px;
  border: 1px dashed var(--line-2); border-radius: var(--r-lg); margin: 14px auto; max-width: 440px;
}

/* ============ ملخص الدوري (بطاقات الأرقام) ============ */
.league-quick-summary{ gap: 10px; margin: 4px auto 14px; max-width: 520px; padding: 0; }
.summary-card{
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 8px 12px;
  box-shadow: var(--shadow);
}
.summary-card::before{
  content: ""; position: absolute; inset: 0 18% auto; height: 2px; border-radius: 2px;
  background: var(--brand-grad); opacity: .9;
}
.summary-card:nth-child(2)::before{ background: var(--gold-grad); }
.summary-card:nth-child(3)::before{ background: linear-gradient(90deg, #22c55e, #4ade80); }
.summary-card-val{
  font-size: 17px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.summary-card-val .ic{ width: 16px; height: 16px; flex: none; }
.summary-card-lbl{ font-size: 10.5px; color: var(--text-3); margin-top: 6px; font-weight: 500; }

/* ============ شريط التبويبات السفلي (عائم وزجاجي) ============ */
.bottom-nav{
  left: 12px; right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  height: 68px; padding: 6px; gap: 2px;
  border-radius: 24px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg), 0 1px 0 rgba(255,255,255,.06) inset;
  max-width: 560px; margin: 0 auto;
  box-sizing: border-box;
  view-transition-name: app-dock;
}
.bottom-nav .tab{
  position: relative; border-radius: 18px; border-top: 0 !important;
  color: var(--text-3); font-size: 10.5px; font-weight: 600; gap: 3px; padding: 0;
  transition: color .25s var(--ease), transform .25s var(--spring);
}
.bottom-nav .tab:active{ transform: scale(.92); }
.bottom-nav .tab .tab-icon{ margin: 0; transition: transform .35s var(--spring); }
.bottom-nav .tab-icon .ic{ width: 22px; height: 22px; }
.bottom-nav .tab.active{
  color: #fff;
  background: linear-gradient(180deg, rgba(59,130,246,.28), rgba(99,102,241,.16));
  box-shadow: 0 0 0 1px rgba(99,130,246,.35) inset, 0 8px 20px -8px rgba(59,130,246,.7);
}
.bottom-nav .tab.active .tab-icon{ transform: translateY(-1px) scale(1.06); color: #93c5fd; }
.bottom-nav .tab.active::after{
  content: ""; position: absolute; top: 4px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold);
}

/* ============ جدول الترتيب ============ */
.share-btn-wa{
  border-radius: 999px !important; padding: 10px 18px; font-size: 13px;
  box-shadow: 0 8px 22px -8px rgba(37,211,102,.6) !important;
  margin: 6px 0 14px auto;
}
#table table{
  border-collapse: separate; border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
#table th, #table td{ border: 0; border-bottom: 1px solid var(--line); padding: 12px 4px; }
#table th{
  background: var(--surface-2); color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .4px;
  position: sticky; top: 0;
}
#table tbody tr{ transition: background .2s; }
#table tbody tr:last-child td{ border-bottom: 0; }
#table tbody tr:hover{ background: rgba(59,130,246,.06); }
#table td{ color: var(--text-2); font-size: 13px; }
#table td.rank-cell{ width: 34px; font-weight: 800; color: var(--text-3); }
#table td.pts-cell b{
  display: inline-flex; min-width: 30px; height: 28px; align-items: center; justify-content: center;
  padding: 0 6px; border-radius: 9px; font-size: 14px; color: #fff;
  background: var(--brand-soft); border: 1px solid rgba(59,130,246,.3);
}
#table tr.top-1 td.rank-cell{ color: var(--gold); box-shadow: inset -3px 0 0 var(--gold); }
#table tr.top-2 td.rank-cell{ color: var(--silver); box-shadow: inset -3px 0 0 var(--silver); }
#table tr.top-3 td.rank-cell{ color: var(--bronze); box-shadow: inset -3px 0 0 var(--bronze); }
#table tr.top-1{ background: linear-gradient(270deg, rgba(245,197,66,.10), transparent 60%); }
#table tr.top-1 td.pts-cell b{ background: var(--gold-grad); color: #1c1403; border-color: transparent; }
#table .table-player-cell span{ color: var(--text); font-weight: 700 !important; }
.table-player-img{ width: 32px; height: 32px; border: 0; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px rgba(59,130,246,.55); }
#table tr.top-1 .table-player-img{ box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); }
.verified-badge{ color: #38bdf8; }

/* ============ بطاقات المواجهات ============ */
.match{
  position: relative; overflow: hidden; isolation: isolate;
  max-width: 520px; margin: 10px auto; padding: 16px 14px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.match::before{
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(14rem 8rem at 100% 0%, rgba(59,130,246,.16), transparent 70%),
    radial-gradient(14rem 8rem at 0% 0%, rgba(99,102,241,.14), transparent 70%);
}
.match:hover{ border-color: var(--line-2); }
.match.is-done::before{
  background:
    radial-gradient(14rem 8rem at 100% 0%, rgba(245,197,66,.10), transparent 70%),
    radial-gradient(14rem 8rem at 0% 0%, rgba(59,130,246,.10), transparent 70%);
}
.match-player-img{
  width: 54px; height: 54px; border: 0;
  box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px rgba(59,130,246,.55), 0 10px 22px -6px rgba(0,0,0,.6);
}
.match-player{ overflow: visible; padding-top: 5px; min-width: 0; }
.match-player-name{ max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.match-player-name{ font-size: 13.5px; font-weight: 700; color: var(--text); }
.match-score-box{ gap: 8px; }
.match input{
  width: 48px; height: 48px; padding: 0; box-sizing: border-box;
  font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 2px 0 rgba(0,0,0,.3) inset;
  -moz-appearance: textfield;
}
.match input::-webkit-outer-spin-button, .match input::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.match input:focus{ background: var(--surface); border-color: var(--brand); box-shadow: var(--ring); }
.match input:disabled{ background: var(--bg); color: var(--text); border-color: var(--line); opacity: 1; -webkit-text-fill-color: var(--text); }
.match.is-done input:disabled{ color: #fff; border-color: rgba(245,197,66,.25); }
.match:not(.is-done) input:disabled{
  width: 40px; height: 40px; background: transparent; border: 1px dashed var(--line-2); box-shadow: none;
}
.match-sep{ color: var(--text-3); font-weight: 800; font-size: 18px; }
.match-share-btn{
  margin-top: 4px; background: rgba(255,255,255,.03) !important; background-image: none !important;
  border: 1px solid var(--line) !important; color: var(--text-2) !important;
  box-shadow: none !important; border-radius: 12px !important; font-weight: 600 !important;
}
.match-share-btn:hover{ color: var(--text) !important; border-color: var(--line-2) !important; }

/* ============ التبويبات الفرعية (Segmented Control) ============ */
.mini-tabs, .prediction-tabs{
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 4px; gap: 4px; margin: 6px auto 12px; max-width: 520px;
}
.mini-tab, .prediction-tab{
  margin: 0; border-radius: 10px; background: transparent; color: var(--text-3);
  font-weight: 700; font-size: 13.5px; padding: 10px 8px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .2s, background .25s var(--ease), box-shadow .25s;
}
.mini-tab:hover, .prediction-tab:hover{ color: var(--text-2); }
.mini-tab.active, .prediction-tab.active{
  color: #fff; background: var(--surface-3);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 4px 14px -4px rgba(0,0,0,.6);
}
.prediction-tab .ic{ width: 16px; height: 16px; }
.match-filter-box{ max-width: 520px; margin: 0 auto 6px; }

/* ============ التوقعات ============ */
.prediction-match{
  max-width: 520px; padding: 16px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.prediction-round{
  background: var(--brand-soft); color: #93c5fd; border: 1px solid rgba(59,130,246,.25);
  border-radius: 999px; padding: 4px 12px; font-size: 11.5px; font-weight: 700;
}
.prediction-player-img{ width: 50px; height: 50px; border: 0; box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px rgba(99,102,241,.55); }
.prediction-player-name{ color: var(--text); font-weight: 700; }
.prediction-score input{
  width: 50px; height: 50px; padding: 0; box-sizing: border-box;
  font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 14px; color: var(--text);
}
.prediction-score input:focus{ border-color: var(--brand); box-shadow: var(--ring); }
.prediction-score input:disabled{ opacity: 1; color: var(--text-2); }
.prediction-save{ border-radius: 12px !important; min-width: 140px; }
.prediction-result{ color: var(--text-3); }
.ranking-title{ font-size: 16px; color: var(--text); }

/* ترتيب المتوقعين */
.ranking-cards-container{ max-width: 520px; gap: 8px; }
.user-card{
  padding: 10px 12px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: none;
  transition: transform .2s var(--ease), border-color .2s;
}
.user-card:hover{ border-color: var(--line-2); }
.user-card.is-me{ border-color: rgba(59,130,246,.55); background: linear-gradient(90deg, rgba(59,130,246,.10), var(--surface)); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.user-card-rank{ width: 30px; height: 30px; border-radius: 10px; background: var(--bg-2); color: var(--text-3); font-size: 13px; }
.user-card-rank.rank-1{ background: var(--gold-grad); color: #1c1403; box-shadow: 0 6px 16px -6px rgba(245,197,66,.8); }
.user-card-rank.rank-2{ background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #0f172a; }
.user-card-rank.rank-3{ background: linear-gradient(135deg, #fdba74, #c2410c); color: #fff; }
.user-card-avatar{ background: var(--brand-grad); box-shadow: 0 0 0 2px var(--surface); }
.user-card-name{ color: var(--text); }
.user-card-stats{ color: var(--text-3); }
.user-me-badge{ background: var(--brand); border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.user-card-score{ background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 5px 10px; }
.user-card-points{ color: #fff; font-variant-numeric: tabular-nums; font-size: 16px; }
.user-card-points-label{ color: var(--text-3); }

/* ============ الحساب والملف الشخصي ============ */
.account-box{
  max-width: 460px; padding: 20px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.account-box input, .account-box select{ width: 100%; max-width: none; }
.login-message{ color: var(--text-2); line-height: 1.8; }
.logout-button{ background-color: var(--danger) !important; box-shadow: 0 6px 16px -6px rgba(239,68,68,.6) !important; }

.profile-full-page{ max-width: 520px; padding: 8px 0; }
.profile-header-card{
  overflow: hidden; isolation: isolate;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow);
  padding-top: 56px !important;
}
.profile-header-card::before{
  content: ""; position: absolute; inset: 0 0 auto; height: 96px; z-index: -1;
  background:
    radial-gradient(18rem 8rem at 80% 0%, rgba(245,197,66,.25), transparent 70%),
    linear-gradient(135deg, #1d4ed8 0%, #4f46e5 55%, #0e1527 100%);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.profile-avatar-large{
  border: 0 !important;
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px rgba(245,197,66,.7), 0 16px 32px -10px rgba(0,0,0,.7) !important;
}
.upload-photo-btn{ background: var(--brand) !important; border-color: var(--surface) !important; }
.settings-gear-btn, .edit-name-btn{ background: var(--glass) !important; border: 1px solid var(--line-2) !important; color: var(--text) !important; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.profile-name-text{ font-size: 22px; font-weight: 800; }
.profile-email-text{ color: var(--text-3); }
.stats-grid-box{ gap: 10px; }
.stat-box-item{
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: none; padding: 14px 10px;
}
.stat-box-value{ font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-box-label{ color: var(--text-3); font-size: 11px; }
.form-pill{ border-radius: 8px; width: 26px; height: 26px; }

/* ============ التغطيات (الفيديو) ============ */
.videos-container{ max-width: 520px; margin: 28px auto 10px; padding: 0; }
.video-section-header{ border-bottom: 0; margin-bottom: 12px; padding-bottom: 0; }
.video-section-header h3{ color: var(--text); font-size: 16px; font-weight: 800; }
.video-section-header h3 .ic{ color: var(--gold); }
.video-card{ background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.video-card video{ border-bottom: 1px solid var(--line); background: #000; }
.video-title{ color: var(--text); font-weight: 700; }
.video-date{ color: var(--text-3); }
.video-upload-form{ background: var(--surface); border: 1px dashed rgba(59,130,246,.5); border-radius: var(--r-lg); }

/* ============ أدوات المنظم ============ */
.admin-controls-box{
  max-width: 520px; background: var(--gold-soft);
  border: 1px solid rgba(245,197,66,.25); border-radius: var(--r-lg); padding: 14px;
}
.admin-controls-box h4{ color: var(--gold); display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ============ النوافذ (Bottom Sheet في الجوال) ============ */
.modal-overlay{
  background: rgba(3, 6, 14, .66);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}
.modal-overlay.active{
  transition: opacity .25s ease;
  @starting-style{ opacity: 0; }
}
.modal-content{
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 40%);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
}
.modal-overlay.active .modal-content{ animation: sheetPop .32s var(--ease) both; }
@keyframes sheetPop{ from{ opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-header{ border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.modal-header h3{ color: var(--text); font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.modal-header h3 .ic{ color: var(--brand); }
.modal-back-btn{
  background: var(--bg-2) !important; background-image: none !important;
  border: 1px solid var(--line-2) !important; color: var(--text-2) !important;
  box-shadow: none !important; border-radius: 999px !important; padding: 6px 12px !important; min-height: 0 !important;
}
@media (max-width: 600px){
  .modal-overlay:not(.side-menu-overlay){ align-items: flex-end; padding: 0; }
  .modal-overlay:not(.side-menu-overlay) .modal-content{
    max-width: none; max-height: 92dvh;
    border-radius: 28px 28px 0 0; border-bottom: 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .modal-overlay:not(.side-menu-overlay) .modal-content::before{
    content: ""; display: block; width: 40px; height: 5px; border-radius: 3px;
    background: var(--line-2); margin: -8px auto 12px;
  }
  .modal-overlay.active:not(.side-menu-overlay) .modal-content{ animation: sheetUp .38s var(--ease) both; }
}
@keyframes sheetUp{ from{ transform: translateY(100%); } }

/* ============ القائمة الجانبية ============ */
.side-menu{
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border-left: 1px solid var(--line-2);
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.side-menu-head{ border-bottom: 1px solid var(--line); }
.side-menu-head img{ border-radius: 14px; box-shadow: 0 8px 20px -6px rgba(59,130,246,.6); }
.side-menu-title{ color: var(--text); }
.side-menu-sub{ color: var(--gold); letter-spacing: 2px; font-weight: 600; }
.side-menu-close{ background: var(--bg-2) !important; background-image: none !important; border: 1px solid var(--line-2) !important; color: var(--text-2) !important; box-shadow: none !important; min-height: 0 !important; padding: 0 !important; }
.side-menu-group{ color: var(--text-3); letter-spacing: .4px; }
.side-menu-item{
  background: none !important; background-image: none !important; box-shadow: none !important;
  color: var(--text) !important; border-radius: 12px !important; font-weight: 600 !important; min-height: 0 !important;
}
.side-menu-item .ic{ color: var(--text-3); transition: color .2s; }
.side-menu-item:hover, .side-menu-item:active{ background: rgba(255,255,255,.05) !important; }
.side-menu-item:hover .ic{ color: var(--brand); }
.side-menu-item.active{ background: var(--brand-soft) !important; color: #bfdbfe !important; }
.side-menu-item.active .ic{ color: #93c5fd; }
.info-block{ background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); }
.info-block h4{ color: var(--text); }
.info-date{ color: var(--gold); }

/* ============ المساعد (الزر العائم) ============ */
.ai-fab{
  bottom: calc(92px + env(safe-area-inset-bottom, 0px)); left: 16px;
  width: 50px; height: 50px; opacity: 1;
  border: 1px solid rgba(245,197,66,.6) !important;
  background: var(--brand-grad) !important;
  box-shadow: 0 12px 28px -8px rgba(59,130,246,.8), 0 0 0 4px rgba(245,197,66,.10) !important;
  transition: transform .25s var(--spring);
}
.ai-fab:active{ transform: scale(.9); }
.ai-msg.ai-bot{ background: var(--bg-2); border-color: var(--line-2); }
.ai-msg.ai-me{ background: var(--brand-grad); }

/* ============ الغرفة الصوتية (البطاقة والمسرح) ============ */
.room-card{
  background:
    radial-gradient(20rem 10rem at 0% 0%, rgba(245,197,66,.14), transparent 70%),
    linear-gradient(160deg, var(--surface-2) 0%, #131f4a 100%);
  border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow);
}
.room-card.live{ border-color: rgba(34,197,94,.6); box-shadow: 0 0 0 4px rgba(34,197,94,.10), var(--shadow); }
.rcd-icon{ border-radius: 18px; background: var(--gold-soft); border-color: rgba(245,197,66,.5); }
.rcd-cta{ background: var(--gold-grad); color: #1c1403; border-radius: 14px; padding: 12px; box-shadow: 0 10px 24px -10px rgba(245,197,66,.8); }
.room-card.closed .rcd-cta{ background: var(--surface-3); color: var(--text-3); box-shadow: none; }
.rcd-stats span{ background: rgba(6,10,20,.5); border-color: var(--line-2); }
.mic-stage, .room-chat-box, .room-offline-box{ background: var(--surface); border-color: var(--line); border-radius: var(--r-lg); }
.room-chat-msg-body{ background: var(--bg-2); border-color: var(--line); border-radius: 14px; }
.room-toast{ background: var(--glass-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-color: rgba(59,130,246,.5); box-shadow: var(--shadow-lg); }

/* ============ حالة الاتصال ============ */
#firebaseStatus{ color: var(--text-3); }
#debugBox{ background: var(--surface); border-color: var(--line-2); border-radius: var(--r); }

/* شاشات أعرض (تابلت/كمبيوتر) */
@media (min-width: 720px){
  .league-quick-summary{ gap: 14px; }
  .summary-card{ padding: 18px 10px 16px; }
  .summary-card-val{ font-size: 20px; }
}

/* تقليل الحركة لمن يفضّل */
@media (prefers-reduced-motion: reduce){
  .logo-box{ animation: none; }
  .section.active, .modal-overlay.active .modal-content{ animation: none !important; }
  ::view-transition-old(root), ::view-transition-new(root){ animation: none; }
}

/* نسيت كلمة المرور: رابط نصي تحت أزرار الدخول */
.account-box .forgot-pass-btn{
  display: block; margin: 12px auto 0; padding: 6px 10px;
  background: none !important; box-shadow: none !important; border: 0;
  color: var(--brand); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px;
}
.account-box .forgot-pass-btn:disabled{ opacity: .5; }

/* المسابقة التجريبية: شريط فوق الرئيسية وقت التجربة */
.trial-banner{
  display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 10px auto; padding: 12px 14px;
  border-radius: var(--r-lg); border: 1px solid rgba(250,204,21,.45);
  background: linear-gradient(180deg, rgba(250,204,21,.14), rgba(250,204,21,.05)); color: var(--text, #fff);
}
.trial-banner .ic{ width: 26px; height: 26px; color: var(--gold); flex: none; }
.trial-banner b{ display: block; color: var(--gold); font-size: 15px; }
.trial-banner span{ display: block; font-size: 13px; color: var(--text-2); }
/* متسابقين التجربة (إضافة وحذف) */
.trial-players{ text-align: right; display: flex; flex-direction: column; gap: 10px; }
.trial-players-s{ font-size: 13px; color: var(--text-2); margin: 0; }
.trial-players-add{ display: flex; gap: 8px; }
.trial-players-add input{ flex: 1; min-width: 0; margin: 0; }
.trial-players-add button{ margin: 0; flex: none; }
.trial-players-list{ display: flex; flex-direction: column; gap: 6px; }
.trial-player{ display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r-md, 12px); background: var(--surface); border: 1px solid var(--line); }
.trial-player span{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trial-player small{ color: var(--text-2); font-size: 11px; }
.trial-player .trial-del{ margin: 0; flex: none; padding: 6px 10px; font-size: 13px; background: rgba(239,68,68,.16); color: #fca5a5; border: 1px solid rgba(239,68,68,.4); }
