
      :root{
        color-scheme: dark;
        --amber:#ffb454;
        --amber-dim:#c9852f;
        --ink:#eef2e6;
        --ink-dim:#aebba6;
        --panel:rgba(12,16,11,.88);
        --line:rgba(255,180,84,.35);
        --red:#ff5347;
        --green:#8fd45a;
      }
      *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
      html,body{ height:100%; height:100dvh; }
      body{
        margin:0; overflow:hidden; background:#0b0e09; color:var(--ink);
        font-family:"Avenir Next","Segoe UI",system-ui,-apple-system,sans-serif;
        user-select:none; -webkit-user-select:none; touch-action:none;
      }
      #gl{ position:fixed; inset:0; width:100%; height:100%; height:100dvh; display:block; }

      /* ---------- HUD ---------- */
      #hud{ position:fixed; inset:0; pointer-events:none; opacity:0; transition:opacity .25s; }
      #hud.on{ opacity:1; }

      #crosshair{ position:absolute; left:50%; top:50%; width:26px; height:26px; transform:translate(-50%,-50%); }
      #crosshair .ch{ position:absolute; background:rgba(240,248,235,.92); box-shadow:0 0 3px rgba(0,0,0,.8); }
      #crosshair .t{ left:12px; top:0; width:2px; height:8px; }
      #crosshair .b{ left:12px; bottom:0; width:2px; height:8px; }
      #crosshair .l{ left:0; top:12px; width:8px; height:2px; }
      #crosshair .r{ right:0; top:12px; width:8px; height:2px; }
      #crosshair .dot{ left:12px; top:12px; width:2px; height:2px; }
      #hitmarker{ position:absolute; left:50%; top:50%; width:30px; height:30px; transform:translate(-50%,-50%) rotate(45deg); opacity:0; }
      #hitmarker i{ position:absolute; background:#fff; box-shadow:0 0 4px rgba(0,0,0,.9); }
      #hitmarker i:nth-child(1){ left:3px; top:3px; width:8px; height:2px; }
      #hitmarker i:nth-child(2){ right:3px; top:3px; width:8px; height:2px; }
      #hitmarker i:nth-child(3){ left:3px; bottom:3px; width:8px; height:2px; }
      #hitmarker i:nth-child(4){ right:3px; bottom:3px; width:8px; height:2px; }
      #hitmarker.show{ opacity:1; }
      #hitmarker.kill i{ background:var(--red); }

      #scoreboard{
        position:absolute; top:calc(10px + env(safe-area-inset-top)); left:50%; transform:translateX(-50%);
        display:flex; flex-direction:column; align-items:center; gap:3px; background:var(--panel);
        border:1px solid var(--line); padding:7px 18px 8px; border-radius:6px;
      }
      #scoreboard .sbrow{ display:flex; align-items:center; gap:14px; }
      #seriesLine{ font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-dim); white-space:nowrap; }
      #seriesLine b{ font-variant-numeric:tabular-nums; }
      #seriesLine b.you{ color:var(--green); }
      #seriesLine b.bot{ color:var(--red); }
      #scoreboard .lab{ font-size:11px; letter-spacing:.18em; color:var(--ink-dim); text-transform:uppercase; text-align:center; }
      #scoreboard .num{ font-size:30px; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; text-align:center; }
      #scoreboard .you{ color:var(--green); }
      #scoreboard .bot{ color:var(--red); }
      #scoreboard .dash{ font-size:22px; color:var(--ink-dim); font-weight:300; }
      #botHpWrap{ position:absolute; top:calc(100px + env(safe-area-inset-top)); left:50%; transform:translateX(-50%); width:180px; text-align:center; }
      #botHpWrap .lab{ font-size:10px; letter-spacing:.22em; color:rgba(255,120,110,.85); text-transform:uppercase; margin-bottom:3px; }
      #botHpBar{ height:5px; background:rgba(255,255,255,.14); border-radius:3px; overflow:hidden; }
      #botHpFill{ height:100%; width:100%; background:var(--red); transition:width .15s; }

      #healthWrap{ position:absolute; left:calc(18px + env(safe-area-inset-left)); bottom:calc(18px + env(safe-area-inset-bottom)); width:min(240px,38vw); }
      #healthWrap .lab{ font-size:11px; letter-spacing:.2em; color:var(--ink-dim); text-transform:uppercase; display:flex; justify-content:space-between; margin-bottom:5px; }
      #healthNum{ color:var(--ink); font-weight:700; letter-spacing:0; font-size:13px; }
      #healthBar{ height:14px; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.22); border-radius:4px; overflow:hidden; }
      #healthFill{ height:100%; width:100%; background:linear-gradient(90deg,#6fbf3f,#9ede66); transition:width .18s; }
      #healthFill.low{ background:linear-gradient(90deg,#c93a2e,#f0664f); }

      #ammoWrap{ position:absolute; right:calc(18px + env(safe-area-inset-right)); bottom:calc(18px + env(safe-area-inset-bottom)); text-align:right; }
      #ammoNum{ font-size:44px; font-weight:800; line-height:.95; font-variant-numeric:tabular-nums; text-shadow:0 2px 10px rgba(0,0,0,.6); }
      #ammoNum small{ font-size:20px; color:var(--ink-dim); font-weight:600; }
      #ammoLab{ font-size:11px; letter-spacing:.22em; color:var(--ink-dim); text-transform:uppercase; margin-top:2px; }
      #reloadHint{ font-size:12px; color:var(--amber); letter-spacing:.08em; margin-top:4px; height:15px; font-weight:700; }

      #banner{
        position:absolute; left:50%; top:34%; transform:translate(-50%,-50%) scale(.94);
        font-size:clamp(30px,6.5vw,58px); font-weight:900; letter-spacing:.02em; text-align:center;
        text-shadow:0 3px 22px rgba(0,0,0,.85); opacity:0; transition:opacity .18s, transform .18s; white-space:nowrap;
      }
      #banner.show{ opacity:1; transform:translate(-50%,-50%) scale(1); }
      #banner.win{ color:var(--green); }
      #banner.lose{ color:var(--red); }
      #banner.fight{ color:var(--amber); }

      #vignette{ position:fixed; inset:0; pointer-events:none; opacity:0;
        box-shadow:inset 0 0 130px 40px rgba(215,20,10,.75); }
      #hitDir{ position:absolute; left:50%; top:50%; width:120px; height:120px; margin:-60px 0 0 -60px; opacity:0; }
      #hitDir .wedge{ position:absolute; left:50%; top:2px; width:44px; height:16px; margin-left:-22px;
        background:radial-gradient(ellipse at 50% 100%, rgba(255,60,45,.95), rgba(255,60,45,0) 70%); }

      #roundMsg{ position:absolute; left:50%; top:58%; transform:translateX(-50%); font-size:15px; letter-spacing:.14em;
        color:var(--ink-dim); text-transform:uppercase; opacity:0; transition:opacity .2s; }
      #roundMsg.show{ opacity:1; }

      /* ---------- Screens ---------- */
      .screen{
        position:fixed; inset:0; height:100%; height:100dvh; display:flex; padding:20px;
        background:radial-gradient(120% 90% at 50% 20%, rgba(38,48,32,.55), rgba(5,7,5,.92) 75%);
        z-index:10; text-align:center;
      }
      .screen.hidden{ display:none; }
      /* margin:auto centers the card when it fits, and collapses to 0 when the
         card is taller than the screen so its top stays reachable by scrolling
         (flex align/justify centering would push the top off-screen for good). */
      .card{ max-width:560px; width:100%; margin:auto; }
      .kicker{ font-size:12px; letter-spacing:.34em; color:var(--amber); text-transform:uppercase; margin-bottom:10px; font-weight:700; }
      h1{ font-size:clamp(38px,8vw,64px); margin:0 0 6px; font-weight:900; letter-spacing:.01em; line-height:1.02; }
      h1 .thin{ color:var(--ink-dim); font-weight:300; }
      .sub{ color:var(--ink-dim); font-size:16px; margin:0 auto 22px; max-width:44ch; line-height:1.5; }
      .controls{
        display:grid; grid-template-columns:1fr 1fr; gap:8px 22px; text-align:left; margin:0 auto 26px; max-width:440px;
        background:var(--panel); border:1px solid rgba(255,255,255,.09); border-radius:8px; padding:16px 20px;
      }
      .controls div{ font-size:14px; color:var(--ink-dim); }
      .controls b{ color:var(--ink); font-weight:700; background:rgba(255,255,255,.09); border:1px solid rgba(255,255,255,.16);
        border-bottom-width:2px; border-radius:4px; padding:0 6px; font-size:12.5px; margin-right:7px; font-family:inherit; }
      .bigbtn{
        pointer-events:auto; cursor:pointer; border:0; border-radius:8px; padding:16px 44px;
        background:linear-gradient(180deg,#ffb454,#e08f26); color:#221503; font-size:19px; font-weight:900;
        letter-spacing:.06em; text-transform:uppercase; box-shadow:0 6px 24px rgba(255,164,60,.35), inset 0 1px 0 rgba(255,255,255,.5);
        font-family:inherit;
      }
      .bigbtn:active{ transform:translateY(1px); }
      .note{ margin-top:16px; font-size:13px; color:var(--ink-dim); }
      #finalScore{ font-size:clamp(30px,6vw,44px); font-weight:900; margin:4px 0 10px; }
      #finalScore .you{ color:var(--green); } #finalScore .bot{ color:var(--red); }

      /* ---------- Touch controls ---------- */
      #touchUI{ position:fixed; inset:0; pointer-events:none; z-index:5; display:none; }
      body.touch.playing #touchUI{ display:block; }
      #stick{ position:absolute; left:26px; bottom:96px; width:118px; height:118px; border-radius:50%;
        border:2px solid rgba(255,255,255,.25); background:rgba(255,255,255,.06); pointer-events:auto; }
      #stickKnob{ position:absolute; left:50%; top:50%; width:52px; height:52px; border-radius:50%;
        background:rgba(255,255,255,.28); border:2px solid rgba(255,255,255,.4); transform:translate(-50%,-50%); }
      #stick.sprinting{ border-color:var(--amber); background:rgba(255,180,84,.18); box-shadow:0 0 18px rgba(255,180,84,.45); }
      #stick.sprinting #stickKnob{ background:rgba(255,180,84,.55); border-color:var(--amber); }
      #sprintTag{ position:absolute; left:50%; top:-24px; transform:translateX(-50%); font-size:10px; font-weight:900;
        letter-spacing:.18em; color:var(--amber); opacity:0; transition:opacity .15s; pointer-events:none; white-space:nowrap; }
      #stick.sprinting #sprintTag{ opacity:1; }
      .tbtn{ position:absolute; pointer-events:auto; border-radius:50%; border:2px solid rgba(255,255,255,.3);
        background:rgba(20,24,18,.5); color:#fff; font-weight:800; letter-spacing:.05em; font-family:inherit;
        display:flex; align-items:center; justify-content:center; text-align:center; }
      .tbtn:active{ background:rgba(255,180,84,.45); }
      #jumpBtn{ right:140px; bottom:66px; width:62px; height:62px; font-size:12px; }
      #reloadBtn{ right:44px; bottom:206px; width:56px; height:56px; font-size:11px; }
      #pauseBtn{ position:absolute; top:calc(12px + env(safe-area-inset-top)); right:14px; width:44px; height:44px; font-size:17px; border-radius:10px; }
      body:not(.touch) #pauseBtn{ display:none; }
      @media (max-width:560px){
        .controls{ grid-template-columns:1fr; }
        #ammoNum{ font-size:34px; }
        #healthWrap{ bottom:calc(226px + env(safe-area-inset-bottom)); width:34vw; }
        #ammoWrap{ bottom:calc(226px + env(safe-area-inset-bottom)); }
        body.touch #jumpBtn{ right:150px; bottom:172px; }
      }

      /* ---------- Quick slots / chests / loot ---------- */
      #quickbar{
        position:fixed; left:50%; bottom:calc(14px + env(safe-area-inset-bottom)); transform:translateX(-50%);
        display:none; gap:8px; pointer-events:none; z-index:4;
      }
      body.playing #quickbar{ display:flex; }
      body.playing .qslot{ pointer-events:auto; }
      .qslot{
        pointer-events:none; cursor:pointer; min-width:58px; padding:6px 9px 5px; text-align:center;
        background:var(--panel); border:1px solid rgba(255,255,255,.18); border-radius:7px; color:var(--ink-dim);
        font-family:inherit;
      }
      .qslot .qkey{ display:block; font-size:10px; font-weight:800; letter-spacing:.14em; color:var(--amber); text-transform:uppercase; }
      .qslot .qname{ display:block; font-size:13px; font-weight:800; color:var(--ink); margin-top:1px; white-space:nowrap; }
      .qslot .qcount{ display:block; font-size:12px; font-weight:800; color:var(--green); margin-top:1px; }
      .qslot.empty{ opacity:.38; }
      .qslot.sel{ border-color:var(--amber); box-shadow:0 0 0 1px var(--amber), 0 0 14px rgba(255,180,84,.25); }
      .qslot.health .qname{ color:var(--green); }
      #chestPrompt{
        position:absolute; left:50%; bottom:24%; transform:translateX(-50%);
        background:var(--panel); border:1px solid var(--line); border-radius:7px; padding:9px 18px;
        font-size:15px; font-weight:700; letter-spacing:.04em; color:var(--ink); opacity:0; transition:opacity .15s; white-space:nowrap;
      }
      #chestPrompt.show{ opacity:1; }
      #chestPrompt b{ color:#221503; background:var(--amber); border-radius:4px; padding:1px 8px; margin-right:8px; }
      body.touch #chestPrompt{ display:none; }
      #toast{
        position:absolute; left:50%; top:20%; transform:translateX(-50%) translateY(-6px);
        font-size:clamp(18px,3.4vw,26px); font-weight:900; color:var(--amber); text-align:center;
        text-shadow:0 2px 14px rgba(0,0,0,.85); opacity:0; transition:opacity .25s, transform .25s; white-space:nowrap;
      }
      #toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
      #toast small{ display:block; font-size:13px; font-weight:600; color:var(--ink); letter-spacing:.06em; margin-top:3px; white-space:normal; }
      #rotateHint{
        position:absolute; left:50%; top:calc(130px + env(safe-area-inset-top)); transform:translateX(-50%);
        font-size:12.5px; color:var(--ink); background:rgba(12,16,11,.72); border:1px solid rgba(255,255,255,.16);
        padding:6px 14px; border-radius:20px; letter-spacing:.03em; display:none; white-space:nowrap;
      }
      @media (orientation:portrait){
        body.touch #hud.on #rotateHint{ display:block; }
      }
      #rotateHint.gone{ display:none !important; }
      #openBtn{ right:146px; bottom:150px; width:66px; height:66px; font-size:13px; border-color:var(--amber); color:var(--amber); display:none; }
      body.touch.playing #openBtn.show{ display:flex; }

      /* Landscape phones: controls spread to the sides, HUD hugs the top corners */
      @media (orientation:landscape) and (max-height:540px){
        #stick{ left:18px; bottom:14px; width:104px; height:104px; }
        #jumpBtn{ right:120px; bottom:12px; width:56px; height:56px; }
        #reloadBtn{ right:32px; bottom:112px; width:52px; height:52px; }
        #openBtn{ right:126px; bottom:84px; }
        #healthWrap{ left:calc(14px + env(safe-area-inset-left)); bottom:auto; top:calc(10px + env(safe-area-inset-top)); width:150px; }
        #ammoWrap{ right:calc(70px + env(safe-area-inset-right)); bottom:auto; top:calc(8px + env(safe-area-inset-top)); }
        #ammoNum{ font-size:30px; }
        body.touch #quickbar{ bottom:calc(10px + env(safe-area-inset-bottom)); }
        .qslot{ min-width:50px; padding:4px 6px 3px; }
        .qslot .qname{ font-size:11.5px; }
        #scoreboard{ padding:5px 14px 6px; }
        #scoreboard .num{ font-size:24px; }
        #botHpWrap{ top:calc(82px + env(safe-area-inset-top)); }
        #chestPrompt{ bottom:20%; }
      }
      /* ---------- Minimap ---------- */
      #minimap{ position:absolute; top:calc(10px + env(safe-area-inset-top)); left:calc(10px + env(safe-area-inset-left));
        width:140px; height:140px; background:rgba(8,11,8,.72); border:1px solid rgba(255,255,255,.28); border-radius:6px; }
      #labels{ position:absolute; inset:0; overflow:hidden; }
      .nametag{ position:absolute; transform:translate(-50%,-100%); font-size:11px; font-weight:800; letter-spacing:.04em;
        color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.9); white-space:nowrap; pointer-events:none; }
      @media (max-width:560px){ #minimap{ width:104px; height:104px; } }

      /* ---------- Menus: solo + multiplayer + lobby ---------- */
      .screen{ overflow-y:auto; touch-action:pan-y; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
      .hidden{ display:none !important; }
      .menuSec{ background:var(--panel); border:1px solid rgba(255,255,255,.09); border-radius:8px; padding:14px 16px 6px; margin:0 auto 14px; max-width:440px; }
      .menuLab{ font-size:11px; letter-spacing:.22em; text-transform:uppercase; color:var(--amber); font-weight:800; margin-bottom:10px; }
      .segrow{ display:flex; gap:8px; justify-content:center; margin-bottom:10px; flex-wrap:wrap; }
      .segbtn{ pointer-events:auto; cursor:pointer; flex:1; min-width:86px; padding:11px 10px; border-radius:7px; border:1px solid rgba(255,255,255,.22);
        background:rgba(255,255,255,.06); color:var(--ink); font-family:inherit; font-size:15px; font-weight:800; letter-spacing:.03em; }
      .segbtn.sel{ border-color:var(--amber); background:rgba(255,180,84,.18); box-shadow:0 0 0 1px var(--amber); }
      .segbtn.teamred{ color:#ff7a70; } .segbtn.teamblue{ color:#7db4ff; }
      .segbtn.teamred.sel{ border-color:#ff5347; box-shadow:0 0 0 1px #ff5347; background:rgba(255,83,71,.16); }
      .segbtn.teamblue.sel{ border-color:#4f9dff; box-shadow:0 0 0 1px #4f9dff; background:rgba(79,157,255,.16); }
      .segbtn:disabled{ opacity:.45; cursor:default; }
      .mpinput{ pointer-events:auto; flex:1; min-width:120px; padding:11px 12px; border-radius:7px; border:1px solid rgba(255,255,255,.22);
        background:rgba(0,0,0,.35); color:var(--ink); font-family:inherit; font-size:15px; font-weight:700; text-align:center; }
      .mpinput.code{ text-transform:uppercase; letter-spacing:.3em; max-width:140px; flex:0 1 140px; }
      .linkbtn{ background:none; border:0; color:var(--ink-dim); text-decoration:underline; cursor:pointer; font-size:13px; font-family:inherit; }
      #lobbyPlayers{ margin:0 auto 16px; max-width:440px; text-align:left; }
      .lpRow{ display:flex; justify-content:space-between; align-items:center; padding:9px 14px; margin-bottom:6px; border-radius:7px;
        background:var(--panel); border:1px solid rgba(255,255,255,.1); font-size:15px; font-weight:700; }
      .lpTeam{ font-size:12px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
      .lpTeam.red{ color:#ff7a70; } .lpTeam.blue{ color:#7db4ff; } .lpTeam.none{ color:var(--ink-dim); }
      #lobbyCode{ color:var(--amber); letter-spacing:.18em; }
      #mpStatus{ min-height:18px; }
      @media (orientation:landscape) and (max-height:540px){
        #minimap{ width:112px; height:112px; }
        #healthWrap{ top:calc(132px + env(safe-area-inset-top)); }
      }

      /* ---------- Tutorial ---------- */
      body.tutorial #scoreboard{ display:none; }
      #tutBar{
        position:absolute; left:50%; top:calc(64px + env(safe-area-inset-top)); transform:translateX(-50%);
        width:min(520px,92vw); background:var(--panel); border:1px solid var(--amber); border-radius:8px;
        padding:12px 16px 11px; text-align:center; pointer-events:none; display:none;
      }
      body.tutorial #tutBar{ display:block; }
      #tutStep{ font-size:11px; letter-spacing:.22em; text-transform:uppercase; color:var(--amber); font-weight:800; margin-bottom:5px; }
      #tutText{ font-size:16.5px; font-weight:700; line-height:1.4; color:var(--ink); }
      #tutSub{ font-size:13px; color:var(--ink-dim); margin-top:4px; min-height:16px; }
      #tutBtns{ position:absolute; right:calc(12px + env(safe-area-inset-right)); top:calc(150px + env(safe-area-inset-top));
        display:none; flex-direction:column; gap:8px; pointer-events:none; }
      body.tutorial #tutBtns{ display:flex; }
      .tutbtn{ pointer-events:auto; cursor:pointer; padding:10px 16px; border-radius:7px; border:1px solid rgba(255,255,255,.3);
        background:rgba(12,16,11,.85); color:var(--ink); font-family:inherit; font-size:13.5px; font-weight:800; letter-spacing:.04em; }
      .tutbtn:active{ background:rgba(255,180,84,.35); }
      @media (max-width:560px){ #tutText{ font-size:15px; } #tutBar{ top:calc(118px + env(safe-area-inset-top)); } }
      @media (orientation:landscape) and (max-height:540px){
        #tutBar{ top:calc(8px + env(safe-area-inset-top)); width:min(460px,54vw); padding:8px 12px; }
        #tutText{ font-size:14px; } #tutBtns{ top:calc(64px + env(safe-area-inset-top)); }
      }

      /* ---------- Leaderboard ---------- */
      .boardbtn{
        pointer-events:auto; cursor:pointer; width:100%; padding:13px 20px; border-radius:8px;
        border:1px solid var(--amber); background:rgba(255,180,84,.12); color:var(--amber);
        font-family:inherit; font-size:16px; font-weight:900; letter-spacing:.06em; text-transform:uppercase;
      }
      .boardbtn:active{ background:rgba(255,180,84,.28); }
      #boardList{ margin:0 auto 8px; max-width:440px; text-align:left; }
      .boardRow{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 14px; margin-bottom:6px; border-radius:7px;
        background:var(--panel); border:1px solid rgba(255,255,255,.1); font-size:15px; font-weight:700; }
      .boardRow .brank{ color:var(--amber); font-weight:900; min-width:26px; }
      .boardRow .bname{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
      .boardRow .bscore{ font-variant-numeric:tabular-nums; color:var(--ink-dim); white-space:nowrap; }
      .boardRow .bscore b{ color:var(--ink); }
      .boardEmpty{ padding:20px 16px; border-radius:7px; background:var(--panel); border:1px solid rgba(255,255,255,.1);
        color:var(--ink-dim); font-size:15px; line-height:1.5; text-align:center; margin-bottom:6px; }
      #boardStatus{ min-height:18px; }
    