:root{
  --bone:#E8E2D6;
  --concrete:#8C8B86;
  --slate:#3B4048;
  --orange:#FF6B1A;
  --magenta:#E5337E;
  --cyan:#2EE6C8;
  --amber:#F2C14E;
  --ink:#14161A;
  --ui:1;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%;background:var(--ink);overflow:hidden}
body{
  font-family:'Archivo',sans-serif;
  color:var(--bone);
  -webkit-user-select:none;user-select:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
  overscroll-behavior:none;
}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
.hidden{display:none !important}
#view{position:fixed;inset:0;width:100%;height:100%;display:block;background:var(--ink);outline:none}

/* ---------- boot ---------- */
#boot{
  position:fixed;inset:0;z-index:100;background:var(--ink);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;
  /* The loading sheet is a picture, not a wall. It used to take the press
     itself, which meant a click aimed at the start control waited for the
     arena to finish before it could land. The press now goes through to the
     title underneath and is remembered by the start marker in index.html, so
     the first tap during loading still drops in the moment it is ready. */
  transition:opacity .35s ease;pointer-events:none;
}
#boot.gone{opacity:0;pointer-events:none}
.boot-mark{
  font-family:'Bungee',sans-serif;font-size:clamp(42px,7vw,88px);line-height:.92;
  letter-spacing:.02em;color:var(--orange);text-align:center;
}
.boot-mark br + *{color:var(--bone)}
.boot-line{
  font-family:'Martian Mono',monospace;font-size:12px;letter-spacing:.32em;color:var(--concrete);
}
.boot-line.err{color:var(--magenta);max-width:70ch;text-align:center;line-height:1.7;letter-spacing:.08em}

/* ---------- portrait warning (phones only) ---------- */
/* The design document asks for a landscape game on touch hardware. On a
   desktop the window is free to be any shape, so this sheet only follows
   phone and tablet hardware; nothing here is a gate on a narrow browser window. */
#orient{
  position:fixed;inset:0;z-index:300;display:none;
  flex-direction:column;align-items:center;justify-content:center;
  padding:30px 24px;background:#0f1114;color:var(--bone);text-align:center;
  pointer-events:auto;
}
html.orient-blocked #orient{display:flex}
html.orient-blocked body{overflow:hidden}
.orient-inner{display:flex;flex-direction:column;align-items:center;max-width:560px}
.orient-inner::before{content:"";display:block;width:56px;height:8px;background:var(--orange);margin-bottom:26px}
.orient-phone{
  position:relative;width:62px;height:108px;margin:0 0 34px;
  border:3px solid var(--bone);box-shadow:inset 0 0 0 4px var(--slate),7px 7px 0 rgba(0,0,0,.4);
  animation:orient-tip 2.8s cubic-bezier(.7,0,.3,1) infinite;
}
.orient-phone::before{
  content:"";position:absolute;inset:6px;background:rgba(46,230,200,.14);
  box-shadow:inset 0 0 0 2px rgba(46,230,200,.5);
}
.orient-phone i{position:absolute;left:50%;bottom:8px;width:16px;height:2px;background:var(--concrete);transform:translateX(-50%)}
@keyframes orient-tip{0%,32%{transform:rotate(0deg)}54%,90%{transform:rotate(90deg)}100%{transform:rotate(0deg)}}
.orient-kicker{
  font-family:'Bungee',sans-serif;font-size:clamp(9px,2.6vw,12px);
  letter-spacing:.22em;color:var(--orange);margin-bottom:12px;
}
#orient h2{
  font-family:'Bungee',sans-serif;font-size:clamp(40px,12vw,78px);
  line-height:.9;margin:0 0 18px;color:var(--bone);letter-spacing:.01em;
}
.orient-line{
  font-family:'Archivo',sans-serif;font-weight:700;font-size:clamp(10px,2.9vw,13px);
  letter-spacing:.12em;line-height:1.8;color:var(--concrete);
}
.orient-foot{
  position:absolute;left:16px;right:16px;bottom:max(16px,env(safe-area-inset-bottom));
  font-family:'Bungee',sans-serif;font-size:clamp(7px,2vw,9px);
  letter-spacing:.14em;line-height:1.7;color:var(--concrete);
}

/* ---------- title ---------- */
/* The title screen is the start control: the whole sheet takes a press so a
   click, a tap or a driver aimed at the title drops straight into the arena. */
