:root {
  --bg: #050608;
  --panel: rgba(8, 12, 18, 0.78);
  --panel-border: rgba(255,255,255,0.14);
  --text: #f2f5f8;
  --muted: #a7b0bc;
  --accent: #ffb347;
  --danger: #ff4d4d;
  --safe: #66d17a;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
button { font-family: inherit; cursor: pointer; }
#gameRoot { position: fixed; inset: 0; background: radial-gradient(circle at 70% 20%, #17202b, #030407 62%); }
#gameCanvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: flex-start; padding: 7vw; background: linear-gradient(90deg, rgba(0,0,0,0.82), rgba(0,0,0,0.26), rgba(0,0,0,0.5)); z-index: 20; }
.screen.active { display: flex; }
.panel { border: 1px solid var(--panel-border); background: var(--panel); backdrop-filter: blur(12px); box-shadow: 0 20px 80px rgba(0,0,0,0.5); padding: 32px; max-width: 560px; }
.panel.hero { min-width: min(560px, 88vw); }
.panel.wide { width: min(920px, 92vw); max-width: 920px; }
.panel.compact { width: min(420px, 92vw); }
.kicker { color: var(--accent); font-size: 12px; letter-spacing: 3px; font-weight: 700; margin-bottom: 10px; }
.kicker.danger { color: var(--danger); }
h1 { margin: 0 0 14px; font-size: clamp(52px, 8vw, 96px); line-height: 0.88; letter-spacing: -4px; }
h2 { margin: 0 0 18px; font-size: 30px; letter-spacing: -1px; }
.muted { color: var(--muted); line-height: 1.45; }
.tiny { color: var(--muted); font-size: 12px; }
.menuStack { display: grid; gap: 10px; margin: 26px 0 12px; }
button { border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: var(--text); padding: 14px 18px; text-align: left; font-weight: 800; letter-spacing: 1px; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
button:hover { transform: translateX(4px); background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.35); }
button.primary { background: rgba(255,179,71,0.20); border-color: rgba(255,179,71,0.65); }
button.ghost { background: transparent; }
.topRow { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.card { min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; }
.card strong { display: block; margin-bottom: 16px; }
.card span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
.card.selected { border-color: var(--accent); background: rgba(255,179,71,0.14); }
.attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.attachments label { display: flex; gap: 10px; align-items: center; border: 1px solid rgba(255,255,255,0.11); padding: 12px; background: rgba(255,255,255,0.05); }
.attachments label span { color: var(--muted); margin-left: auto; font-size: 12px; }
.statBox { border-top: 1px solid rgba(255,255,255,0.13); padding-top: 16px; color: var(--muted); display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; font-size: 12px; }
.statBox strong { color: var(--text); display: block; font-size: 18px; margin-top: 5px; }
.controlGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; }
.controlGrid span { color: var(--muted); }
.loadingBar { height: 8px; border: 1px solid rgba(255,255,255,0.2); margin-top: 24px; overflow: hidden; }
.loadingBar span { display: block; width: 20%; height: 100%; background: var(--accent); animation: load 1.2s infinite alternate ease-in-out; }
@keyframes load { to { width: 100%; } }
.hidden { display: none !important; }
.clickToPlay { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; background: rgba(0,0,0,0.28); text-align: center; }
.clickToPlay div { font-size: 40px; font-weight: 900; letter-spacing: 2px; }
.clickToPlay span { color: var(--muted); margin-top: 10px; }
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hudBlock { position: fixed; color: var(--text); text-shadow: 0 2px 5px #000; font-weight: 800; letter-spacing: 1px; }
.topCenter { top: 22px; left: 50%; transform: translateX(-50%); font-size: 18px; }
.bottomLeft { left: 26px; bottom: 24px; width: 240px; }
.bottomRight { right: 26px; bottom: 24px; text-align: right; }
.bottomRight strong { display: block; font-size: 34px; letter-spacing: -1px; }
.bottomRight span, .bottomLeft span { color: var(--muted); display: block; font-size: 12px; margin-bottom: 6px; }
.healthBar { height: 12px; border: 1px solid rgba(255,255,255,0.35); background: rgba(0,0,0,0.35); overflow: hidden; }
.healthBar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--danger), var(--safe)); transition: width 120ms ease; }
.crosshair { position: fixed; left: 50%; top: 50%; width: 28px; height: 28px; transform: translate(-50%, -50%); }
.crosshair span { position: absolute; background: rgba(255,255,255,0.86); box-shadow: 0 0 5px #000; }
.crosshair span:nth-child(1) { width: 2px; height: 8px; left: 13px; top: 0; }
.crosshair span:nth-child(2) { width: 2px; height: 8px; left: 13px; bottom: 0; }
.crosshair span:nth-child(3) { height: 2px; width: 8px; left: 0; top: 13px; }
.crosshair span:nth-child(4) { height: 2px; width: 8px; right: 0; top: 13px; }
.hitMarker { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 42px; font-weight: 900; color: white; text-shadow: 0 0 8px #000; animation: hit 150ms ease-out; }
@keyframes hit { from { transform: translate(-50%, -50%) scale(1.8); opacity: 1; } to { transform: translate(-50%, -50%) scale(1); opacity: 0.7; } }
.killFeed { position: fixed; right: 24px; top: 70px; width: 300px; display: grid; gap: 8px; text-align: right; }
.killFeed div { background: rgba(0,0,0,0.36); border-right: 3px solid var(--accent); padding: 8px 10px; font-size: 13px; animation: fadeKill 3s forwards; }
@keyframes fadeKill { 0% { opacity: 0; transform: translateX(16px); } 15%, 75% { opacity: 1; transform: translateX(0); } 100% { opacity: 0; transform: translateX(16px); } }
.damageVignette { position: fixed; inset: 0; background: radial-gradient(circle, transparent 40%, rgba(255,0,0,0.35)); animation: damageFlash 350ms forwards; }
@keyframes damageFlash { to { opacity: 0; } }
@media (max-width: 760px) {
  .screen { padding: 20px; }
  .cards, .attachments, .statBox { grid-template-columns: 1fr; }
  h1 { letter-spacing: -2px; }
  .bottomRight strong { font-size: 26px; }
}


.mobileControls { position: fixed; inset: 0; z-index: 12; pointer-events: none; touch-action: none; }
.moveStick { position: fixed; left: max(24px, env(safe-area-inset-left)); bottom: calc(34px + env(safe-area-inset-bottom)); width: 116px; height: 116px; border-radius: 999px; border: 2px solid rgba(255,255,255,0.24); background: rgba(0,0,0,0.28); pointer-events: none; }
.moveStick div { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 999px; background: rgba(255,255,255,0.30); border: 1px solid rgba(255,255,255,0.42); transform: translate(-50%, -50%); }
.mobileLookHint { position: fixed; right: 18px; top: 52%; transform: translateY(-50%); color: rgba(255,255,255,0.35); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.touchBtn { position: fixed; width: 76px; height: 76px; border-radius: 999px; padding: 0; text-align: center; font-size: 12px; background: rgba(8,12,18,0.58); border: 1px solid rgba(255,255,255,0.28); color: white; pointer-events: auto; touch-action: none; display: flex; align-items: center; justify-content: center; }
.touchBtn:active { transform: scale(0.95); background: rgba(255,179,71,0.25); }
.touchBtn.fire { right: max(24px, env(safe-area-inset-right)); bottom: calc(38px + env(safe-area-inset-bottom)); width: 96px; height: 96px; border-color: rgba(255,179,71,0.65); }
.touchBtn.aim { right: calc(max(24px, env(safe-area-inset-right)) + 108px); bottom: calc(70px + env(safe-area-inset-bottom)); }
.touchBtn.jump { right: calc(max(24px, env(safe-area-inset-right)) + 54px); bottom: calc(154px + env(safe-area-inset-bottom)); }
.touchBtn.reload { right: max(24px, env(safe-area-inset-right)); bottom: calc(146px + env(safe-area-inset-bottom)); }
.touchBtn.slide { left: calc(max(24px, env(safe-area-inset-left)) + 128px); bottom: calc(44px + env(safe-area-inset-bottom)); }
.touchBtn.pauseBtn { right: max(16px, env(safe-area-inset-right)); top: calc(16px + env(safe-area-inset-top)); width: 64px; height: 44px; border-radius: 10px; }
/* Mobile controls are shown/hidden by JavaScript. Do not hide them using pointer:fine,
   because iPad with a connected mouse can report a fine pointer while still needing touch controls. */
@media (max-width: 760px) {
  html, body { touch-action: none; -webkit-user-select: none; user-select: none; }
  .topCenter { top: calc(18px + env(safe-area-inset-top)); font-size: 15px; }
  .killFeed { display: none; }
  .bottomLeft { left: 20px; bottom: calc(160px + env(safe-area-inset-bottom)); width: 220px; }
  .bottomRight { right: 20px; bottom: calc(250px + env(safe-area-inset-bottom)); }
  .clickToPlay div { font-size: 34px; }
  .clickToPlay span { padding: 0 18px; }
}

/* Polished Edition upgrades */
#gameRoot::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 52%, transparent 0 38%, rgba(0,0,0,0.18) 78%, rgba(0,0,0,0.42) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 14%, transparent 84%, rgba(0,0,0,0.18));
  z-index: 2;
}
.panel {
  border-top: 1px solid rgba(255,255,255,0.28);
  background: linear-gradient(145deg, rgba(9,14,22,0.90), rgba(5,7,11,0.72));
}
.panel.hero::before {
  content: "ALPHA SURVIVAL SIM";
  display: block;
  color: rgba(255,255,255,0.34);
  font-size: 11px;
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.topLeft { top: 24px; left: 24px; min-width: 220px; }
.topLeft span { color: var(--muted); display: block; font-size: 11px; margin-bottom: 3px; }
.topLeft strong { display: block; font-size: 14px; }
.topLeft em { display: block; color: var(--accent); font-style: normal; font-size: 11px; margin-top: 4px; opacity: 0.92; }
.miniMap {
  position: fixed;
  left: 24px;
  top: 100px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.65), 0 8px 30px rgba(0,0,0,0.28);
}
.waveBanner {
  position: fixed;
  left: 50%;
  top: 118px;
  transform: translateX(-50%);
  padding: 12px 24px;
  border: 1px solid rgba(255,179,71,0.55);
  background: rgba(0,0,0,0.62);
  color: white;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px #000;
  animation: wavePop 1.6s forwards;
  z-index: 14;
}
@keyframes wavePop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.96); }
  18%, 78% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.98); }
}
#healthText { display: block; margin-top: 8px; color: rgba(255,255,255,0.8); font-size: 12px; letter-spacing: 2px; }
.reloadBar { height: 5px; width: 180px; margin-top: 8px; margin-left: auto; border: 1px solid rgba(255,255,255,0.22); background: rgba(0,0,0,0.42); overflow: hidden; }
.reloadBar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 50ms linear; }
#stanceText { display: block; color: rgba(255,255,255,0.70); font-style: normal; font-size: 11px; letter-spacing: 2px; margin-top: 6px; }
.crosshair::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 3px;
  background: rgba(255,255,255,0.95);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(255,255,255,0.85);
}
.card::after {
  content: "SELECT";
  display: block;
  margin-top: 10px;
  color: rgba(255,179,71,0.78);
  font-size: 10px;
  letter-spacing: 2px;
}
.card.selected::after { content: "EQUIPPED"; }
button.primary { box-shadow: inset 0 0 22px rgba(255,179,71,0.09), 0 0 24px rgba(255,179,71,0.05); }
button:active { transform: scale(0.99); }
@media (max-width: 760px) {
  .topLeft, .miniMap { display: none; }
  .waveBanner { top: calc(62px + env(safe-area-inset-top)); font-size: 12px; padding: 9px 14px; }
  .reloadBar { width: 130px; }
}

