/* ============ DUST STRIKE — UI ============ */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Black.woff2') format('woff2');
  font-weight: 900; font-display: swap;
}

:root {
  --bg: #0b0e13;
  --panel: rgba(13, 16, 23, 0.86);
  --border: rgba(240, 168, 50, 0.35);
  --amber: #f0a832;
  --amber-hi: #ffc35c;
  --text: #e8e3d8;
  --dim: #9a937f;
  --red: #e0483e;
  --green: #59c26a;
  --font: 'Vazirmatn', Tahoma, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: crosshair;
}

.hidden { display: none !important; }

/* ---------- screens & glass panels ---------- */
.screen {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20,24,33,.25), rgba(5,7,10,.72) 75%);
}
.glass {
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), inset 0 0 60px rgba(240,168,50,.04);
}
.glass::before, .glass::after {
  content: '';
  position: absolute; width: 26px; height: 26px;
  border-color: var(--amber); border-style: solid;
  opacity: .9;
}
.glass::before { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.glass::after { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }

.panel { padding: 34px 38px; min-width: 340px; max-width: 92vw; }

.brand { text-align: center; margin-bottom: 22px; }
.brand h1 {
  font-family: var(--font);
  font-weight: 900; font-size: 40px; letter-spacing: 4px;
  color: var(--amber);
  text-shadow: 0 0 26px rgba(240,168,50,.45), 0 2px 0 #4a3208;
  direction: ltr;
}
.brand-sub { font-size: 15px; color: var(--dim); letter-spacing: 10px; margin-top: 2px; }

/* ---------- auth ---------- */
.panel-auth { width: 380px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 10px;
  background: transparent; border: 1px solid rgba(255,255,255,.14);
  color: var(--dim); font-family: var(--font); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.tab:hover { color: var(--text); border-color: var(--border); }
.tab.active { color: #12100a; background: var(--amber); border-color: var(--amber); font-weight: 700; }

form label { display: block; font-size: 13px; color: var(--dim); margin: 12px 0 6px; }
form input {
  width: 100%; padding: 12px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.16);
  color: var(--text); font-family: var(--font); font-size: 15px;
  outline: none; transition: border-color .15s;
  border-radius: 2px;
}
form input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(240,168,50,.15); }
form button { width: 100%; margin-top: 20px; }

.error {
  margin-top: 14px; padding: 10px 12px; font-size: 13.5px;
  background: rgba(224,72,62,.12); border: 1px solid rgba(224,72,62,.45);
  color: #ff9d95; text-align: center; border-radius: 2px;
}
.hint-small { margin-top: 16px; font-size: 12px; color: var(--dim); text-align: center; line-height: 1.9; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%;
  padding: 13px 18px; margin-top: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--text); font-family: var(--font); font-size: 16px; font-weight: 500;
  cursor: pointer; letter-spacing: .3px;
  transition: all .15s; text-align: center;
  border-radius: 2px;
}
.btn:hover { border-color: var(--amber); color: var(--amber-hi); background: rgba(240,168,50,.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  border-color: var(--amber); color: #17120a; font-weight: 800;
  box-shadow: 0 6px 22px rgba(240,168,50,.35);
}
.btn.primary:hover { filter: brightness(1.08); color: #17120a; }
.btn.big { font-size: 20px; padding: 16px; }
.btn.ghost { opacity: .75; }

/* ---------- menu ---------- */
.panel-menu { width: 380px; }
.menu-user {
  font-size: 13.5px; color: var(--dim); text-align: center;
  padding: 10px; margin-bottom: 14px;
  background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.14);
}
.menu-user b { color: var(--amber-hi); }
.menu-sep { display: inline-block; width: 8px; }

/* ---------- pause ---------- */
.panel-small { width: 360px; }
.panel-small h2, .panel-over h2, .panel-board h2, .panel-help h2 {
  font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 18px;
  color: var(--amber-hi); letter-spacing: 1px;
}
.setting { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.setting label { font-size: 13px; color: var(--dim); white-space: nowrap; width: 84px; }
.setting input[type=range] { flex: 1; accent-color: var(--amber); cursor: pointer; }
.set-val { font-size: 12px; color: var(--amber-hi); width: 44px; text-align: left; direction: ltr; }

/* ---------- game over ---------- */
.panel-over { width: 460px; }
.record {
  text-align: center; font-weight: 800; color: #17120a;
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  padding: 8px; margin-bottom: 14px; font-size: 15px; letter-spacing: 1px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { filter: brightness(1.25); } }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 16px; }
.stat {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  padding: 10px 6px; text-align: center;
}
.s-label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.s-val { font-size: 21px; font-weight: 800; color: var(--amber-hi); direction: ltr; display: inline-block; }
.rank-line { text-align: center; font-size: 14px; color: var(--dim); margin-bottom: 12px; min-height: 20px; }
.rank-line b { color: var(--amber-hi); }

/* ---------- leaderboard ---------- */
.panel-board { width: 520px; max-width: 94vw; }
.lb-table { max-height: 46vh; overflow-y: auto; margin-bottom: 8px; }
table.lb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lb th {
  color: var(--amber); font-size: 12.5px; font-weight: 700;
  padding: 8px 6px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #12151d;
}
table.lb td { padding: 9px 6px; border-bottom: 1px solid rgba(255,255,255,.07); text-align: center; }
table.lb tr.me td { background: rgba(240,168,50,.13); color: var(--amber-hi); }
table.lb td.name { text-align: right; font-weight: 500; }
table.lb td.num { direction: ltr; }
.lb-empty { text-align: center; color: var(--dim); padding: 26px; font-size: 14px; }

/* ---------- help ---------- */
.panel-help { width: 470px; max-width: 94vw; }
.help-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.help-table td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.help-table td:first-child {
  direction: ltr; text-align: left; color: var(--amber-hi);
  font-weight: 700; width: 42%; font-size: 13px;
}
.help-note { font-size: 13px; color: var(--dim); line-height: 2; margin-bottom: 6px; }

/* ---------- toast / loading ---------- */
#toast {
  position: fixed; top: 26px; left: 50%; transform: translateX(-50%);
  z-index: 90; background: rgba(13,16,23,.94); border: 1px solid var(--border);
  color: var(--amber-hi); padding: 10px 22px; font-size: 14px; font-family: var(--font);
}
.loader-text {
  color: var(--amber); font-size: 16px; letter-spacing: 2px;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; font-family: var(--font); }

