:root {
  --pink: #ff2f7d;
  --cyan: #35e6f2;
  --gold: #ffc83d;
  --ink: #07070d;
  --paper: #f7f1e6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #07070d;
  color: var(--paper);
  font-family: "Helvetica Neue", "Arial", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

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

/* in game the pointer belongs to the camera, not to the page; the pause screen
   drops this class again so the menu is clickable. !important because the
   canvas carries its own cursor rule and no stray rule may bring the arrow back */
body.playing,
body.playing *,
body.look,
body.look * {
  cursor: none !important;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.hud-tl {
  position: absolute;
  top: 22px;
  left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-frame {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18), 0 0 0 5px rgba(0, 0, 0, 0.55),
    0 14px 40px rgba(0, 0, 0, 0.6);
}

#minimap { width: 200px; height: 200px; display: block; }

.map-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 26px 10px rgba(0, 0, 0, 0.55);
}

#zone {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.32em;
  padding: 5px 10px 4px;
  border-radius: 3px;
  color: #0a0a12;
  background: linear-gradient(100deg, var(--gold), #ffe9a8);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.hud-tr {
  position: absolute;
  top: 22px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.stars { display: flex; gap: 3px; height: 26px; }
.stars i {
  width: 22px;
  height: 22px;
  display: block;
  background: rgba(255, 255, 255, 0.16);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  transition: background 0.2s ease;
}
.stars i.on { background: var(--gold); filter: drop-shadow(0 0 8px rgba(255, 200, 61, 0.8)); }

#money {
  font-family: "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  color: #eafff4;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.bar {
  position: relative;
  width: 210px;
  height: 14px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  overflow: hidden;
  margin-top: 2px;
}
.bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #37f2a2, #b6ff6d);
  transition: width 0.15s linear, background 0.3s ease;
}
.bar span {
  position: absolute;
  right: 6px;
  top: 0;
  line-height: 14px;
  font-size: 8px;
  letter-spacing: 0.24em;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.6);
}

.hud-bl {
  position: absolute;
  left: 26px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.weapon-name {
  font-size: 10px;
  letter-spacing: 0.3em;
  font-weight: 800;
  color: rgba(247, 241, 230, 0.65);
}
.ammo { font-family: "Courier New", monospace; font-size: 26px; font-weight: 700; }
.ammo b { color: var(--cyan); }
.ammo span { font-size: 16px; opacity: 0.5; }

#objective {
  position: absolute;
  right: 26px;
  bottom: 112px;
  width: 320px;
  text-align: right;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(8, 8, 16, 0), rgba(8, 8, 16, 0.82));
  border-right: 3px solid var(--gold);
  border-radius: 3px;
}
.obj-label {
  font-size: 9px;
  letter-spacing: 0.34em;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 4px;
}
.obj-text { font-size: 15px; line-height: 1.35; font-weight: 600; }
.obj-timer {
  font-family: "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  color: #ff6f8d;
  margin-top: 4px;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  opacity: 0.9;
}
#crosshair span {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}
#crosshair .h { left: 0; top: 12px; width: 26px; height: 2px; }
#crosshair .v { top: 0; left: 12px; height: 26px; width: 2px; }

#prompt {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  padding: 9px 18px;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(6, 6, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
#prompt b {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 7px;
  border-radius: 4px;
  background: var(--paper);
  color: #0b0b14;
  font-family: "Courier New", monospace;
}

#banner {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 26px rgba(255, 47, 125, 0.75), 0 6px 30px rgba(0, 0, 0, 0.9);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
#banner.gold { color: var(--gold); text-shadow: 0 0 30px rgba(255, 200, 61, 0.8), 0 6px 30px rgba(0, 0, 0, 0.9); }
#banner.small { font-size: 24px; letter-spacing: 0.2em; }
@keyframes pop {
  from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#subtitle {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.04em;
  max-width: 60vw;
  color: rgba(247, 241, 230, 0.92);
  text-shadow: 0 2px 12px #000;
}

/* ---------- Screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 100% at 50% 0%, rgba(255, 47, 125, 0.28), transparent 55%),
    radial-gradient(90% 80% at 20% 100%, rgba(53, 230, 242, 0.22), transparent 60%),
    rgba(4, 4, 10, 0.86);
  backdrop-filter: blur(10px);
}

#screen-title {
  background: radial-gradient(120% 110% at 50% -10%, rgba(255, 90, 160, 0.42), transparent 55%),
    radial-gradient(100% 90% at 12% 100%, rgba(53, 230, 242, 0.3), transparent 62%),
    linear-gradient(180deg, #100a1c 0%, #06121a 100%);
  /* A short window cannot show the whole card; scroll the overlay instead of
     clipping the controls and Play button below the viewport. */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 24px 0;
}