/* Pro controls additions */
.touchBtn.auto {
  right: 118px;
  bottom: 138px;
  width: 118px;
  border-color: rgba(60, 255, 150, 0.55);
  background: rgba(16, 68, 44, 0.72);
}
.touchBtn.auto:not(.active) {
  border-color: rgba(255,255,255,0.22);
  background: rgba(20,24,32,0.72);
  opacity: 0.72;
}
@media (max-width: 850px) {
  .touchBtn.auto { right: 94px; bottom: 112px; width: 100px; }
}
.multiplayerNote {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.28);
  border-radius: 10px;
}

/* Ridgefire V3 outdoor readability / real-game feel */
:root {
  --panel: rgba(8, 12, 18, 0.72);
  --accent: #ffbe55;
}
#gameRoot { background: linear-gradient(180deg, #96c9f2 0%, #c4dcae 52%, #5d7845 100%); }
.screen { background: linear-gradient(90deg, rgba(0,0,0,0.72), rgba(0,0,0,0.16), rgba(0,0,0,0.30)); }
.hudBlock, .killFeed div { backdrop-filter: blur(5px); }
.audioStatus {
  position: fixed;
  left: 50%;
  top: 54px;
  transform: translateX(-50%);
  z-index: 12;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.78);
  background: rgba(0,0,0,0.34);
  border: 1px solid rgba(255,255,255,0.13);
  padding: 5px 9px;
  text-shadow: 0 1px 3px #000;
}
.radioSubtitle {
  position: fixed;
  left: 50%;
  bottom: 102px;
  transform: translateX(-50%);
  max-width: min(680px, 90vw);
  padding: 10px 16px;
  border-left: 3px solid var(--accent);
  background: rgba(0,0,0,0.58);
  box-shadow: 0 10px 34px rgba(0,0,0,0.30);
  color: white;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-align: center;
  text-shadow: 0 2px 5px #000;
  animation: subtitleIn 180ms ease-out;
}
@keyframes subtitleIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.topCenter { background: rgba(0,0,0,0.32); border: 1px solid rgba(255,255,255,0.12); padding: 8px 16px; }
.bottomLeft, .bottomRight, .topLeft { background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.10); padding: 12px; }
@media (max-width: 760px) {
  .audioStatus { top: calc(48px + env(safe-area-inset-top)); font-size: 9px; }
  .radioSubtitle { bottom: calc(118px + env(safe-area-inset-bottom)); font-size: 12px; padding: 8px 12px; }
}

