:root {
  --ink: #02070a;
  --sky: #030a10;
  --panel: rgba(3, 15, 17, .96);
  --panel-2: #06191a;
  --line: #0e4644;
  --green: #14f17a;
  --green-dim: #079653;
  --red: #f02b39;
  --amber: #ffc247;
  --blue: #2b91d7;
  --white: #ede9d7;
  --muted: #8aa3a4;
  --frame-width: min(100vw, calc((100dvh - 124px) * .5625), 520px);
  --surface-height: 100dvh;
  --icon-atlas: url('../images/generated/military-ui-atlas.png');
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.visuallyHidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--ink); }
html { touch-action: manipulation; }
body {
  min-height: 100dvh;
  overflow-x: hidden;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  color: var(--white);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  line-height: 1.5;
  display: grid;
  place-items: start center;
  background:
    radial-gradient(circle at 50% 25%, rgba(12, 54, 55, .18), transparent 44%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 4px),
    #020608;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
button, #gameCanvas { -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

#gameShell {
  position: relative;
  width: var(--frame-width);
  max-width: 100%;
  min-height: var(--surface-height);
  height: var(--surface-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: #02080b;
  border-inline: 1px solid rgba(20, 241, 122, .16);
  box-shadow: 0 0 80px rgba(0, 0, 0, .8);
}

.pixelIcon {
  display: inline-block;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  background-image: var(--icon-atlas);
  background-repeat: no-repeat;
  background-size: 400% 400%;
  image-rendering: pixelated;
}
.iconScore { background-position: 0 0; }
.iconWave { background-position: 33.333% 0; }
.iconCity { background-position: 66.666% 0; }
.iconMultiplier { background-position: 100% 0; }
.iconMissile { background-position: 0 33.333%; }
.iconRadar { background-position: 33.333% 33.333%; }
.iconLauncher { background-position: 66.666% 33.333%; }
.iconShield { background-position: 100% 33.333%; }
.iconExplosion { background-position: 0 66.666%; }
.iconRepair { background-position: 33.333% 66.666%; }
.iconUpgrade { background-position: 66.666% 66.666%; }
.iconStore { background-position: 100% 66.666%; }
.iconSettings { background-position: 0 100%; }
.iconSound { background-position: 33.333% 100%; }
.iconMusic { background-position: 66.666% 100%; }
.iconShare { background-position: 100% 100%; }
.iconCurrency, .iconLeaderboard { background-position: 0 0; }
.iconAmmo { background-position: 0 33.333%; }

.shellAction {
  position: absolute;
  inset-block-start: max(10px, env(safe-area-inset-top));
  inset-inline-end: 10px;
  z-index: 30;
}
.iconButton, .closeButton {
  border: 1px solid var(--green-dim);
  background: rgba(3, 19, 18, .88);
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 5px;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(20, 241, 122, .08);
}
.iconButton:hover { border-color: var(--green); }

#startMenuContainer {
  width: 100%;
  min-height: 100%;
  height: 100%;
  overflow-y: auto;
  padding: clamp(54px, 9vh, 82px) 18px 22px;
  padding-block-start: max(clamp(54px, 9vh, 82px), calc(env(safe-area-inset-top) + 48px));
  padding-block-end: max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  background:
    linear-gradient(180deg, transparent 0 55%, rgba(6, 35, 28, .65) 100%),
    radial-gradient(circle at 50% 34%, rgba(20, 241, 122, .09), transparent 34%);
}
.brandMark { width: 88px; height: 37px; display: flex; align-items: end; justify-content: center; gap: 5px; filter: drop-shadow(0 0 7px rgba(20,241,122,.35)); }
.brandMark span { width: 18px; background: var(--green); clip-path: polygon(50% 0, 100% 42%, 72% 42%, 72% 100%, 28% 100%, 28% 42%, 0 42%); }
.brandMark span:nth-child(1) { height: 25px; }.brandMark span:nth-child(2) { height: 37px; }.brandMark span:nth-child(3) { height: 25px; }
.eyebrow { margin: 0; color: var(--green); letter-spacing: .12em; font-size: 13px; }
#mainTitle { margin: 0; color: var(--white); font-size: clamp(30px, 9vw, 45px); line-height: 1.25; text-shadow: 3px 3px 0 #073d2c; }
.startBrief { max-width: 330px; margin: 0 0 10px; color: var(--muted); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 13px; }
#difficultySelection { width: 100%; max-width: 410px; padding: 13px; border: 1px solid var(--line); background: rgba(2, 11, 13, .88); box-shadow: inset 0 0 24px rgba(14,70,68,.18); }
#difficultySelection h2 { margin: 0 0 10px; color: var(--amber); font-size: 17px; font-weight: 400; }
.difficultyGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.difficulty-button {
  min-width: 0;
  min-height: 56px;
  padding: 7px 3px;
  border: 1px solid #1e5752;
  border-radius: 2px;
  color: var(--muted);
  background: #061314;
  cursor: pointer;
}
.difficulty-button strong, .difficulty-button small { display: block; font-weight: 400; }
.difficulty-button strong { color: var(--white); font-size: 13px; }
.difficulty-button small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.difficulty-button.selected { border-color: var(--green); background: rgba(8, 73, 47, .38); box-shadow: inset 0 0 10px rgba(20,241,122,.18), 0 0 8px rgba(20,241,122,.12); }
.difficulty-button.selected strong { color: var(--green); }