#title{position:fixed;inset:0;z-index:20;overflow:hidden;cursor:pointer;pointer-events:auto}
#title .title-prompt{pointer-events:auto}
.title-chip{
  position:absolute;z-index:6;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));
  pointer-events:auto;
}
.title-shade{position:absolute;inset:0;background:rgba(20,22,26,.46)}
.title-inner{
  position:relative;z-index:2;
  display:flex;flex-direction:column;align-items:center;
  padding-top:clamp(18px,4.5vh,58px);
  text-align:center;
}
.wordmark-wrap{position:relative;width:min(1040px,88vw);max-width:calc(84vh * 2.01)}
.wordmark{
  display:block;width:100%;height:auto;
  image-rendering:pixelated;
}
.title-ball{
  position:absolute;left:82%;top:28.5%;
  width:12.5%;height:auto;aspect-ratio:1/1;
  transform:translate(-50%,-50%);
  z-index:3;
  pointer-events:none;
}
.title-prompt{
  margin-top:clamp(6px,2.2vh,24px);
  font-family:'Bungee',sans-serif;
  font-size:clamp(16px,1.65vw,26px);
  letter-spacing:.14em;
  color:var(--bone);
  position:relative;
  z-index:4;
  touch-action:manipulation;
}
/* The pulse lives on the words, not the button: the press target keeps a
   still box so a tap or an automated press always lands on it. */
.title-prompt .prompt-text{display:inline-block;animation:breathe 1.6s steps(2,end) infinite}
/* A thumb never has to find the exact words: the press area is wider than the
   lettering but the lettering itself does not move. */
.title-prompt::before{content:"";position:absolute;inset:-18px -30px;}
@keyframes breathe{0%,100%{opacity:1}50%{opacity:.55}}
.title-sub{
  margin-top:10px;font-family:'Archivo',sans-serif;font-weight:700;
  font-size:clamp(9px,1.02vw,14px);letter-spacing:.28em;color:var(--concrete);
}
.title-auto{
  margin-top:8px;font-family:'Martian Mono',monospace;
  font-size:clamp(9px,.82vw,12px);letter-spacing:.18em;color:var(--cyan);
  min-height:1.2em;
}
.title-best{
  margin-top:12px;font-family:'Martian Mono',monospace;
  font-size:clamp(10px,1vw,13px);letter-spacing:.16em;color:var(--amber);min-height:1.2em;
}
.title-foot{
  position:absolute;left:0;right:0;bottom:max(14px,env(safe-area-inset-bottom));z-index:1;
  display:flex;flex-direction:column;align-items:center;gap:7px;padding:0 18px;text-align:center;
  /* A line of key hints, never a control: a press that lands on it belongs to
     the start prompt or the title around it. */
  pointer-events:none;
}
#title-controls,#title-controls-touch{
  font-family:'Bungee',sans-serif;font-size:clamp(9px,.92vw,12px);
  letter-spacing:.11em;color:var(--bone);opacity:.88;line-height:1.5;
}
#title-controls-touch{display:none}
.title-credit{
  font-family:'Archivo',sans-serif;font-weight:700;font-size:clamp(8px,.82vw,10px);
  letter-spacing:.2em;color:var(--concrete);
}

