:root{
  --bg:#080d1c; --bg2:#0e1730; --card:rgba(255,255,255,.055);
  --border:rgba(255,255,255,.10); --border2:rgba(255,255,255,.18);
  --text:#eef3ff; --muted:#8f9bbd;
  --accent:#ff8a1f; --accent2:#ffd166; --grad:linear-gradient(135deg,#ff8a1f,#ffd166);
  --cyan:#3ddcff; --green:#4ade80; --red:#ff5d5d; --violet:#8b5cf6;
  --r:14px; --rl:22px; --sh:0 8px 30px rgba(0,0,0,.45);
  font-family:"Tajawal","Cairo","Segoe UI",Tahoma,system-ui,sans-serif;
  color:var(--text); background:var(--bg); -webkit-tap-highlight-color:transparent;
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-user-select:none;user-select:none}
html,body{height:100%;overflow:hidden;overscroll-behavior:none}
body{background:radial-gradient(ellipse at 50% -10%,#1b2a55 0%,#080d1c 55%);}
#app{position:fixed;inset:0}
#gl{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
.screen{position:absolute;inset:0;display:none;flex-direction:column;z-index:5}
.screen.active{display:flex}
.muted{color:var(--muted);font-size:.72rem}
.row{display:flex;align-items:center;gap:.4rem}
.glow{position:absolute;inset:-30% -20% auto -20%;height:60vh;pointer-events:none;
  background:radial-gradient(ellipse at 50% 0%,rgba(255,138,31,.20),transparent 62%)}
.pad{padding:.85rem}
h3{font-size:.78rem;color:var(--muted);letter-spacing:.08em;margin-bottom:.5rem;font-weight:700}
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--r);
  backdrop-filter:blur(10px);box-shadow:var(--sh)}
.tag{font-size:.62rem;padding:.15rem .5rem;border-radius:99px;background:rgba(255,138,31,.16);color:var(--accent2)}

/* ============ LOBBY ============ */
.topbar{display:flex;justify-content:space-between;align-items:center;padding:.7rem 1rem;
  background:linear-gradient(180deg,rgba(8,13,28,.92),rgba(8,13,28,.35));backdrop-filter:blur(12px);z-index:3}
