/* SPIDER-MAN fan tribute — presentation layer (red/blue PS4 identity) */
:root {
  --red: #c01420;
  --red-bright: #e82635;
  --blue: #1b3a7a;
  --blue-bright: #2f6fd6;
  --ink: #0a0d16;
  --hud-white: #f2f5fa;
  --hud-dim: rgba(242, 245, 250, 0.55);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--hud-white);
  user-select: none;
  -webkit-user-select: none;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.hidden { display: none !important; }
kbd {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px; padding: 1px 7px; font-size: 12px; font-family: inherit;
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, rgba(24,34,66,0.92), rgba(6,8,14,0.97) 75%);
}
.panel {
  background: rgba(10, 14, 24, 0.88);
  border: 1px solid rgba(255,255,255,0.14);
  border-top: 3px solid var(--red);
  border-radius: 10px;
  padding: 34px 44px;
  max-width: 900px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
}
.panel h2 {
  font-size: 34px; letter-spacing: 6px; font-weight: 800; font-style: italic;
  margin-bottom: 18px; color: #fff;
  text-shadow: 0 2px 0 var(--red), 0 6px 24px rgba(192,20,32,0.45);
}
.panel h3 { font-size: 14px; letter-spacing: 3px; color: var(--red-bright); margin: 16px 0 8px; }
.panel table { border-collapse: collapse; width: 100%; }
.panel td { padding: 4px 14px 4px 0; font-size: 14px; color: var(--hud-dim); }
.panel td:first-child { color: #fff; white-space: nowrap; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-bottom: 22px; }
.tips { list-style: none; }
.tips li { font-size: 13px; color: var(--hud-dim); padding: 4px 0 4px 16px; position: relative; }
.tips li::before { content: "»"; position: absolute; left: 0; color: var(--red-bright); }

/* ---------- title ---------- */
#title-screen { flex-direction: column; overflow: hidden; }
.web-bg {
  position: absolute; inset: -40%; z-index: -1; opacity: 0.5;
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 14deg, rgba(255,255,255,0.045) 14deg 15deg),
    repeating-radial-gradient(circle at 50% 50%, transparent 0 78px, rgba(255,255,255,0.05) 78px 80px);
  animation: webspin 120s linear infinite;
}
@keyframes webspin { to { transform: rotate(360deg); } }
.title-inner { text-align: center; animation: titlein 0.9s cubic-bezier(0.2, 0.9, 0.25, 1) both; }
@keyframes titlein { from { opacity: 0; transform: translateY(26px) scale(0.97); } }
.title-kicker { letter-spacing: 8px; font-size: 13px; color: var(--hud-dim); margin-bottom: 10px; }
.game-logo {
  font-size: clamp(56px, 11vw, 128px); font-weight: 900; font-style: italic;
  letter-spacing: -2px; line-height: 0.95;
  color: #fff;
  text-shadow:
    0 0 2px #fff,
    4px 4px 0 var(--red),
    8px 8px 0 rgba(20, 30, 70, 0.9),
    0 18px 60px rgba(192, 20, 32, 0.5);
}
.logo-man { color: var(--red-bright); text-shadow: 2px 2px 0 #fff, 6px 6px 0 rgba(20,30,70,0.9), 0 18px 60px rgba(192,20,32,0.6); }
.title-sub { margin: 14px 0 34px; letter-spacing: 10px; font-size: 13px; color: var(--blue-bright); font-weight: 700; }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.menu-btn {
  font: inherit; font-size: 17px; font-weight: 700; letter-spacing: 4px;
  color: #fff; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.25); border-radius: 4px;
  padding: 13px 46px; min-width: 320px; cursor: pointer;
  transition: all 0.15s ease; text-transform: uppercase;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
.menu-btn:hover { background: rgba(255,255,255,0.16); transform: translateX(4px); border-color: #fff; }
.menu-btn.primary { background: linear-gradient(100deg, var(--red), #8e0d18); border-color: rgba(255,120,130,0.6); }
.menu-btn.primary:hover { background: linear-gradient(100deg, var(--red-bright), var(--red)); box-shadow: 0 6px 30px rgba(232,38,53,0.4); }
.menu-btn.small { font-size: 12px; padding: 9px 30px; min-width: 240px; opacity: 0.8; }
.title-stats { margin-top: 26px; font-size: 13px; letter-spacing: 2px; color: var(--hud-dim); min-height: 18px; }
.title-stats b { color: #ffd166; }
.title-foot { margin-top: 30px; font-size: 11px; line-height: 1.7; color: rgba(242,245,250,0.35); letter-spacing: 0.5px; }

/* ---------- loading ---------- */
.load-box { text-align: center; letter-spacing: 4px; font-size: 14px; color: var(--hud-dim); }
.load-spinner {
  width: 54px; height: 54px; margin: 0 auto 18px;
  border: 3px solid rgba(255,255,255,0.12); border-top-color: var(--red-bright);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- pause ---------- */
.pause-panel { min-width: 420px; text-align: center; }
.pause-stats { font-size: 13px; color: var(--hud-dim); letter-spacing: 1px; margin-bottom: 20px; line-height: 1.9; }
.pause-stats b { color: #ffd166; }

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

#compass {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  width: min(480px, 56vw); height: 30px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
#compass-strip { position: absolute; top: 0; height: 100%; white-space: nowrap; }
.compass-tick {
  position: absolute; top: 0; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--hud-dim); transform: translateX(-50%); text-align: center; width: 40px;
}
.compass-tick.cardinal { color: #fff; font-size: 14px; }
.compass-tick.wp { color: #ffd166; font-size: 15px; }
.compass-tick.crime { color: #ff5560; font-size: 15px; }
.compass-needle {
  position: absolute; left: 50%; top: 22px; width: 2px; height: 8px;
  background: var(--red-bright); transform: translateX(-50%);
}

#objective {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  font-size: 13px; letter-spacing: 2px; color: var(--hud-dim);
  background: rgba(8,10,18,0.45); padding: 5px 18px; border-radius: 3px;
}
#objective-text b { color: #ffd166; }

#vitals { position: absolute; left: 26px; top: 22px; display: flex; align-items: center; gap: 12px; }
.level-badge {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--blue-bright), var(--blue));
  border: 2px solid rgba(255,255,255,0.5); border-radius: 50%;
  font-size: 19px; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  box-shadow: 0 4px 18px rgba(27,58,122,0.55);
}
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar { width: 210px; height: 11px; background: rgba(6,8,14,0.65); border: 1px solid rgba(255,255,255,0.28); border-radius: 2px; overflow: hidden; transform: skewX(-14deg); }
.bar.xp { height: 5px; width: 180px; }
#health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3b47, var(--red)); transition: width 0.25s ease; box-shadow: 0 0 12px rgba(255,59,71,0.7); }
#xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #ffe08a, #ffb84d); transition: width 0.3s ease; }

#minimap-wrap {
  position: absolute; top: 18px; right: 22px; width: 200px;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; overflow: hidden;
  background: rgba(6,8,14,0.55); box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#minimap { display: block; width: 200px; height: 200px; }
#minimap-label { text-align: center; font-size: 9px; letter-spacing: 4px; color: var(--hud-dim); padding: 3px 0 5px; }

#speedo {
  position: absolute; left: 26px; bottom: 24px;
  font-weight: 800; font-style: italic;
}
#speed-val { font-size: 42px; text-shadow: 0 2px 0 rgba(0,0,0,0.55), 0 0 26px rgba(47,111,214,0.35); }
.speed-unit { font-size: 13px; margin-left: 6px; color: var(--hud-dim); letter-spacing: 2px; }
#combo { font-size: 14px; color: #ffd166; letter-spacing: 1px; min-height: 20px; font-style: normal; }
#combo .combo-x { color: var(--red-bright); font-weight: 900; }

/* prompts & toasts */
#prompt-stack { position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px; }
.prompt {
  display: flex; align-items: center; gap: 10px;
  background: rgba(8, 10, 18, 0.62); border: 1px solid rgba(255,255,255,0.16);
  border-left: 3px solid var(--red-bright);
  padding: 7px 16px; border-radius: 4px; font-size: 14px; letter-spacing: 0.5px;
  animation: promptin 0.25s ease both;
}
@keyframes promptin { from { opacity: 0; transform: translateY(8px); } }
.prompt kbd { background: rgba(255,255,255,0.2); }

#toast-stack { position: absolute; top: 108px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast {
  background: linear-gradient(100deg, rgba(20,28,52,0.92), rgba(10,13,22,0.92));
  border: 1px solid rgba(255,255,255,0.2); border-left: 4px solid #ffd166;
  padding: 10px 26px; border-radius: 4px; font-size: 15px; letter-spacing: 1px;
  animation: toastin 0.35s cubic-bezier(0.2,1.4,0.4,1) both;
  text-align: center;
}
.toast small { display: block; color: #ffd166; font-size: 12px; letter-spacing: 3px; margin-top: 2px; }
@keyframes toastin { from { opacity: 0; transform: translateY(-14px) scale(0.94); } }
.toast.out { transition: opacity 0.4s, transform 0.4s; opacity: 0; transform: translateY(-10px); }

/* big banner (crime stopped etc.) */
#banner {
  position: absolute; top: 33%; left: 50%; transform: translateX(-50%);
  text-align: center; animation: bannerin 0.45s cubic-bezier(0.2,1.5,0.35,1) both;
}
#banner-title {
  font-size: 54px; font-weight: 900; font-style: italic; letter-spacing: 3px;
  color: #fff; text-shadow: 3px 3px 0 var(--red), 0 10px 44px rgba(192,20,32,0.6);
}
#banner-sub { font-size: 16px; letter-spacing: 5px; color: #ffd166; margin-top: 6px; }
@keyframes bannerin { from { opacity: 0; transform: translateX(-50%) scale(1.35); } }
#banner.out { transition: opacity 0.5s; opacity: 0; }

/* world-space markers */
#marker-layer { position: absolute; inset: 0; overflow: hidden; }
.marker {
  position: absolute; transform: translate(-50%, -100%); text-align: center;
  transition: opacity 0.2s; will-change: left, top;
}
.marker .diamond {
  width: 15px; height: 15px; margin: 0 auto 3px;
  background: #ffd166; transform: rotate(45deg);
  border: 2px solid rgba(0,0,0,0.45); box-shadow: 0 0 14px rgba(255,209,102,0.9);
  animation: markerbob 1.6s ease-in-out infinite;
}
.marker.crime .diamond { background: #ff5560; box-shadow: 0 0 16px rgba(255,85,96,0.95); animation: markerbob 0.7s ease-in-out infinite; }
.marker.trial .diamond { background: #6ee7ff; box-shadow: 0 0 14px rgba(110,231,255,0.9); }
.marker.pickup .diamond { width: 10px; height: 10px; background: #8dff9a; box-shadow: 0 0 10px rgba(141,255,154,0.9); }
@keyframes markerbob { 50% { transform: rotate(45deg) translate(-3px, -3px); } }
.marker .dist { font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; letter-spacing: 1px; }
.marker .label { font-size: 10px; color: var(--hud-dim); letter-spacing: 1px; text-shadow: 0 1px 3px #000; }
.marker.offscreen .diamond { animation: none; opacity: 0.85; }

/* vignettes */
#damage-vignette {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(190, 10, 24, 0.55) 100%);
  transition: opacity 0.18s;
}
#dive-vignette {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(10, 20, 40, 0.5) 100%);
  transition: opacity 0.3s;
}

@media (max-width: 900px) {
  .controls-grid { grid-template-columns: 1fr; }
  #minimap-wrap { transform: scale(0.8); transform-origin: top right; }
  .bar { width: 150px; }
}