/* ---------- hud ---------- */
#hud{position:fixed;inset:0;z-index:14;pointer-events:none;overflow:hidden}
#hud.hidden{display:none}
#topleft{
  position:absolute;top:max(14px,env(safe-area-inset-top));left:max(16px,env(safe-area-inset-left));
  display:flex;align-items:flex-end;gap:clamp(14px,1.6vw,26px);pointer-events:none;
}
#stats{display:flex;gap:clamp(10px,1.2vw,22px);align-items:flex-end}
.stat{display:flex;flex-direction:column;gap:1px;line-height:1}
.stat-label{
  font-family:'Bungee',sans-serif;font-size:clamp(8px,.72vw,10px);letter-spacing:.16em;color:var(--concrete);
}
.stat-num{
  font-family:'Martian Mono',monospace;font-weight:700;
  font-size:clamp(15px,1.45vw,24px);letter-spacing:.02em;color:var(--bone);
  font-variant-numeric:tabular-nums;
}
#wave-line{
  position:absolute;left:50%;top:max(12px,env(safe-area-inset-top));transform:translateX(-50%);
  text-align:center;pointer-events:none;white-space:nowrap;z-index:2;
}
#wave-name{
  display:block;font-family:'Bungee',sans-serif;font-size:clamp(11px,1vw,15px);
  letter-spacing:.18em;color:var(--bone);text-shadow:0 2px 0 rgba(0,0,0,.45);
}
#wave-sub{
  display:block;margin-top:2px;font-family:'Martian Mono',monospace;
  font-size:clamp(7px,.64vw,10px);letter-spacing:.14em;color:var(--cyan);
}
#wave-line.clear #wave-name{color:var(--amber)}
#wave-line.clear #wave-sub{color:var(--amber)}
#heal-hint{
  position:absolute;left:50%;bottom:calc(max(16px,env(safe-area-inset-bottom)) + 58px);
  transform:translateX(-50%);
  font-family:'Bungee',sans-serif;font-size:clamp(9px,.82vw,12px);letter-spacing:.12em;
  color:var(--cyan);background:rgba(16,18,22,.74);padding:6px 12px;
  box-shadow:inset 0 0 0 2px rgba(46,230,200,.5);
  white-space:nowrap;pointer-events:none;
}
#top-tools{display:flex;gap:5px;pointer-events:auto;padding-bottom:1px}
.chip{
  font-family:'Bungee',sans-serif;font-size:clamp(8px,.7vw,10px);letter-spacing:.1em;
  background:var(--slate);color:var(--bone);padding:7px 9px;line-height:1;
}
.chip:active,.chip:hover{background:var(--concrete);color:var(--ink)}

#controls-card{
  position:absolute;left:max(16px,env(safe-area-inset-left));
  top:calc(max(14px,env(safe-area-inset-top)) + 54px);
  z-index:2;pointer-events:none;
  display:flex;flex-direction:column;gap:1px;
  min-width:124px;padding:7px 9px 8px;
  background:rgba(20,22,26,.68);
  box-shadow:inset 3px 0 0 rgba(46,230,200,.55);
  font-family:'Bungee',sans-serif;
  font-size:clamp(8px,.7vw,10px);letter-spacing:.09em;line-height:1.45;
}
#controls-card .cc-title{
  color:var(--concrete);font-size:clamp(6px,.5vw,8px);letter-spacing:.18em;
  margin-bottom:2px;
}
#controls-card .cc-row{display:flex;justify-content:space-between;gap:12px}
#controls-card .cc-key{color:var(--amber);min-width:36px}
#controls-card .cc-act{color:var(--bone)}
body.touch #controls-card{
  top:calc(max(10px,env(safe-area-inset-top)) + 94px);
  min-width:0;padding:5px 8px 6px;
  display:grid;grid-template-columns:auto auto;column-gap:14px;row-gap:0;
  font-size:clamp(8px,.9vw,9px);line-height:1.55;letter-spacing:.06em;
  background:rgba(20,22,26,.68);
}
body.touch #controls-card .cc-title{grid-column:1/-1;font-size:clamp(6px,.58vw,7px);margin-bottom:1px}
body.touch #controls-card .cc-key{display:none}
body.touch #controls-card .cc-row{justify-content:flex-start;gap:0}

#crosshair{
  position:absolute;left:50%;top:50%;width:48px;height:48px;
  transform:translate(-50%,-50%);
  --gap:7px;
  transition:opacity .12s linear;
  opacity:1;
}
#crosshair i{position:absolute;display:block;background:var(--bone);box-shadow:0 0 0 1px rgba(20,22,26,.38)}
#crosshair .ct,#crosshair .cb{width:2px;height:9px;left:calc(50% - 1px)}
#crosshair .ct{top:calc(50% - var(--gap) - 9px)}
#crosshair .cb{top:calc(50% + var(--gap))}
#crosshair .cl,#crosshair .cr{height:2px;width:9px;top:calc(50% - 1px)}
#crosshair .cl{left:calc(50% - var(--gap) - 9px)}
#crosshair .cr{left:calc(50% + var(--gap))}
#crosshair .cd{width:2px;height:2px;left:calc(50% - 1px);top:calc(50% - 1px)}
#crosshair.tp{opacity:0}

#hitmarker{position:absolute;left:50%;top:50%;width:44px;height:44px;transform:translate(-50%,-50%);opacity:0}
#hitmarker.on{opacity:1}
#hitmarker i{position:absolute;left:calc(50% - 1px);top:calc(50% - 1px);width:2px;height:11px;background:var(--amber)}
#hitmarker i:nth-child(1){transform:translate(-9px,-9px) rotate(45deg)}
#hitmarker i:nth-child(2){transform:translate(9px,-9px) rotate(-45deg)}
#hitmarker i:nth-child(3){transform:translate(-9px,9px) rotate(-45deg)}
#hitmarker i:nth-child(4){transform:translate(9px,9px) rotate(45deg)}

