* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #0a0e12; color: #e7eef5;
  font-family: 'Rajdhani', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
h1, h2, h3 { font-family: 'Teko', 'Rajdhani', sans-serif; margin: 0; letter-spacing: 0.5px; }
button { font-family: inherit; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------------- buttons ---------------- */
.btn {
  border: none; cursor: pointer; font-weight: 700; letter-spacing: 1px;
  border-radius: 6px; padding: 12px 22px; font-size: 15px;
  font-family: 'Rajdhani', sans-serif; transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #ffcf4a, #ff9f3f); color: #1a1205; box-shadow: 0 4px 18px rgba(255,180,50,0.35); }
.btn-primary:hover { box-shadow: 0 6px 22px rgba(255,180,50,0.5); }
.btn-ghost { background: rgba(255,255,255,0.08); color: #e7eef5; border: 1px solid rgba(255,255,255,0.25); }
.btn-ghost:hover { background: rgba(255,255,255,0.16); }
.btn-xl { padding: 16px 34px; font-size: 19px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ================= MENU ================= */
#screen-menu { background: #0a0e12; overflow-y: auto; }
.menu-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 75% 15%, rgba(255,160,40,0.14), transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(50,200,230,0.12), transparent 50%),
    linear-gradient(160deg, #0b1118 0%, #0c1620 55%, #071015 100%);
}
.menu-scan {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.4;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 3px);
}
.menu-top {
  position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  padding: 22px 36px 0;
}
.brand-mark { font-family: 'Teko'; font-size: 30px; font-weight: 700; color: #ffd166; letter-spacing: 2px; }
.brand-sub { display: block; font-size: 12px; color: #7fb6c9; letter-spacing: 3px; margin-top: -4px; }
#menu-stats { font-size: 13px; color: #9fb0c0; letter-spacing: 1px; }
.menu-hero { position: relative; z-index: 1; padding: 50px 36px 10px; max-width: 720px; }
.menu-hero h1 { font-size: 64px; line-height: 0.95; color: #f3f6fa; text-shadow: 0 4px 30px rgba(0,0,0,0.6); }
.menu-hero p { color: #a9bac8; font-size: 16px; margin: 14px 0 22px; }
.menu-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.menu-tabs {
  position: relative; z-index: 1; display: flex; gap: 6px; padding: 30px 36px 0; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab {
  background: none; border: none; color: #8b9cab; padding: 10px 18px; font-size: 15px; font-weight: 700;
  letter-spacing: 1px; cursor: pointer; border-bottom: 3px solid transparent;
}
.tab.active { color: #ffd166; border-bottom-color: #ffd166; }
.tab-panel { display: none; position: relative; z-index: 1; padding: 26px 36px 60px; }
.tab-panel.active { display: block; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 980px; }
.card {
  background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 18px 20px;
}
.card h3 { color: #ffd166; font-size: 20px; margin-bottom: 10px; }
.setting-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: #c3d0dc; border-bottom: 1px dashed rgba(255,255,255,0.07); }
.setting-row b { color: #fff; }
#loadout-preview { font-size: 14px; color: #c3d0dc; line-height: 1.7; margin-bottom: 12px; }
#loadout-preview b { color: #8fe3ff; }
#loadout-preview .lp-perk { color: #ffd166; }

.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 980px; }
.howto-grid .card p { color: #c3d0dc; font-size: 14.5px; line-height: 1.55; }
.howto-grid .card b { color: #ffd166; }

.intel-wrap { display: flex; gap: 26px; max-width: 980px; flex-wrap: wrap; }
#intel-map { border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: #0c2733; }
.intel-text { max-width: 360px; color: #c3d0dc; font-size: 14.5px; line-height: 1.6; }
.intel-text h3 { color: #ffd166; font-size: 24px; margin-bottom: 8px; }
.intel-text li { margin-bottom: 6px; }
.intel-small { color: #7f93a3; font-size: 13px; }

/* ---------------- loadout editor ---------------- */
.loadout-editor { display: grid; grid-template-columns: 1.1fr 1.1fr 1fr 1.1fr; gap: 16px; max-width: 1180px; }
.lo-col h3 { font-size: 17px; color: #ffd166; margin-bottom: 10px; }
.lo-col .hint { color: #7f93a3; font-size: 12px; font-weight: 400; }
.weapon-list, .perk-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; margin-bottom: 14px; }
.weapon-item, .perk-item {
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08); border-radius: 7px;
  padding: 9px 12px; font-size: 14px; transition: background .12s;
}
.weapon-item:hover, .perk-item:hover { background: rgba(255,255,255,0.09); }
.weapon-item.selected, .perk-item.selected { border-color: #ffd166; background: rgba(255,209,102,0.14); color: #ffe9b0; }
.weapon-item .cls, .perk-item .desc { color: #8b9cab; font-size: 11.5px; }
.lo-preview { background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 16px; }
.wpn-class { color: #8fe3ff; font-size: 13px; margin-bottom: 10px; letter-spacing: 1px; }
.bar-row { margin-bottom: 8px; }
.bar-row .lbl { display: flex; justify-content: space-between; font-size: 12px; color: #a9bac8; margin-bottom: 2px; }
.bar-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #ffd166, #ff9f3f); }
.lo-note { font-size: 12.5px; color: #8b9cab; margin-top: 14px; line-height: 1.5; background: rgba(0,0,0,0.25); padding: 10px; border-radius: 6px; }
.lo-note b { color: #ffd166; }
.att-list { margin-top: 2px; }
.att-row { margin-bottom: 10px; }
.att-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #6f8294; margin-bottom: 5px; }
.att-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.att-btn { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #c7d2dc; font-size: 12px; padding: 6px 10px; border-radius: 5px; cursor: pointer; }
.att-btn:hover { background: rgba(255,255,255,0.12); }
.att-btn.selected { background: linear-gradient(90deg, #ffd166, #ff9f3f); color: #1a1208; border-color: transparent; font-weight: 600; }

/* ================= GAME ================= */
#screen-game { background: #000; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hud-top-left { position: absolute; top: 14px; left: 14px; z-index: 5; width: 240px; }
.hp-wrap { background: rgba(10,14,18,0.55); border-radius: 8px; padding: 8px 10px; }
.armor-bar { position: relative; height: 10px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; margin-bottom: 4px; }
.armor-fill { height: 100%; background: linear-gradient(90deg, #39a0d6, #6fd8ff); width: 100%; transition: width .15s; }
.plate-ticks { position: absolute; inset: 0; display: flex; }
.plate-ticks span { flex: 1; border-right: 1px solid rgba(0,0,0,0.3); }
.hp-bar { position: relative; height: 22px; border-radius: 5px; background: rgba(255,255,255,0.1); overflow: hidden; }
.hp-fill { height: 100%; background: linear-gradient(90deg, #6fd88a, #3fae5c); width: 100%; transition: width .15s; }
.hp-text { position: absolute; right: 8px; top: 2px; font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px #000; }
.ammo-row { margin-top: 8px; display: flex; gap: 8px; }
.ammo-chip {
  background: rgba(10,14,18,0.6); border-radius: 6px; padding: 6px 10px; font-size: 13px; min-width: 76px;
  border: 1px solid rgba(255,255,255,0.1); opacity: 0.55;
}
.ammo-chip.active { opacity: 1; border-color: #ffd166; }
.ammo-chip .wname { display: block; font-size: 10.5px; color: #a9bac8; letter-spacing: 0.5px; }
.ammo-chip .wammo { font-weight: 700; font-size: 16px; }
.ammo-chip .wammo small { font-size: 11px; color: #8b9cab; font-weight: 500; }

.hud-top-right { position: absolute; top: 14px; right: 14px; z-index: 5; text-align: right; }
.alive-count { background: rgba(10,14,18,0.6); border-radius: 6px; padding: 5px 12px; font-weight: 700; font-size: 14px; margin-bottom: 6px; letter-spacing: 1px; color: #ffd166; }
.cash-count { background: rgba(10,14,18,0.6); border-radius: 6px; padding: 5px 12px; font-weight: 700; font-size: 14px; margin-bottom: 6px; letter-spacing: 1px; color: #6fd88a; }
#minimap { border-radius: 8px; border: 1px solid rgba(255,255,255,0.25); display: block; }

.buy-hint {
  position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(10,30,18,0.75); border: 1px solid rgba(111,216,138,0.5); color: #bdf2c9;
  padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none;
}
.buy-hint.show { opacity: 1; }

.buy-menu {
  background: #11161c; border: 2px solid rgba(111,216,138,0.4); border-radius: 10px;
  padding: 20px 26px; width: 320px; display: flex; flex-direction: column; gap: 10px;
}
.buy-menu h3 { color: #6fd88a; letter-spacing: 2px; margin-bottom: 4px; }
.buy-item {
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
  padding: 10px 14px; font-size: 14px;
}
.buy-item:hover { background: rgba(111,216,138,0.15); border-color: rgba(111,216,138,0.5); }
.buy-item b { color: #ffd166; }

.hud-feed { position: absolute; top: 160px; right: 14px; z-index: 5; width: 280px; text-align: right; display: flex; flex-direction: column; gap: 4px; }
.feed-item { font-size: 12.5px; background: rgba(10,14,18,0.5); border-radius: 5px; padding: 4px 9px; opacity: 0.95; }

.hud-toasts { position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.toast-item { background: rgba(10,14,18,0.7); border: 1px solid rgba(255,209,102,0.4); color: #ffe9b0; padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; }

.gas-timer {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(130,20,180,0.35); border: 1px solid rgba(210,120,255,0.6); border-radius: 8px;
  padding: 6px 16px; font-size: 13px; font-weight: 700; letter-spacing: 1px;
}

.crosshair {
  position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px;
  border: 2px solid rgba(255,255,255,0.85); border-radius: 50%; z-index: 4; pointer-events: none;
  box-shadow: 0 0 2px rgba(0,0,0,0.6);
}
.hitmarker {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 6;
  color: #ff5a5a; font-size: 22px; font-weight: 900; opacity: 0; pointer-events: none;
}
.hitmarker.show { opacity: 1; }
.high-alert {
  position: absolute; top: 55px; left: 50%; transform: translateX(-50%); z-index: 5;
  color: #ff5a5a; font-weight: 700; letter-spacing: 1px; font-size: 13px; opacity: 0;
  text-shadow: 0 0 10px rgba(255,0,0,0.6);
}
.high-alert.show { opacity: 1; animation: blink 0.5s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.overlay {
  position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75); flex-direction: column; gap: 10px;
}
.overlay.show { display: flex; }
#full-map { border-radius: 10px; border: 2px solid rgba(255,255,255,0.3); background: #0c2733; }
.overlay-hint { color: #a9bac8; font-size: 13px; letter-spacing: 1px; }

/* ---------------- touch controls ---------------- */
.touch-only { display: none; }
@media (pointer: coarse) {
  .touch-only { display: block; }
}
.stick-base {
  position: absolute; bottom: 30px; left: 30px; width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.2); z-index: 6; touch-action: none;
}
.aim-base { left: auto; right: 30px; background: rgba(255,80,80,0.06); border-color: rgba(255,120,120,0.25); }
.stick-nub {
  position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%;
  background: rgba(255,255,255,0.3); pointer-events: none;
}
.touch-buttons { position: absolute; bottom: 150px; right: 24px; z-index: 6; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tbtn {
  width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3);
  background: rgba(10,14,18,0.6); color: #fff; font-size: 16px; font-weight: 700; touch-action: none;
}

/* ================= END SCREEN ================= */
#screen-end {
  background: radial-gradient(circle at 50% 20%, rgba(255,160,40,0.15), transparent 55%), #0a0e12;
}
#screen-end.active {
  display: flex; align-items: center; justify-content: center;
}
.end-wrap { text-align: center; }
#end-title { font-size: 72px; color: #ffd166; letter-spacing: 3px; text-shadow: 0 6px 30px rgba(255,180,50,0.4); }
.end-stats { display: flex; gap: 30px; justify-content: center; margin: 22px 0 32px; }
.end-stat { background: rgba(255,255,255,0.06); border-radius: 10px; padding: 16px 26px; min-width: 110px; }
.end-stat b { display: block; font-size: 30px; color: #fff; }
.end-stat span { font-size: 12px; color: #9fb0c0; letter-spacing: 1px; }

@media (max-width: 900px) {
  .menu-hero h1 { font-size: 42px; }
  .panel-grid, .howto-grid { grid-template-columns: 1fr; }
  .loadout-editor { grid-template-columns: 1fr 1fr; }
  .intel-wrap { flex-direction: column; }
  #intel-map { width: 100%; height: auto; }
}
@media (max-width: 560px) {
  .loadout-editor { grid-template-columns: 1fr; }
  .menu-tabs { overflow-x: auto; }
  .hud-top-left { width: 190px; }
}
