body.fps-integrated {
  --yellow: #ffd400;
  --yellow-2: #ffea73;
  --black: #08080b;
  --panel: rgba(8, 8, 12, 0.92);
  --panel-soft: rgba(15, 15, 22, 0.82);
  --paper: rgba(250, 250, 252, 0.9);
  --line: rgba(255, 212, 0, 0.68);
  --text: #f8f8fb;
  --muted: #b9bac4;
  --danger: #ff4b45;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

#fps-background,
#fps-background *,
.game-toolbar,
.game-toolbar *,
.game-hud,
.game-hud *,
.crosshair,
.crosshair *,
.hit-marker,
.hit-marker *,
.control-help,
.control-help *,
.mobile-controls,
.mobile-controls * {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #0a0a0d;
}

body.fps-integrated {
  position: relative;
  min-height: 100%;
  overflow-x: hidden;
  background: transparent !important;
  isolation: isolate;
}

body.fps-integrated .game-toolbar,
body.fps-integrated .game-hud,
body.fps-integrated .crosshair,
body.fps-integrated .hit-marker,
body.fps-integrated .control-help,
body.fps-integrated .mobile-controls {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.fps-integrated.game-control-active {
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.game-toolbar button,
.mobile-controls button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* =========================
   BACKGROUND GAME LAYERS
   ========================= */
#fps-background {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  background: #65727e;
  pointer-events: none;
}

#fps-background canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
}

body.fps-integrated.game-control-active #fps-background {
  pointer-events: auto;
}

.game-vignette,
.game-scanlines {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.game-vignette {
  background:
    radial-gradient(circle at 50% 40%, transparent 35%, rgba(0, 0, 0, 0.25) 72%, rgba(0, 0, 0, 0.72) 120%),
    linear-gradient(180deg, rgba(7, 9, 13, 0.08), rgba(5, 5, 8, 0.26));
}

.game-scanlines {
  opacity: 0.12;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

/* =========================
   GAME TOOLBAR + HUD
   ========================= */
.game-toolbar {
  position: fixed;
  top: calc(14px + var(--safe-area-top));
  right: 14px;
  z-index: 2147483000;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(255, 212, 0, 0.48);
  border-radius: 14px;
  background: rgba(3, 3, 6, 0.78);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.42), inset 0 0 18px rgba(255, 212, 0, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.game-button {
  min-height: 38px;
  border: 1px solid rgba(255, 212, 0, 0.42);
  border-radius: 9px;
  padding: 0 13px;
  color: #fff;
  background: rgba(20, 20, 27, 0.92);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.055em;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.game-button:hover {
  transform: translateY(-1px);
  border-color: var(--yellow);
}

.game-button:active {
  transform: translateY(1px) scale(0.98);
}

.game-button--primary {
  color: #08080b;
  border-color: var(--yellow);
  background: linear-gradient(180deg, #ffe967, var(--yellow));
  box-shadow: 0 0 18px rgba(255, 212, 0, 0.28);
}

.game-button__icon {
  margin-right: 5px;
}

body.fps-integrated.game-control-active .game-button--primary {
  color: #fff;
  border-color: #ff655f;
  background: linear-gradient(180deg, #ba2825, #761411);
  box-shadow: 0 0 18px rgba(255, 64, 58, 0.32);
}

.game-hud {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: calc(82px + var(--safe-area-bottom));
  z-index: 2147482960;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  opacity: 0.56;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

body.fps-integrated.game-control-active .game-hud {
  opacity: 1;
}

.hud-panel {
  width: min(260px, 31vw);
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 212, 0, 0.52);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(6, 6, 10, 0.9), rgba(20, 20, 28, 0.72));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36), inset 3px 0 0 var(--yellow);
  backdrop-filter: blur(10px);
}

.hud-panel strong {
  display: block;
  margin-top: 1px;
  font-size: clamp(24px, 3.1vw, 40px);
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.hud-panel small {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.6em;
}

.hud-label {
  color: var(--yellow);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hud-meter {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.hud-meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff514b, var(--yellow));
  transform-origin: left center;
  transition: transform 180ms ease;
}

.hud-panel--ammo {
  text-align: right;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36), inset -3px 0 0 var(--yellow);
}

#reloadState {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.hud-center {
  align-self: center;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(5, 5, 8, 0.6);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  backdrop-filter: blur(8px);
}

.crosshair,
.hit-marker {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2147482970;
  width: 42px;
  height: 42px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 150ms ease;
}

body.fps-integrated.game-control-active .crosshair {
  opacity: 1;
}

.crosshair i,
.hit-marker i {
  position: absolute;
  display: block;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.88);
}

.crosshair i:nth-child(1) { left: 20px; top: 3px; width: 2px; height: 11px; }
.crosshair i:nth-child(2) { left: 20px; bottom: 3px; width: 2px; height: 11px; }
.crosshair i:nth-child(3) { top: 20px; left: 3px; width: 11px; height: 2px; }
.crosshair i:nth-child(4) { top: 20px; right: 3px; width: 11px; height: 2px; }
.crosshair b {
  position: absolute;
  top: 19px;
  left: 19px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 7px rgba(255, 212, 0, 0.7);
}

.crosshair.is-firing i:nth-child(1) { transform: translateY(-3px); }
.crosshair.is-firing i:nth-child(2) { transform: translateY(3px); }
.crosshair.is-firing i:nth-child(3) { transform: translateX(-3px); }
.crosshair.is-firing i:nth-child(4) { transform: translateX(3px); }

.hit-marker {
  width: 34px;
  height: 34px;
}

.hit-marker i {
  width: 2px;
  height: 10px;
  background: #fff;
  transform-origin: center bottom;
}

.hit-marker i:nth-child(1) { top: 2px; left: 9px; transform: rotate(-45deg); }
.hit-marker i:nth-child(2) { top: 2px; right: 9px; transform: rotate(45deg); }
.hit-marker i:nth-child(3) { bottom: 2px; left: 9px; transform: rotate(-135deg); }
.hit-marker i:nth-child(4) { bottom: 2px; right: 9px; transform: rotate(135deg); }
.hit-marker.show {
  animation: hit-flash 160ms ease-out;
}

@keyframes hit-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.45); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
}