#damage-edges{position:absolute;inset:0;opacity:0;transition:opacity .16s linear}
#damage-edges i{position:absolute;background:var(--magenta);opacity:.42}
#damage-edges .de-t{left:0;right:0;top:0;height:min(3.6vh,26px)}
#damage-edges .de-b{left:0;right:0;bottom:0;height:min(3.6vh,26px)}
#damage-edges .de-l{top:0;bottom:0;left:0;width:min(2.2vw,20px)}
#damage-edges .de-r{top:0;bottom:0;right:0;width:min(2.2vw,20px)}
#lowhp-edges{position:absolute;inset:0;opacity:0;box-shadow:inset 0 0 0 8px rgba(229,51,126,.18);transition:opacity .3s linear}
#lowhp-edges.on{opacity:1;animation:lowpulse 1.1s steps(2,end) infinite}
@keyframes lowpulse{0%,100%{opacity:.35}50%{opacity:1}}

#health{
  position:absolute;left:max(16px,env(safe-area-inset-left));bottom:max(14px,env(safe-area-inset-bottom));
  display:flex;align-items:center;gap:9px;
}
.hud-icon{display:block;image-rendering:auto}
#health .hud-icon{height:clamp(30px,3.2vw,48px);width:auto}
#pips{display:flex;gap:2px;align-items:flex-end}
.pip{
  width:clamp(4px,.42vw,7px);height:clamp(11px,1.05vw,18px);
  background:var(--bone);
  box-shadow:inset -2px -2px 0 var(--concrete);
}
.pip.empty{background:var(--slate);box-shadow:inset -2px -2px 0 var(--ink)}
.pip.low{background:var(--magenta);box-shadow:inset -2px -2px 0 #8f1f4f}

#ammo{
  position:absolute;right:max(16px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));
  display:flex;align-items:center;gap:10px;
}
#ammo .hud-icon{height:clamp(34px,3.7vw,56px);width:auto}
.ammo-block{
  display:flex;align-items:baseline;gap:6px;
  background:var(--slate);
  padding:clamp(3px,.45vw,8px) clamp(8px,1vw,16px) clamp(5px,.55vw,10px);
  box-shadow:inset 0 -4px 0 rgba(20,22,26,.45);
}
.ammo-mag{
  font-family:'Martian Mono',monospace;font-weight:700;
  font-size:clamp(26px,3.2vw,50px);line-height:1;color:var(--bone);
  font-variant-numeric:tabular-nums;min-width:1.9ch;text-align:right;
}
.ammo-sep{font-family:'Martian Mono',monospace;font-size:clamp(16px,1.8vw,26px);color:var(--concrete)}
.ammo-res{font-family:'Martian Mono',monospace;font-size:clamp(17px,2vw,30px);color:var(--bone)}
#weapon-badge{
  position:absolute;right:max(16px,env(safe-area-inset-right));
  bottom:calc(max(14px,env(safe-area-inset-bottom)) + clamp(66px,6.6vw,96px));
  text-align:right;line-height:1;display:flex;flex-direction:column;align-items:flex-end;max-width:46vw;
}
#weapon-name{
  display:inline-block;background:var(--slate);color:var(--bone);
  font-family:'Bungee',sans-serif;font-size:clamp(10px,.95vw,15px);letter-spacing:.09em;
  padding:7px 10px 6px;box-shadow:inset 0 -3px 0 rgba(20,22,26,.45);
}
#weapon-alt{
  margin-top:4px;font-family:'Martian Mono',monospace;font-size:clamp(7px,.62vw,9px);
  letter-spacing:.1em;color:var(--concrete);white-space:nowrap;
}
#weapon-list{
  position:absolute;right:max(16px,env(safe-area-inset-right));
  bottom:calc(max(14px,env(safe-area-inset-bottom)) + clamp(114px,11.4vw,154px));
  display:grid;grid-auto-flow:column;grid-template-rows:repeat(8,auto);
  grid-auto-columns:auto;gap:3px 5px;justify-items:end;
}
.wslot{
  display:flex;align-items:center;gap:5px;direction:ltr;justify-self:end;
  background:rgba(20,22,26,.5);color:var(--concrete);
  font-family:'Bungee',sans-serif;font-size:clamp(7px,.62vw,9px);letter-spacing:.08em;
  padding:3px 6px 2px;line-height:1;white-space:nowrap;
}
.wslot .wk{font-family:'Martian Mono',monospace;color:var(--amber);font-size:.95em}
.wslot.cur{background:var(--bone);color:var(--ink)}
.wslot.cur .wk{color:#8a6a1e}
#pickup{
  position:absolute;left:50%;bottom:calc(max(16px,env(safe-area-inset-bottom)) + 96px);
  transform:translateX(-50%);
  padding:9px 14px;background:var(--cyan);color:var(--ink);
  font-family:'Bungee',sans-serif;font-size:clamp(9px,.85vw,12px);letter-spacing:.14em;
  white-space:nowrap;
}
#toast{
  position:absolute;left:50%;top:32%;transform:translateX(-50%);
  padding:8px 12px;background:rgba(20,22,26,.82);color:var(--bone);
  font-family:'Bungee',sans-serif;font-size:clamp(9px,.85vw,12px);letter-spacing:.14em;
  white-space:nowrap;opacity:0;transition:opacity .25s linear;pointer-events:none;
}
#toast.on{opacity:1}
#reload-hint{
  position:absolute;left:50%;top:calc(50% + 46px);transform:translateX(-50%);
  font-family:'Bungee',sans-serif;font-size:clamp(9px,.85vw,12px);letter-spacing:.16em;
  color:var(--amber);background:rgba(20,22,26,.72);padding:6px 9px;
}
#speedo{
  position:absolute;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);
  display:flex;align-items:baseline;gap:4px;opacity:.72;
}
#speed-num{font-family:'Martian Mono',monospace;font-weight:700;font-size:clamp(12px,1.1vw,17px);color:var(--bone);font-variant-numeric:tabular-nums}
.speed-unit{font-family:'Bungee',sans-serif;font-size:clamp(7px,.6vw,9px);letter-spacing:.14em;color:var(--concrete)}
#mode-tag{
  position:absolute;left:50%;bottom:calc(max(16px,env(safe-area-inset-bottom)) + 20px);transform:translateX(-50%);
  font-family:'Bungee',sans-serif;font-size:clamp(7px,.6vw,9px);letter-spacing:.2em;color:var(--concrete);
}
#ball-rim{
  position:fixed;left:50%;bottom:-31vh;transform:translateX(-50%);
  width:160vw;height:34vh;background:var(--orange);
  border-radius:50%;
  box-shadow:inset 0 3px 0 var(--bone);
  opacity:0;display:none;z-index:11;pointer-events:none;
}
#ball-rim.on{display:block;opacity:.92}

