/* ==========================================================================
   Frimax Streets
   ========================================================================== */

.streets-stage {
  background: #05130a;
  cursor: crosshair;
}

/* While the pointer is locked the cursor is the crosshair in the HUD */
.streets-stage.locked {
  cursor: none;
}

.streets-stage.hit {
  animation: stage-hit 0.4s ease;
}

@keyframes stage-hit {
  0%,
  100% {
    box-shadow: var(--shadow-lg);
  }
  30% {
    box-shadow:
      0 0 0 4px var(--lose),
      var(--shadow-lg);
  }
}

/* ============================================================== HUD ==== */

.hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  font-family: var(--font-display);
}

.hud-overlay[hidden] {
  display: none;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(6, 22, 9, 0.85), transparent);
}

.objective {
  max-width: 58%;
}

.objective-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--frimax-green-bright);
}

.objective-text {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--frimax-cream);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  line-height: 1.25;
}

.hud-stats {
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.stat b {
  font-size: 1.05rem;
  color: var(--frimax-amber);
  font-variant-numeric: tabular-nums;
}

/* Under fifteen seconds the clock turns and pulses */
.stat-time {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--frimax-cream);
  font-variant-numeric: tabular-nums;
}

.stat-time.low {
  color: var(--lose);
  animation: clock-pulse 0.9s ease-in-out infinite;
}

@keyframes clock-pulse {
  50% {
    opacity: 0.5;
  }
}

/* brand.css sets `.stage canvas { width: 100% }`, which outranks a bare
   `.minimap` rule and stretched the minimap over the entire view. Scoping it
   to the stage raises the specificity above that. */
.cab .streets-stage .minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 150px;
  height: 150px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: rgba(6, 22, 9, 0.72);
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  opacity: 0.75;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: var(--frimax-cream);
}

.crosshair::before {
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
}

.crosshair::after {
  top: 8px;
  left: 0;
  height: 2px;
  width: 18px;
}

/* Contextual "press E" line above the crosshair */
.prompt {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(6, 22, 9, 0.86);
  border: 1px solid var(--border-strong);
  color: var(--frimax-cream);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.prompt[hidden] {
  display: none;
}

.controls-note {
  font-size: 0.82rem;
  color: var(--text-faint);
  line-height: 1.7;
}

.controls-note b {
  color: var(--frimax-amber);
}

/* =================================================== touch controls ==== */

/* A gamepad under the view rather than over it: on a phone the view is the
   width of the screen, and a stick drawn on top of it hides a third of the
   world. The cabinet lifts these into the corners when the phone is turned
   on its side. */
.streets-pad {
  justify-content: space-between;
  padding-left: 22px;
  padding-right: 22px;
}

.stick,
.touch-action {
  display: none;
}

@media (pointer: coarse) {
  .stick,
  .touch-action {
    display: block;
  }
}

.stick {
  position: relative;
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid rgba(255, 253, 247, 0.25);
  background: radial-gradient(circle at 50% 40%, rgba(255, 253, 247, 0.14), rgba(0, 0, 0, 0.45));
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, var(--frimax-green-bright), var(--frimax-green-dark));
  border: 2px solid rgba(255, 253, 247, 0.85);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.touch-action {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(ellipse 80% 90% at 50% 20%, #ffd27a, var(--frimax-amber) 55%, #b9740a);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -6px 10px rgba(120, 70, 0, 0.5),
    0 6px 0 #7a4a08,
    0 12px 18px rgba(0, 0, 0, 0.55);
  color: #3a2200;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-action:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 1px 0 #7a4a08,
    0 4px 8px rgba(0, 0, 0, 0.5);
}

.streets-pad .cab-hint.for-touch {
  flex: 1 1 auto;
}

.controls-note .for-touch {
  display: none;
}

@media (pointer: coarse) {
  .controls-note .for-keys {
    display: none;
  }
  .controls-note .for-touch {
    display: inline;
  }

  .cab .streets-stage .minimap {
    width: 84px;
    height: 84px;
    right: 8px;
    bottom: 8px;
  }
}

/* ============================================================ legend ==== */

.legend {
  padding: 18px 20px;
}

.legend h3 {
  font-size: 1rem;
  color: var(--frimax-amber);
  margin-bottom: 12px;
}

.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.legend li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.legend b {
  color: var(--text);
}

.mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 5px;
}

.mark-pack {
  background: linear-gradient(180deg, #f0912f, #a85f16);
  border: 2px solid var(--frimax-green);
}

.mark-drop {
  background: transparent;
  border: 2px dashed var(--frimax-amber);
}

.mark-stale {
  background: #6b6b6b;
  border: 2px solid var(--lose);
}

.mark-job {
  background: var(--frimax-green);
  border: 2px solid var(--frimax-amber);
  border-radius: 50%;
}

@media (max-width: 700px) {
  .hud-stats {
    gap: 9px;
  }
  .stat {
    font-size: 0.68rem;
  }
  .objective-text {
    font-size: 0.8rem;
  }
}

/* The taller view on an upright phone (see the top of the script). Set here
   as well as in the script so the playfield's box is already the right shape
   when the page first paints, instead of jumping as the script loads. The
   condition is the same one the script tests. */
@media (max-width: 699px) and (orientation: portrait) {
  .cab #stage {
    --ar: 480 / 500 !important;
  }
}
