/* ==========================================================
   DARK OUTPOST — visual system
   bone #E8E4DA · charcoal #1C1D1F · concrete #3A3C40
   champagne #C9B37E (HUD metal accent) · red #C1121F (emergency only)
   ========================================================== */
*{box-sizing:border-box}
html,body{
  margin:0;padding:0;height:100%;width:100%;overflow:hidden;background:#0A0A0B;color:#E8E4DA;
  position:relative;
  font-family:'Tajawal',system-ui,-apple-system,'Segoe UI',sans-serif;
  -webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;
  overscroll-behavior:none;touch-action:none;
}
button{font-family:inherit;color:inherit;border:0;background:none;cursor:pointer;-webkit-user-select:none;user-select:none}
.hidden{display:none !important}

#game-root{
  position:absolute;inset:0;
  display:flex;flex-direction:column;min-height:0;
  overflow:hidden;touch-action:none;
  background:#0A0A0B;
}

/* ------------------------- HUD ------------------------- */
#hud{
  flex:0 0 auto;position:relative;z-index:30;
  display:flex;flex-direction:column;gap:5px;
  padding:7px 10px 7px;
  background:linear-gradient(#101113,#0b0c0d);
  border-bottom:1px solid rgba(201,179,126,.30);
  box-shadow:0 1px 0 rgba(0,0,0,.6);
}
.hud-row{display:flex;align-items:center;gap:7px;min-width:0}
.hud-row-2{gap:6px}