#hint{
  position:absolute;left:50%;bottom:calc(max(16px,env(safe-area-inset-bottom)) + 44px);
  transform:translateX(-50%);
  padding:8px 12px;background:rgba(20,22,26,.72);
  font-family:'Bungee',sans-serif;font-size:clamp(8px,.8vw,11px);letter-spacing:.16em;
  color:var(--bone);white-space:nowrap;opacity:0;
  transition:opacity .3s linear;
  pointer-events:none;
}
#hint b{color:var(--amber);font-weight:400}
#hint.on{opacity:.94}
body.touch #hint{bottom:calc(max(16px,env(safe-area-inset-bottom)) + 8px);font-size:8px}

/* ---------- panels ---------- */
.panel{
  position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;
  background:rgba(20,22,26,.84);padding:18px;
}
.panel-box{
  width:min(600px,92vw);max-height:88vh;overflow:auto;
  background:#1b1f25;padding:clamp(18px,2.4vw,34px);
  box-shadow:inset 0 0 0 3px var(--slate);
  text-align:left;
}
.panel-box.small{width:min(440px,92vw);text-align:center}
.panel-kicker{
  font-family:'Bungee',sans-serif;font-size:10px;letter-spacing:.2em;color:var(--concrete);
  margin-bottom:6px;
}
.panel-box h2{
  font-family:'Bungee',sans-serif;font-size:clamp(30px,4.2vw,54px);line-height:.94;
  margin:0 0 16px;color:var(--bone);letter-spacing:.01em;
}
.help-grid{display:grid;grid-template-columns:auto 1fr;gap:10px 16px;margin:14px 0 18px;align-items:center}
.help-grid .key{
  font-family:'Martian Mono',monospace;font-weight:700;font-size:clamp(10px,1.1vw,13px);
  color:var(--ink);background:var(--bone);padding:6px 8px;text-align:center;white-space:nowrap;
}
.help-grid > div:nth-child(even){
  font-family:'Archivo',sans-serif;font-weight:700;font-size:clamp(10px,1.1vw,13px);
  letter-spacing:.08em;color:var(--bone);line-height:1.45;
}
.help-line{
  font-family:'Archivo',sans-serif;font-weight:700;font-size:clamp(9px,1vw,12px);
  letter-spacing:.12em;line-height:1.6;color:var(--concrete);margin:10px 0 18px;
}
.pause-controls{
  font-family:'Martian Mono',monospace;font-size:10px;color:var(--concrete);
  letter-spacing:.06em;line-height:1.8;margin-bottom:18px;
}
.big-btn{
  display:inline-block;background:var(--bone);color:var(--ink);
  font-family:'Bungee',sans-serif;font-size:clamp(11px,1.2vw,15px);letter-spacing:.1em;
  padding:14px 20px;line-height:1;
}
.big-btn:hover,.big-btn:active{background:var(--concrete)}
.dead-stats{display:grid;grid-template-columns:1fr 1fr;gap:2px;margin:4px 0 8px}
.dead-stats > div{
  display:flex;align-items:baseline;justify-content:space-between;gap:12px;
  background:var(--slate);padding:8px 10px;
}
.dead-stats span{font-family:'Bungee',sans-serif;font-size:9px;letter-spacing:.16em;color:var(--concrete)}
.dead-stats b{font-family:'Martian Mono',monospace;font-weight:700;font-size:clamp(15px,1.7vw,22px);color:var(--bone)}
#dead .panel-box{text-align:left}
#dead-best{color:var(--amber);min-height:1.4em}
#btn-again,#btn-resume,#btn-help-close{margin-top:2px}