/* crosshair */
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.ch { position: absolute; background: #f4efe2; box-shadow: 0 0 3px rgba(0,0,0,.9); }
.ch.t { width: 2px; height: 9px; left: -1px; top: calc(-11px - var(--gap, 6px)); }
.ch.b { width: 2px; height: 9px; left: -1px; top: calc(2px + var(--gap, 6px)); }
.ch.l { width: 9px; height: 2px; top: -1px; left: calc(-11px - var(--gap, 6px)); }
.ch.r { width: 9px; height: 2px; top: -1px; left: calc(2px + var(--gap, 6px)); }
.ch.dot { width: 2px; height: 2px; left: -1px; top: -1px; }

/* hitmarker */
#hitmarker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#hitmarker span {
  position: absolute; width: 11px; height: 2px; background: #fff;
  box-shadow: 0 0 4px rgba(0,0,0,.8);
}
#hitmarker span:nth-child(1) { transform: translate(5px, 5px) rotate(45deg); }
#hitmarker span:nth-child(2) { transform: translate(-16px, 5px) rotate(-45deg); }
#hitmarker span:nth-child(3) { transform: translate(5px, -7px) rotate(-45deg); }
#hitmarker span:nth-child(4) { transform: translate(-16px, -7px) rotate(45deg); }
#hitmarker.hs span { background: var(--amber); }