/* V5 mobile-first combat controls */
.touchBtn.autoReload {
  left: max(16px, env(safe-area-inset-left));
  top: calc(72px + env(safe-area-inset-top));
  width: 128px;
  height: 44px;
  border-radius: 10px;
  font-size: 10px;
  letter-spacing: 0.5px;
  border-color: rgba(110, 190, 255, 0.55);
  background: rgba(18, 48, 82, 0.72);
}
.touchBtn.autoReload:not(.active) {
  border-color: rgba(255,255,255,0.22);
  background: rgba(20,24,32,0.72);
  opacity: 0.72;
}
@media (max-width: 760px) {
  .touchBtn.autoReload { top: calc(54px + env(safe-area-inset-top)); width: 112px; height: 40px; }
}


/* Ridgefire V5 mobile-first combat upgrade */
.mobileControls::before {
  content: "AIM / SMART TRIGGER ZONE";
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  top: 42%;
  width: min(34vw, 240px);
  height: 26vh;
  border-radius: 22px;
  border: 1px dashed rgba(255,255,255,0.16);
  background: radial-gradient(circle at 50% 50%, rgba(255,190,85,0.08), rgba(0,0,0,0.05) 62%, transparent 74%);
  color: rgba(255,255,255,0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-align: center;
  pointer-events: none;
}
.crosshair.locked span { background: #ffbe55; box-shadow: 0 0 10px rgba(255,190,85,0.95); }
.crosshair::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 46px; height: 46px;
  margin-left: -23px; margin-top: -23px;
  border-radius: 50%;
  border: 1px solid rgba(255,190,85,0.0);
  box-shadow: inset 0 0 0 1px rgba(255,190,85,0.0);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.crosshair.locked::after {
  border-color: rgba(255,190,85,0.75);
  box-shadow: 0 0 18px rgba(255,190,85,0.36), inset 0 0 12px rgba(255,190,85,0.16);
}
.touchBtn.auto { font-weight: 900; line-height: 1.05; }
.touchBtn.fire { opacity: 0.70; }
.mobileLookHint { opacity: 0.74; text-shadow: 0 2px 7px #000; }
@media (max-width: 760px) {
  .touchBtn.fire { width: 74px; height: 74px; right: max(18px, env(safe-area-inset-right)); bottom: calc(30px + env(safe-area-inset-bottom)); }
  .touchBtn.auto { right: calc(max(18px, env(safe-area-inset-right)) + 82px); bottom: calc(30px + env(safe-area-inset-bottom)); width: 118px; height: 62px; border-radius: 16px; }
  .touchBtn.aim { right: calc(max(18px, env(safe-area-inset-right)) + 38px); bottom: calc(104px + env(safe-area-inset-bottom)); width: 70px; height: 62px; border-radius: 16px; }
  .touchBtn.reload { right: max(18px, env(safe-area-inset-right)); bottom: calc(104px + env(safe-area-inset-bottom)); width: 70px; height: 62px; border-radius: 16px; }
  .touchBtn.jump { right: max(18px, env(safe-area-inset-right)); bottom: calc(174px + env(safe-area-inset-bottom)); width: 66px; height: 58px; border-radius: 16px; }
  .touchBtn.slide { left: calc(max(24px, env(safe-area-inset-left)) + 128px); bottom: calc(44px + env(safe-area-inset-bottom)); width: 78px; height: 56px; border-radius: 16px; }
  .moveStick { width: 128px; height: 128px; background: rgba(0,0,0,0.34); }
  .moveStick div { width: 52px; height: 52px; }
  .mobileControls::before { right: 16px; top: 35%; width: 37vw; height: 26vh; }
}
@media (orientation: portrait) and (max-width: 900px) {
  .mobileControls::after {
    content: "Rotate device for best play";
    position: fixed;
    left: 50%; top: 18%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.62);
    border: 1px solid rgba(255,255,255,0.16);
    padding: 9px 13px;
    border-radius: 10px;
    color: white;
    font-size: 12px;
    letter-spacing: 1px;
    pointer-events: none;
  }
}


/* Ridgefire V6 clean mobile/tablet HUD fix
   - Removes the confusing white aim-zone circle.
   - Moves the minimap away from the joystick on touch devices.
   - Makes manual fire clearly secondary because Smart Fire is the main mobile shooting method. */
.touchDevice .mobileControls::before,
.mobileControls::before {
  display: none !important;
  content: none !important;
}
.touchDevice .mobileLookHint {
  right: max(18px, env(safe-area-inset-right));
  top: 30%;
  opacity: 0.52;
  font-size: 10px;
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 5px 8px;
  border-radius: 999px;
}
.touchDevice .miniMap {
  display: block !important;
  left: auto !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  top: calc(72px + env(safe-area-inset-top)) !important;
  width: 112px !important;
  height: 112px !important;
  border-radius: 12px;
  opacity: 0.86;
  background: rgba(4,10,9,0.42);
  z-index: 11;
}
.touchDevice .killFeed,
.touchDevice .topLeft {
  display: none !important;
}
.touchDevice .moveStick {
  left: max(18px, env(safe-area-inset-left)) !important;
  bottom: calc(26px + env(safe-area-inset-bottom)) !important;
  width: 124px !important;
  height: 124px !important;
  z-index: 16;
}
.touchDevice .moveStick div {
  width: 50px !important;
  height: 50px !important;
}
.touchDevice .touchBtn.slide {
  left: calc(max(18px, env(safe-area-inset-left)) + 134px) !important;
  bottom: calc(32px + env(safe-area-inset-bottom)) !important;
  width: 76px !important;
  height: 54px !important;
  border-radius: 16px !important;
}
.touchDevice .bottomLeft {
  left: max(16px, env(safe-area-inset-left)) !important;
  bottom: calc(164px + env(safe-area-inset-bottom)) !important;
  width: min(220px, 42vw) !important;
  padding: 9px !important;
}
.touchDevice .bottomRight {
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: calc(240px + env(safe-area-inset-bottom)) !important;
  padding: 9px !important;
}
.touchDevice .touchBtn.fire {
  width: 64px !important;
  height: 52px !important;
  right: max(18px, env(safe-area-inset-right)) !important;
  bottom: calc(28px + env(safe-area-inset-bottom)) !important;
  border-radius: 14px !important;
  opacity: 0.54 !important;
  font-size: 9px !important;
  line-height: 1.05 !important;
  background: rgba(8,12,18,0.46) !important;
}
.touchDevice .touchBtn.auto {
  right: calc(max(18px, env(safe-area-inset-right)) + 74px) !important;
  bottom: calc(28px + env(safe-area-inset-bottom)) !important;
  width: 130px !important;
  height: 52px !important;
  border-radius: 14px !important;
  font-size: 10px !important;
  line-height: 1.05 !important;
}
.touchDevice .touchBtn.aim {
  right: calc(max(18px, env(safe-area-inset-right)) + 78px) !important;
  bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  width: 64px !important;
  height: 56px !important;
  border-radius: 14px !important;
}
.touchDevice .touchBtn.reload {
  right: max(18px, env(safe-area-inset-right)) !important;
  bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  width: 64px !important;
  height: 56px !important;
  border-radius: 14px !important;
}
.touchDevice .touchBtn.jump {
  right: max(18px, env(safe-area-inset-right)) !important;
  bottom: calc(158px + env(safe-area-inset-bottom)) !important;
  width: 64px !important;
  height: 54px !important;
  border-radius: 14px !important;
}
.touchDevice .touchBtn.autoReload {
  left: max(16px, env(safe-area-inset-left)) !important;
  top: calc(58px + env(safe-area-inset-top)) !important;
  width: 120px !important;
  height: 38px !important;
  border-radius: 10px !important;
}
@media (orientation: landscape) and (max-height: 520px) {
  .touchDevice .miniMap {
    top: calc(58px + env(safe-area-inset-top)) !important;
    width: 92px !important;
    height: 92px !important;
  }
  .touchDevice .bottomRight {
    display: none !important;
  }
  .touchDevice .bottomLeft {
    bottom: calc(144px + env(safe-area-inset-bottom)) !important;
    width: 180px !important;
  }
  .touchDevice .radioSubtitle {
    bottom: calc(96px + env(safe-area-inset-bottom)) !important;
  }
}
@media (orientation: portrait) and (max-width: 900px) {
  .touchDevice .miniMap {
    top: calc(108px + env(safe-area-inset-top)) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    width: 96px !important;
    height: 96px !important;
  }
  .touchDevice .moveStick {
    bottom: calc(22px + env(safe-area-inset-bottom)) !important;
  }
}


/* Ridgefire V7 arsenal additions */
.arsenalCards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dangerCard { border-color: rgba(255,95,55,0.42); }
.dangerCard.selected { border-color: rgba(255,95,55,0.85); background: rgba(255,95,55,0.13); }
.statBox { grid-template-columns: repeat(6, 1fr); }
.touchBtn.grenade {
  right: calc(max(18px, env(safe-area-inset-right)) + 150px);
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 82px;
  height: 56px;
  border-radius: 14px;
  font-size: 10px;
  border-color: rgba(158,208,255,0.62);
  background: rgba(23,57,92,0.72);
}
.touchBtn.grenade:active { background: rgba(90,155,230,0.35); }
.touchDevice .touchBtn.grenade {
  right: calc(max(18px, env(safe-area-inset-right)) + 150px) !important;
  bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  width: 78px !important;
  height: 56px !important;
  border-radius: 14px !important;
  font-size: 9px !important;
}
@media (max-width: 760px) {
  .arsenalCards { grid-template-columns: 1fr; }
  .statBox { grid-template-columns: repeat(2, 1fr); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .touchDevice .touchBtn.grenade {
    right: calc(max(18px, env(safe-area-inset-right)) + 146px) !important;
    bottom: calc(86px + env(safe-area-inset-bottom)) !important;
    width: 70px !important;
    height: 48px !important;
  }
}

/* Ridgefire V8 campaign / save system */
.scrollPanel { max-height: min(86vh, 820px); overflow-y: auto; }
.levelGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.levelCard { min-height: 132px; display: grid; gap: 8px; text-align: left; align-content: start; }
.levelCard strong { font-size: 17px; letter-spacing: 0.5px; }
.levelCard span { color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: 1.5px; }
.levelCard em { color: var(--muted); font-style: normal; line-height: 1.35; font-size: 13px; }
.levelCard b { margin-top: 4px; color: rgba(255,255,255,0.88); font-size: 11px; letter-spacing: 2px; }
.levelCard.completed { border-color: rgba(102,209,122,0.55); background: rgba(102,209,122,0.09); }
.levelCard.locked { opacity: 0.46; filter: grayscale(0.7); cursor: not-allowed; }
.scoresList { display: grid; gap: 10px; margin: 14px 0 18px; }
.scoreSummary { display: inline-grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); padding: 12px; margin-right: 8px; }
.scoreSummary strong { font-size: 24px; color: var(--accent); }
.scoreSummary span { color: var(--muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.scoresList h3 { margin: 16px 0 6px; }
.scoresList div:not(.scoreSummary) { border-left: 3px solid var(--accent); padding: 8px 10px; background: rgba(0,0,0,0.24); }
.scoresList div:not(.scoreSummary) span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.smallStack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#missionProgressText { color: #fff; opacity: 0.95; }
@media (max-width: 760px) {
  .levelGrid, .smallStack { grid-template-columns: 1fr; }
  .scrollPanel { max-height: 88vh; padding: 20px; }
  .levelCard { min-height: 112px; }
}

/* V9 Frontier Ops: premium mobile-first polish + third-person/vehicle controls */
:root {
  --accent: #f2b84b;
  --accent2: #7fd1ff;
  --danger: #ff4d4d;
  --safe: #57d587;
}
.panel.hero h1,
.panel h2 {
  text-shadow: 0 12px 34px rgba(0,0,0,0.55), 0 0 28px rgba(242,184,75,0.08);
}
.panel.hero::before { content: "FRONTIER OPS FIELD BUILD"; }
.menuStack button,
.card,
.levelCard {
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,0.075), rgba(255,255,255,0.018));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.09), 0 18px 45px rgba(0,0,0,0.12);
}
.menuStack button:hover,
.card:hover,
.levelCard:hover {
  border-color: rgba(242,184,75,0.48);
  background: linear-gradient(145deg, rgba(242,184,75,0.12), rgba(255,255,255,0.025));
}
.hudBlock {
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(4,7,10,0.64), rgba(7,12,19,0.38));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 18px 44px rgba(0,0,0,0.24);
}
#viewModeText { color: var(--accent2) !important; }
#vehicleText { color: #ffe6a6 !important; }
.crosshair.locked span,
.crosshair.locked::after {
  background: rgba(116,255,172,0.96);
  box-shadow: 0 0 10px rgba(116,255,172,0.9);
}
.touchBtn.viewBtn {
  left: calc(max(18px, env(safe-area-inset-left)) + 216px);
  bottom: calc(32px + env(safe-area-inset-bottom));
  width: 72px;
  height: 54px;
  border-radius: 14px;
  font-size: 10px;
  border-color: rgba(127,209,255,0.58);
  background: rgba(15,45,68,0.72);
}
.touchBtn.vehicleBtn {
  left: calc(max(18px, env(safe-area-inset-left)) + 296px);
  bottom: calc(32px + env(safe-area-inset-bottom));
  width: 86px;
  height: 54px;
  border-radius: 14px;
  font-size: 10px;
  border-color: rgba(242,184,75,0.62);
  background: rgba(76,52,14,0.72);
}
.touchBtn.viewBtn:active,
.touchBtn.vehicleBtn:active { background: rgba(242,184,75,0.28); }
.touchDevice .touchBtn.viewBtn {
  left: calc(max(18px, env(safe-area-inset-left)) + 216px) !important;
  bottom: calc(32px + env(safe-area-inset-bottom)) !important;
  width: 72px !important;
  height: 54px !important;
}
.touchDevice .touchBtn.vehicleBtn {
  left: calc(max(18px, env(safe-area-inset-left)) + 296px) !important;
  bottom: calc(32px + env(safe-area-inset-bottom)) !important;
  width: 86px !important;
  height: 54px !important;
}
@media (orientation: landscape) and (max-height: 520px) {
  .touchDevice .touchBtn.viewBtn {
    left: calc(max(18px, env(safe-area-inset-left)) + 206px) !important;
    width: 64px !important;
    height: 48px !important;
  }
  .touchDevice .touchBtn.vehicleBtn {
    left: calc(max(18px, env(safe-area-inset-left)) + 276px) !important;
    width: 78px !important;
    height: 48px !important;
  }
}
@media (max-width: 760px) {
  .touchDevice .topCenter { font-size: 13px; letter-spacing: 1px; }
  .touchDevice #audioStatus { top: calc(36px + env(safe-area-inset-top)); transform: translateX(-50%) scale(0.92); }
  .touchDevice .bottomLeft { backdrop-filter: blur(6px); }
  .touchDevice .clickToPlay div { font-size: 30px; }
}