/* ---------- touch ---------- */
#touch-ui{display:none;position:fixed;inset:0;z-index:12;pointer-events:none}
body.touch.in-play #touch-ui{display:block}
body.touch #hud #stats{top:max(10px,env(safe-area-inset-top))}
body.touch #health{bottom:auto;top:calc(max(10px,env(safe-area-inset-top)) + 42px)}
body.touch #speedo{display:none}
body.touch #touch-ui .touch-btn,
body.touch #touch-ui #stickpad{pointer-events:auto}
#stickpad{
  z-index:3;
  position:absolute;left:max(18px,env(safe-area-inset-left));
  bottom:max(20px,env(safe-area-inset-bottom));
  width:clamp(96px,13vh,132px);height:clamp(96px,13vh,132px);
  background:rgba(59,64,72,.72);
  box-shadow:inset 0 0 0 3px rgba(232,226,214,.22);
  touch-action:none;
}
#stickknob{
  position:absolute;left:50%;top:50%;width:42%;height:42%;
  transform:translate(-50%,-50%);
  background:var(--bone);
  box-shadow:inset -3px -3px 0 var(--concrete);
  pointer-events:none;
}
#touch-look{position:absolute;inset:0;z-index:1;pointer-events:auto;touch-action:none}
.touch-btn{
  z-index:4;
  position:absolute;display:flex;align-items:center;justify-content:center;
  font-family:'Bungee',sans-serif;letter-spacing:.06em;
  background:rgba(59,64,72,.86);color:var(--bone);
  box-shadow:inset 0 0 0 3px rgba(232,226,214,.22);
  line-height:1;touch-action:none;
}
.touch-btn:active{background:var(--bone);color:var(--ink)}
#btn-fire{right:max(16px,env(safe-area-inset-right));bottom:max(20px,env(safe-area-inset-bottom));width:clamp(78px,12vh,112px);height:clamp(78px,12vh,112px);font-size:clamp(13px,1.9vh,18px)}
#btn-roll{right:calc(max(16px,env(safe-area-inset-right)) + clamp(84px,12.6vh,120px));bottom:max(20px,env(safe-area-inset-bottom));width:clamp(60px,9vh,84px);height:clamp(60px,9vh,84px);font-size:clamp(10px,1.4vh,13px)}
#btn-jump{right:max(16px,env(safe-area-inset-right));bottom:calc(max(20px,env(safe-area-inset-bottom)) + clamp(84px,12.6vh,120px));width:clamp(58px,8.6vh,80px);height:clamp(58px,8.6vh,80px);font-size:clamp(10px,1.4vh,13px)}
#btn-dive{right:calc(max(16px,env(safe-area-inset-right)) + clamp(148px,22.2vh,212px));bottom:max(20px,env(safe-area-inset-bottom));width:clamp(58px,8.6vh,80px);height:clamp(58px,8.6vh,80px);font-size:clamp(10px,1.4vh,13px);background:rgba(46,230,200,.22);box-shadow:inset 0 0 0 3px rgba(46,230,200,.55)}
#btn-dive:active{background:var(--cyan);color:var(--ink)}
#btn-launch{right:calc(max(16px,env(safe-area-inset-right)) + clamp(148px,22.2vh,212px));bottom:calc(max(20px,env(safe-area-inset-bottom)) + clamp(84px,12.6vh,120px));width:clamp(58px,8.6vh,80px);height:clamp(58px,8.6vh,80px);font-size:clamp(9px,1.25vh,12px);background:rgba(46,230,200,.22);box-shadow:inset 0 0 0 3px rgba(46,230,200,.55)}
#btn-launch:active{background:var(--cyan);color:var(--ink)}
#btn-reload{right:calc(max(16px,env(safe-area-inset-right)) + clamp(84px,12.6vh,120px));bottom:calc(max(20px,env(safe-area-inset-bottom)) + clamp(66px,9.4vh,90px));width:clamp(46px,7vh,62px);height:clamp(46px,7vh,62px);font-size:clamp(12px,1.8vh,16px);background:rgba(20,22,26,.7)}
body.touch #ammo{bottom:auto;top:calc(max(10px,env(safe-area-inset-top)) + 4px);right:max(14px,env(safe-area-inset-right))}
body.touch #weapon-badge{bottom:auto;top:calc(max(10px,env(safe-area-inset-top)) + 50px);right:max(14px,env(safe-area-inset-right));text-align:right}
body.touch #weapon-name{font-size:10px;padding:5px 7px 4px}
body.touch #weapon-alt{font-size:7px;margin-top:2px}
body.touch #weapon-list{bottom:auto;top:calc(max(10px,env(safe-area-inset-top)) + 84px);right:max(14px,env(safe-area-inset-right));gap:2px 4px}
body.touch .wslot{font-size:7px;padding:2px 4px 1px;gap:3px}
body.touch #pickup{bottom:auto;top:calc(50% + 40px);font-size:9px;padding:7px 10px}
body.touch #toast{top:24%;font-size:9px}
body.touch #ammo .hud-icon{height:clamp(24px,4.2vh,38px)}
body.touch .ammo-mag{font-size:clamp(20px,3.4vh,34px)}
body.touch .ammo-sep,body.touch .ammo-res{font-size:clamp(12px,2vh,20px)}
body.touch #reload-hint{top:calc(50% + 36px)}
body.touch #heal-hint{bottom:calc(max(16px,env(safe-area-inset-bottom)) + 198px);font-size:9px}
body.touch #wave-line{top:calc(max(10px,env(safe-area-inset-top)) + 2px)}
body.touch #wave-name{font-size:10px}
body.touch #wave-sub{font-size:7px}
body.touch #crosshair{--gap:6px}

