* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a1420;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #dbe8f4;
  user-select: none;
  touch-action: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#overlay { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

#flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,40,20,.55));
  opacity: 0; transition: opacity .1s;
}
#flash.on { opacity: 1; }

/* ---------- экраны ---------- */
.screen {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(6, 14, 24, .78);
  backdrop-filter: blur(6px);
}
.screen.visible { display: flex; }

.menu-card {
  width: min(420px, 92vw);
  max-height: 92vh; overflow-y: auto;
  background: linear-gradient(160deg, #10202f, #0b1622);
  border: 1px solid #24445e;
  border-radius: 18px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0,0,0,.6);
}

.logo {
  font-size: 44px; letter-spacing: 3px; font-weight: 800; color: #e8f2fb;
}
.logo span { color: #ff9a3d; }
.tagline { color: #7fa4c4; margin: 4px 0 20px; font-size: 14px; letter-spacing: 1px; }
.best-line { margin-top: 14px; color: #7fa4c4; font-size: 13px; }
.best-line b { color: #ffd166; }

h2 { margin-bottom: 16px; font-size: 26px; }

.field { margin: 14px 0; text-align: left; }
.field > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #7fa4c4; margin-bottom: 6px; }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 10px 4px; border-radius: 10px;
  border: 1px solid #24445e; background: #0e1c2b; color: #b9cede;
  font-size: 14px; cursor: pointer;
}
.seg button.active { background: #1c3a52; border-color: #4d86b8; color: #fff; }
.diff-hint { font-size: 12px; color: #6f94b4; margin-top: 6px; min-height: 16px; }

.btn-big {
  width: 100%; margin-top: 16px; padding: 15px;
  font-size: 19px; font-weight: 700; letter-spacing: 1px;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(160deg, #ff9a3d, #f4632e); color: #1a0e04;
  box-shadow: 0 6px 24px rgba(244, 99, 46, .35);
}
.btn-big:active { transform: scale(.97); }

.menu-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-flat {
  flex: 1; padding: 11px; font-size: 14px; cursor: pointer;
  border: 1px solid #24445e; border-radius: 10px;
  background: transparent; color: #b9cede;
}

.help-list { text-align: left; list-style: none; font-size: 14px; line-height: 1.5; }
.help-list li { margin-bottom: 9px; }
.c-red { color: #ff6a5e; } .c-orange { color: #ffb35c; } .c-green { color: #7ee787; }

.over-stats { margin: 12px 0 6px; }
.over-score { font-size: 52px; font-weight: 800; color: #ffd166; }
#over-detail { color: #7fa4c4; font-size: 14px; margin-top: 4px; }
#over-record { color: #7ee787; font-weight: 700; margin-top: 10px; animation: pulse 1s infinite; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-variant-numeric: tabular-nums; }
#hud.hidden, .hidden { display: none !important; }

.hud-top-left { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 14px; }
#hud-score { font-size: 30px; font-weight: 800; color: #ffd166; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
#hud-kills { font-size: 13px; color: #9fc3e2; }

.hud-top-right { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 14px; text-align: right; }
.hp-wrap { width: 150px; height: 12px; border: 1px solid #3a6183; border-radius: 6px; overflow: hidden; background: rgba(0,0,0,.4); }
#hud-hp { height: 100%; width: 100%; background: linear-gradient(90deg, #46d160, #a3e635); transition: width .2s; }
#hud-hp.low { background: linear-gradient(90deg, #ef4444, #f97316); }
#hud-flares { margin-top: 5px; font-size: 14px; color: #ffe9a8; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
#hud-flares.empty { color: #ff6a5e; animation: blink .7s steps(2) infinite; }

#hud-warning {
  position: absolute; top: 16%; left: 50%; transform: translateX(-50%);
  padding: 8px 18px; border-radius: 10px; white-space: nowrap;
  background: rgba(180, 20, 10, .82); border: 1px solid #ff6a5e;
  font-weight: 800; font-size: clamp(13px, 3.4vw, 19px); letter-spacing: 1px; color: #fff;
  animation: blink .38s steps(2) infinite;
}
#hud-boundary {
  position: absolute; top: 26%; left: 50%; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 10px; white-space: nowrap;
  background: rgba(160, 110, 10, .82); border: 1px solid #ffb35c;
  font-weight: 700; font-size: clamp(12px, 3vw, 16px); color: #fff;
  animation: blink .7s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .25; } }
@keyframes pulse { 50% { transform: scale(1.06); } }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: rgba(150, 255, 170, .9); box-shadow: 0 0 4px rgba(0,0,0,.8); }
#crosshair i:first-child { width: 22px; height: 2px; left: -11px; top: -1px; }
#crosshair i:last-child { width: 2px; height: 22px; left: -1px; top: -11px; }

.hud-bottom-left {
  position: absolute; left: 14px; bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: flex-end;
}
.gauge {
  background: rgba(5, 15, 25, .6); border: 1px solid #2a4a66; border-radius: 10px;
  padding: 6px 10px; text-align: center; min-width: 74px;
}
.gauge span { display: block; font-size: 22px; font-weight: 700; color: #9fe8b0; font-family: Consolas, monospace; }
.gauge small { color: #6f94b4; font-size: 10px; text-transform: uppercase; }
.thr-wrap {
  width: 18px; height: 64px; border: 1px solid #2a4a66; border-radius: 8px;
  background: rgba(5,15,25,.6); position: relative; overflow: hidden;
}
.thr-wrap small { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 8px; color: #6f94b4; z-index: 1; }
#hud-thr { position: absolute; bottom: 0; left: 0; right: 0; height: 50%; background: linear-gradient(180deg, #ff9a3d, #7a4a1a); }

#radar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(180px, 26vh); height: min(180px, 26vh);
  border-radius: 50%;
  border: 2px solid #2a5a3a;
  background: rgba(3, 18, 8, .72);
  box-shadow: 0 0 22px rgba(30, 220, 100, .18), inset 0 0 30px rgba(20, 120, 60, .25);
}

.hud-bottom-right {
  position: absolute; right: 14px; bottom: max(14px, env(safe-area-inset-bottom));
  text-align: right;
  background: rgba(5, 15, 25, .6); border: 1px solid #2a4a66; border-radius: 10px;
  padding: 6px 12px;
}
#hud-weapon { font-size: 15px; font-weight: 700; color: #ffb35c; letter-spacing: 1px; }
#hud-ammo { font-size: 20px; font-weight: 700; color: #dbe8f4; font-family: Consolas, monospace; }
#hud-lock { font-size: 13px; font-weight: 800; color: #ff5b5b; animation: blink .3s steps(2) infinite; }

#btn-pause {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid #2a4a66; background: rgba(5,15,25,.55); color: #b9cede;
  font-size: 17px; cursor: pointer; pointer-events: auto;
}

#floaties { position: absolute; inset: 0; overflow: hidden; }
.floaty {
  position: absolute; left: 50%; top: 42%; transform: translateX(-50%);
  font-size: 22px; font-weight: 800; color: #ffd166; text-shadow: 0 2px 6px rgba(0,0,0,.7);
  animation: floatUp 1.1s ease-out forwards;
}
.floaty.bonus { color: #7ee787; }
@keyframes floatUp { to { transform: translate(-50%, -70px); opacity: 0; } }

/* ---------- мобильные кнопки ---------- */
#mobile-ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#throttle {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 34vh; border-radius: 22px;
  border: 1px solid #2a4a66; background: rgba(5,15,25,.5);
  overflow: hidden; pointer-events: auto;
}
#throttle span {
  position: absolute; bottom: 8px; left: 0; right: 0; text-align: center;
  font-size: 10px; color: #9fc3e2; letter-spacing: 1px; z-index: 1;
}
#throttle-fill { position: absolute; bottom: 0; left: 0; right: 0; height: 55%; background: linear-gradient(180deg, rgba(255,154,61,.85), rgba(122,74,26,.85)); }

.mbtns {
  position: absolute; right: 12px; bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px));
  display: flex; flex-direction: column; gap: 12px; pointer-events: auto;
}
.mbtns button {
  width: 62px; height: 62px; border-radius: 50%;
  border: 1px solid #3a6183; background: rgba(10, 26, 42, .72);
  font-size: 24px; color: #fff; cursor: pointer;
}
#mb-fire { width: 76px; height: 76px; background: rgba(190, 60, 20, .78); border-color: #ff9a3d; font-size: 30px; }
#mb-flare.urgent { border-color: #ff3b30; background: rgba(180, 20, 10, .85); animation: blink .38s steps(2) infinite; }
.mbtns button:active { transform: scale(.93); filter: brightness(1.3); }
