/* =============================================================================
   css/style.css  —  Agent B : UI / UX / creepy pixel aesthetics
   -----------------------------------------------------------------------------
   THE HOLLOW — a raycast horror maze.
   Static-file friendly (GitHub Pages). No external fonts, no build step.
   Palette: near-black, cold desaturated blues/greys. Monospace everywhere.
   ============================================================================= */

/* ---- reset / base ---------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  /* Web-safe monospace stack only — nothing fetched, works fully offline. */
  font-family: "Courier New", "Lucida Console", Monaco, Consolas, monospace;
  color: #b9c2cc;
  background: #050507;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: none;
  user-select: none;
  cursor: default;
}

/* ---- layering model -------------------------------------------------------
   canvas (z 0)  <  vignette (z 20)  <  hud (z 30)  <  screens (z 100)
   --------------------------------------------------------------------------- */

#game-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

/* ---- the raycast canvas: 320x200 upscaled, CRISP pixels, no blur ----------- */
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  background: #050507;

  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* =============================================================================
   HUD
   ============================================================================= */
#hud {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none; /* HUD never steals clicks from the canvas */
}

#hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  font-size: 15px;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 1);
}

#objectives {
  color: #8a97a3;
}

#objectives .label {
  color: #5e6b76;
  margin-right: 8px;
  font-size: 12px;
  letter-spacing: 0.22em;
}

#relic-count {
  color: #cfe6ef;
  font-weight: bold;
}

#objectives .sep {
  color: #46525c;
  margin: 0 2px;
}

#relic-total {
  color: #6f7c87;
}

#timer {
  color: #8a97a3;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
}

/* subtle pulse applied briefly when a relic is collected */
#hud-top.pulse #relic-count {
  animation: relic-ping 0.5s ease-out;
}

@keyframes relic-ping {
  0% { color: #ffffff; text-shadow: 0 0 12px #cfe6ef, 0 0 20px #7fd4ff; }
  100% { color: #cfe6ef; text-shadow: none; }
}

/* ---- crosshair ------------------------------------------------------------- */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  line-height: 1;
  color: rgba(190, 205, 215, 0.5);
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

/* ---- transient message (centered-lower) ------------------------------------ */
#message {
  position: absolute;
  left: 50%;
  bottom: 16%;
  transform: translateX(-50%);
  max-width: 80%;
  text-align: center;
  font-size: 18px;
  color: #c9d4dd;
  text-shadow: 0 0 8px rgba(0, 0, 0, 1), 0 0 14px rgba(20, 40, 50, 0.6);
  opacity: 0;
  transition: opacity 0.4s ease;
  letter-spacing: 0.08em;
}

#message.show {
  opacity: 1;
}

/* a whisper variant — faint, trembling, unsettling */
#message.whisper {
  color: #8f6f7a;
  font-style: italic;
  letter-spacing: 0.18em;
  text-shadow: 0 0 10px rgba(60, 10, 20, 0.6);
  animation: whisper-shiver 0.9s ease-in-out;
}

@keyframes whisper-shiver {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translate(calc(-50% - 1px), 1px); }
  50% { transform: translate(calc(-50% + 1px), -1px); }
  75% { transform: translate(calc(-50% - 1px), 0); }
}

/* ---- paused overlay message (pointer unlock) ------------------------------- */
#message.paused {
  bottom: auto;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: #aeb9c3;
  pointer-events: none;
}

/* =============================================================================
   vignette — radial darkening of the edges, claustrophobia
   ============================================================================= */
#vignette {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 36%,
    rgba(0, 0, 0, 0.45) 72%,
    rgba(0, 0, 0, 0.9) 100%
  );
  transition: background 0.25s ease;
}

/* a brief closing-in pulse used as a scare */
#vignette.pulse {
  animation: vignette-pulse 0.6s ease-out;
}

@keyframes vignette-pulse {
  0% {
    background: radial-gradient(ellipse at center,
      rgba(0,0,0,0) 10%, rgba(0,0,0,0.7) 45%, rgba(0,0,0,0.98) 100%);
  }
  100% {
    background: radial-gradient(ellipse at center,
      rgba(0,0,0,0) 36%, rgba(0,0,0,0.45) 72%, rgba(0,0,0,0.9) 100%);
  }
}

/* =============================================================================
   damage / scare flash — red overlay, transparent by default
   ============================================================================= */
#damage-flash {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(120, 0, 0, 0) 30%,
    rgba(90, 0, 6, 0.55) 100%
  );
  opacity: 0;
}

#damage-flash.flash {
  animation: damage-flash 0.5s ease-out;
}

@keyframes damage-flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* =============================================================================
   SCREENS (menu / win / loading) — overlay everything
   ============================================================================= */
.screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at center, rgba(10, 12, 16, 0.72) 0%, rgba(0, 0, 0, 0.96) 85%),
    #000;
}

/* contract: .hidden must hide */
.hidden {
  display: none !important;
}

/* ---- glitchy / flickering title ------------------------------------------- */
.title {
  font-size: clamp(34px, 9vw, 92px);
  font-weight: bold;
  letter-spacing: 0.3em;
  color: #d7dee5;
  text-transform: uppercase;
  margin-bottom: 18px;
  text-shadow:
    0 0 10px rgba(120, 150, 170, 0.25),
    0 0 2px rgba(255, 255, 255, 0.3);
  animation: title-flicker 4.2s infinite steps(1);
  position: relative;
}

@keyframes title-flicker {
  0%, 100%   { opacity: 1; }
  2%         { opacity: 0.35; }
  3%         { opacity: 1; }
  40%        { opacity: 1; }
  41%        { opacity: 0.55; }
  42%        { opacity: 1; }
  70%        { opacity: 1; }
  71%        { opacity: 0.2; }
  72.5%      { opacity: 1; }
}

.subtitle {
  font-size: clamp(13px, 2.4vw, 18px);
  color: #7f8a94;
  max-width: 42ch;
  line-height: 1.6;
  margin-bottom: 30px;
  letter-spacing: 0.08em;
}

#win-stats {
  color: #9fb0bb;
  min-height: 1.6em;
}

/* ---- buttons --------------------------------------------------------------- */
.btn {
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #cdd7df;
  background: linear-gradient(180deg, #14181d 0%, #0a0c0f 100%);
  border: 1px solid #38424c;
  padding: 14px 42px;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, background 0.2s ease;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

.btn:hover {
  color: #ffffff;
  border-color: #7fb6cc;
  background: linear-gradient(180deg, #1b2129 0%, #0c0f13 100%);
  box-shadow:
    0 0 14px rgba(90, 150, 180, 0.35),
    inset 0 0 10px rgba(90, 150, 180, 0.12);
}

.btn:active {
  transform: translateY(1px);
}

/* accessible, visible keyboard focus */
.btn:focus-visible {
  outline: 2px solid #9fd4ff;
  outline-offset: 3px;
}

/* ---- controls hint --------------------------------------------------------- */
.controls-hint {
  margin-top: 34px;
  font-size: 13px;
  color: #67727c;
  line-height: 1.9;
}

.controls-hint .dim {
  color: #434d56;
  font-size: 12px;
}

/* =============================================================================
   accessibility — reduced motion: kill the heavy animations
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  .title,
  #message.whisper,
  #hud-top.pulse #relic-count,
  #vignette.pulse,
  #damage-flash.flash {
    animation: none !important;
  }
  #message,
  .btn,
  #vignette {
    transition: none !important;
  }
  /* keep damage flash perceivable but static-safe */
  #damage-flash.flash {
    opacity: 0;
  }
}