#screen-title .title-wrap {
  /* auto margins centre the card while it fits and collapse to zero when it
     does not, so flex centring cannot hide the top of an oversized card */
  margin: auto;
  flex-shrink: 0;
}

.title-wrap {
  width: min(760px, 88vw);
  text-align: center;
  padding: 34px 30px 30px;
  border-radius: 10px;
  background: rgba(6, 7, 16, 0.55);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.kicker {
  font-size: 10px;
  letter-spacing: 0.42em;
  font-weight: 800;
  color: var(--cyan);
  margin-bottom: 10px;
}

.title-wrap h1 {
  margin: 0;
  font-size: clamp(52px, 11vw, 104px);
  line-height: 0.88;
  letter-spacing: 0.08em;
  font-weight: 900;
  background: linear-gradient(180deg, #fff7e8 20%, #ffc5dd 55%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 18px 60px rgba(255, 47, 125, 0.35);
}

.title-wrap h2 {
  margin: 2px 0 14px;
  font-size: clamp(18px, 3.4vw, 28px);
  letter-spacing: 0.62em;
  font-weight: 800;
  color: #eafcff;
  text-shadow: 0 0 22px rgba(53, 230, 242, 0.65);
}

.tagline {
  margin: 0 auto 20px;
  max-width: 460px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(247, 241, 230, 0.7);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 7px 18px;
  margin: 0 auto 24px;
  max-width: 620px;
  text-align: left;
}
.controls div {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: rgba(247, 241, 230, 0.76);
}
kbd {
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  min-width: 20px;
  text-align: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: #fff;
}
.controls span { margin-left: 2px; }

button {
  pointer-events: auto;
  cursor: pointer;
  border: 0;
  padding: 15px 42px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.28em;
  color: #10030a;
  background: linear-gradient(100deg, var(--pink), #ff8ab6 55%, var(--cyan));
  box-shadow: 0 16px 42px rgba(255, 47, 125, 0.38);
  transition: transform 0.12s ease, filter 0.12s ease;
}
button:hover { transform: translateY(-2px); filter: brightness(1.08); }
button:active { transform: translateY(0); }

.hint {
  margin: 16px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: rgba(247, 241, 230, 0.44);
}

.hint.save-hint {
  color: var(--cyan);
  opacity: 0.82;
  margin-bottom: 0;
}

.panel {
  text-align: center;
  padding: 36px 44px;
  border-radius: 10px;
  background: rgba(8, 8, 18, 0.8);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.panel h3 {
  margin: 0 0 8px;
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #ff5277;
  text-shadow: 0 0 34px rgba(255, 82, 119, 0.6);
}
.panel p { margin: 0 0 22px; font-size: 13px; color: rgba(247, 241, 230, 0.7); }

/* ---------- touch controls (phones / tablets) ---------- */
#touch { display: none; }
body.touch #touch { display: block; }
body.touch #scene { touch-action: none; }
#stick {
  position: fixed;
  left: 22px;
  bottom: 26px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(10, 14, 22, 0.34);
  border: 2px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(2px);
  touch-action: none;
  z-index: 20;
}
#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 214, 170, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
}
#touchBtns {
  position: fixed;
  right: 18px;
  bottom: 22px;
  display: grid;
  grid-template-columns: repeat(2, 62px);
  gap: 10px;
  z-index: 20;
  touch-action: none;
}
.tbtn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(12, 16, 26, 0.42);
  color: #ffe9c9;
  font: 600 11px/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  border: 2px solid rgba(255, 255, 255, 0.3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.tbtn:active { background: rgba(255, 160, 120, 0.55); }
body.touch .hud-bl { bottom: 160px; }

/* credits and licences */
#screen-credits { z-index: 40; }
.credits { max-width: 640px; max-height: 86vh; overflow-y: auto; text-align: left; }
.credits ul { margin: 0 0 18px; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: rgba(247, 241, 230, 0.85); }
.credits li span { color: rgba(247, 241, 230, 0.5); }
.credits a, .credits-link { color: #7fe7f2; }