.prof{display:flex;align-items:center;gap:.6rem}
.avatar{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-weight:800;
  background:var(--grad);color:#3a1d00;box-shadow:0 0 0 2px rgba(255,209,102,.35)}
.prof-txt{display:flex;flex-direction:column;gap:.15rem;font-size:.8rem}
.lvlbar{width:120px;height:5px;border-radius:99px;background:rgba(255,255,255,.12);overflow:hidden}
.lvlbar i{display:block;height:100%;width:20%;background:var(--cyan)}
.curr{display:flex;gap:.4rem}
.coin{font-size:.75rem;font-weight:700;padding:.3rem .6rem .3rem 1.4rem;border-radius:99px;position:relative;
  background:rgba(255,255,255,.07);border:1px solid var(--border)}
.coin::before{content:"";position:absolute;inset-inline-start:.45rem;top:.42rem;width:9px;height:9px;border-radius:50%}
.coin.gold::before{background:var(--accent2)}
.coin.gem::before{background:var(--cyan)}
.lobby-main{flex:1;display:grid;grid-template-columns:1.15fr .85fr;gap:.7rem;padding:.7rem 1rem 0;min-height:0}
.showcase{position:relative;display:flex;flex-direction:column;justify-content:flex-end;min-height:0}
#hero{width:100%;height:100%;object-fit:contain}
.showcase-info{position:absolute;bottom:0;inset-inline-start:0;padding:.8rem 1rem;text-shadow:0 2px 12px #000}
.showcase-info h2{font-size:1.6rem;letter-spacing:-.02em}
.showcase-info p{font-size:.78rem;color:var(--accent2)}
.stars{font-size:.8rem;color:var(--accent2);letter-spacing:.15em}
.side{display:flex;flex-direction:column;gap:.5rem;overflow-y:auto;padding-bottom:.3rem}
.chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-bottom:.4rem}
.chip{font-size:.72rem;padding:.32rem .6rem;border-radius:99px;border:1px solid var(--border);
  background:rgba(255,255,255,.04);cursor:pointer;transition:.15s}
.chip:hover{background:rgba(255,255,255,.1)}
.chip.on{background:var(--grad);color:#3a1d00;font-weight:700;border-color:transparent}
.mini-list{display:flex;gap:.4rem;flex-wrap:wrap}
.mini{display:flex;flex-direction:column;align-items:center;gap:.2rem;font-size:.62rem;
  padding:.35rem .45rem;border-radius:10px;border:1px solid var(--border);cursor:pointer;width:58px}
.mini.on{border-color:var(--accent);background:rgba(255,138,31,.12)}
.mini i{width:22px;height:22px;border-radius:7px;display:block}
.lobby-foot{display:flex;align-items:center;gap:1rem;padding:.7rem 1rem calc(.8rem + env(safe-area-inset-bottom))}
.dock{display:flex;gap:.4rem;flex:1;overflow-x:auto}
.dock button{display:flex;flex-direction:column;align-items:center;gap:.2rem;gap:.25rem;font-size:.66rem;
  padding:.5rem .7rem;border-radius:var(--r);border:1px solid var(--border);background:var(--card);color:var(--text)}
.dock button svg{width:20px;height:20px;stroke:var(--accent2)}
.play{position:relative;border:none;cursor:pointer;padding:.75rem 2.1rem;border-radius:99px;
  background:var(--grad);color:#3a1d00;font-weight:900;font-size:1.15rem;letter-spacing:.05em;
  box-shadow:0 10px 34px rgba(255,138,31,.42);display:flex;flex-direction:column;align-items:center;line-height:1.05}
.play small{font-size:.6rem;font-weight:700;opacity:.8}
.play:active{transform:scale(.97)}

/* ============ HUD ============ */
#hud{pointer-events:none}
#hud *{pointer-events:auto}
.hud-top{position:absolute;top:8px;inset-inline-start:8px;display:flex;gap:.4rem;align-items:flex-start}
#mini{width:132px;height:132px;border-radius:12px;border:1px solid var(--border2);
  background:rgba(8,13,28,.55);backdrop-filter:blur(6px)}
.stat-pill{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:52px;
  padding:.3rem .5rem;border-radius:12px;background:rgba(8,13,28,.55);border:1px solid var(--border);
  backdrop-filter:blur(6px);font-size:.6rem;color:var(--muted)}
.stat-pill b{font-size:1rem;color:var(--text)}
.stat-pill.zone b{color:var(--accent2)}
#killfeed{position:absolute;top:150px;inset-inline-start:8px;display:flex;flex-direction:column;gap:.25rem;max-width:60vw}
.kf{font-size:.68rem;padding:.25rem .5rem;border-radius:8px;background:rgba(8,13,28,.65);border:1px solid var(--border)}
.kf b{color:var(--accent2)}
#announce{position:absolute;top:34%;inset-inline:0;text-align:center;font-size:1.35rem;font-weight:800;
  color:var(--accent2);text-shadow:0 3px 18px #000;opacity:0;transition:opacity .3s}
#announce.show{opacity:1}
#hitmarker{position:absolute;inset:0;border:0 solid rgba(255,80,80,0);transition:border-width .1s}
#hitmarker.hit{border-width:3px;border-color:rgba(255,80,80,.5)}
.stick{position:absolute;bottom:calc(16px + env(safe-area-inset-bottom));inset-inline-start:16px;
  width:118px;height:118px;border-radius:50%;background:rgba(255,255,255,.06);
  border:2px solid rgba(255,255,255,.16);backdrop-filter:blur(4px)}
.stick.right{inset-inline-start:auto;inset-inline-end:16px;bottom:calc(140px + env(safe-area-inset-bottom))}
.stick i{position:absolute;left:50%;top:50%;width:52px;height:52px;margin:-26px 0 0 -26px;border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#fff6e6,#ffb648);box-shadow:0 6px 18px rgba(0,0,0,.4)}
.pad-right{position:absolute;inset-inline-end:14px;bottom:calc(16px + env(safe-area-inset-bottom));
  display:grid;grid-template-columns:repeat(3,1fr);gap:.4rem;width:min(62vw,270px)}
.pad-left{position:absolute;inset-inline-start:14px;bottom:calc(146px + env(safe-area-inset-bottom));
  display:flex;flex-direction:column;gap:.35rem}
.gbtn{border:1px solid var(--border2);background:rgba(8,13,28,.5);backdrop-filter:blur(5px);color:var(--text);
  border-radius:50%;aspect-ratio:1;font-size:.68rem;font-weight:700;display:grid;place-items:center}
.gbtn:active{background:rgba(255,138,31,.35)}
.gbtn.fire{grid-column:span 2;border-radius:999px;aspect-ratio:auto;font-size:.95rem;
  background:linear-gradient(135deg,rgba(255,93,93,.85),rgba(255,138,31,.85));border-color:transparent;color:#2a0d00}
.gbtn.gloo{background:linear-gradient(135deg,rgba(61,220,255,.8),rgba(139,92,246,.8));color:#04121c;border-color:transparent}
.gbtn.sm{width:46px;font-size:.58rem}
.hud-bottom{position:absolute;bottom:calc(6px + env(safe-area-inset-bottom));inset-inline:0;display:flex;
  align-items:flex-end;justify-content:center;gap:.6rem;padding:0 .5rem}

.vitals{display:flex;flex-direction:column;gap:.25rem;width:150px}
.bar{position:relative;height:13px;border-radius:99px;background:rgba(8,13,28,.7);border:1px solid var(--border);
  overflow:hidden;font-size:.6rem}
.bar i{position:absolute;inset:0;width:100%;transform-origin:right center;transition:transform .18s}
.bar.hp i{background:linear-gradient(90deg,#4ade80,#a3e635)}
.bar.ar i{background:linear-gradient(90deg,#3ddcff,#8b5cf6)}
.bar span{position:absolute;inset:0;display:grid;place-items:center;font-weight:700;text-shadow:0 1px 3px #000}
.wpn{display:flex;flex-direction:column;align-items:center;min-width:130px;font-size:.7rem;color:var(--muted)}
.wpn b{font-size:.85rem;color:var(--text)}
.wpn .ammo b{font-size:1.15rem;color:var(--accent2)}
.attach{font-size:.6rem;color:var(--cyan)}
.quick{display:flex;gap:.3rem;position:absolute;inset-inline-end:calc(min(62vw,270px) + 22px);bottom:.3rem}
.qslot{width:38px;height:38px;border-radius:10px;border:1px solid var(--border);background:rgba(8,13,28,.6);
  display:grid;place-items:center;font-size:.6rem;position:relative}
.qslot b{position:absolute;bottom:-2px;inset-inline-end:0;font-size:.6rem;color:var(--accent2)}
/* ============ RESULTS ============ */
#results{background:rgba(4,7,16,.82);backdrop-filter:blur(8px);align-items:center;justify-content:center}
.res-card{width:min(92vw,460px);background:linear-gradient(180deg,rgba(20,30,60,.95),rgba(8,13,28,.98));
  border:1px solid var(--border2);border-radius:var(--rl);padding:1.2rem;text-align:center;box-shadow:var(--sh)}
.banner{font-size:2.1rem;font-weight:900;letter-spacing:.06em;background:var(--grad);
  -webkit-background-clip:text;background-clip:text;color:transparent;animation:pop .5s ease}
.banner.lose{background:linear-gradient(135deg,#8f9bbd,#5b6684);-webkit-background-clip:text;background-clip:text}
@keyframes pop{from{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}
.res-title{font-size:.95rem;color:var(--muted);margin-bottom:.8rem}
.res-grid{display:grid;grid-template-columns:1fr 1fr;gap:.4rem;margin-bottom:.7rem}
.res-grid div{background:rgba(255,255,255,.05);border:1px solid var(--border);border-radius:10px;padding:.5rem;font-size:.7rem}
.res-grid b{display:block;font-size:1.1rem;color:var(--accent2)}
.res-rew{font-size:.78rem;color:var(--green);margin-bottom:.8rem}
.res-btns{display:flex;gap:.5rem}
.btn{flex:1;padding:.7rem;border-radius:99px;border:none;font-weight:800;font-size:.9rem;cursor:pointer}
.btn.primary{background:var(--grad);color:#3a1d00}
.btn.ghost{background:transparent;border:1.5px solid var(--border2);color:var(--text)}
.panel{position:fixed;inset:0;z-index:40;display:none;align-items:flex-end;justify-content:center;
  background:rgba(4,7,16,.6);backdrop-filter:blur(4px)}
.panel.open{display:flex}
.panel-in{width:min(100%,560px);max-height:86vh;display:flex;flex-direction:column;
  background:linear-gradient(180deg,rgba(18,27,54,.98),rgba(8,13,28,.99));
  border:1px solid var(--border2);border-radius:var(--rl) var(--rl) 0 0;box-shadow:var(--sh)}
.panel-top{display:flex;align-items:center;justify-content:space-between;padding:.8rem 1rem;
  border-bottom:1px solid var(--border)}
.panel-top h2{font-size:1rem}
.x{background:none;border:none;color:var(--muted);font-size:1.6rem;line-height:1;cursor:pointer}
.panel-body{padding:.8rem 1rem 1.4rem;overflow-y:auto;display:flex;flex-direction:column;gap:.6rem}
.shop-grid{display:grid;grid-template-columns:1fr 1fr;gap:.5rem}
.item{background:rgba(255,255,255,.045);border:1px solid var(--border);border-radius:12px;padding:.6rem;
  display:flex;flex-direction:column;gap:.35rem;font-size:.72rem}
.item .thumb{height:56px;border-radius:9px;background:linear-gradient(135deg,rgba(255,138,31,.25),rgba(61,220,255,.18));
  display:grid;place-items:center;font-weight:900;font-size:1.05rem;color:var(--accent2)}
.item .buy{padding:.4rem;border-radius:99px;border:none;background:var(--grad);color:#3a1d00;font-weight:800;font-size:.7rem}
.item .buy.owned{background:rgba(74,222,128,.2);color:var(--green)}
.banner-tip{position:absolute;top:16%;inset-inline:0;text-align:center;font-size:1rem;font-weight:800;
  color:#fff;text-shadow:0 2px 14px #000;opacity:0;transition:opacity .3s;pointer-events:none;z-index:60}
.banner-tip.show{opacity:1}
#toasts{position:fixed;bottom:calc(1rem + env(safe-area-inset-bottom));inset-inline-start:1rem;z-index:70;
  display:flex;flex-direction:column;gap:.4rem}
.toast{padding:.5rem .9rem;border-radius:10px;font-size:.78rem;background:rgba(8,13,28,.9);
  border:1px solid var(--border2);animation:fadeUp .25s ease}
.toast.ok{border-color:rgba(74,222,128,.5)}
.toast.bad{border-color:rgba(255,93,93,.5)}
@keyframes fadeUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.loading{align-items:center;justify-content:center;gap:.8rem;background:var(--bg);font-size:.9rem;z-index:80}
.spin{width:34px;height:34px;border-radius:50%;border:3px solid rgba(255,255,255,.15);border-top-color:var(--accent);
  animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.wheel{width:210px;height:210px;border-radius:50%;margin:0 auto;position:relative;
  background:conic-gradient(#ff8a1f 0 45deg,#3ddcff 45deg 90deg,#8b5cf6 90deg 135deg,#4ade80 135deg 180deg,
  #ffd166 180deg 225deg,#ff5d5d 225deg 270deg,#3ddcff 270deg 315deg,#8b5cf6 315deg 360deg);
  border:4px solid rgba(255,255,255,.25);transition:transform 2.6s cubic-bezier(.18,.9,.12,1)}
.wheel::after{content:"";position:absolute;inset:38%;border-radius:50%;background:#0b1020;border:2px solid var(--border2)}
.pointer{width:0;height:0;margin:0 auto -14px;border-inline:12px solid transparent;border-top:20px solid var(--accent2)}

/* ============ RESPONSIVE ============ */
@media (max-width:720px){
  .lobby-main{grid-template-columns:1fr;grid-template-rows:auto 1fr;padding:.5rem .6rem 0}
  .showcase{height:34vh}
  .showcase-info h2{font-size:1.2rem}
  .side{flex-direction:row;overflow-x:auto;gap:.4rem}
  .side .card{min-width:150px}
  .lvlbar{width:80px}
  .stick{width:100px;height:100px}
  .stick.right{bottom:calc(126px + env(safe-area-inset-bottom))}
  .gbtn.sm{width:42px}
  .vitals{width:112px}
  .quick{inset-inline-end:calc(min(62vw,270px) + 12px)}
}
@media (orientation:landscape) and (max-height:520px){
  .stick{bottom:calc(10px + env(safe-area-inset-bottom))}
  .stick.right{bottom:calc(10px + env(safe-area-inset-bottom));inset-inline-end:auto;inset-inline-start:auto;left:50%;margin-left:-50px}
  .pad-right{bottom:calc(10px + env(safe-area-inset-bottom))}
  .hud-top{transform:scale(.88);transform-origin:top right}
}
.dock button.active{border-color:var(--accent);background:rgba(255,138,31,.14)}
.sec-title{font-size:.75rem;color:var(--muted);margin:.2rem 0}
.license{font-size:.62rem;color:var(--muted);text-align:center;padding-bottom:.4rem}
