/*
  System: Escape — Firewall Run.
  A cold monochrome system you outrun. The closing firewall, the blocks and the
  glitch all live on the canvas; this sheet styles the shell around it — menu,
  HUD, reward toast and the run-end scorecard.
*/

:root {
  --sys-void:   #07080a;
  --sys-ink:    #f4f5f7;
  --sys-dim:    rgba(244,245,247,0.42);
  --sys-faint:  rgba(244,245,247,0.20);
  --sys-line:   rgba(255,255,255,0.14);
  --sys-mono:   'Courier New', ui-monospace, monospace;
}

html, body {
  width: 100%; height: 100%; margin: 0;
  background: var(--sys-void);
  color: var(--sys-ink);
  overflow: hidden;
  overscroll-behavior: none;
}

#sys { position: fixed; inset: 0; overflow: hidden; font-family: var(--sys-mono); }
#sys-canvas {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%;
  touch-action: none;
  cursor: none;
}
#sys.is-menu #sys-canvas,
#sys.is-over #sys-canvas { cursor: default; }

/* ── HUD ── */
.sys-hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 84px 26px 0;
  font-size: 0.62rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--sys-dim); pointer-events: none; z-index: 4;
  transition: opacity 0.5s ease;
}
.sys-hud[hidden] { display: none; }
.sys-hud-row { display: flex; gap: 22px; align-items: center; }
#sys-depth { color: var(--sys-ink); }
#sys-mode-tag, #sys-best { color: var(--sys-faint); }

.sys-mute {
  pointer-events: all; appearance: none; background: none;
  border: 1px solid var(--sys-faint); color: var(--sys-dim);
  width: 28px; height: 28px; border-radius: 50%; font-size: 0.68rem;
  cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.sys-mute:hover { color: var(--sys-ink); border-color: var(--sys-line); }
.sys-mute[aria-pressed="true"] { color: var(--sys-faint); }

/* ── Reward toast ── */
.sys-toast {
  position: absolute; left: 50%; top: 110px; transform: translate(-50%, -8px);
  z-index: 7; padding: 9px 18px;
  border: 1px solid var(--sys-line); background: rgba(7,8,10,0.85);
  color: var(--sys-ink); font-size: 0.64rem; letter-spacing: 0.16em;
  text-transform: uppercase; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.45s ease, transform 0.45s ease;
}
.sys-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.sys-toast[hidden] { display: none; }

/* ── Overlays ── */
.sys-overlay {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
.sys-overlay[hidden] { display: none; }

.sys-entry-core {
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--sys-ink); opacity: 0.12;
  animation: sys-breathe 3.4s ease-in-out infinite;
}
@keyframes sys-breathe {
  0%,100% { transform: scale(1);    opacity: 0.10; }
  50%      { transform: scale(1.16); opacity: 0.20; }
}
.sys-title {
  margin: 34px 0 0; font-weight: 400;
  font-size: clamp(2.2rem, 8vw, 4.2rem);
  letter-spacing: 0.42em; text-indent: 0.42em; color: var(--sys-ink);
}
.sys-sub {
  margin: 12px 0 0; font-size: 0.7rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--sys-dim);
}

/* ── Menu: mode picker ── */
.sys-modes {
  margin-top: 38px; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
}
.sys-mode {
  appearance: none; background: none; cursor: pointer;
  border: 1px solid var(--sys-faint); color: var(--sys-ink);
  width: 168px; padding: 20px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-family: var(--sys-mono);
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.sys-mode:hover { border-color: var(--sys-ink); transform: translateY(-2px); background: rgba(255,255,255,0.03); }
.sys-mode-name { font-size: 0.92rem; letter-spacing: 0.28em; text-indent: 0.28em; }
.sys-mode-info { font-size: 0.56rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sys-dim); }
.sys-mode-best { font-size: 0.56rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sys-faint); }

.sys-hint {
  margin-top: 34px; max-width: 30rem;
  font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sys-faint); line-height: 1.7;
}

/* ── Scorecard ── */
.sys-over { background: rgba(7,8,10,0.78); opacity: 0; transition: opacity 0.6s ease; }
.sys-over.is-shown { opacity: 1; }
.sys-eyebrow { font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--sys-dim); }
.sys-over h2 {
  margin: 12px 0 0; font-weight: 400;
  font-size: clamp(1.8rem, 7vw, 3rem); letter-spacing: 0.16em;
}
.sys-over-sub {
  margin: 10px 0 0; font-size: 0.66rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sys-dim);
}
.sys-reward {
  margin-top: 16px; font-size: 0.68rem; letter-spacing: 0.06em; color: var(--sys-dim);
  max-width: 32rem; line-height: 1.6;
}
.sys-reward b { color: var(--sys-ink); letter-spacing: 0.02em; }
.sys-share {
  margin: 18px 0 0; padding: 12px 18px;
  border: 1px solid var(--sys-line); background: rgba(255,255,255,0.03);
  font-family: var(--sys-mono); font-size: 0.7rem; letter-spacing: 0.14em;
  color: var(--sys-ink); line-height: 1.7; white-space: pre; text-align: center;
}
.sys-share[hidden] { display: none; }

.sys-free-actions {
  margin-top: 30px; display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
}
.sys-free-btn {
  appearance: none; cursor: pointer; text-decoration: none;
  background: none; border: 1px solid var(--sys-faint); color: var(--sys-ink);
  font-family: var(--sys-mono); font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; padding: 11px 22px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.sys-free-btn:hover { border-color: var(--sys-ink); }
.sys-free-btn.is-primary { background: var(--sys-ink); color: var(--sys-void); border-color: var(--sys-ink); }
.sys-free-btn.is-primary:hover { background: transparent; color: var(--sys-ink); }

/* ── Shared footer, pinned to the foot of the system and themed dark ──
   The page footer is normally a white in-flow bar; on this full-screen game
   it would hide behind the fixed canvas. Fix it to the bottom, make it slim
   and dark, and keep it under the menu / scorecard overlays (z 6/7). */
#site-footer .site-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: rgba(7, 8, 10, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: rgba(244, 245, 247, 0.5);
}
#site-footer .footer-inner { padding: 9px 18px; }
#site-footer .footer-copy { font-size: 12px; }
#site-footer .footer-links a:hover,
#site-footer .footer-social a:hover { color: var(--sys-ink); }
/* keep it a single slim row even on narrow screens */
@media (max-width: 700px) {
  #site-footer .footer-inner { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  #site-footer .footer-links, #site-footer .footer-social { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) { .sys-entry-core { animation: none; } }

@media (max-width: 620px) {
  .sys-hud { padding-top: 74px; font-size: 0.56rem; }
  .sys-modes { gap: 12px; }
  .sys-mode { width: 44vw; max-width: 168px; padding: 16px 10px; }
}
