/* css/spy.css — the spy banner (js/ui/spy.js; owner 2026-10-12, after Fallout Shelter: „POJAWIŁ SIĘ SZPIEG!”).
   One bold card under the HUD top bar in the HUD's own navy panel look with a red alarm edge: the spy glyph on a red
   badge, two short lines and a 10 s ring timer (yellow, red for the last 3 s). It never takes taps — the hall under
   it stays tappable. Result: green edge + check „Złapany! +¥…”, or a dim badge „Uciekł! −¥… · −5 fanów”.
   Motion (short, one-shot): drop-in 260 ms, one ping on the badge, a tick bump per second for the last 3 s, result
   pop, slide-out (the --mo-* tokens). Visual pass 2 (2026-10-15): a flat HUD block (--panel, the 2 px red / green
   edge, the small dark edge below) — no gradient, no glow. Reduce motion: no animation at all. */

#hud > .spy-banner {
  position: absolute;
  top: calc(max(8px, var(--safe-top)) + 62px);
  left: 50%;
  width: min(420px, calc(100% - 16px));
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
  animation: spy-in var(--mo-med) var(--mo-spring) both;
}

.spy-banner__card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 2px solid var(--red);
  box-shadow: var(--sh-edge-sm);
  color: var(--text);
}

.spy-banner__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--red);
  color: #ffffff;
  box-shadow: 0 3px 0 var(--red-dark);
}

/* one ping ring as he appears */
.spy-banner__icon::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: var(--r-md);
  border: 2px solid var(--red);
  opacity: 0;
  animation: spy-ping var(--mo-slow) var(--mo-out) var(--mo-fast) 1 both;
}

.spy-banner__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spy-banner__title {
  font-weight: 900;
  font-size: var(--fs-16);
  line-height: var(--lh-tight);
}

.spy-banner__sub {
  font-weight: 700;
  font-size: var(--fs-12);
  line-height: var(--lh-tight);
  color: var(--text-2);
}

.spy-banner__timer {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
}

.spy-banner__ring {
  position: absolute;
  inset: 0;
}

.spy-banner__ring-bg {
  fill: rgba(8, 12, 22, 0.6);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 4;
}

.spy-banner__ring-fg {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke var(--mo-fast) var(--mo-out);
}

.spy-banner__num {
  position: relative;
  font-weight: 900;
  font-size: var(--fs-16);
  font-variant-numeric: tabular-nums;
}

.spy-banner.is-urgent .spy-banner__ring-fg { stroke: var(--red); }
.spy-banner.is-urgent .spy-banner__num { color: var(--red); }
.spy-banner__timer.is-tick { animation: spy-tick var(--mo-slow) var(--mo-spring); }

/* result: caught */
.spy-banner.is-caught .spy-banner__card {
  border-color: var(--green);
}
.spy-banner.is-caught .spy-banner__icon {
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-dark);
}
.spy-banner.is-caught .spy-banner__icon::after { animation: none; }
.spy-banner.is-caught .spy-banner__sub {
  color: var(--green);
  font-weight: 900;
  font-size: var(--fs-16);
  font-variant-numeric: tabular-nums;
}

/* result: he got away */
.spy-banner.is-missed .spy-banner__card {
  border-color: var(--line);
}
.spy-banner.is-missed .spy-banner__icon {
  background: var(--raised-2);
  color: var(--text-2);
  box-shadow: 0 3px 0 var(--edge-c);
}
.spy-banner.is-missed .spy-banner__icon::after { animation: none; }
.spy-banner.is-missed .spy-banner__sub {
  color: var(--red);
  font-weight: 800;
  font-size: var(--fs-14);
  font-variant-numeric: tabular-nums;
}

.spy-banner.is-result .spy-banner__card { animation: spy-pop var(--mo-slow) var(--mo-spring); }
#hud > .spy-banner.is-out { animation: spy-out var(--mo-med) var(--mo-out) both; }

@keyframes spy-in {
  from { opacity: 0; transform: translate(-50%, -14px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes spy-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -12px); }
}

@keyframes spy-ping {
  0% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}

@keyframes spy-tick {
  0% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@keyframes spy-pop {
  0% { transform: scale(0.96); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* toasts paint above #hud: while the banner is up they start under it, not over its bottom edge (zero specificity
   on the :has part, so the sheet / modal toast rules in css/sheets.css still win) */
:where(#app:has(> #hud > .spy-banner:not(.is-out))) > #layer-toasts > .toast-stack {
  top: max(var(--toast-top, 0px), calc(max(8px, var(--safe-top)) + 140px));
}

[data-reduce-motion="true"] #hud > .spy-banner,
[data-reduce-motion="true"] .spy-banner *,
[data-reduce-motion="true"] .spy-banner *::after {
  animation: none !important;
  transition: none !important;
}