/* short screens and narrow screens */
@media (max-width:760px){
  #stats{gap:8px}
  #title-controls{display:none}
  body.touch #title-controls-touch{display:block}
  .title-ball{width:17%}
}
@media (max-height:520px){
  .title-inner{padding-top:3vh}
  .wordmark-wrap{width:min(760px,68vw);max-width:calc(84vh * 2.01)}
  .title-prompt{margin-top:4px;font-size:14px}
  .title-sub{display:none}
  .title-best{margin-top:4px}
  .title-foot{bottom:6px;gap:2px}
  .title-credit{display:none}
  #health .hud-icon{height:30px}
  #ammo .hud-icon{height:34px}
  .ammo-mag{font-size:30px}
  #stats .stat-num{font-size:16px}
  #mode-tag{display:none}
  .panel-box{max-height:92vh}
  .panel-box h2{font-size:30px;margin-bottom:8px}
  .help-grid{gap:6px 12px;margin:8px 0 10px}
  .panel-box{padding:16px}
}
@media (orientation:portrait) and (pointer:coarse){
  .wordmark-wrap{width:96vw;max-width:none}
  .title-prompt{font-size:15px}
  #title-controls-touch{display:block;font-size:8px}
  .title-ball{width:20%}
  /* stack the stats and the tool chips so nothing runs off the right edge */
  #topleft{
    right:calc(max(14px,env(safe-area-inset-right)) + 92px);
    flex-direction:column;align-items:flex-start;gap:4px;
  }
  #stats{gap:8px}
  #stats .stat-num{font-size:12px}
  #stats .stat-label{font-size:6.5px}
  #top-tools{padding-bottom:0}
  .chip{font-size:7.5px;padding:5px 6px}
  body.touch #wave-line{top:calc(max(10px,env(safe-area-inset-top)) + 82px)}
  body.touch #wave-name{font-size:9px;letter-spacing:.12em}
  body.touch #wave-sub{font-size:6.5px}
  #health{top:calc(max(10px,env(safe-area-inset-top)) + 62px)}
  #health .hud-icon{height:24px}
  .pip{width:4px;height:9px}
  #ammo .hud-icon{height:24px}
  .ammo-mag{font-size:20px}
  #btn-fire{width:80px;height:80px;font-size:14px}
  #btn-roll{width:62px;height:62px}
  #btn-jump{width:60px;height:60px}
  #btn-reload{width:48px;height:48px}
  #stickpad{width:100px;height:100px}
  /* keep the ball rim a thin edge so it never covers the thumb buttons */
  #ball-rim{width:150vw;height:24vh;bottom:-21vh}
  body.touch #hint{
    left:max(16px,env(safe-area-inset-left));
    transform:none;text-align:left;
    bottom:calc(max(20px,env(safe-area-inset-bottom)) + 300px);
    width:58vw;white-space:normal;line-height:1.5;
  }
}
body.touch #weapon-alt{display:none}

