* { box-sizing: border-box; }
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #87b9df;
      font-family: Arial, Helvetica, sans-serif;
    }
    canvas { display: block; }

    #overlay {
      position: fixed;
      inset: 0;
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: center;
      background:
        radial-gradient(circle at center, rgba(10,20,30,.45), rgba(0,0,0,.82));
      color: white;
      text-align: center;
      padding: 24px;
    }

    #panel {
      width: min(520px, 92vw);
      padding: 28px;
      border: 1px solid rgba(255,255,255,.25);
      border-radius: 18px;
      background: rgba(12, 18, 24, .78);
      box-shadow: 0 20px 80px rgba(0,0,0,.45);
      backdrop-filter: blur(12px);
    }

    h1 {
      margin: 0 0 10px;
      font-size: clamp(30px, 6vw, 52px);
      letter-spacing: 2px;
    }

    p {
      margin: 8px 0;
      color: #d9e7f4;
      line-height: 1.5;
    }

    button {
      margin-top: 20px;
      padding: 14px 24px;
      border: 0;
      border-radius: 10px;
      background: white;
      color: #111;
      font-weight: 800;
      font-size: 16px;
      cursor: pointer;
      transition: transform .15s ease, opacity .15s ease;
    }

    button:hover { transform: translateY(-2px); }
    button:active { transform: translateY(0); }

    #hud {
      position: fixed;
      inset: 0;
      z-index: 5;
      pointer-events: none;
      color: white;
    }

    #crosshair {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 14px;
      height: 14px;
      transform: translate(-50%, -50%);
    }

    #crosshair::before,
    #crosshair::after {
      content: "";
      position: absolute;
      background: rgba(255,255,255,.9);
      box-shadow: 0 0 3px #000;
    }

    #crosshair::before {
      width: 14px;
      height: 2px;
      top: 6px;
      left: 0;
    }

    #crosshair::after {
      width: 2px;
      height: 14px;
      left: 6px;
      top: 0;
    }

    #instructions {
      position: absolute;
      left: 18px;
      bottom: 18px;
      padding: 12px 14px;
      border-radius: 10px;
      background: rgba(0,0,0,.42);
      font-size: 13px;
      line-height: 1.5;
      text-shadow: 0 1px 2px #000;
    }

    #status {
      position: absolute;
      right: 18px;
      top: 18px;
      padding: 10px 13px;
      border-radius: 10px;
      background: rgba(0,0,0,.42);
      font-size: 13px;
      text-shadow: 0 1px 2px #000;
    }

    @media (max-width: 700px) {
      #instructions {
        font-size: 11px;
        max-width: 220px;
      }
    }

.mobile-help { display: none; }

#mobileControls {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  touch-action: none;
}

#movePad {
  position: absolute;
  left: 28px;
  bottom: 34px;
  width: 128px;
  height: 128px;
  border: 2px solid rgba(255,255,255,.42);
  border-radius: 50%;
  background: rgba(5,12,18,.32);
  box-shadow: inset 0 0 22px rgba(0,0,0,.35);
  pointer-events: auto;
  touch-action: none;
}

#moveStick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,.66);
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 5px 18px rgba(0,0,0,.35);
}

#jumpButton {
  position: absolute;
  right: 28px;
  bottom: 42px;
  width: 84px;
  height: 84px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  color: white;
  background: rgba(20,28,35,.62);
  border: 2px solid rgba(255,255,255,.58);
  font-size: 15px;
  pointer-events: auto;
  touch-action: none;
}

#lookZone {
  position: absolute;
  right: 0;
  top: 0;
  width: 56%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}

body.mobile-playing #mobileControls { display: block; }
body.mobile-playing #instructions { display: none; }

@media (hover: none), (pointer: coarse) {
  .desktop-help { display: none; }
  .mobile-help { display: block; }
  #panel { padding: 24px 20px; }
  #status { font-size: 11px; }
  #crosshair { opacity: .75; }
}


#minimap {
  position: absolute;
  right: 18px;
  top: 72px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.78);
  background: rgba(8,15,20,.82);
  box-shadow: 0 8px 28px rgba(0,0,0,.42);
}

@media (max-width: 700px) {
  #minimap {
    width: 126px;
    height: 126px;
    right: 14px;
    top: 62px;
  }
}


#healthHud {
  position: absolute;
  left: 18px;
  top: 18px;
  display: flex;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.42);
  text-shadow: 0 2px 3px rgba(0,0,0,.8);
}

#healthHud .heart {
  font-size: 29px;
  line-height: 1;
  color: #ff3f4f;
  transition: opacity .18s ease, transform .18s ease;
}

#healthHud .heart.empty {
  opacity: .18;
  transform: scale(.84);
}

#damageFlash {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: rgba(255,0,0,0);
  transition: background .12s ease;
}

body.player-hit #damageFlash {
  background: rgba(255,0,0,.28);
}

@media (max-width: 700px) {
  #healthHud {
    top: 14px;
    left: 14px;
    gap: 4px;
    padding: 7px 9px;
  }

  #healthHud .heart {
    font-size: 23px;
  }
}


#notorietyHud {
  position: absolute;
  left: 18px;
  top: 82px;
  width: 190px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.44);
  text-shadow: 0 1px 2px #000;
}

#notorietyLabel {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
}

#notorietyTrack {
  width: 100%;
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.34);
}

#notorietyFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #55c96c 0%, #f0d343 52%, #ff8a35 76%, #ed303c 100%);
  transition: width .18s ease;
}

#notorietyState {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 800;
}

#punchButton {
  position: absolute;
  right: 124px;
  bottom: 44px;
  width: 82px;
  height: 82px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  color: white;
  background: rgba(90,35,28,.72);
  border: 2px solid rgba(255,255,255,.58);
  font-size: 14px;
  pointer-events: auto;
  touch-action: none;
}

#punchButton.punching {
  transform: scale(.9);
}

@media (max-width: 700px) {
  #notorietyHud {
    left: 14px;
    top: 68px;
    width: 154px;
    padding: 8px 9px;
  }

  #punchButton {
    width: 72px;
    height: 72px;
    right: 118px;
    bottom: 48px;
    font-size: 12px;
  }
}


/* Keep action buttons above the invisible camera-look layer. */
#jumpButton,
#punchButton {
  z-index: 30;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#lookZone {
  z-index: 4;
}

#jumpButton:active,
#punchButton:active {
  transform: scale(.92);
}


/* Half-heart display */
#healthHud .heart.half {
  color: transparent;
  background: linear-gradient(90deg, #ff3f4f 50%, rgba(255,255,255,.16) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 1;
  transform: scale(1);
}

/* Arrest screen */
#arrestOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 8, 14, .82);
  backdrop-filter: blur(8px);
}

#arrestOverlay.show {
  display: flex;
}

#arrestPanel {
  width: min(440px, 92vw);
  padding: 28px 24px;
  text-align: center;
  color: white;
  border-radius: 18px;
  background: rgba(18, 28, 39, .97);
  border: 2px solid rgba(105, 170, 255, .75);
  box-shadow: 0 22px 90px rgba(0,0,0,.58);
}

#arrestPanel h2 {
  margin: 12px 0 8px;
  font-size: clamp(25px, 7vw, 38px);
}

#arrestPanel p {
  margin: 0;
  color: #d9e7f4;
}

#arrestBadge {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.4px;
  color: #09101a;
  background: #8fc1ff;
}

#restartGameButton {
  margin-top: 22px;
  pointer-events: auto;
}