/* vignette on damage */
#vignette {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(160, 10, 10, .55) 100%);
  transition: opacity .25s;
}

/* scope */
#scope-overlay { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 31%, rgba(0,0,0,.97) 33%); }
.scope-line { position: absolute; background: rgba(0,0,0,.85); }
.scope-line.v { left: 50%; top: 0; width: 1.5px; height: 100%; margin-left: -0.75px; }
.scope-line.h { top: 50%; left: 0; height: 1.5px; width: 100%; margin-top: -0.75px; }

/* top bar */
#top-bar {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; align-items: center;
}
.tb-box {
  background: rgba(10,12,17,.72); border: 1px solid rgba(255,255,255,.14);
  padding: 7px 18px; font-size: 14.5px; color: var(--dim);
  backdrop-filter: blur(6px);
}
.tb-box b { color: var(--amber-hi); font-size: 17px; margin: 0 4px; }
.tb-box.score b { color: #fff; }
.tb-sep { display: inline-block; width: 10px; }

/* killfeed */
#killfeed {
  position: absolute; top: 74px; right: 18px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.kf {
  background: rgba(10,12,17,.78); border-right: 3px solid var(--amber);
  padding: 6px 12px; font-size: 13px; color: var(--text);
  animation: kfin .18s ease-out;
  transition: opacity .5s;
}
.kf .kf-weapon { color: var(--dim); margin: 0 6px; }
.kf .hs { color: var(--amber); font-weight: 700; margin-right: 6px; font-size: 11.5px; }
@keyframes kfin { from { transform: translateX(24px); opacity: 0; } }

/* minimap */
#minimap {
  position: absolute; top: 16px; left: 16px;
  background: rgba(10,12,17,.7);
  border: 1px solid rgba(255,255,255,.16);
}

/* health / armor */
#bottom-left { position: absolute; bottom: 20px; left: 20px; width: 240px; }
.stat-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.stat-label { font-size: 12.5px; color: var(--dim); width: 44px; }
.bar {
  flex: 1; height: 13px; background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.18); overflow: hidden;
}
.bar > div { height: 100%; width: 100%; background: linear-gradient(180deg, #6fdc7f, #3f9f50); transition: width .18s; }
.bar.armor > div { background: linear-gradient(180deg, #5db3e8, #3272a8); }
.bar > div.low { background: linear-gradient(180deg, #ff7a5e, #c03428); }
.stat-num { font-size: 14px; font-weight: 700; color: var(--text); width: 34px; text-align: left; direction: ltr; }

/* ammo */
#bottom-right { position: absolute; bottom: 20px; right: 22px; text-align: center; }
#weapon-name { font-size: 13.5px; color: var(--dim); margin-bottom: 2px; }
#ammo-row { direction: ltr; }
#ammo-big { font-size: 44px; font-weight: 900; color: #fff; text-shadow: 0 0 12px rgba(240,168,50,.5); }
#ammo-big.empty { color: var(--red); }
#ammo-reserve { font-size: 16px; color: var(--dim); margin-left: 6px; }
#reload-hint { font-size: 12px; color: var(--amber); animation: pulse 1s infinite; }

/* center messages */
#msg-center {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  text-align: center; width: 90vw; pointer-events: none;
}
.msg-big {
  font-size: 34px; font-weight: 900; color: var(--amber-hi);
  text-shadow: 0 0 30px rgba(240,168,50,.5);
  animation: msgin 2.6s ease-out forwards;
}
.msg-sub {
  font-size: 17px; font-weight: 700; color: var(--text);
  margin-top: 6px; animation: msgin 2.6s ease-out forwards;
}
.msg-sub.danger { color: #ff8d80; }
@keyframes msgin {
  0% { opacity: 0; transform: scale(1.25); }
  12% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 700px) {
  .brand h1 { font-size: 30px; }
  .panel { padding: 26px 22px; }
  .panel-board { width: 94vw; }
  #minimap { display: none; }
}