/* A FRAMED GAME IS SHORTER THAN THE WINDOW. The published page keeps a band
   at the foot for its rail and its cookie notice, so a 1280x720 window hands
   the game about 460 px. The full-size wordmark then pushed the drop-in
   prompt into the key-hint line at the bottom. Keep the mark large but leave
   a clear band for the press and the hints. */
@media (min-height:521px) and (max-height:660px){
  .title-inner{padding-top:2vh}
  .wordmark-wrap{width:min(980px,84vw);max-width:calc(66vh * 2.01)}
  .title-sub{display:none}
  .title-prompt{margin-top:clamp(6px,1.8vh,16px)}
  .title-best{margin-top:6px}
  .title-foot{bottom:6px;gap:2px}
  .title-credit{display:none}
}

/* ---------- short landscape title (a framed phone, or a phone with the
   system bars eating the height) ---------- */
/* The wrapper around a published game can leave only ~258 px of height on a
   phone held sideways. There the full-size wordmark pushed the drop-in
   prompt past the bottom edge, where it collided with the control hint and
   was half out of the frame. Keep every element of the title, tighten it,
   and hold the prompt clear of the foot. */
@media (max-height:340px){
  .title-inner{padding-top:4px}
  .wordmark-wrap{width:min(720px,64vw);max-width:calc(64vh * 2.01)}
  /* The press is the one thing that must never be crowded: keep a clear band
     under the wordmark, and let the prompt read as a control rather than as a
     caption sitting on the bottom edge. */
  .title-prompt{
    margin-top:clamp(8px,3.4vh,14px);font-size:clamp(12px,2.3vh,18px);
    padding:5px 16px;color:var(--bone);
    background:rgba(16,18,22,.6);
    box-shadow:inset 0 0 0 2px rgba(46,230,200,.55);
  }
  .title-prompt .prompt-text{animation:none}
  .title-sub{display:none}
  .title-auto{display:none}
  .title-best{margin-top:3px;font-size:10px;min-height:0}
  .title-foot{bottom:4px;gap:2px}
  #title-controls-touch{font-size:7px}
}
/* A frame this short (a phone held sideways with the page's own chrome above
   and below it) has room for the mark and the press, nothing else. */
@media (max-height:232px){
  .title-inner{padding-top:2px}
  .wordmark-wrap{width:min(70vw,calc(56vh * 2.01))}
  .title-prompt{font-size:clamp(11px,3vh,15px);padding:4px 12px;margin-top:6px}
  .title-best{display:none}
  .title-foot{display:none}
}

/* A started run hides the title on the same frame, but the element stays
   hittable for a beat so the press that started it can finish its click. */
#title.title-gone{opacity:0}