.primaryButton, .secondaryButton, .buyButton, .settingToggle, .textButton {
  min-height: 44px;
  border: 1px solid var(--green-dim);
  border-radius: 3px;
  background: #061b17;
  color: var(--white);
  cursor: pointer;
  padding: 8px 15px;
}
.primaryButton { color: #00120a; background: var(--green); border-color: #69ffa9; box-shadow: 0 0 12px rgba(20,241,122,.25), inset 0 -3px 0 rgba(0,0,0,.25); font-size: 18px; }
#actualStartButton { width: min(100%, 410px); margin-top: 3px; }
.mainModeActions { width: min(100%, 410px); display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 3px; }
.mainModeActions #actualStartButton { width: 100%; margin: 0; display: grid !important; place-content: center; min-height: 64px; }
.mainModeActions #actualStartButton span { font-size: 17px; }
.mainModeActions #actualStartButton small { font-size: 9px; color: #b8f5c5; }
.duelEntryButton { min-width: 0; min-height: 64px; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: 1fr auto; gap: 1px 6px; align-items: center; padding: 7px; color: var(--white); text-align: start; }
.duelEntryButton strong, .duelEntryButton small { display: block; }
.duelEntryButton strong { color: var(--green); font-size: 15px; }
.duelEntryButton small { color: var(--muted); font-size: 9px; }
.duelEntryButton b { grid-column: 2; color: var(--amber); font-size: 9px; font-weight: 400; }
.duelEntryButton.secondaryButton { border-color: var(--green-dim); background: #061516; box-shadow: inset 0 0 0 1px rgba(20,241,122,.04); }
.duelEntryButton .pixelIcon { grid-row: 1 / 3; width: 30px; height: 30px; }
.duelEntryButton strong { color: var(--green); }
.secondaryButton { background: #061516; }
.textButton { border-color: transparent; background: transparent; color: var(--muted); padding-inline: 8px; display: inline-flex; align-items: center; gap: 5px; }
.textButton .pixelIcon { width: 22px; height: 22px; }
.startEconomySummary { width:min(100%,410px); display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; color:var(--white); }
.startStat { min-width:0; min-height:58px; display:flex; align-items:center; justify-content:center; gap:6px; padding:6px 4px; border:1px solid var(--line); background:linear-gradient(180deg,#07191a,#041011); }
.startStat .pixelIcon { width:27px;height:27px }.startStat .coinIcon{width:22px;height:22px}.startStat small,.startStat strong{display:block;white-space:nowrap}.startStat small{color:var(--muted);font-size:8px}.startStat strong{color:var(--white);font-size:14px;font-weight:400}.startStat:first-child strong{color:var(--amber)}.startStat:nth-child(2) strong{color:var(--green)}.startStat:nth-child(3) strong{color:var(--blue)}
.economyValue { display:flex; align-items:center; gap:5px; }
.coinIcon { position:relative; display:inline-block; flex:0 0 auto; width:20px; height:20px; background:var(--amber); border:2px solid #fff0a3; clip-path:polygon(25% 0,75% 0,100% 25%,100% 75%,75% 100%,25% 100%,0 75%,0 25%); box-shadow:inset 0 0 0 4px #b66812; }
.startLinks { display: flex; align-items: center; justify-content: center; gap: 4px; }
.profilePanel{width:min(100%,410px);border:1px solid var(--line);background:#041113;text-align:start}.profilePanel summary{min-height:54px;display:flex;align-items:center;gap:9px;padding:6px 10px;cursor:pointer;color:var(--green);list-style:none}.profilePanel summary::marker{content:''}.profilePanel summary::-webkit-details-marker{display:none}.profilePanel summary::after{content:'+';margin-inline-start:5px;color:var(--muted);font-size:18px}.profilePanel[open] summary::after{content:'−'}.profilePanel summary strong{margin-inline-start:auto;color:var(--white);font-size:11px}.profilePanel[open] summary{border-bottom:1px solid var(--line)}.profileAvatarIcon{width:38px;height:38px;flex:0 0 auto;background:url('../icons/profile-commander.svg') center/contain no-repeat;filter:drop-shadow(0 0 4px rgba(20,241,122,.32))}#profileIdentity{display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:9px;color:var(--muted);font-size:10px}#profileIdentity .tomanWallet{grid-column:1/-1;padding:6px;border:1px dashed #6f5317;color:var(--amber)}#profileForm{display:grid;grid-template-columns:1fr;gap:6px;padding:0 9px 9px}#profileForm label{color:var(--muted);font-size:9px}#profileForm input{display:block;width:100%;height:39px;margin-top:2px;border:1px solid var(--line);background:#061718;color:var(--white);padding:5px 8px}.profileFormActions{display:grid;grid-template-columns:2fr 1fr;gap:6px}.profileFormActions button{width:100%}#profileStatus{min-height:18px;margin:0;padding:0 9px 8px;color:var(--muted);font-size:10px;text-align:center}#profileStatus.success{color:var(--green)}#profileStatus.error{color:var(--red)}
#installPwaButton, #leaderboardContainer, #leaderboardViewMoreContainer { display: none; }

#uiContainer {
  display: none;
  min-height: calc(60px + env(safe-area-inset-top));
  padding: 5px 7px;
  padding-block-start: max(5px, env(safe-area-inset-top));
  padding-inline-end: 48px;
  grid-template-columns: 1.25fr 1fr .65fr .7fr;
  gap: 2px;
  align-items: center;
  border-bottom: 1px solid var(--green-dim);
  background: rgba(1, 9, 12, .98);
  z-index: 5;
}
.hudItem { min-width: 0; display: flex; align-items: center; gap: 4px; padding: 2px; }
.hudItem .pixelIcon { width: 25px; height: 25px; }
.hudWave .pixelIcon { display: none; }
.hudItem small, .hudItem strong { display: block; white-space: nowrap; }
.hudItem small { color: var(--muted); font-size: 9px; line-height: 1.1; }
.hudItem strong { font-size: 14px; line-height: 1.15; font-weight: 400; color: var(--green); font-variant-numeric: tabular-nums; }
.hudWave strong { color: var(--red); }.hudMultiplier strong { color: var(--amber); }.hudCities strong { color: var(--white); }
#bonusIndicator { display: none; grid-column: 1/-1; color: var(--amber); text-align: center; font-size: 11px; line-height: 1; }
.hudEconomy { grid-column:1/-1; display:flex; align-items:center; justify-content:center; gap:15px; min-height:25px; padding-top:3px; border-top:1px dashed #16403c; font-size:11px; }
.hudEconomy .pixelIcon { width:20px;height:20px; }.hudEconomy strong{color:var(--amber);}.hudEconomy small{color:var(--muted);}
#economyConnectionStatus{margin-inline-start:auto;color:var(--green);font-size:9px}#economyConnectionStatus.offline{color:var(--red)}

#canvasContainer {
  position: relative;
  display: none;
  width: 100%;
  aspect-ratio: 9 / 16;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--sky);
  border-bottom: 1px solid var(--green-dim);
}
#canvasContainer::after, #duelBattlefield::after { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; border: 0 solid rgba(255, 45, 38, 0); box-shadow: inset 0 0 0 rgba(255, 32, 24, 0); }
@keyframes ground-impact-flash { 0% { opacity: .8; border-width: 8px; border-color: rgba(255,62,45,.75); box-shadow: inset 0 0 70px rgba(255,35,24,.42); } 35% { opacity: .3; } 100% { opacity: 0; border-width: 2px; } }
#canvasContainer.ground-impact::after, #duelBattlefield.ground-impact::after { animation: ground-impact-flash 340ms steps(4, end); }
@keyframes ground-hit-shake { 0%,100% { transform: translate(0,0); } 15% { transform: translate(-7px,3px); } 30% { transform: translate(6px,-4px); } 45% { transform: translate(-5px,-2px); } 60% { transform: translate(4px,3px); } 75% { transform: translate(-2px,1px); } }
#gameShell.ground-hit-shake { animation: ground-hit-shake 380ms steps(2, end); }
.reduced-effects #canvasContainer.ground-impact::after, .reduced-effects #duelBattlefield.ground-impact::after, .reduced-effects #gameShell.ground-hit-shake { animation: none; }
#gameCanvas { display: none; width: 100%; height: 100%; position: absolute; inset: 0; cursor: crosshair; image-rendering: pixelated; touch-action: none; }
.scanlines { pointer-events: none; position: absolute; inset: 0; z-index: 2; opacity: .14; background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(110,255,207,.1) 3px 4px); mix-blend-mode: screen; }
.reduced-effects .scanlines { display: none; }
@keyframes impact-shake { 0%,100% { transform: translate(0,0); } 25% { transform: translate(-3px,2px); } 50% { transform: translate(3px,-2px); } 75% { transform: translate(-2px,-1px); } }
#gameShell.impact-shake { animation: impact-shake 180ms steps(2, end); }
#gameShell.ground-hit-shake.impact-shake { animation: ground-hit-shake 380ms steps(2, end); }
.reduced-effects #gameShell.impact-shake, .reduced-effects #gameShell.ground-hit-shake.impact-shake { animation: none; }
#pauseOverlay { position: absolute; inset: 0; z-index: 10; display: none; place-items: center; background: rgba(0,6,8,.74); color: var(--amber); text-align: center; font-size: clamp(23px, 7vw, 35px); text-shadow: 2px 2px 0 #57220d; }
#pauseOverlay span { padding: 12px 16px; border-block: 1px solid var(--amber); }
#canvasContainer.screenShake { animation: screen-shake 160ms steps(2, end); }

/* Multiplayer Duel uses the same frame, HUD language, panels and controls as single-player. */
#duelScreen {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--sky);
  overflow: hidden;
  direction: rtl;
  user-select: none;
  touch-action: none;
}
#duelScreen.active { display: grid; }
body.duel-active #settingsButton { display: none; }
.duelHud {
  position: relative;
  z-index: 6;
  min-height: calc(60px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 1.15fr 1fr .9fr;
  gap: 4px;
  align-items: center;
  padding: 5px 7px;
  background: rgba(1, 9, 12, .98);
}
.duelHudEnemy { padding-block-start: max(5px, env(safe-area-inset-top)); border-bottom: 1px solid var(--red); }
.duelHudLocal { min-height: calc(60px + env(safe-area-inset-bottom)); padding-block-end: max(5px, env(safe-area-inset-bottom)); border-top: 1px solid var(--green-dim); }
.duelIdentity, .duelMetric { min-width: 0; display: flex; align-items: center; gap: 5px; padding: 2px; }
.duelIdentity > span:last-child, .duelMetric > span:last-child { min-width: 0; }
.duelIdentity .profileAvatarIcon { width: 30px; height: 30px; }
.duelMetric .pixelIcon { width: 25px; height: 25px; }
.duelIdentity small, .duelIdentity strong, .duelMetric small, .duelMetric strong, .duelMetric time { display: block; white-space: nowrap; }
.duelIdentity small, .duelMetric small { color: var(--muted); font-size: 8px; line-height: 1.1; }
.duelIdentity strong { max-width: 96px; overflow: hidden; color: var(--white); font-size: 12px; font-weight: 400; text-overflow: ellipsis; }
.duelHudEnemy .duelIdentity strong { color: #ff8a72; }
.duelHudLocal .duelIdentity strong { color: var(--green); }
#duelTimer { direction: ltr; color: var(--amber); font-size: 17px; font-variant-numeric: tabular-nums; }
.duelHp { direction: ltr; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; width: 76px; margin-top: 3px; }
.duelHp i { position: relative; height: 7px; border: 1px solid currentColor; background: #142226; overflow: hidden; }
.duelHp i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--hp-fill, 100%); background: currentColor; }
.duelHudEnemy .duelHp { color: var(--red); }
.duelHudLocal .duelHp { color: var(--green); }
#duelBattlefield { position: relative; min-height: 0; overflow: hidden; background: var(--sky); }
#duelCanvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
#duelNetworkNotice { position: absolute; z-index: 9; top: 12px; left: 50%; translate: -50% 0; max-width: 85%; padding: 5px 10px; border: 1px solid var(--amber); background: var(--panel); color: var(--amber); font-size: 11px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .15s; }
#duelNetworkNotice.visible { opacity: 1; }
.duelOverlay { position: absolute; z-index: 12; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0, 4, 6, .76); backdrop-filter: blur(3px); }
.duelOverlay[hidden] { display: none; }
.duelDialog { width: min(100%, 390px); display: grid; justify-items: center; gap: 9px; text-align: center; }
.duelDialogIcon { width: 52px; height: 52px; }
.duelDialog h2 { margin: 0; color: var(--green); font-size: 25px; font-weight: 400; }
.duelDialog p { max-width: 290px; margin: 0; color: var(--muted); font-size: 12px; }
.duelDialog > button { width: 100%; margin-top: 5px; }
.duelAmmo > span:last-child { min-width: 0; flex: 1; }
.duelAmmo strong { color: var(--amber); font-size: 16px; line-height: 1; }
.duelAmmo i { position: relative; display: block; width: 76px; height: 4px; margin-top: 4px; overflow: hidden; background: #142226; }
.duelAmmo b { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--green); transition: width .1s linear; }
.duelRewards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.duelRewards span { padding: 9px; border: 1px solid var(--line); background: var(--panel-2); }
.duelRewards small, .duelRewards strong { display: block; }
.duelRewards small { color: var(--muted); font-size: 9px; }
.duelRewards strong { color: var(--amber); font-size: 19px; }
.duelResultActions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; width: 100%; }
.duelResultActions button { min-height: 46px; }
#duelResultTitle.defeat { color: var(--red); }
#duelScreen.urgent #duelTimer { color: var(--red); animation: duel-urgent .7s steps(2) infinite; }
@keyframes duel-urgent { 50% { opacity: .55; } }

#mobileCommandBar { display: none; min-height: 63px; align-items: stretch; justify-content: space-between; background: #03100f; border-top: 1px solid #0b302f; padding: 5px 7px max(5px, env(safe-area-inset-bottom)); gap: 6px; z-index: 6; }
#specialWeaponsUI, #controlsContainer { display: none; align-items: stretch; gap: 5px; }
.weaponControl { position: relative; min-width: 64px; min-height: 50px; display: grid; grid-template-columns: 29px 1fr; grid-template-rows: 1fr 1fr; gap: 0 3px; align-items: center; border: 1px solid var(--line); border-radius: 3px; background: #061718; color: var(--white); padding: 3px 6px; cursor: pointer; }
.weaponControl .pixelIcon { grid-row: 1/3; width: 28px; height: 28px; }
.weaponLabel { font-size: 9px; color: var(--muted); white-space: nowrap; }.weaponCount { font-size: 15px; color: var(--amber); font-weight: 400; }
.weaponControl.armed { border-color: var(--red); box-shadow: inset 0 0 8px rgba(240,43,57,.35); }
.weaponControl.disabled { opacity: .35; }
#controlsContainer .iconButton { min-width: 49px; min-height: 50px; display: flex; flex-direction: column; gap: 2px; font-size: 8px; color: var(--muted); }
#ammoIndicator{min-width:94px;min-height:50px;display:flex;align-items:center;justify-content:center;gap:7px;border:1px solid var(--green-dim);background:#061718}#ammoIndicator .pixelIcon{width:30px;height:30px}#ammoIndicator small,#ammoIndicator strong{display:block}#ammoIndicator small{color:var(--muted);font-size:9px}#ammoIndicator strong{color:var(--amber);font-size:19px;line-height:1}
.pauseGlyph { width: 17px; height: 20px; border-inline: 5px solid var(--green); }
.restartGlyph { width: 20px; height: 20px; border: 3px solid var(--green); border-left-color: transparent; border-radius: 50%; position: relative; }
.restartGlyph::after { content: ''; position: absolute; left: -5px; top: -4px; border: 5px solid transparent; border-top-color: var(--green); transform: rotate(-35deg); }
#screenshotButton { display: none !important; }

.modalPanel {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  width: var(--frame-width);
  max-width: 100%;
  height: var(--surface-height);
  transform: translateX(-50%);
  z-index: 100;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 4, 6, .76);
  place-items: center;
  overflow: auto;
  backdrop-filter: blur(3px);
}
.modalContent { width: min(100%, 440px); max-height: calc(100dvh - 24px); overflow: auto; padding: 18px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 0 0 3px #02090b, 0 0 24px rgba(10, 96, 78, .3); }
.modalContent > h2 { margin: 0 0 12px; color: var(--green); font-size: 27px; font-weight: 400; text-align: center; }
#messageText { margin: 7px 0; color: var(--amber); font-size: 23px; text-align: center; }
.scoreCaption, .finalScore, .bestWave { display: block; }
.scoreCaption { color: var(--muted); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 12px; }
.finalScore { margin-top: 4px; color: var(--amber); font-size: 30px; line-height: 1.25; }
.bestWave { margin-top: 7px; color: var(--white); font-size: 15px; }
#messageSubText { margin: 4px 0; color: var(--white); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 13px; text-align: center; }
#messageBonusText { margin: 8px 0; color: var(--green); text-align: center; font-size: 14px; }
#messageBox[data-mode="game-over"] .modalContent { border-color: #79222a; }
#messageBox[data-mode="game-over"] h2 { color: var(--red); }
#gameOverCommander{display:none;align-items:center;gap:10px;margin:-4px 0 11px;padding:9px 11px;border-block:1px solid var(--line);background:linear-gradient(90deg,rgba(7,49,39,.62),rgba(4,19,21,.75));text-align:start}#gameOverCommander .profileAvatarIcon{width:42px;height:42px}#gameOverCommander>span:last-child{min-width:0;flex:1}#gameOverCommander small,#gameOverCommander strong,#gameOverCommander em{display:block}#gameOverCommander small{color:var(--muted);font-size:9px}#gameOverCommander strong{overflow:hidden;color:var(--green);font-size:16px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}#gameOverCommander em{color:var(--muted);font-size:9px;font-style:normal}#messageBox[data-mode="game-over"] #gameOverCommander{display:flex}
#gameOverRank { display: none; margin: 12px auto; width: 130px; padding: 7px; border: 1px dashed var(--line); text-align: center; color: var(--muted); }
#gameOverRank small, #gameOverRank strong { display: block; } #gameOverRank strong { color: var(--white); font-size: 18px; }
#gameOverEconomy{display:flex;justify-content:center;gap:8px;margin:8px 0}#gameOverEconomy>span{min-width:125px;padding:7px;border:1px solid var(--line);text-align:center}#gameOverEconomy small,#gameOverEconomy strong{display:block}#gameOverEconomy small{color:var(--muted);font-size:10px}#gameOverEconomy strong{color:var(--amber)}
#messageBox[data-mode="wave-complete"] #gameOverEconomy{display:none}
#statsContainer { display: none; margin: 12px 0; padding: 10px 0; border-block: 1px solid #193332; grid-template-columns: 1fr 1fr; gap: 5px 12px; color: var(--muted); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 11px; text-align: start; }
#statsContainer span { min-width: 0; overflow-wrap: anywhere; }
#scoreSubmission { display: none; margin-top: 10px; text-align: center; }
#scoreSubmission label { color: var(--amber); font-size: 13px; }
.submitRow { display: flex; gap: 5px; margin-top: 6px; }
#playerNameInput { min-width: 0; flex: 1; height: 44px; border: 1px solid var(--green-dim); background: #071313; color: var(--white); padding: 8px 10px; text-align: center; }
#submitScoreButton { min-width: 62px; border: 1px solid var(--green); background: #0a2a20; color: var(--green); }
#submissionStatus { min-height: 20px; margin-top: 5px; font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 11px; }
.messageBoxButtons { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.messageBoxButtons button { flex: 1 1 120px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.messageBoxButtons .pixelIcon { width: 23px; height: 23px; }
#messageBox[data-mode="wave-complete"] #messageScreenshotButton, #messageBox[data-mode="wave-complete"] #messageRestartButton, #messageBox[data-mode="wave-complete"] #gameOverMainMenuButton, #messageBox[data-mode="wave-complete"] #scoreSubmission, #messageBox[data-mode="wave-complete"] #statsContainer, #messageBox[data-mode="wave-complete"] #gameOverRank { display: none !important; }
#messageBox[data-mode="game-over"] #skipStoreButton { display: none !important; }

.storePanel { place-items: stretch center; padding: 0; }
.storePanel .modalContent { width: 100%; height: 100%; max-height: none; min-height: 0; display: flex; flex-direction: column; padding: max(13px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
.storeHeader { display: flex; justify-content: space-between; align-items: end; padding: 0 4px 9px; border-bottom: 1px solid var(--line); }
.storeHeader p, .storeHeader h2 { margin: 0; font-weight: 400; }.storeHeader p { color: var(--muted); font-size: 10px; }.storeHeader h2 { color: var(--green); font-size: 24px; }.storeHeader > strong { display: flex; align-items: center; gap: 4px; color: var(--amber); font-size: 16px; font-weight: 400; }
.storeHeader > strong .pixelIcon { width: 24px; height: 24px; }
#storeItemsContainer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; overflow: auto; padding: 8px 1px; }
.storeItem { min-height: 119px; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: 1fr auto; align-items: center; gap: 4px 7px; padding: 8px; border: 1px solid #0c4b3e; background: linear-gradient(145deg, rgba(8,48,35,.75), rgba(3,18,19,.92)); }
.storeItemIcon { width: 40px; height: 40px; grid-row: 1; }
.storeItemInfo { min-width: 0; }.storeItemInfo > * { display: block; }.storeItemInfo strong { color: var(--white); font-size: 13px; font-weight: 400; }.storeItemInfo span { font-size: 10px; }.itemStock,.itemLevel { color: var(--muted); }.itemCost { color: var(--amber); margin-top: 3px; }
.storeItemButtons { grid-column: 1/-1; display: flex; gap: 4px; justify-content: end; }
.buyButton { min-height: 35px; padding: 4px 12px; color: var(--green); font-size: 12px; }.buyMultipleButton { color: var(--blue); border-color: #176486; }
.buyButton:disabled { opacity: .28; filter: grayscale(1); cursor: not-allowed; }
.stickyAction { margin-top: auto; width: 100%; }
.storeTabs{display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:8px 2px}.storeTab{min-height:44px;border:1px solid var(--line);background:#051416;color:var(--muted)}.storeTab.active{border-color:var(--green);color:var(--green);background:#073021}
#storeNotice{min-height:25px;text-align:center;color:var(--muted);font-size:11px}#storeNotice.error{color:var(--red)}#storeNotice.success{color:var(--green)}.inlineMarketButton{margin-inline-start:8px;border:1px solid var(--amber);background:#2c1b04;color:var(--amber)}
.storeTabPanel{min-height:0;overflow:auto}.economyCatalog{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:4px 1px 8px}.economyCard{min-height:145px;display:grid;grid-template-columns:42px 1fr;grid-template-rows:1fr auto;gap:5px;padding:8px;border:1px solid #0c4b3e;background:linear-gradient(145deg,rgba(8,48,35,.75),rgba(3,18,19,.96))}.economyCard>.pixelIcon{width:40px;height:40px}.economyCard div>*{display:block}.economyCard strong{font-size:12px}.economyCard small{color:var(--muted);font-size:9px}.economyCard em{color:var(--blue);font-size:9px;font-style:normal}.economyBuyButton,.marketBuyButton{grid-column:1/-1;min-height:40px;border:1px solid var(--green);background:#08241c;color:var(--green);font-size:10px}.economyBuyButton .coinIcon{width:14px;height:14px;margin-inline-end:4px}.marketBuyButton{border-color:var(--amber);color:var(--amber);background:#271a05}.marketNotice{margin:0 2px 5px;color:var(--muted);font-size:10px}.productBadge{display:inline!important;color:#00170c;background:var(--green);padding:1px 3px;font-size:8px}.purchaseSuccess{animation:purchase-ok .35s steps(2)}@keyframes purchase-ok{50%{filter:brightness(1.8);transform:scale(.98)}}
.attemptCountdownLabel{text-align:center;color:var(--muted)}.attemptCountdownLabel strong{display:block;margin:8px;color:var(--amber);font-size:28px}

.compactModal .modalContent { width: min(100%, 390px); }
.panelHeading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }.panelHeading h2 { margin: 0; color: var(--green); font-size: 22px; font-weight: 400; }.closeButton { color: var(--red); font-size: 25px; line-height: 1; }
.settingsList { display: grid; gap: 7px; }
.settingRow { min-height: 59px; display: grid; grid-template-columns: 34px 1fr auto; grid-template-rows: auto auto; gap: 3px 8px; align-items: center; padding: 7px; border: 1px solid var(--line); background: #061213; }
.settingRow .pixelIcon { width: 31px; height: 31px; grid-row: 1/3; }.settingRow label { color: var(--white); font-size: 13px; }.settingToggle { min-height: 34px; padding: 4px 8px; color: var(--green); font-size: 11px; }
.settingRow input[type="range"] { grid-column: 2/4; width: 100%; accent-color: var(--green); }
.switchRow { grid-template-columns: 34px 1fr auto; grid-template-rows: 1fr; cursor: pointer; }.switchRow .pixelIcon { grid-row: 1; }.switchRow input { width: 42px; height: 22px; accent-color: var(--green); }
#settingsGameActions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}#settingsGameActions button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;font-size:12px}#settingsGameActions .restartGlyph{width:17px;height:17px}
#aboutGameModal p { color: var(--muted); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 14px; }
#aboutGameModal .primaryButton { width: 100%; margin-top: 8px; }

.tacticalPanel { position: fixed; top: 0; left: 50%; width: var(--frame-width); max-width: 100%; height: var(--surface-height); z-index: 60; overflow: auto; transform: translateX(-50%); padding: max(58px, calc(env(safe-area-inset-top) + 48px)) 18px max(22px, env(safe-area-inset-bottom)); border: 1px solid var(--line); background: rgba(2,14,16,.99); box-shadow: 0 0 30px #000; }
#leaderboardList { list-style: none; margin: 0; padding: 0; font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 12px; }
#leaderboardList li { display: flex; gap: 7px; padding: 8px 5px; border-bottom: 1px dashed #153c3a; }.rank { color: var(--muted); }.name { flex: 1; min-width: 0; overflow-wrap: anywhere; }.wave { color: var(--blue); }.score { color: var(--amber); }
#leaderboardViewMoreContainer { text-align: center; margin-top: 10px; } #leaderboardViewMoreLink { color: var(--green); }
.pwa-install-instructions { display: none; position: fixed; z-index: 200; inset: auto 10px max(10px, env(safe-area-inset-bottom)); max-width: 400px; margin: auto; padding: 13px; border: 1px solid var(--line); background: #071414; color: var(--white); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 12px; }.pwa-install-instructions button { min-height: 36px; border: 1px solid var(--green); background: #08221b; color: var(--green); }

#playerStatsModal { box-sizing: border-box !important; font-family: 'Vazirmatn', Tahoma, sans-serif !important; background: rgba(3,15,17,.98) !important; border: 1px solid var(--green-dim) !important; border-radius: 0 !important; box-shadow: 0 0 24px #000 !important; }
#closeStatsButton { min-height: 44px; border: 1px solid var(--green); background: #08251c; color: var(--green); font-family: 'Vazirmatn', Tahoma, sans-serif; }

@keyframes screen-shake { 0%,100%{transform:translate(0)} 25%{transform:translate(3px,-2px)} 50%{transform:translate(-2px,2px)} 75%{transform:translate(2px,1px)} }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } .scanlines { display:none; } }

@media (max-width: 370px) {
  :root { --frame-width: min(100vw, calc((100dvh - 116px) * .5625)); }
  #uiContainer { min-height: 56px; padding-inline-start: 4px; gap: 0; }
  .hudItem .pixelIcon { width: 21px; height: 21px; }.hudItem strong { font-size: 12px; }.hudItem small { font-size: 8px; }
  #mobileCommandBar { min-height: 59px; padding-inline: 4px; }.weaponControl { min-width: 59px; padding-inline: 4px; }.weaponLabel { font-size: 8px; }
  #controlsContainer .iconButton { min-width: 45px; }.controlLabel { display: none; }
  .difficulty-button strong { font-size: 12px; }.difficulty-button small { font-size: 9px; }
  .storeItem { min-height: 111px; padding: 6px; grid-template-columns: 35px 1fr; }.storeItemIcon { width: 34px; height: 34px; }
  .economyCard{min-height:137px;padding:6px}.economyCard>.pixelIcon{width:34px;height:34px}
  .duelMetric .pixelIcon { display: none; }
  .duelHp { width: 58px; }
}

@media (min-width: 700px) {
  :root { --surface-height: min(calc(100dvh - 24px), 960px); }
  body { padding-block: 12px; place-items: center; }
  #gameShell { min-height: var(--surface-height); height: var(--surface-height); border: 1px solid #183b3b; border-radius: 8px; overflow: hidden; }
  #startMenuContainer { min-height: 100%; }
  .modalPanel, .tacticalPanel { top: 50%; transform: translate(-50%, -50%); }
}

@media (orientation: landscape) and (max-height: 600px) {
  body::before { content: 'برای بهترین تجربه، گوشی را عمودی نگه دارید'; position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; padding: 30px; color: var(--amber); background: #02080b; text-align: center; font-size: 22px; }
}
#duelResultTitle.defeat { color: var(--red); }
