:root{--nv:#0b1f3a;--nv2:#132c4e;--gd:#e8b341;--gd2:#c9932c;--bg:#f1f5fb;--ink:#0f172a;--mut:#64748b;--rd:#dc2626;--gr:#15803d}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:"Cairo","Segoe UI",Tahoma,Arial,sans-serif;background:var(--bg);color:var(--ink);direction:rtl;-webkit-tap-highlight-color:transparent}
.wrap{max-width:760px;margin:0 auto;padding:14px 14px 40px}
.screen{display:none}.screen.on{display:block}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:14px;background:var(--nv);color:#fff;font:inherit;font-weight:700;padding:14px 18px;cursor:pointer;width:100%}
.btn.gold{background:linear-gradient(180deg,var(--gd),var(--gd2));color:#2a1c00}
.btn.gray{background:#e2e8f0;color:#334155}
.btn:disabled{opacity:.5}
.card{background:#fff;border-radius:18px;padding:16px;box-shadow:0 6px 24px rgba(11,31,58,.08);margin-bottom:14px}
h1,h2,h3{margin:0 0 10px}
.muted{color:var(--mut);font-size:14px}
label{display:block;font-size:13px;font-weight:700;color:#334155;margin:10px 0 6px}
input,select{width:100%;padding:13px 14px;border:1px solid #cbd5e1;border-radius:12px;font:inherit;background:#fff}
.cover{text-align:center;padding:10px 0 0}
.cover img{width:150px;height:150px;border-radius:50%;object-fit:cover;border:5px solid var(--gd);background:#dbe3ee}
.cover .t1{font-size:26px;font-weight:800;color:var(--nv);margin-top:12px}
.cover .t2{font-size:34px;font-weight:900;color:var(--gd2);line-height:1.15}
.cover .t3{margin-top:10px;font-size:17px;font-weight:700;color:#334155}
.cover .t4{display:inline-block;margin-top:8px;background:var(--nv);color:#fff;border-radius:99px;padding:5px 16px;font-size:14px;font-weight:700}
.games{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.gt{border:0;border-radius:18px;padding:18px 12px;color:#fff;font:inherit;font-weight:800;font-size:17px;cursor:pointer;min-height:120px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center}
.gt .em{font-size:34px;line-height:1}
.gt.m{background:linear-gradient(160deg,#1e3a8a,#0b1f3a)}
.gt.s{background:linear-gradient(160deg,#16a34a,#065f46)}
.gt.x{background:linear-gradient(160deg,#f97316,#c2410c)}
.gt.l{background:linear-gradient(160deg,#7c3aed,#4c1d95)}
.gt.w{background:linear-gradient(160deg,#0f766e,#134e4a)}
.gt:disabled{filter:grayscale(.6);opacity:.65}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.roomno{font-size:46px;font-weight:900;letter-spacing:6px;color:var(--nv);text-align:center;direction:ltr}
.pl{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid #eef2f7}
.pl:last-child{border:0}
.dot{width:9px;height:9px;border-radius:50%;background:#cbd5e1}.dot.on{background:var(--gr)}
.seat{width:26px;height:26px;border-radius:50%;background:var(--nv);color:#fff;font-size:13px;font-weight:800;display:flex;align-items:center;justify-content:center}
.xo{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:340px;margin:0 auto}
.xc{aspect-ratio:1;border:0;border-radius:14px;background:#e8eef7;font-size:52px;font-weight:900;color:var(--nv);cursor:pointer;display:flex;align-items:center;justify-content:center}
.xc.o{color:#c2410c}.xc.win{background:#dcfce7;color:var(--gr)}
.turnbar{text-align:center;font-weight:800;font-size:17px;margin:6px 0 14px;color:var(--nv)}
.qcard{background:linear-gradient(160deg,#1e3a8a,#0b1f3a);color:#fff;border-radius:18px;padding:18px;font-size:19px;font-weight:700;line-height:1.6;min-height:110px;display:flex;align-items:center}
.opt{display:block;width:100%;text-align:right;margin-top:10px;background:#fff;border:2px solid #cbd5e1;border-radius:14px;padding:14px;font:inherit;font-weight:700;font-size:16px;cursor:pointer}
.opt:disabled{opacity:.75}
.opt.ok{border-color:var(--gr);background:#dcfce7}
.opt.ok:disabled{opacity:1}
.opt.bad{border-color:var(--rd);background:#fee2e2}
.scores{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.sc{background:#eef2f7;border-radius:12px;padding:8px 12px;font-weight:800;font-size:14px}
.sc.me{background:var(--gd);color:#2a1c00}
.big{font-size:22px;font-weight:900;text-align:center;color:var(--nv);margin:10px 0}
.msg{color:var(--rd);font-weight:700;font-size:14px;min-height:18px;margin-top:8px}
.back{background:none;border:0;color:var(--mut);font:inherit;font-weight:700;cursor:pointer;padding:6px 0}

/* ---- transitions, board, dice, question sheet, win ---- */
.screen.on{animation:fade .22s ease}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.board{position:relative;display:grid;grid-template-columns:repeat(10,1fr);gap:2px;aspect-ratio:1;width:100%;max-width:520px;margin:0 auto;background:#0b1f3a;padding:4px;border-radius:12px}
.cell{position:relative;border-radius:4px;display:flex;align-items:flex-start;justify-content:flex-end;font-size:10px;font-weight:700;color:#5d7799;padding:1px 3px;overflow:hidden}
.cell.a{background:#e8f0fb}.cell.b{background:#d7e5f7}
.cell.lad{background:linear-gradient(135deg,#fde68a,#f5c451)}
.cell.snk{background:linear-gradient(135deg,#fecaca,#f7a1a1)}
.cell.hl{outline:2px solid #e8b341;outline-offset:-2px}
.tok{position:absolute;width:7.2%;height:7.2%;border-radius:50%;transform:translate(-50%,-50%);transition:left .16s linear,top .16s linear;box-shadow:0 2px 6px rgba(0,0,0,.35);border:2px solid #fff;z-index:5}
.dicewrap{display:flex;align-items:center;justify-content:center;gap:10px;margin:14px 0 4px;min-height:56px}
.dice{width:56px;height:56px;border-radius:12px;background:#fff;border:2px solid #cfd9e8;box-shadow:0 3px 10px rgba(11,31,58,.25);display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);padding:7px;gap:2px}
.dice i{background:#0b1f3a;border-radius:50%;width:100%;height:100%}
.dice.rolling{animation:roll .5s linear infinite}
@keyframes roll{0%{transform:rotate(0) scale(1)}25%{transform:rotate(90deg) scale(1.08)}50%{transform:rotate(180deg) scale(1)}75%{transform:rotate(270deg) scale(1.08)}100%{transform:rotate(360deg) scale(1)}}
.qov{position:fixed;inset:0;background:rgba(6,15,30,.72);display:none;align-items:flex-end;justify-content:center;z-index:60;backdrop-filter:blur(2px)}
.qov.on{display:flex;animation:fade .2s ease}
.qbox{width:100%;max-width:560px;background:#fff;border-radius:22px 22px 0 0;padding:16px 14px 22px;box-shadow:0 -10px 40px rgba(0,0,0,.35);border-top:4px solid #e8b341;animation:up .28s cubic-bezier(.2,.8,.2,1)}
@keyframes up{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
.win{position:fixed;inset:0;background:radial-gradient(circle at 50% 30%,#16386a,#071528);color:#fff;display:none;flex-direction:column;align-items:center;justify-content:center;z-index:80;text-align:center;padding:24px}
.win.on{display:flex}
.win h2{font-size:34px;color:#e8b341;margin:0 0 8px}
.win .who{font-size:22px;font-weight:800}
.win .conf{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.win .conf i{position:absolute;width:9px;height:14px;border-radius:2px;animation:fall linear infinite}
@keyframes fall{from{transform:translateY(-40px) rotate(0)}to{transform:translateY(110vh) rotate(540deg)}}

.opt .lbl{color:#c9932c;font-weight:900}

/* ludo: classic 15x15 cross board */
.lboard { position: relative; width: 100%; aspect-ratio: 1/1; margin: 6px auto; background: #f3f6fb; border-radius: 16px; box-shadow: inset 0 0 0 2px #e2e8f0; overflow: hidden; }
.lwrap { position: absolute; inset: 2.6% }
.lcell { position: absolute; box-sizing: border-box; border: 1px solid #cfd9e8; border-radius: 2px; }
.lcell.lstart { border-color: rgba(255,255,255,.55); box-shadow: inset 0 0 0 2px rgba(255,255,255,.55) }
.lcell.lsafe { border-color: #b9c9e2 }
.lhome { position: absolute; box-sizing: border-box; border-radius: 2px }
.lbase { position: absolute; box-sizing: border-box; border-radius: 14px; border: 3px solid #cfd9e8; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px }
.lbase.b0 { border-color: #0b1f3a } .lbase.b1 { border-color: #e8b341 }
.lbase.b2 { border-color: #16a34a } .lbase.b3 { border-color: #dc2626 }
.lbasein { position: absolute; left: 18%; top: 18%; width: 64%; height: 64%; border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(15,23,42,.12) }
.lbase .lbl { position: absolute; bottom: 4px; left: 12px; right: 12px; text-align: center; font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(255,255,255,.82); border-radius: 6px; padding: 1px 3px }
.lcore { position: absolute; box-sizing: border-box; background: #fdf6e3; box-shadow: inset 0 0 0 2px #e8b341; border-radius: 8px }
.lcore span { position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font-size: 11px; font-weight: 800; color: #a9761a; line-height: 1.15; background: rgba(253,246,227,.94); border-radius: 0 0 6px 6px; z-index: 5 }
.ltok { position: absolute; width: 9%; height: 9%; margin: -4.5% 0 0 -4.5%; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(15,23,42,.35); transition: left .35s cubic-bezier(.3,.1,.2,1), top .35s cubic-bezier(.3,.1,.2,1); display: flex; align-items: center; justify-content: center; font-size: 9px; color: #fff; font-weight: 700; z-index: 3 }
.ltok.mine { outline: 2px solid rgba(15,23,42,.65); outline-offset: 1px }
.ltok.pick { animation: lpulse 1s infinite; cursor: pointer; z-index: 4 }
@keyframes lpulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.25) } }
.ltok.done { opacity: .95 }

/* الكتابة والمقال */
.gt.wr { grid-column: 1 / -1; min-height: 100px }
.wr-item { background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:12px 14px; margin-bottom:10px }
.wr-item .wr-prompt { font-size:15px; font-weight:700; line-height:1.75; color:#0b1f3a; white-space:pre-wrap }
.wr-item .wr-tag { display:inline-block; font-size:11px; font-weight:700; color:#a9761a; background:#fdf6e3; border:1px solid #f0d9a8; border-radius:8px; padding:1px 8px; margin-bottom:8px }
.wr-item .wr-btn { margin-top:10px; display:inline-block; background:#0b1f3a; color:#fff; border:0; border-radius:10px; padding:9px 16px; font-size:14px; font-weight:700 }
.wr-item .wr-ans { display:none; margin-top:10px; border-top:1px dashed #e2e8f0; padding-top:10px }
.wr-item.open .wr-ans { display:block }
.wr-item .wr-h { font-size:12px; font-weight:800; color:#15803d; margin-bottom:6px }
.wr-item .wr-body { font-size:14px; line-height:1.85; color:#1e293b; white-space:pre-wrap }
.wr-item .wr-body ol { margin:0; padding-inline-start:20px }
.wr-item .wr-body li { margin-bottom:6px }
.wr-empty { text-align:center; color:#64748b; padding:26px 10px; line-height:1.9 }

.wr-item .wr-title { font-size:14px; font-weight:800; color:#0b1f3a; margin:4px 0 6px; line-height:1.5 }
.wr-item .wr-tag.unit { color:#0b1f3a; background:#eef2f9; border-color:#dbe3ee }
.wr-item .wr-tag.page { color:#64748b; background:#f1f5f9; border-color:#e2e8f0 }
.wr-item.ref { background:#f8fafc; border-color:#dbe3ee }
.wr-item.plain { background:#fbfcfe }
.wr-item .wr-en { font-size:14px; line-height:1.85; color:#1e293b; white-space:pre-wrap; margin-bottom:8px }
.wr-item .wr-ar { font-size:13.5px; line-height:1.95; color:#475569; white-space:pre-wrap; background:#f8fafc; border-radius:10px; padding:8px 10px; margin-bottom:6px }
.wr-item .wr-note { font-size:12px; line-height:1.8; color:#64748b; margin-top:8px; border-top:1px dashed #e2e8f0; padding-top:8px }
.wr-item .wr-qa { margin-bottom:10px }
.wr-item .wr-q { font-size:13.5px; font-weight:700; color:#0b1f3a; line-height:1.7 }
.wr-item .wr-a { font-size:13.5px; color:#15803d; line-height:1.7; margin-top:2px }

.wr-item .wr-warn { display:block; background:#fff7e6; border:1.5px solid #f0b429; border-radius:12px; padding:10px 12px; margin:0 0 12px; font-size:13.5px; line-height:1.85; color:#8a4b00; font-weight:600 }
.wr-item .wr-warn .wr-warn-lb { display:inline-block; background:#f0b429; color:#fff; font-size:11.5px; font-weight:800; border-radius:8px; padding:1px 8px; margin-left:6px; vertical-align:1px }

.qt{display:flex;align-items:center;gap:9px;margin:0 0 12px;direction:rtl}
.qt>b{font-size:14px;font-weight:900;color:#0b1f3a;min-width:30px;text-align:center;font-variant-numeric:tabular-nums}
.qt>span{flex:1;height:9px;background:#e2e8f0;border-radius:99px;overflow:hidden;display:block}
.qt>span>i{display:block;height:100%;width:100%;background:#16a34a;border-radius:99px;transition:width .95s linear}
.qt.low>b{color:#dc2626}
.qt.low>span>i{background:#dc2626}
.qcard .qt>b{color:#fff}
.qcard .qt>span{background:rgba(255,255,255,.25)}
.msg.on{color:#b45309}
.qcard{flex-wrap:wrap}
.qcard .qt{flex:0 0 100%}

/* ---------- login tabs ---------- */
.ltabs{display:flex;gap:8px;margin:6px 0 14px}
.ltab{flex:1;padding:10px 12px;border-radius:12px;border:1.5px solid #cfd9e8;background:#fff;font:inherit;font-weight:700;color:#0b1f3a;cursor:pointer}
.ltab.on{background:#0b1f3a;color:#fff;border-color:#0b1f3a}

/* ---------- من سيربح المليون: the show look ---------- */
.milscreen{background:radial-gradient(120% 90% at 50% 0%,#123a6b 0%,#0a1f45 45%,#050d22 100%)}
.milwrap{max-width:980px;margin:0 auto;padding:10px 10px 26px;color:#eaf2ff}
.miltop{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 4px 12px}
.millogo{font-weight:900;font-size:19px;letter-spacing:.4px;color:#f6d27a;text-shadow:0 2px 14px rgba(246,210,122,.45)}
.milturn{font-weight:700;font-size:14px;color:#bfd4f5}
.milbody{display:flex;gap:14px;align-items:stretch}
.milstage{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:14px;background:radial-gradient(90% 120% at 50% 0%,#16406f 0%,#0b2450 60%,#071735 100%);border:1px solid #2a5590;border-radius:20px;padding:18px;box-shadow:inset 0 0 60px rgba(10,40,90,.9),0 10px 30px rgba(0,0,0,.35)}
.milq{background:linear-gradient(180deg,#123a6b,#0c2a52);border:2px solid #3f6fae;border-radius:16px;padding:18px;font-size:19px;font-weight:800;line-height:1.5;min-height:74px;display:flex;align-items:center;justify-content:center;text-align:center;box-shadow:inset 0 0 24px rgba(80,140,220,.25)}
.milhex{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:4px}
.hex{position:relative;display:flex;align-items:center;gap:10px;min-height:64px;padding:10px 22px;border:0;background:linear-gradient(180deg,#1b4b86,#0e2f5c);color:#fff;font:inherit;font-weight:800;font-size:16px;cursor:pointer;text-align:right;clip-path:polygon(7% 0,93% 0,100% 50%,93% 100%,7% 100%,0 50%);box-shadow:inset 0 0 0 2px rgba(120,170,235,.55);transition:filter .15s,transform .12s}
.hex .hl{flex:none;width:30px;height:30px;border-radius:50%;background:#f6d27a;color:#0b1f3a;font-weight:900;display:flex;align-items:center;justify-content:center}
.hex .ht{flex:1 1 auto}
.hex:hover:not(:disabled){filter:brightness(1.18)}
.hex:disabled{opacity:.55;cursor:default}
.hex.dead{opacity:.12}
.hex.suggested{box-shadow:inset 0 0 0 3px #f6d27a}
.hex.ok,.hex.opt.ok{background:linear-gradient(180deg,#1f8a4c,#136236);box-shadow:inset 0 0 0 3px #7ef2a8;opacity:1}
.hex.bad{background:linear-gradient(180deg,#8a1f1f,#5c1313)}
.hex .aud{position:absolute;left:6px;bottom:4px;width:26px;background:rgba(246,210,122,.85);border-radius:3px 3px 0 0}
.hex .audn{position:absolute;left:6px;top:2px;font-size:10px;color:#f6d27a;font-style:normal}
.millife{display:flex;gap:10px;justify-content:center;margin-top:6px}
.life{width:56px;height:56px;border-radius:50%;border:2px solid #6f9fd6;background:radial-gradient(circle at 40% 35%,#2a5c98,#0d2a52);color:#eaf2ff;font:inherit;font-weight:900;font-size:15px;cursor:pointer;box-shadow:0 4px 14px rgba(0,0,0,.35)}
.life:hover:not(:disabled){filter:brightness(1.2)}
.life.used{opacity:.28;filter:grayscale(1);cursor:default;border-color:#3b4b62}
.milladder{flex:none;width:150px;list-style:none;margin:0;padding:8px;border-radius:16px;background:rgba(4,12,30,.55);border:1px solid #23456f;display:flex;flex-direction:column-reverse;justify-content:space-between;gap:1px}
.milladder li{display:flex;justify-content:space-between;align-items:center;gap:6px;padding:3px 8px;border-radius:8px;font-size:12px;color:#9dbbe0}
.milladder li b{color:#e8f1ff;font-size:13px}
.milladder li.past{color:#5f7fa6}
.milladder li.on{background:linear-gradient(90deg,#f6d27a,#e8b341);color:#0b1f3a}
.milladder li.on b{color:#0b1f3a}
.milscores{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.milout{margin-top:12px}
@media (max-width:720px){
  .milbody{flex-direction:column}
  .milladder{width:auto;flex-direction:row;overflow:auto;gap:4px}
  .milladder li{flex-direction:column;min-width:44px}
  .milhex{grid-template-columns:1fr}
}

/* ---------- 3D dice ---------- */
.dice3d{width:58px;height:58px;perspective:520px;background:none!important;border:0!important;box-shadow:none!important;display:block!important;padding:0!important}
.dice3d .cube{position:relative;width:58px;height:58px;transform-style:preserve-3d;transition:transform 1.05s cubic-bezier(.2,.85,.25,1)}
.dice3d .face{position:absolute;inset:0;background:linear-gradient(160deg,#ffffff,#e8eef8);border-radius:12px;border:2px solid #cfd9e8;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);padding:7px;gap:2px;backface-visibility:hidden;box-shadow:0 3px 10px rgba(11,31,58,.25)}
.dice3d .face i{background:#0b1f3a;border-radius:50%;width:100%;height:100%}
.dice3d .f1{transform:translateZ(29px)}
.dice3d .f6{transform:rotateY(180deg) translateZ(29px)}
.dice3d .f3{transform:rotateY(90deg) translateZ(29px)}
.dice3d .f4{transform:rotateY(-90deg) translateZ(29px)}
.dice3d .f2{transform:rotateX(90deg) translateZ(29px)}
.dice3d .f5{transform:rotateX(-90deg) translateZ(29px)}
.dice3d.rolling{filter:drop-shadow(0 8px 16px rgba(11,31,58,.35))}

/* ---------- ludo pawns ---------- */
.ltok{position:absolute;width:5.6%;height:5.6%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;border-radius:50%;background:transparent!important;z-index:6;transition:left .14s linear,top .14s linear}
.ltok svg{width:100%;height:100%;display:block;filter:drop-shadow(0 2px 3px rgba(0,0,0,.35))}
.ltok.mine{outline:2px solid rgba(246,210,122,.9);outline-offset:1px;border-radius:50%}
.ltok.pick{cursor:pointer;animation:pawnbob .9s ease-in-out infinite}
.ltok.done{opacity:.85}
.ltok.moving{z-index:9;transition:left .13s linear,top .13s linear}
@keyframes pawnbob{0%,100%{transform:translate(-50%,-50%) scale(1)}50%{transform:translate(-50%,-58%) scale(1.12)}}
