/* كشخة | لكل مقامٍ كشخة */
:root {
  --navy: #0f1a33; --navy2: #17244a; --navy3: #22325f; --ink: #0a1226;
  --ivory: #f7f1e3; --ivory2: #efe6d2; --paper: #fffdf8; --line: #e3d8c2;
  --gold: #b48a3a; --gold2: #d8b66a; --gold3: #f1dfae;
  --em: #127a56; --em2: #1aa572; --red: #b33a3a; --amber: #c98a1e;
  --text: #1b2238; --muted: #6e6f78; --r: 14px; --sh: 0 10px 30px rgba(10, 18, 38, .12);
  --font: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', Tahoma, sans-serif; --display: 'Reem Kufi', 'IBM Plex Sans Arabic', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--ivory); direction: rtl; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
#app { min-height: 100%; }
.view { min-height: 100vh; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* أزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 10px 16px; font-weight: 600; font-size: 15px; background: var(--paper); color: var(--text); border-color: var(--line); transition: transform .12s, background .2s, box-shadow .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--navy); color: var(--ivory); border-color: var(--navy); }
.btn.gold { background: linear-gradient(180deg, #d9b871, #b48a3a); color: #1b1408; border-color: #a77f31; }
.btn.em { background: var(--em); color: #fff; border-color: var(--em); }
.btn.danger { background: #fff; color: var(--red); border-color: #e6b8b8; }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.lg { padding: 14px 22px; font-size: 17px; border-radius: 14px; }
.btn .ic { width: 18px; height: 18px; flex: none; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; }

/* الشعار */
.logo { font-family: var(--display); font-weight: 700; letter-spacing: 0; display: inline-flex; align-items: center; gap: 8px; line-height: 1; }
.logo .mark { width: 1.1em; height: 1.1em; }
.logo b { background: linear-gradient(180deg, #f1dfae, #c99c45 60%, #9d7429); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* حقول */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none; width: 100%; transition: border .2s, box-shadow .2s; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180, 138, 58, .18); }
.input.code { font-size: 26px; letter-spacing: 8px; text-align: center; font-weight: 700; direction: ltr; }

/* بطاقات */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 1px 0 rgba(0, 0, 0, .02); }
.pad { padding: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--ivory2); color: var(--text); border: 1px solid transparent; }
.chip.on { background: var(--navy); color: var(--ivory); }
.chip.em { background: #def3ea; color: var(--em); }
.chip.red { background: #f7e2e2; color: var(--red); }
.chip.gold { background: #f6ecd2; color: #7a5a1c; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #aaa; }
.dot.on { background: var(--em2); box-shadow: 0 0 0 3px rgba(26, 165, 114, .2); }

/* النوافذ */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 14, 32, .55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: fade .2s; }
.modal { background: var(--paper); border-radius: 18px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.modal.wide { width: min(920px, 100%); }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; font-size: 18px; flex: 1; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.sumrow { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.sumrow:last-child { border: 0; }
.sumrow b { font-variant-numeric: tabular-nums; }

/* التنبيهات */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: var(--ivory); padding: 10px 16px; border-radius: 12px; box-shadow: var(--sh); font-weight: 600; font-size: 14.5px; animation: toastin .25s ease; max-width: 92vw; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--em); }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px); } }
#netbar { position: fixed; bottom: 0; inset-inline: 0; background: var(--red); color: #fff; text-align: center; padding: 8px; font-weight: 600; z-index: 150; }
body.offline .fin { opacity: .45; pointer-events: none; }

/* ===== الصفحة الرئيسية ===== */
.home { background: radial-gradient(1200px 600px at 70% 10%, #23356a 0%, var(--navy) 55%, var(--ink) 100%); color: var(--ivory); display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 30px; padding: 40px clamp(20px, 6vw, 90px); position: relative; overflow: hidden; }
.home::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(216, 182, 106, .12) 1px, transparent 1px); background-size: 26px 26px; mask-image: linear-gradient(to bottom, #000, transparent 85%); }
.home > * { position: relative; }
.home .logo { font-size: clamp(64px, 10vw, 128px); }
.home .tag { font-family: var(--display); font-size: clamp(22px, 3vw, 34px); color: var(--gold3); margin: 10px 0 6px; }
.home .sub { color: #c9cfdf; max-width: 520px; line-height: 1.9; font-size: 16px; }
.home .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; max-width: 520px; }
.home .acts .btn { justify-content: flex-start; padding: 16px 18px; }
.home .acts .btn.main { grid-column: 1 / -1; font-size: 19px; padding: 18px 22px; }
.home .acts .btn.dark { background: rgba(255, 255, 255, .06); color: var(--ivory); border-color: rgba(255, 255, 255, .14); }
.home .stage { justify-self: center; width: min(400px, 90%); aspect-ratio: 360/600; border-radius: 200px 200px 24px 24px; border: 2px solid rgba(216, 182, 106, .55); overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 0 0 8px rgba(216, 182, 106, .08); background: var(--ivory); }
.home .stage svg { width: 100%; height: 100%; display: block; }
.home .foot { position: absolute; bottom: 14px; inset-inline: 0; text-align: center; font-size: 12.5px; color: #8e97b3; }
@media (max-width: 860px) { .home { grid-template-columns: 1fr; text-align: center; padding-top: 30px; } .home .sub, .home .acts { margin-inline: auto; } .home .stage { order: -1; width: 210px; } .home .logo { justify-content: center; } }

/* صفحات الدخول */
.gate { background: linear-gradient(180deg, var(--navy), var(--ink)); color: var(--ivory); display: flex; flex-direction: column; align-items: center; padding: 26px 16px 60px; }
.gate .top { width: min(980px, 100%); display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.gate .top .logo { font-size: 36px; }
.gate .panel { width: min(980px, 100%); background: var(--paper); color: var(--text); border-radius: 22px; padding: clamp(18px, 4vw, 34px); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.steps { display: flex; gap: 8px; margin-bottom: 22px; }
.steps span { flex: 1; height: 5px; border-radius: 5px; background: var(--ivory2); }
.steps span.on { background: var(--gold); }
.gate h2 { margin: 0 0 6px; font-family: var(--display); font-size: 28px; }
.teams4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.tcard { border-radius: 18px; padding: 20px 14px; text-align: center; border: 2px solid transparent; background: var(--ivory); transition: transform .15s, border .2s, box-shadow .2s; cursor: pointer; position: relative; }
.tcard:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.tcard.sel { border-color: var(--tc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 20%, transparent); }
.tcard .em { width: 74px; height: 74px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--tc); color: #fff; }
.tcard .em svg { width: 44px; height: 44px; }
.tcard b { font-family: var(--display); font-size: 22px; display: block; }
.tcard .st { position: absolute; top: 10px; left: 10px; font-size: 11px; }
@media (max-width: 720px) { .teams4 { grid-template-columns: 1fr 1fr; } }

/* كيف تلعب */
.how4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.how4 .st { background: var(--ivory); border-radius: 18px; padding: 22px 16px; text-align: center; position: relative; }
.how4 .st .n { position: absolute; top: 12px; right: 14px; font-family: var(--display); font-size: 30px; color: var(--gold2); }
.how4 .st svg.big { width: 64px; height: 64px; color: var(--navy); margin-bottom: 8px; }
.how4 .st h4 { margin: 4px 0; font-family: var(--display); font-size: 20px; }
.how4 .st p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
@media (max-width: 760px) { .how4 { grid-template-columns: 1fr 1fr; } }

/* ===== واجهة المجموعة ===== */
.team { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: var(--ivory); }
.tbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--navy); color: var(--ivory); flex-wrap: nowrap; min-height: 58px; }
.tbar .logo { font-size: 26px; }
.tbar .tname { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 5px 12px 5px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.tbar .tname i { width: 24px; height: 24px; border-radius: 50%; background: var(--tc); display: grid; place-items: center; }
.tbar .tname i svg { width: 16px; height: 16px; color: #fff; }
.tbar .stat { display: flex; flex-direction: column; line-height: 1.15; padding: 0 10px; border-inline-start: 1px solid rgba(255, 255, 255, .12); }
.tbar .stat small { font-size: 11px; color: #9aa4c2; }
.tbar .stat b { font-size: 16px; }
.bal { color: var(--gold3); display: inline-flex; align-items: center; gap: 5px; }
.bal.bump { animation: bump .7s ease; }
@keyframes bump { 30% { transform: scale(1.25); color: #7ff0c0; } }
.timer b { font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }
.timer.warn b { color: #ff9a8a; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.mkt { font-size: 12px; padding: 3px 9px; border-radius: 99px; font-weight: 700; }
.mkt.open { background: rgba(26, 165, 114, .2); color: #7fe6bd; }
.mkt.closed { background: rgba(255, 255, 255, .08); color: #aab; }
.tbar .btn { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); color: var(--ivory); padding: 8px 10px; }
.tbar .sp { flex: 1; }
.tmain { flex: 1; display: grid; grid-template-columns: minmax(340px, 44%) minmax(0, 1fr); min-height: 0; }
.tmain > * { min-width: 0; }
.studio { position: relative; display: flex; flex-direction: column; min-height: 0; background: linear-gradient(180deg, #f6eedd, #eadfc8); border-inline-end: 1px solid var(--line); }
.casecard { margin: 10px; border-radius: 14px; overflow: hidden; position: relative; color: #fff; min-height: 64px; background: var(--navy); flex: none; }
.casecard .bg { position: absolute; inset: 0; opacity: .75; }
.casecard .bg svg { width: 100%; height: 100%; display: block; }
.casecard .in { position: relative; padding: 10px 14px; background: linear-gradient(90deg, rgba(10, 18, 38, .1), rgba(10, 18, 38, .78)); display: flex; gap: 10px; align-items: flex-start; }
.casecard h3 { margin: 0; font-family: var(--display); font-size: 20px; }
.casecard p { margin: 4px 0 0; font-size: 14px; line-height: 1.7; color: #e8ebf5; }
.casecard .rn { font-size: 12px; color: var(--gold3); font-weight: 700; }
.casecard.folded p { display: none; }
.casecard .fold { background: rgba(255, 255, 255, .14); border: 0; color: #fff; border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.figwrap { flex: 1; position: relative; overflow: hidden; min-height: 0; touch-action: pan-y; background: radial-gradient(ellipse 70% 60% at 50% 38%, #fdf9f0 0%, #efe7d6 62%, #dfd2b8 100%); margin: 0 10px; border-radius: 16px; }
.figwrap::after { content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 13%; background: linear-gradient(180deg, #ddd0b4, #cdbd9f); z-index: 0; }
.figwrap .figin { z-index: 1; }
.figwrap .figin { position: absolute; inset: 0; display: flex; justify-content: center; transition: transform .25s ease; transform-origin: 50% 30%; }
.figwrap svg.fig { height: 100%; width: auto; max-width: 100%; }
.figwrap.drop { outline: 3px dashed var(--gold); outline-offset: -8px; }
svg.fig { display: block; width: 100%; height: 100%; }
.lay { cursor: pointer; }
.lay.sel { filter: drop-shadow(0 0 2px #d8b66a) drop-shadow(0 0 5px rgba(216, 182, 106, .9)); }
.lay.prev { opacity: .92; }
.lay.pop { animation: popin .45s ease; transform-box: fill-box; transform-origin: center; }
@keyframes popin { 0% { opacity: 0; transform: scale(.94); } 60% { opacity: 1; transform: scale(1.02); } }
.prevbar { position: absolute; top: 10px; inset-inline: 10px; background: var(--navy); color: var(--ivory); border-radius: 12px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; z-index: 5; box-shadow: var(--sh); }
.prevbar b { color: var(--gold3); }
.tools { display: flex; gap: 6px; padding: 8px 10px 10px; flex-wrap: wrap; justify-content: center; flex: none; }
.tools .btn { padding: 7px 10px; font-size: 13px; }
.tools .btn.approve { padding: 8px 16px; }
.selbar { position: absolute; bottom: 8px; inset-inline: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; box-shadow: var(--sh); z-index: 4; }
.selbar b { margin-inline-end: auto; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 14px; border-radius: 10px 10px 0 0; font-weight: 700; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.on { color: var(--navy); border-bottom-color: var(--gold); }
.tab .n { background: var(--ivory2); border-radius: 99px; padding: 0 7px; font-size: 12px; }
.pbody { flex: 1; overflow: auto; padding: 12px; min-height: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; position: sticky; top: -12px; background: var(--paper); padding: 8px 0; z-index: 2; }
.filters .input { width: auto; padding: 8px 10px; }
.filters .search { flex: 1; min-width: 160px; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: thin; }
.cats .chip { cursor: pointer; white-space: nowrap; border: 1px solid var(--line); background: #fff; padding: 6px 12px; }
.cats .chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .15s; }
.pcard:hover { box-shadow: var(--sh); transform: translateY(-2px); }
.pcard .th { aspect-ratio: 1/1; background: radial-gradient(circle at 50% 40%, #fbf6ea, #efe4cd); display: grid; place-items: center; cursor: zoom-in; position: relative; }
.pcard .th svg, .pcard .th img { width: 88%; height: 88%; }
.pcard .own { position: absolute; top: 8px; right: 8px; }
.pcard .bd { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .nm { font-weight: 700; font-size: 14px; line-height: 1.4; }
.price { font-weight: 800; color: var(--navy); display: inline-flex; gap: 4px; align-items: baseline; }
.price small { font-size: 11px; color: var(--muted); font-weight: 600; }
.short { font-size: 12px; color: var(--red); font-weight: 600; }
.sw { display: flex; gap: 5px; flex-wrap: wrap; }
.sw button { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfc4ad; padding: 0; }
.sw button.on { box-shadow: 0 0 0 2px var(--navy); }
.pcard .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: auto; }
.pcard .acts .btn { padding: 6px 4px; font-size: 12.5px; }
.pcard .acts .btn.full { grid-column: 1 / -1; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty svg { width: 54px; height: 54px; color: #c7b994; display: block; margin: 0 auto 10px; }
.ilist { display: flex; flex-direction: column; gap: 8px; }
.irow { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.irow .th { width: 64px; height: 64px; flex: none; border-radius: 10px; background: #f6efdf; display: grid; place-items: center; }
.irow .th svg, .irow .th img { width: 90%; height: 90%; }
.irow .inf { flex: 1; min-width: 0; }
.irow .inf b { display: block; font-size: 14px; }
.irow .inf small { color: var(--muted); }
.irow .acts { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.modes { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.modes .chip { cursor: pointer; border: 1px solid var(--line); background: #fff; }
.modes .chip.on { background: var(--navy); color: #fff; }
.lockmsg { background: #f6ecd2; color: #6a4e16; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
@media (max-width: 860px) {
  .tmain { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; overflow: auto; }
  .studio { height: 62vh; height: 62dvh; border: 0; border-bottom: 1px solid var(--line); }
  .panel { min-height: 60vh; }
  .tbar { overflow-x: auto; gap: 6px; padding: 6px 8px; }
  .tbar .logo { font-size: 20px; }
  .tbar .stat { padding: 0 6px; }
  .tbar .lbl { display: none; }
  .casecard p { font-size: 12.5px; }
  .tools .btn span { display: none; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
}

/* شاشات الانتظار والنتائج للمجموعة */
.waitv { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 14px; background: radial-gradient(800px 400px at 50% 20%, #fff8e9, var(--ivory)); overflow: auto; }
.waitv h2 { font-family: var(--display); font-size: 30px; margin: 0; }
.waitv .mini4 { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.waitv .mini4 .chip { padding: 8px 14px; font-size: 14px; }
.hangers { display: flex; gap: 16px; }
.hangers svg { width: 46px; height: 46px; color: var(--gold); animation: swing 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
.hangers svg:nth-child(2) { animation-delay: .3s; } .hangers svg:nth-child(3) { animation-delay: .6s; }
@keyframes swing { 50% { transform: rotate(8deg); } }
.finalfig { width: 220px; height: 360px; border-radius: 110px 110px 18px 18px; overflow: hidden; border: 2px solid var(--gold2); background: #fff; }
.finalfig svg { width: 100%; height: 100%; }

/* تأثير المكافأة */
.award-fx { position: fixed; inset: 0; pointer-events: none; z-index: 120; display: grid; place-items: center; }
.award-fx .bx { background: linear-gradient(180deg, #13284f, #0b1730); color: #fff; padding: 22px 36px; border-radius: 22px; text-align: center; border: 2px solid var(--gold2); box-shadow: 0 20px 60px rgba(0, 0, 0, .4); animation: awin 2.4s ease forwards; }
.award-fx .bx b { display: block; font-size: 48px; font-family: var(--display); color: #8ff0c6; direction: ltr; }
.award-fx .coin { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2c0, #d8b66a 50%, #9d7429); animation: coin 1.4s ease-out forwards; }
@keyframes awin { 0% { opacity: 0; transform: scale(.7); } 12% { opacity: 1; transform: scale(1.05); } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
@keyframes coin { 0% { transform: translate(0, 0) scale(.4); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; } }
.fly { position: fixed; z-index: 130; pointer-events: none; transition: all .6s cubic-bezier(.5, -.2, .6, 1); }

/* ===== لوحة المشرف ===== */
.admin { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: #f3efe6; }
.side { background: var(--navy); color: #cfd5e6; padding: 16px 10px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .logo { font-size: 30px; padding: 4px 10px 14px; color: #fff; }
.side .brand small { display: block; font-size: 12px; color: #8e97b3; font-weight: 600; padding: 0 10px 12px; }
.side .brand .logo { padding-bottom: 4px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14.5px; }
.side a:hover { background: rgba(255, 255, 255, .06); }
.side a.on { background: rgba(216, 182, 106, .16); color: var(--gold3); }
.side a .n { margin-inline-start: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
.amain { min-width: 0; display: flex; flex-direction: column; }
.abar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.abar h1 { font-size: 19px; margin: 0; }
.acontent { padding: 18px 20px 60px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi small { color: var(--muted); font-weight: 600; font-size: 12px; display: block; }
.kpi b { font-size: 20px; display: block; margin-top: 3px; }
.ctrl { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.ctrl h3 { margin: 0 0 10px; font-size: 15px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.phasebar { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.phasebar span { flex: 1; text-align: center; padding: 8px 6px; border-radius: 9px; background: var(--ivory2); font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.phasebar span.on { background: var(--navy); color: var(--gold3); }
.phasebar span.done { background: #dfeee7; color: var(--em); }
.tlive { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; border-top: 4px solid var(--tc); }
.tlive .fg { height: 250px; background: #f4ecdc; cursor: zoom-in; }
.tlive .fg svg { width: 100%; height: 100%; }
.tlive .inf { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.tlive .inf .row { justify-content: space-between; }
.secret { background: #1b2440; color: var(--gold3); border-radius: 8px; padding: 2px 8px; font-weight: 700; font-size: 12.5px; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: 12px; overflow: hidden; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
.tbl th { background: var(--ivory2); font-size: 12.5px; color: #555; font-weight: 700; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; text-align: center; }
.warnbox { background: #fff4e0; border: 1px solid #f0d49a; color: #7a5313; padding: 10px 14px; border-radius: 12px; margin: 8px 0; font-size: 14px; }
.okbox { background: #e3f4ec; border: 1px solid #b6e2cd; color: var(--em); padding: 10px 14px; border-radius: 12px; margin: 8px 0; font-weight: 600; }
.errbox { background: #fbe9e9; border: 1px solid #efc4c4; color: var(--red); padding: 10px 14px; border-radius: 12px; margin: 8px 0; }
/* لوحة منح الأموال */
.qhead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--navy); color: #fff; border-radius: 16px; padding: 16px 20px; margin-bottom: 14px; }
.qhead .qn { font-family: var(--display); font-size: 44px; line-height: 1; }
.qhead .qn small { font-size: 18px; color: #9aa4c2; }
.qhead .qv { font-size: 20px; color: var(--gold3); font-weight: 700; }
.qstate { font-size: 14px; padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); }
.abtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.abtn { border: 0; border-radius: 18px; padding: 22px 10px; color: #fff; background: var(--tc); font-family: var(--display); font-size: 26px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 8px 0 color-mix(in srgb, var(--tc) 70%, #000); transition: transform .08s, box-shadow .08s; }
.abtn:active { transform: translateY(6px); box-shadow: 0 2px 0 color-mix(in srgb, var(--tc) 70%, #000); }
.abtn small { font-family: var(--font); font-size: 14px; opacity: .9; }
.abtn:disabled { filter: grayscale(.7); opacity: .5; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 5px; }
.qgrid button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 0; font-weight: 700; font-size: 13px; }
.qgrid button.cur { outline: 3px solid var(--gold); }
.qgrid button.done { color: #fff; }
.qgrid button.none { background: #ddd; color: #666; }
.sliders .sl { display: grid; grid-template-columns: 1fr 70px; gap: 10px; align-items: center; margin-bottom: 8px; }
.sliders input[type=range] { width: 100%; accent-color: var(--gold); }
.judge { display: grid; grid-template-columns: 260px 1fr; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; border-top: 4px solid var(--tc); }
.judge .fg { height: 420px; background: #f4ecdc; border-radius: 12px; overflow: hidden; cursor: zoom-in; }
.judge .fg svg { width: 100%; height: 100%; }
.pedit { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
.pedit .pv { background: #f4ecdc; border-radius: 12px; height: 420px; }
.pedit .pv svg { width: 100%; height: 100%; }
.mx td input { width: 70px; padding: 6px; }
@media (max-width: 1000px) { .admin { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; } .side .logo { width: 100%; } .side a { padding: 8px 10px; font-size: 13px; } .grid4, .abtns { grid-template-columns: 1fr 1fr; } .grid3, .grid2, .judge, .pedit { grid-template-columns: 1fr; } }

/* ===== شاشة العرض ===== */
.disp { position: fixed; inset: 0; background: radial-gradient(1400px 700px at 50% 0%, #22356b, var(--navy) 55%, var(--ink)); color: var(--ivory); overflow: hidden; display: flex; flex-direction: column; }
.disp::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(216, 182, 106, .1) 1px, transparent 1px); background-size: 30px 30px; }
.disp > * { position: relative; }
.dhead { display: flex; align-items: center; justify-content: space-between; padding: 2.2vh 3vw; }
.dhead .logo { font-size: 5vh; }
.dhead .rn { font-size: 2.4vh; color: var(--gold3); font-weight: 700; }
.dbody.top { justify-content: flex-start; padding-top: 3vh; }
.dbody { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 4vw 4vh; text-align: center; min-height: 0; }
.dtitle { font-family: var(--display); font-size: 8vh; margin: 0; line-height: 1.2; }
.dsub { font-size: 3vh; color: #c9cfdf; max-width: 70vw; line-height: 1.7; margin: 1.5vh 0; }
.dteams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2vw; width: 100%; margin-top: 4vh; }
.dteam { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 2.4vh; padding: 3vh 1vw; border-top: .8vh solid var(--tc); }
.dteam .em { width: 9vh; height: 9vh; border-radius: 50%; background: var(--tc); display: grid; place-items: center; margin: 0 auto 1.4vh; }
.dteam .em svg { width: 5.4vh; height: 5.4vh; color: #fff; }
.dteam b { font-family: var(--display); font-size: 4vh; display: block; }
.dteam .s { font-size: 2.2vh; margin-top: 1vh; color: #c9cfdf; display: flex; gap: .6vw; align-items: center; justify-content: center; }
.dteam .v { font-size: 4.4vh; color: var(--gold3); font-weight: 800; margin-top: 1vh; direction: rtl; }
.dtimer { font-size: 16vh; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; line-height: 1; letter-spacing: .02em; }
.dtimer.warn { color: #ff9a8a; animation: pulse 1s infinite; }
.dscene { position: absolute; inset: 0; opacity: .35; }
.dscene svg { width: 100%; height: 100%; }
.dq { font-family: var(--display); font-size: 20vh; line-height: 1; }
.dq small { font-size: 6vh; color: #9aa4c2; }
.dresults { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.6vw; width: 100%; height: 100%; align-items: end; }
.dres { background: rgba(255, 255, 255, .06); border-radius: 2vh; border: 1px solid rgba(255, 255, 255, .12); overflow: hidden; display: flex; flex-direction: column; opacity: 0; transform: translateY(30px); transition: all .8s ease; border-top: .7vh solid var(--tc); }
.dres.show { opacity: 1; transform: none; }
.dres.win { box-shadow: 0 0 0 .4vh var(--gold2), 0 0 8vh rgba(216, 182, 106, .45); }
.dres .fg { height: 36vh; background: var(--ivory); }
.dres .fg svg { width: 100%; height: 100%; }
.dres .inf { padding: 1.4vh 1vw; }
.dres .inf b { font-family: var(--display); font-size: 3.4vh; display: block; }
.dres .sc { display: flex; justify-content: space-around; font-size: 1.9vh; color: #c9cfdf; margin: .8vh 0; }
.dres .sc span b { font-size: 2.6vh; color: #fff; font-family: var(--font); }
.dres .tot { font-size: 5.4vh; font-weight: 800; color: var(--gold3); }
.dres .rk { font-family: var(--display); font-size: 3vh; }
.crown { width: 3.4vh; height: 3.4vh; color: var(--gold2); vertical-align: -.4vh; margin-inline-end: .6vw; }
.dres { position: relative; }
.dcum { width: min(1100px, 90vw); margin-top: 2vh; }
.dcum table { width: 100%; border-collapse: collapse; font-size: 2.1vh; }
.dcum td, .dcum th { padding: 1vh 1vw; border-bottom: 1px solid rgba(255, 255, 255, .12); text-align: center; }
.dcum th { color: #9aa4c2; font-weight: 600; }
.dcum td:first-child, .dcum th:first-child { text-align: right; }
.podium { display: flex; align-items: flex-end; gap: 2vw; justify-content: center; margin-top: 2vh; }
.podium .pl { width: 22vw; text-align: center; }
.podium .pl .fg { height: 36vh; }
.podium .pl .fg svg { height: 100%; }
.podium .blk { border-radius: 1.4vh 1.4vh 0 0; background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1b1408; font-family: var(--display); font-size: 6vh; display: grid; place-items: center; }
.podium .pl:nth-child(1) .blk { height: 14vh; background: linear-gradient(180deg, #d9dde4, #9aa1ac); }
.podium .pl:nth-child(2) .blk { height: 20vh; }
.podium .pl:nth-child(3) .blk { height: 10vh; background: linear-gradient(180deg, #e2b48a, #a86d3e); }
.dctl { position: fixed; bottom: 14px; left: 14px; display: flex; gap: 8px; z-index: 10; transition: opacity .3s; }
.dctl .btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); }
.disp.idle .dctl { opacity: 0; }
.dfx { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 20; }
.dfx .bx { background: rgba(10, 18, 38, .9); border: .4vh solid var(--tc); border-radius: 3vh; padding: 4vh 6vw; text-align: center; animation: awin 3.2s ease forwards; }
.dfx .bx b { font-family: var(--display); font-size: 7vh; display: block; }
.dfx .bx span { font-size: 9vh; color: #8ff0c6; font-weight: 800; direction: ltr; display: block; }
.confetti { position: fixed; top: -20px; width: 10px; height: 16px; z-index: 25; animation: fall linear forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.spin { width: 12vh; height: 12vh; border: .8vh solid rgba(216, 182, 106, .2); border-top-color: var(--gold2); border-radius: 50%; animation: rot 1.2s linear infinite; margin: 4vh auto; }
@keyframes rot { to { transform: rotate(360deg); } }

/* الطباعة */
@media print {
  .side, .abar, .noprint, .dctl { display: none !important; }
  .admin { display: block; background: #fff; }
  .acontent { padding: 0; }
  body { background: #fff; }
  .card, .ctrl, .tbl { box-shadow: none; break-inside: avoid; }
}
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
