/* Z98 split from index.html — order matters: files are linked in this sequence. */
  /* ===== NO-TANKS 8 THE INTRO AS AN AIR-RECON FEED (#cine, game/intro.js): the letterbox bars carry the feed's own words — a live dot and
     "Trinh sát đường không", a running timecode above; the voice-over's captions as subtitles below; the battlefield's name as a lower third ===== */
  #cine{position:fixed;inset:0;height:100%;height:var(--appH,100svh);z-index:30;pointer-events:none;opacity:0;transition:opacity .5s ease;}
  #cine.on{opacity:1;}
  #cine .bar{position:absolute;left:0;right:0;height:0;background:#000;transition:height .7s cubic-bezier(.2,.8,.2,1);display:flex;align-items:center;
    justify-content:space-between;padding:0 clamp(16px,3vw,44px);overflow:hidden;font-family:'Saira Condensed',Rajdhani,sans-serif;color:#ece0c2;}
  #cine .bar.top{top:0;} #cine .bar.bot{bottom:0;justify-content:center;}
  #cine.on .bar{height:11vh;}
  #cine .cn-feed{display:flex;align-items:center;gap:10px;font-size:clamp(12px,1.1vw,15px);font-weight:600;letter-spacing:.06em;color:rgba(236,224,194,.8);}
  #cine .cn-feed i{width:9px;height:9px;border-radius:50%;background:#e0412b;box-shadow:0 0 10px rgba(224,65,43,.9);}
  #cine.on .cn-feed i{animation:cnRec 1.1s steps(1) infinite;}
  @keyframes cnRec{50%{opacity:.15;}}
  #cine .cn-tc{font-size:clamp(13px,1.2vw,17px);font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:.08em;color:rgba(236,224,194,.66);}
  #cine .cn-cap{max-width:68vw;text-align:center;font-size:clamp(15px,1.5vw,21px);font-weight:500;line-height:1.25;color:#f3ead3;}
  #cine-title{position:absolute;left:clamp(20px,5vw,80px);bottom:calc(11vh + clamp(18px,4vh,40px));padding-left:16px;border-left:3px solid #e2b45c;
    opacity:0;transform:translateX(-16px);transition:opacity .7s ease .45s,transform .7s cubic-bezier(.2,.8,.2,1) .45s;}
  #cine.on #cine-title{opacity:1;transform:none;}
  #cine-title .ct-name{font:clamp(40px,6.2vw,100px)/.92 'Saira Stencil One',sans-serif;letter-spacing:.04em;color:#ece0c2;text-shadow:0 4px 26px rgba(0,0,0,.65);}
  #cine-title .ct-where{margin-top:8px;font:600 clamp(14px,1.35vw,19px)/1.3 'Saira Condensed',sans-serif;color:rgba(236,224,194,.88);text-shadow:0 2px 10px rgba(0,0,0,.85);}
  #cine-skip{position:absolute;right:clamp(16px,3vw,44px);top:50%;transform:translateY(-50%);font-size:12px;letter-spacing:.04em;color:rgba(236,224,194,.42);}
  #cine.on #cine-skip{animation:cineBlink 1.8s ease-in-out infinite;}
  @keyframes cineBlink{0%,100%{opacity:.45;}50%{opacity:1;}}
  @media (orientation:landscape) and (max-height:520px){ #cine-skip{display:none;} #cine .cn-cap{font-size:14px;} }
  @media (orientation:portrait){ #cine-title{bottom:calc(11vh + 22px);} #cine-skip{display:none;} }
  #hud{transition:opacity .45s ease;}
  body.cine #hud{opacity:0;pointer-events:none;}
  #touch{transition:opacity .45s ease;} body.cine #touch{opacity:0;pointer-events:none;}   /* NO-TANKS 8 the recon feed is clean on a phone too: the sticks and buttons come back when it ends */

  /* ===== MOBILE (landscape-only) ===== */
  .touch-only{display:none;}
  body.touch .touch-only{display:block;}
  body.touch .desktop-only{display:none;}
  /* declutter + move stats out of the thumb zones */
  body.touch #abilities{display:none;}          /* mobile uses on-screen buttons */
  body.touch #combo{top:58px;}
  body.touch .chip{background:linear-gradient(180deg,rgba(16,24,10,.26),rgba(6,12,5,.34));backdrop-filter:blur(5px) saturate(120%);box-shadow:0 3px 12px rgba(0,0,0,.3);border-color:rgba(255,255,255,.07);}   /* barely-there HUD — see the battlefield through it */
  /* === all stats hug the LEFT edge (top→down) + buffs on the RIGHT edge; top-center & bottom-center stay clear for viewing === */
  body.touch #topbar{left:max(10px,env(safe-area-inset-left));top:max(8px,env(safe-area-inset-top));transform:none;padding:2px 3px;}   /* pause moved to top-right → topbar takes the full left edge */
  body.touch #topbar .cell{padding:1px 7px;}
  body.touch #topbar .lbl{font-size:6px;letter-spacing:1px;}
  body.touch #topbar .val{font-size:13px;}
  body.touch #hpwrap{left:max(10px,env(safe-area-inset-left));top:calc(max(8px,env(safe-area-inset-top)) + 40px);bottom:auto;width:136px;padding:4px 8px;}
  body.touch #hpwrap .row{gap:5px;margin-bottom:3px;}
  body.touch #hpwrap .ic{width:13px;height:13px;}
  body.touch #hpwrap .bar{height:6px;}
  body.touch #lives{font-size:10px;}
  body.touch #weaponchip{left:max(10px,env(safe-area-inset-left));top:calc(max(8px,env(safe-area-inset-top)) + 40px);right:auto;bottom:auto;transform:none;padding:3px 9px;font-size:11px;}
  body.touch #weaponchip .wc-ic{width:15px;height:15px;}
  body.touch #gunlist{left:max(10px,env(safe-area-inset-left));top:calc(max(8px,env(safe-area-inset-top)) + 66px);right:auto;bottom:auto;transform:none;justify-content:flex-start;flex-wrap:wrap;max-width:152px;gap:4px;}
  body.touch .gunicon{width:25px;height:25px;}
  body.touch .gunicon svg{width:14px;height:14px;}
  body.touch #buffbar{left:auto;right:max(10px,env(safe-area-inset-right));top:calc(max(10px,env(safe-area-inset-top)) + 170px);transform:none;display:flex;flex-direction:column;align-items:flex-end;gap:4px;}
  /* bigger, friendlier joystick */
  body.touch .stick{width:150px;height:150px;}
  body.touch .stick .knob{width:62px;height:62px;}
  /* action buttons: clear labelled column on the right */
  body.touch #mbtns{gap:12px;bottom:calc(max(14px,env(safe-area-inset-bottom)) + 4px);}
  body.touch .mbtn{width:58px;height:58px;background:linear-gradient(180deg,rgba(22,30,14,.32),rgba(10,16,8,.42));border-color:rgba(255,255,255,.1);box-shadow:0 4px 12px rgba(0,0,0,.28);}  /* see-through — don't block the battlefield */
  body.touch .mbtn .ic{margin-bottom:7px;}
  .mbtn .mbtag{position:absolute;bottom:4px;left:0;right:0;text-align:center;font-size:8px;letter-spacing:1px;color:var(--muted);font-weight:800;pointer-events:none;}
  /* left-thumb FIRE trigger (manual mode) + AUTO toggle */
  #mFire{position:absolute;left:max(22px,env(safe-area-inset-left));bottom:max(20px,env(safe-area-inset-bottom));
    width:92px;height:92px;border-radius:50%;display:none;align-items:center;justify-content:center;pointer-events:auto;z-index:14;
    background:radial-gradient(circle at 50% 38%,rgba(243,150,60,.34),rgba(20,12,6,.62));
    border:2px solid rgba(255,182,92,.72);box-shadow:0 6px 22px rgba(0,0,0,.5),inset 0 0 18px rgba(255,150,60,.22);
    color:#ffd9a0;-webkit-tap-highlight-color:transparent;transition:transform .07s ease,box-shadow .15s ease;}
  #mFire .ic{width:44px;height:44px;color:#ffdca6;}
  #mFire:active,#mFire.firing{transform:scale(.93);background:radial-gradient(circle at 50% 38%,rgba(255,120,40,.62),rgba(40,12,4,.72));
    border-color:#ffb860;box-shadow:0 2px 10px rgba(0,0,0,.5),inset 0 0 28px rgba(255,140,50,.5);}
  body.touch #mFire{display:flex;}                 /* visible in MANUAL mode */
  body.touch.autofire #mFire{display:none;}        /* hidden in AUTO mode (gun fires itself) */
  #autoBtn{position:absolute;left:max(22px,env(safe-area-inset-left));bottom:calc(max(20px,env(safe-area-inset-bottom)) + 104px);
    display:none;align-items:center;gap:5px;padding:6px 13px;border-radius:999px;pointer-events:auto;z-index:14;cursor:pointer;
    background:rgba(8,12,6,.55);border:1px solid var(--line);color:var(--muted);font-size:11px;font-weight:800;letter-spacing:1.5px;
    -webkit-tap-highlight-color:transparent;}
  #autoBtn .ic{width:13px;height:13px;}
  #autoBtn.on{color:#1c1404;background:linear-gradient(180deg,#f4c45e,#e29a30);border-color:rgba(255,230,175,.7);}
  body.touch #autoBtn{display:inline-flex;}
  /* === top-right cluster: PAUSE · FULLSCREEN · SOUND — grouped, tiny, fully transparent (icon only) === */
  body.touch #muteBtn,body.touch #fsBtn,body.touch #mPause{background:none;border:none;box-shadow:none;backdrop-filter:none;width:38px;height:38px;top:max(8px,env(safe-area-inset-top));}
  body.touch #muteBtn{right:max(10px,env(safe-area-inset-right));}
  body.touch #musBtn{display:none;}   /* Z111 the phone's top row is full: music on/off lives in the ⏸ menu there */
  body.touch #mPause{left:auto;right:calc(max(10px,env(safe-area-inset-right)) + 42px);border-radius:9px;}
  body.touch #fsBtn{right:calc(max(10px,env(safe-area-inset-right)) + 84px);left:auto;}   /* fullscreen outermost → hiding it on iOS leaves no gap */
  body.touch #muteBtn .ic,body.touch #fsBtn .ic,body.touch #mPause .ic{width:21px;height:21px;color:rgba(255,255,255,.82);filter:drop-shadow(0 1px 2px rgba(0,0,0,.95));}
  /* === DASH on the LEFT thumb, right above the FIRE trigger; AUTO sits above DASH, both see-through === */
  body.touch #mDash{position:absolute;left:max(22px,env(safe-area-inset-left));bottom:calc(max(20px,env(safe-area-inset-bottom)) + 118px);width:58px;height:58px;}
  body.touch #autoBtn{left:auto;right:calc(max(10px,env(safe-area-inset-right)) + 126px);top:max(8px,env(safe-area-inset-top));bottom:auto;width:38px;height:38px;padding:0;border-radius:10px;gap:0;background:rgba(8,12,6,.3);border-color:rgba(255,255,255,.1);box-shadow:none;}   /* set-once toggle → moved into the top-right utility cluster */
  body.touch #autoBtn span:not(.ic){display:none;}    /* icon-only in the cluster */
  body.touch #autoBtn .ic{width:19px;height:19px;}
  body.touch #autoBtn.on{background:rgba(44,30,6,.4);color:#ffcf5a;border-color:rgba(255,200,90,.6);box-shadow:0 0 9px rgba(255,180,60,.5);}
  /* camera controls (zoom + rotate view) — left edge, vertically centred, see-through */
  /* camera controls (zoom + rotate) — desktop: bottom-left corner; mobile: stacked just above DASH */
  #camCtl{position:absolute;left:max(14px,env(safe-area-inset-left));bottom:max(16px,env(safe-area-inset-bottom));top:auto;display:flex;flex-direction:row;gap:8px;pointer-events:none;z-index:14;}
  body.touch #camCtl{left:max(8px,env(safe-area-inset-left));bottom:calc(max(20px,env(safe-area-inset-bottom)) + 184px);}   /* above the mobile DASH button */
  @media (max-height:340px){ body.touch #gunlist{display:none !important;} }   /* tiny landscape (iPhone SE): drop the gun strip so it never meets the bottom-anchored camera buttons (weaponchip still shows the active gun). !important beats updateGunHUD's inline display */
  .camBtn{pointer-events:auto;width:40px;height:40px;border-radius:11px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
    background:rgba(8,12,6,.32);border:1px solid rgba(255,255,255,.1);color:rgba(255,255,255,.85);backdrop-filter:blur(4px);box-shadow:0 3px 10px rgba(0,0,0,.3);-webkit-tap-highlight-color:transparent;}
  .camBtn:active{transform:scale(.92);}
  .camBtn .ic{width:17px;height:17px;}
  #zoomLbl{font-size:8px;font-weight:800;letter-spacing:.5px;color:rgba(255,255,255,.72);}
  /* compact menus to fit a short landscape viewport */
  body.touch .overlay{gap:9px;padding:12px;}
  body.touch .title{font-size:clamp(26px,8vw,44px);letter-spacing:3px;}
  body.touch .subtitle{font-size:11px;letter-spacing:4px;}
  body.touch .panel{padding:12px 16px;max-width:360px;}
  body.touch .btn-primary{font-size:16px;padding:12px 22px;}
  body.touch .help{font-size:11px;line-height:1.7;}
  body.touch .tap{display:none;}
  body.touch .go-stats{gap:18px;margin:8px 0 10px;} body.touch .go-stat .v{font-size:24px;}
  body.touch #upcards{gap:8px;} body.touch .upcard{width:30%;min-width:92px;padding:12px 8px;}
  body.touch .upcard .ic{width:38px;height:38px;}
  /* portrait gate */
  #rotate{position:fixed;inset:0;height:100%;height:var(--appH,100svh);z-index:60;display:none;flex-direction:column;align-items:center;justify-content:center;gap:14px;
    background:radial-gradient(120% 90% at 50% 45%,rgba(14,20,8,.93),rgba(4,6,3,.99));color:var(--ink);text-align:center;padding:30px;}
  #rotate .ic{width:78px;height:78px;color:var(--amber);animation:rotPulse 1.8s ease-in-out infinite;}
  #rotate .rt-t{font-size:21px;font-weight:900;letter-spacing:4px;}
  #rotate .rt-s{font-size:11px;letter-spacing:5px;color:var(--muted);text-transform:uppercase;}
  @keyframes rotPulse{0%,100%{transform:rotate(-14deg);}50%{transform:rotate(3deg);}}
  @media (orientation:portrait){ body.touch.ingame #rotate{display:flex;} }   /* menus work upright; only the battle needs landscape */

  /* ===== STAGE TRANSITION WIPE ===== */
  #stagewipe{position:fixed;inset:0;height:100%;height:var(--appH,100svh);z-index:24;pointer-events:none;opacity:0;transition:opacity .5s ease;
    display:flex;align-items:center;justify-content:center;overflow:hidden;
    background:radial-gradient(125% 95% at 50% 50%,rgba(4,6,3,.32),rgba(2,3,1,.9));}
  #stagewipe.show{opacity:1;}
  #stagewipe .sw-inner{text-align:center;transform:scale(.84);transition:transform .65s cubic-bezier(.2,.9,.2,1);}
  #stagewipe.show .sw-inner{transform:scale(1);}
  #stagewipe .sw-clear{font-size:14px;letter-spacing:8px;color:var(--green);text-transform:uppercase;font-weight:800;margin-bottom:10px;
    opacity:0;transform:translateY(-12px);transition:opacity .5s ease .05s,transform .5s ease .05s;}
  #stagewipe.show .sw-clear{opacity:1;transform:none;}
  #stagewipe .sw-stage{font-size:clamp(44px,12vw,108px);font-weight:900;letter-spacing:6px;line-height:1;
    background:linear-gradient(105deg,var(--green),var(--ink) 55%,var(--amber));-webkit-background-clip:text;background-clip:text;color:transparent;
    filter:drop-shadow(0 6px 30px rgba(0,0,0,.7));}
  #stagewipe .sw-biome{font-size:clamp(16px,4vw,30px);letter-spacing:10px;color:var(--swaccent,#ffce4a);text-transform:uppercase;font-weight:800;margin-top:8px;text-shadow:0 2px 16px rgba(0,0,0,.85);}
  #stagewipe .sw-tag{margin-top:18px;font-size:12px;letter-spacing:6px;color:var(--muted);text-transform:uppercase;opacity:0;transition:opacity .5s ease .3s;}
  #stagewipe.show .sw-tag{opacity:1;animation:swTagPulse 1.1s ease-in-out infinite .6s;}
  @keyframes swTagPulse{0%,100%{opacity:.55;}50%{opacity:1;}}
  #stagewipe .sw-scan{position:absolute;left:0;right:0;height:2px;top:0;opacity:0;
    background:linear-gradient(90deg,transparent,var(--swaccent,#ffce4a),transparent);box-shadow:0 0 18px var(--swaccent,#ffce4a);}
  #stagewipe.show .sw-scan{animation:swScan 1.7s ease-in-out;}
  @keyframes swScan{0%{top:14%;opacity:0;}18%{opacity:.85;}82%{opacity:.85;}100%{top:86%;opacity:0;}}

  /* ===== radar / minimap ===== */
  #radar{position:absolute;top:calc(max(12px,env(safe-area-inset-top)) + 50px);right:max(12px,env(safe-area-inset-right));left:auto;bottom:auto;
    width:132px;height:132px;border-radius:14px;border:1px solid var(--line);pointer-events:none;z-index:10;
    background:linear-gradient(180deg,rgba(20,28,14,.5),rgba(10,16,8,.58));backdrop-filter:blur(6px);
    box-shadow:0 8px 24px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.05);}
  body.touch #radar{width:104px;height:104px;top:calc(max(10px,env(safe-area-inset-top)) + 48px);}
  /* ===== core-under-attack alarm ===== */
  #corealarm{position:fixed;inset:0;height:100%;height:var(--appH,100svh);pointer-events:none;z-index:11;opacity:0;transition:opacity .3s;
    background:radial-gradient(circle at 50% 50%,transparent 52%,rgba(224,60,40,.5) 100%);}
  body.corelow #corealarm{opacity:1;animation:alarmPulse 1s ease-in-out infinite;}
  @keyframes alarmPulse{0%,100%{opacity:.35;}50%{opacity:.95;}}
  #corewarn{position:absolute;top:calc(max(12px,env(safe-area-inset-top)) + 120px);left:50%;transform:translateX(-50%);
    display:none;align-items:center;gap:7px;z-index:13;pointer-events:none;white-space:nowrap;
    font-size:13px;font-weight:900;letter-spacing:3px;color:#ff6a4a;text-transform:uppercase;text-shadow:0 2px 10px rgba(0,0,0,.85);}
  #corewarn .ic{width:18px;height:18px;color:#ff6a4a;}
  body.corelow #corewarn,body.coreatk #corewarn{display:flex;} body.corelow #corewarn,body.coredanger #corewarn{animation:warnBlink .8s steps(2,end) infinite;}
  body.coredanger #corealarm{opacity:1;animation:alarmPulse 1.4s ease-in-out infinite;}
  #coreArrow{position:fixed;display:none;z-index:14;pointer-events:none;flex-direction:column;align-items:center;gap:2px;transform:translate(-50%,-50%);}
  #coreArrow i{display:block;width:0;height:0;border-left:26px solid #ff6a4a;border-top:15px solid transparent;border-bottom:15px solid transparent;filter:drop-shadow(0 0 8px rgba(255,80,50,.9));animation:warnBlink .7s steps(2,end) infinite;}
  #coreArrow b{font:900 12px/1 'Saira Condensed',Rajdhani,sans-serif;letter-spacing:1px;color:#ffb35a;text-shadow:0 2px 6px #000;}
  @keyframes warnBlink{0%,100%{opacity:1;}50%{opacity:.3;}}
  /* ===== best-score lines ===== */
  .bestline{font-size:12px;letter-spacing:3px;color:var(--amber);font-weight:800;text-transform:uppercase;opacity:.9;margin-top:2px;min-height:14px;}
  .go-best{font-size:12px;letter-spacing:2px;color:var(--muted);font-weight:800;text-transform:uppercase;margin-bottom:12px;min-height:14px;}
  .go-best.newbest{color:var(--amber);text-shadow:0 0 14px rgba(231,181,74,.6);}

  /* ===== title-screen banner (AI key art) + clean premium controls ===== */
  #start{ background:radial-gradient(46% 42% at 86% 14%,rgba(3,5,2,.62) 0%,rgba(3,5,2,0) 72%), linear-gradient(180deg,rgba(3,5,2,.12) 0%,rgba(3,5,2,0) 30%,rgba(3,5,2,.5) 66%,rgba(3,5,2,.95) 100%), url('../assets/keyart-desktop.jpg') center/cover no-repeat;
    backdrop-filter:none; justify-content:flex-end; justify-content:safe flex-end; gap:14px; padding-bottom:clamp(22px,6vh,54px); }
  #start .start-id{ display:flex; flex-direction:column; align-items:center; gap:10px; }   /* greeting · best · wallet (one row on short landscape) */
  #start .tap{ display:none; }                                /* redundant with the DEPLOY button */
  #start .bestline{ display:inline-flex; align-items:center; gap:8px; padding:5px 16px; border-radius:999px;
    background:rgba(6,9,4,.5); border:1px solid rgba(255,206,110,.32); color:var(--amber);
    font-size:12px; letter-spacing:2px; text-shadow:0 2px 10px rgba(0,0,0,.95); }
  #start .panel{ display:flex; flex-direction:column; align-items:center; gap:12px;
    background:none; border:none; box-shadow:none; backdrop-filter:none; padding:0; max-width:none; overflow:visible; }
  #start .panel::before{ display:none; }
  #start .btn-primary{ display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
    background:linear-gradient(180deg,#f4c45e 0%,#e29a30 52%,#cd7c20 100%); color:#1c1404;
    border:1px solid rgba(255,230,175,.75); border-radius:13px; padding:15px 50px;
    font-size:21px; font-weight:900; letter-spacing:4px; text-shadow:0 1px 0 rgba(255,235,190,.45);
    box-shadow:0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.5);
    animation:deployPulse 2.4s ease-in-out infinite; }
  #start .btn-primary:hover{ filter:brightness(1.07); transform:translateY(-2px); }
  @keyframes deployPulse{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.5),0 0 0 rgba(243,185,74,0),inset 0 1px 0 rgba(255,255,255,.5);}
    50%{box-shadow:0 12px 32px rgba(0,0,0,.5),0 0 30px rgba(243,185,74,.5),inset 0 1px 0 rgba(255,255,255,.5);}}
  #start .help{ font-size:11px; letter-spacing:.4px; color:rgba(255,255,255,.58); line-height:2; text-shadow:0 1px 6px rgba(0,0,0,.95); margin:0; }
  #start .help b{ color:rgba(255,255,255,.82); font-weight:700; }
  #start .help kbd{ background:rgba(255,255,255,.09); border:1px solid rgba(255,255,255,.16); color:rgba(255,255,255,.82); border-radius:5px; padding:1px 6px; font-size:10px; }
  body.touch #start{ padding-bottom:max(12px,env(safe-area-inset-bottom)); gap:10px; }
  body.touch #start .btn-primary{ font-size:18px; padding:13px 42px; }
  #rotate{ background:linear-gradient(180deg,rgba(3,5,2,.5),rgba(3,5,2,.8)), url('../assets/keyart-mobile.jpg') center/cover no-repeat; }

  /* Z322 the intro's mist (game/intro-clouds.js): a haze round the edges high up (--haze) and the whiteout inside a cloud (--fill), under the captions */
  #introMist{position:fixed;inset:0;height:100%;height:var(--appH,100svh);z-index:29;pointer-events:none;display:none;--haze:0;--fill:0;--mist:#d8dde2;}
  #introMist.on{display:block;}
  #introMist i{position:absolute;inset:0;}
  #introMist .haze{opacity:var(--haze);background:radial-gradient(ellipse 85% 75% at 50% 58%,transparent 30%,var(--mist) 100%),linear-gradient(180deg,var(--mist) 0%,transparent 45%);}
  #introMist .fill{opacity:var(--fill);background:var(--mist);}