.control-help {
  position: fixed;
  top: calc(76px + var(--safe-area-top));
  left: 50%;
  z-index: 2147482980;
  display: grid;
  gap: 3px;
  width: min(650px, calc(100% - 30px));
  padding: 10px 18px;
  border: 1px solid rgba(255, 212, 0, 0.46);
  border-radius: 10px;
  color: #fff;
  background: rgba(4, 4, 7, 0.78);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(12px);
}

.control-help strong {
  color: var(--yellow);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.control-help span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 10px;
}

body.fps-integrated.game-control-active .control-help {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================
   MOBILE CONTROLS
   ========================= */
.mobile-controls {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .mobile-controls {
    position: fixed;
    inset: 0;
    z-index: 2147482990;
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  body.fps-integrated.game-control-active .mobile-controls {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .look-pad {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 58%;
    touch-action: none;
  }

  .joystick {
    position: absolute;
    left: max(24px, env(safe-area-inset-left, 0px));
    bottom: calc(36px + var(--safe-area-bottom));
    width: 116px;
    height: 116px;
    border: 2px solid rgba(255, 255, 255, 0.36);
    border-radius: 50%;
    background: rgba(8, 8, 12, 0.42);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.42);
    touch-action: none;
  }

  .joystick::before,
  .joystick::after {
    position: absolute;
    content: "";
    background: rgba(255, 255, 255, 0.14);
  }

  .joystick::before { top: 50%; left: 13px; right: 13px; height: 1px; }
  .joystick::after { left: 50%; top: 13px; bottom: 13px; width: 1px; }

  .joystick__knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 54px;
    height: 54px;
    border: 2px solid rgba(255, 212, 0, 0.78);
    border-radius: 50%;
    background: rgba(255, 212, 0, 0.24);
    box-shadow: 0 0 20px rgba(255, 212, 0, 0.16);
    transform: translate(-50%, -50%);
  }

  .touch-action {
    position: absolute;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border: 2px solid rgba(255, 255, 255, 0.46);
    border-radius: 50%;
    color: #fff;
    background: rgba(8, 8, 12, 0.54);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    touch-action: none;
  }

  .touch-action:active {
    background: rgba(255, 212, 0, 0.42);
    transform: scale(0.94);
  }

  .touch-action--fire {
    right: max(24px, env(safe-area-inset-right, 0px));
    bottom: calc(38px + var(--safe-area-bottom));
    width: 84px;
    height: 84px;
    border-color: rgba(255, 86, 78, 0.8);
    background: rgba(140, 25, 22, 0.5);
  }

  .touch-action--jump {
    right: max(115px, calc(env(safe-area-inset-right, 0px) + 115px));
    bottom: calc(112px + var(--safe-area-bottom));
  }

  .touch-action--exit {
    top: calc(78px + var(--safe-area-top));
    right: max(18px, env(safe-area-inset-right, 0px));
    width: 62px;
    height: 34px;
    border-radius: 8px;
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(0, 0, 0, 0.62);
  }
}


/* ================================================================
   INTEGRASI DENGAN HTML OLXTOTO YANG SUDAH ADA
   ================================================================ */
body.fps-integrated .main-wrapper,
body.fps-integrated #site,
body.fps-integrated #content {
  background-color: transparent !important;
}

/* Panel putih lama dibuat sedikit transparan agar arena tetap terlihat. */
body.fps-integrated .m-design,
body.fps-integrated .m-design-product-info,
body.fps-integrated .m-design__additional-info-container {
  background-color: rgba(245, 245, 247, 0) !important;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* Saat kontrol diambil alih, seluruh node website lama diredupkan.
   Elemen game dikecualikan agar tetap aktif dan dapat diklik. */
body.fps-integrated.game-control-active > :not(#fps-background):not(.game-vignette):not(.game-scanlines):not(.game-toolbar):not(.game-hud):not(.crosshair):not(.hit-marker):not(.control-help):not(.mobile-controls):not(script):not(style):not(noscript) {
  opacity: 0.12 !important;
  filter: blur(1.5px) saturate(0.45) !important;
  pointer-events: none !important;
  transition: opacity 220ms ease, filter 220ms ease;
}

.fps-noscript-warning {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 2147483001;
  max-width: calc(100% - 30px);
  padding: 10px 15px;
  border: 1px solid #ffd400;
  border-radius: 9px;
  color: #fff;
  background: rgba(0, 0, 0, 0.88);
  font: 700 12px/1.4 Arial, sans-serif;
  transform: translateX(-50%);
}

@media (max-width: 720px) {
  .game-toolbar {
    top: calc(48px + var(--safe-area-top));
    right: 8px;
    left: 8px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .game-hud {
    bottom: calc(72px + var(--safe-area-bottom));
  }
}