.hp-wrap{flex:1 1 auto;display:flex;align-items:center;gap:6px;min-width:0}
.hp-label{
  font-size:10px;font-weight:900;letter-spacing:.14em;color:#C9B37E;opacity:.9;
  font-variant-numeric:tabular-nums;
}
.hp-bar{
  position:relative;flex:1 1 auto;min-width:0;height:11px;background:#17181a;
  border:1px solid rgba(201,179,126,.38);
  clip-path:polygon(5px 0,100% 0,100% 100%,0 100%,0 5px);
  overflow:hidden;
}
.hp-bar::after{
  content:'';position:absolute;inset:0;pointer-events:none;
  background:repeating-linear-gradient(90deg,transparent 0 9px,rgba(0,0,0,.5) 9px 11px);
}
.hp-fill{
  height:100%;width:100%;background:#C9B37E;
  transition:width .16s linear,background-color .25s linear;
  box-shadow:0 0 10px rgba(201,179,126,.35);
}
.hp-num{font-size:12px;font-weight:700;color:#E8E4DA;font-variant-numeric:tabular-nums;min-width:26px;text-align:center}

.chip{
  display:flex;align-items:center;gap:5px;
  padding:2px 7px;height:22px;
  background:#141518;border:1px solid rgba(201,179,126,.26);
  clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
  white-space:nowrap;
}
.chip-k{font-size:10px;color:#8d8880;font-weight:500}
.chip b{font-size:12.5px;font-weight:900;color:#C9B37E;font-variant-numeric:tabular-nums;letter-spacing:.02em}
.score-chip{min-width:74px;justify-content:space-between}
.score-chip b{color:#E8E4DA}
.ammo-chip b#magNum{font-size:14px;color:#C9B37E}
.ammo-chip #resNum{font-size:11px;color:#9a948a;font-variant-numeric:tabular-nums}
.ammo-sep{color:#5a5750;font-size:11px}

.icon-btn{
  flex:0 0 auto;display:grid;place-items:center;width:34px;height:34px;
  color:#C9B37E;background:#141518;border:1px solid rgba(201,179,126,.3);
  clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
  transition:background .12s,transform .08s;
}
.icon-btn:active{background:#232428;transform:scale(.94)}
.icon-btn:focus-visible{outline:2px solid #C9B37E;outline-offset:2px}

/* ------------------------- STAGE ------------------------- */
#stage{
  position:relative;flex:1 1 0;min-height:0;min-width:0;overflow:hidden;background:#0A0A0B;
}
#scene{
  position:absolute;inset:0;display:block;touch-action:none;
  width:100%;height:100%;max-width:100%;max-height:100%;
}

#vignette{
  position:absolute;inset:0;pointer-events:none;opacity:0;z-index:5;
  background:radial-gradient(ellipse at 50% 55%,rgba(193,18,31,0) 38%,rgba(193,18,31,.62) 100%);
  transition:opacity .18s linear;
}
#lowhp{
  position:absolute;inset:0;pointer-events:none;opacity:0;z-index:4;
  background:radial-gradient(ellipse at 50% 50%,rgba(193,18,31,0) 52%,rgba(193,18,31,.35) 100%);
  animation:lowpulse 1.5s ease-in-out infinite;
}
@keyframes lowpulse{0%,100%{opacity:.25}50%{opacity:.7}}

/* boss bar */
#bossBar{
  position:absolute;top:9px;left:50%;transform:translateX(-50%);
  width:min(320px,74%);z-index:6;pointer-events:none;text-align:center;
}
.boss-name{
  font-size:10px;font-weight:700;letter-spacing:.06em;color:#E8E4DA;
  text-shadow:0 2px 6px #000;margin-bottom:4px;
}
.boss-track{
  height:9px;background:rgba(10,10,11,.8);border:1px solid rgba(193,18,31,.6);
  clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
  overflow:hidden;
}
.boss-fill{height:100%;width:100%;background:linear-gradient(90deg,#7c0d17,#C1121F);transition:width .12s linear}

/* banner */
#banner{
  position:absolute;top:16%;left:0;right:0;z-index:7;pointer-events:none;
  text-align:center;opacity:0;transform:translateY(-8px);
  transition:opacity .35s ease,transform .35s ease;
}
#banner.show{opacity:1;transform:translateY(0)}
.banner-kicker{
  font-size:11px;letter-spacing:.34em;color:#C9B37E;font-weight:700;margin-bottom:6px;
  text-shadow:0 2px 10px #000;
}
.banner-title{
  font-size:26px;font-weight:900;letter-spacing:.02em;color:#E8E4DA;
  text-shadow:0 3px 18px #000,0 0 2px #000;
}
.banner-sub{
  margin-top:5px;font-size:12px;color:#a8a29a;text-shadow:0 2px 10px #000;font-weight:500;
}

/* reticle */
#reticle{
  position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  z-index:6;pointer-events:none;opacity:.85;transition:opacity .15s,transform .12s;
}
#reticle.locked{opacity:1;transform:translate(-50%,-50%) scale(1.06)}
#reticle.locked svg{filter:drop-shadow(0 0 7px rgba(201,179,126,.85))}
#reticle.locked #reticleArcs{opacity:.55}

#lockMarker{
  position:absolute;z-index:6;pointer-events:none;width:26px;height:26px;
  margin:-13px 0 0 -13px;opacity:0;transition:opacity .12s,left .05s linear,top .05s linear;
  border:1px solid rgba(201,179,126,.9);
  transform:rotate(45deg);
  box-shadow:0 0 10px rgba(201,179,126,.5) inset;
}
#lockMarker.on{opacity:.85}

/* ------------------------- CONTROLS ------------------------- */
#controls{
  flex:0 0 auto;position:relative;z-index:25;
  display:flex;align-items:flex-end;justify-content:space-between;
  gap:10px;padding:8px 16px 14px;
  background:linear-gradient(#0a0a0b,#111214);
  border-top:1px solid rgba(201,179,126,.14);
}
.stick-group{flex:0 0 auto;display:flex;align-items:flex-end}
.action-group{flex:0 0 auto;display:flex;flex-direction:column;align-items:center;gap:10px}

#stick{
  position:relative;width:116px;height:116px;border-radius:50%;
  background:radial-gradient(circle at 50% 45%,rgba(28,29,31,.95),rgba(12,13,14,.98));
  border:1px solid rgba(201,179,126,.3);
  box-shadow:0 4px 18px rgba(0,0,0,.7),inset 0 0 18px rgba(0,0,0,.8);
  touch-action:none;
}
.stick-ring{
  position:absolute;inset:13px;border-radius:50%;
  border:1px dashed rgba(201,179,126,.16);
}
#knob{
  position:absolute;left:50%;top:50%;width:54px;height:54px;margin:-27px 0 0 -27px;
  border-radius:50%;display:grid;place-items:center;
  background:radial-gradient(circle at 40% 35%,#3a3c40,#1a1b1e);
  border:1px solid rgba(201,179,126,.5);
  box-shadow:0 3px 10px rgba(0,0,0,.75),inset 0 1px 0 rgba(255,255,255,.07);
  transition:transform .06s linear,background .12s;
}
#stick.active #knob{background:radial-gradient(circle at 40% 35%,#4a4d52,#22242a)}