/* V10: clean third-person + controller/vehicle polish */
.crosshair::after,
.crosshair.locked::after,
.thirdPersonMode .crosshair::after,
.vehicleMode .crosshair::after {
  display: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
.thirdPersonMode .crosshair,
.vehicleMode .crosshair {
  width: 18px !important;
  height: 18px !important;
  opacity: 0.78;
}
.thirdPersonMode .crosshair span,
.vehicleMode .crosshair span {
  background: rgba(255,255,255,0.85) !important;
  box-shadow: 0 0 6px rgba(0,0,0,0.6) !important;
}
.thirdPersonMode .crosshair.locked span,
.vehicleMode .crosshair.locked span {
  background: rgba(242,184,75,0.94) !important;
  box-shadow: 0 0 8px rgba(242,184,75,0.65) !important;
}
#controllerStatus { color: #9be7ff !important; }
.gamepadConnected #controllerStatus { color: #75ffab !important; }
.gamepadConnected .panel.hero::after {
  content: "Controller detected";
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: rgba(155,231,255,0.95);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.vehicleMode .bottomRight::after {
  content: "Vehicle mode: steer with left stick / WASD";
  display: block;
  margin-top: 6px;
  color: rgba(255,230,166,0.9);
  font-size: 10px;
}
.touchDevice.thirdPersonMode .mobileLookHint,
.touchDevice.vehicleMode .mobileLookHint {
  opacity: 0.30;
}


/* V13 foundation and go-live polish */
.upgradePanel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 18px; }
.upgradeCard { min-height: 116px; display: flex; flex-direction: column; gap: 8px; justify-content: space-between; border-left: 3px solid rgba(255,179,71,0.65); }
.upgradeCard.maxed { border-color: rgba(102,209,122,0.7); background: rgba(102,209,122,0.08); }
.upgradeCard small { color: var(--muted); line-height: 1.35; }
.scoreSummary { display: inline-grid; min-width: 150px; margin: 0 10px 10px 0; border: 1px solid rgba(255,255,255,0.12); padding: 12px; background: rgba(255,255,255,0.055); }
.scoreSummary strong { font-size: 24px; }
.dailyBadge { display: inline-block; margin: 8px 8px 0 0; padding: 7px 10px; border: 1px solid rgba(255,179,71,0.42); background: rgba(255,179,71,0.10); color: #ffd190; font-weight: 800; font-size: 12px; letter-spacing: 1px; }
.crosshair.locked span { background: rgba(102,209,122,0.96); box-shadow: 0 0 8px rgba(102,209,122,0.8), 0 0 4px #000; }
@media (max-width: 760px), (pointer: coarse) {
  .upgradePanel { grid-template-columns: 1fr; }
  .menuStack button { min-height: 48px; }
}

/* ── V12: Challenge Screen ─────────────────────────────── */
.challenge-target-score {
  font-size: clamp(2.4rem, 10vw, 4.2rem);
  font-weight: 900;
  color: #f5a623;
  letter-spacing: 0.04em;
  margin: 0.3em 0;
  text-shadow: 0 2px 18px rgba(245,166,35,0.45);
}
.challenge-result {
  font-size: 0.95rem;
  color: #a8b8c8;
  min-height: 1.4em;
  margin-top: 0.2em;
}
.challenge-result.challengeWin {
  color: #5ee87a;
  font-weight: 700;
}
.challenge-result.challengeClose {
  color: #f5c842;
}

/* ── V12: iOS install hint ─────────────────────────────── */
.ios-install-hint {
  font-size: 0.78rem;
  color: #7a8fa0;
  margin-top: 0.35em;
  padding: 0.4em 0.8em;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.ios-install-hint strong { color: #b8cad8; }

.tinyLink{font-size:0.78rem;color:#cbd5e1;text-decoration:none;opacity:.75}.tinyLink:hover{opacity:1;text-decoration:underline}