.rnd-btn{
  position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1px;border-radius:50%;touch-action:none;
  transition:transform .07s ease,box-shadow .12s,background .12s;
  -webkit-user-select:none;user-select:none;
}
.rnd-btn:focus-visible{outline:2px solid #C9B37E;outline-offset:3px}

.fire-btn{
  width:84px;height:84px;color:#E8E4DA;
  background:radial-gradient(circle at 42% 32%,#33363b,#171819 70%);
  border:1.5px solid rgba(201,179,126,.62);
  box-shadow:0 6px 22px rgba(0,0,0,.8),inset 0 1px 0 rgba(255,255,255,.08);
}
.fire-btn .fire-glow{
  position:absolute;inset:-6px;border-radius:50%;pointer-events:none;
  background:radial-gradient(circle,rgba(193,18,31,.35),transparent 62%);
  opacity:0;transition:opacity .1s;
}
.fire-btn:active{transform:scale(.94);background:radial-gradient(circle at 42% 32%,#4a1d24,#1a1012 70%)}
.fire-btn:active .fire-glow{opacity:1}
.fire-btn.held{transform:scale(.96);border-color:#C1121F}
.fire-btn.held .fire-glow{opacity:1}

.reload-btn{
  width:58px;height:58px;color:#C9B37E;
  background:radial-gradient(circle at 42% 32%,#2a2c30,#141518 70%);
  border:1px solid rgba(201,179,126,.42);
  box-shadow:0 4px 14px rgba(0,0,0,.7);
}
.reload-btn:active{transform:scale(.93)}
.reload-btn.reloading{border-color:#C9B37E;box-shadow:0 0 14px rgba(201,179,126,.35)}
.reload-btn.empty-pulse{animation:emptyPulse .5s ease 2}
@keyframes emptyPulse{0%,100%{border-color:rgba(193,18,31,.4)}50%{border-color:#C1121F;box-shadow:0 0 16px rgba(193,18,31,.6)}}
.ring-svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(0deg);pointer-events:none}
.reload-btn .glyph{position:relative;z-index:2}
.btn-label{
  position:relative;z-index:2;font-size:9.5px;font-weight:700;letter-spacing:.04em;
  color:#a8a29a;line-height:1;
}
.fire-btn .btn-label{color:#cfc9be}

/* ------------------------- OVERLAYS ------------------------- */
.overlay{
  position:absolute;inset:0;z-index:60;display:flex;flex-direction:column;
  padding:18px;overflow-y:auto;overscroll-behavior:contain;
  background:
    radial-gradient(120% 80% at 50% 0%,rgba(28,29,31,.97),rgba(10,10,11,.995) 70%),
    #0A0A0B;
  animation:fadeIn .28s ease;
}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.overlay-over{padding-top:150px}
.overlay-inner{margin:auto;width:100%;max-width:430px}
.overlay-inner.narrow{max-width:360px;text-align:center}

.brand{text-align:center;margin-bottom:20px}
.brand-kicker{
  font-size:10px;letter-spacing:.3em;color:#C1121F;font-weight:700;margin-bottom:8px;
}
.brand-title{
  font-size:clamp(30px,10vw,44px);font-weight:900;letter-spacing:.01em;margin:0;
  color:#E8E4DA;line-height:1.05;
  text-shadow:0 0 30px rgba(201,179,126,.16);
}
.brand-rule{
  width:74px;height:2px;margin:12px auto;background:#C9B37E;
  clip-path:polygon(0 0,100% 0,calc(100% - 6px) 100%,0 100%);
}
.brand-story{
  font-size:13.5px;line-height:1.75;color:#a8a29a;margin:0;font-weight:500;
}

.ctrl-list{
  list-style:none;margin:0 0 20px;padding:14px 14px;
  background:rgba(20,21,24,.7);border:1px solid rgba(201,179,126,.18);
  clip-path:polygon(12px 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%,0 12px);
  display:flex;flex-direction:column;gap:10px;
}
.ctrl-list li{display:flex;gap:10px;align-items:flex-start;font-size:12.5px;line-height:1.55;color:#b7b1a8}
.ctrl-list b{color:#E8E4DA;font-weight:700}
.ctrl-ico{
  flex:0 0 auto;width:22px;height:22px;display:grid;place-items:center;
  color:#C9B37E;font-size:13px;border:1px solid rgba(201,179,126,.35);
  background:#101113;border-radius:2px;
}

.start-actions,.stack-btns{display:flex;flex-direction:column;gap:9px}
.primary-btn{
  width:100%;padding:15px 18px;font-size:16px;font-weight:900;letter-spacing:.03em;
  color:#0A0A0B;background:#C9B37E;
  clip-path:polygon(14px 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%,0 14px);
  transition:transform .1s ease,background .15s;
  box-shadow:0 6px 22px rgba(201,179,126,.16);
}
.primary-btn:hover{background:#d8c493}
.primary-btn:active{transform:scale(.975)}
.primary-btn:focus-visible{outline:2px solid #E8E4DA;outline-offset:3px}

.ghost-btn{
  width:100%;padding:11px 16px;font-size:13px;font-weight:700;color:#b7b1a8;
  border:1px solid rgba(201,179,126,.3);background:rgba(20,21,24,.7);
  clip-path:polygon(10px 0,100% 0,100% calc(100% - 10px),calc(100% - 10px) 100%,0 100%,0 10px);
  transition:color .15s,border-color .15s,background .15s;
}
.ghost-btn:hover{color:#E8E4DA;border-color:rgba(201,179,126,.6)}
.ghost-btn:active{transform:scale(.98)}
.ghost-btn.danger{color:#c9a3a5;border-color:rgba(193,18,31,.4)}
.ghost-btn.danger:hover{color:#E8E4DA;border-color:#C1121F}

.start-foot{
  margin-top:16px;display:flex;justify-content:center;gap:8px;
  font-size:11.5px;color:#7d7870;font-weight:500;
}
.start-foot b{color:#C9B37E;font-variant-numeric:tabular-nums}
.dot{color:#4a4741}

.ov-kicker{font-size:10px;letter-spacing:.28em;color:#C1121F;font-weight:700;margin-bottom:6px}
.ov-title{font-size:30px;font-weight:900;margin:0 0 6px;color:#E8E4DA;letter-spacing:.01em}
.ov-sub{font-size:13px;color:#9a948a;margin:0 0 20px;line-height:1.6;font-weight:500}

.result-grid{
  display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0 0 14px;
}
.result-cell{
  display:flex;flex-direction:column;gap:3px;padding:10px 12px;
  background:rgba(20,21,24,.8);border:1px solid rgba(201,179,126,.2);
  clip-path:polygon(9px 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%,0 9px);
  text-align:start;
}
.result-cell span{font-size:10.5px;color:#8d8880;font-weight:500}
.result-cell b{font-size:19px;font-weight:900;color:#C9B37E;font-variant-numeric:tabular-nums}
.best-line{
  font-size:12px;color:#8d8880;margin-bottom:16px;font-weight:500;
  display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;
}
.best-line b{color:#E8E4DA;font-variant-numeric:tabular-nums}
.save-state{font-size:10.5px;color:#5f5b55;width:100%;text-align:center;min-height:13px}

/* ------------------------- SHORT SCREENS ------------------------- */
@media (max-height:560px){
  #hud{padding:4px 8px;gap:3px}
  .hud-row{gap:5px}
  .hp-bar{height:8px}
  .chip{height:19px;padding:1px 5px}
  .chip b{font-size:11px}
  .chip-k{font-size:9px}
  .icon-btn{width:28px;height:28px}
  #controls{padding:4px 12px 7px;gap:8px}
  #stick{width:88px;height:88px}
  #knob{width:42px;height:42px;margin:-21px 0 0 -21px}
  .stick-ring{inset:10px}
  .fire-btn{width:64px;height:64px}
  .reload-btn{width:46px;height:46px}
  .btn-label{display:none}
  .reload-btn .glyph{width:20px;height:20px}
  .fire-btn .glyph{width:26px;height:26px}
  .banner-title{font-size:19px}
  .banner-kicker{font-size:9px;letter-spacing:.24em}
  .banner-sub{font-size:10.5px}
  .overlay{padding:12px}
  .overlay-over{padding-top:12px}
  .brand{margin-bottom:12px}
  .brand-story{font-size:12px;line-height:1.6}
  .ctrl-list{padding:9px;gap:6px;margin-bottom:12px}
  .ctrl-list li{font-size:11px}
  .primary-btn{padding:11px 14px;font-size:14px}
  .ghost-btn{padding:8px 12px;font-size:11.5px}
  .result-cell{padding:7px 9px}
  .result-cell b{font-size:15px}
  .ov-title{font-size:22px}
}

/* ---- very short play areas (editor preview, landscape phones) ---- */
@media (max-height:430px){
  #hud{flex-direction:row;align-items:center;gap:6px;padding:3px 7px}
  .hud-row{flex:1 1 auto;gap:5px;min-width:0}
  .hud-row-2{flex:0 0 auto;gap:4px}
  .hp-wrap{gap:4px}
  .hp-label{font-size:9px;letter-spacing:.06em}
  .hp-bar{height:7px}
  .hp-num{font-size:10px;min-width:20px}
  .chip{
    height:18px;padding:0 5px;gap:3px;border-radius:3px;clip-path:none;
  }
  .chip-k{display:none}
  .score-chip{min-width:0}
  .score-chip .chip-k{display:inline;font-size:9px}
  .chip b,.score-chip b{font-size:11px}
  .ammo-chip b#magNum{font-size:12px}
  .ammo-chip #resNum{font-size:9.5px}
  .icon-btn{width:26px;height:26px;border-radius:4px;clip-path:none}
  #controls{padding:3px 14px 6px;gap:8px;align-items:center}
  .action-group{flex-direction:row;align-items:center;gap:9px}
  #stick{width:66px;height:66px}
  #knob{width:30px;height:30px;margin:-15px 0 0 -15px}
  #knob svg{width:18px;height:18px}
  .stick-ring{inset:7px}
  .fire-btn{width:54px;height:54px}
  .reload-btn{width:46px;height:46px}
  .fire-btn .glyph{width:24px;height:24px}
  .reload-btn .glyph{width:19px;height:19px}
  .btn-label{display:none}
  #bossBar{top:3px;width:min(240px,62%)}
  .boss-name{font-size:8.5px;margin-bottom:2px}
  .boss-track{height:6px}
  #banner{top:26%}
  .banner-kicker{font-size:8px;letter-spacing:.18em;margin-bottom:2px}
  .banner-title{font-size:15px}
  .banner-sub{font-size:9px;margin-top:2px}
  #reticle svg{width:32px;height:32px}
  #lockMarker{width:20px;height:20px;margin:-10px 0 0 -10px}
}
@media (max-width:360px){
  .chip-k{display:none}
  .hp-num{display:none}
  #stick{width:104px;height:104px}
  #knob{width:48px;height:48px;margin:-24px 0 0 -24px}
  .fire-btn{width:76px;height:76px}
}
@media (prefers-reduced-motion: reduce){
  #lowhp{animation:none;opacity:.35}
  .overlay{animation:none}
}