:root {
  --bg: #050505;
  --fg: #f4f4f4;
  --hud: #9aa3ad;          /* neutral steel: chrome, never an accent */
  --red: #de2910;
  --gold: #ffde00;
  --us: #9fb2c8;           /* the American feed's cold blue grey */
  --ok: #7ec488;           /* green ONLY where green means go: active, infiltrated */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --display: "Anton", "Arial Narrow", Arial, sans-serif;
}
/* Self-hosted so there is no CDN to depend on and nothing to keep up to date.
   Latin subset only; Chinese never uses it. SIL OFL, see fonts/OFL.txt. */
@font-face {
  font-family: "Anton";
  src: url("fonts/anton.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  overflow: hidden;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}
[lang="zh-CN"] {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}
.wordmark {
  font-family: var(--display);
  font-weight: 400;          /* Anton ships one weight; bolder would be synthetic */
  letter-spacing: 0.12em;    /* condensed faces choke on the wide mono tracking */
  text-indent: 0.12em;       /* recenters tracked text */
  text-transform: uppercase;
}

/* ---- shared camera surface ---- */
.crt {
  position: absolute; inset: 0;
  background: url("img/crt.jpg?v=5") center / cover no-repeat;
  opacity: 0.38;
  pointer-events: none;
}

/* ---- shared HUD chrome ---- */
.hudline {
  position: absolute; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  padding: 0 clamp(0.7rem, 2.5vw, 1.6rem);
  font-size: clamp(0.56rem, 1.5vw, 0.72rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hud);
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}
.hudline.top { top: max(0.8rem, env(safe-area-inset-top)); }
.hudline.bottom { bottom: max(0.8rem, env(safe-area-inset-bottom)); justify-content: center; }
.camtag, .clock { display: inline-flex; align-items: center; gap: 0.5em; }
.rec {
  width: 0.55em; height: 0.55em; border-radius: 50%;
  background: var(--red); display: inline-block; flex: none;
  animation: blink 1.6s steps(1, end) infinite;
}
@keyframes blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.15; } }
body.paused .rec { animation: none; opacity: 1; }
/* The American feed reads cold and English-only: a different agency's screen. */
.hudline.us { color: var(--us); }
.hudline.us .camtag em { font-style: normal; opacity: 0.62; }
.interceptbar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 0.42rem 0.6rem;
  padding-top: calc(0.42rem + env(safe-area-inset-top));
  background: rgba(5,5,5,0.72);
  border-bottom: 1px solid rgba(154,163,173,0.32);
  color: var(--hud);
  font-size: clamp(0.5rem, 1.35vw, 0.63rem);
  letter-spacing: 0.24em; text-indent: 0.24em;
  text-transform: uppercase;
}
.interceptbar [lang="zh-CN"] { letter-spacing: 0.12em; }
#idstat {
  color: var(--us); letter-spacing: 0.22em; text-indent: 0.22em;
  transition: color 0.12s linear;
}
#idstat.match {
  color: var(--red); font-weight: 700;
  background: rgba(5,5,5,0.7);
  border: 1px solid var(--red);
  padding: 0.3rem 0.7rem;
}

/* ---- entry gate: state login ---- */
#gate {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 0.7rem; cursor: pointer;
  background: var(--bg) url("media/poster.jpg?v=3") center / cover no-repeat;
  padding: 1.5rem;
}
#gate::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(5,5,5,0.78) 0%, rgba(5,5,5,0.96) 100%);
}
#gate > * { position: relative; }
#star {
  width: clamp(58px, 13vw, 104px); height: auto;
  mix-blend-mode: screen; margin-bottom: 0.3rem;
}
#gate .sys {
  font-size: clamp(1.05rem, 4.2vw, 1.7rem);
  letter-spacing: 0.3em; text-indent: 0.3em; color: var(--fg);
}
#gate .sys-en {
  font-size: clamp(0.52rem, 1.9vw, 0.7rem);
  letter-spacing: 0.28em; text-indent: 0.28em;
  color: var(--hud); text-transform: uppercase;
}
#gate .subject {
  margin-top: 1.1rem; display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  font-size: clamp(0.55rem, 1.9vw, 0.72rem);
  letter-spacing: 0.26em; text-indent: 0.26em; color: var(--hud);
  text-transform: uppercase;
}
#gate .subject b {
  font-size: clamp(1.7rem, 7.6vw, 3.4rem); color: var(--fg);
  letter-spacing: 0.1em; text-indent: 0.1em;
}
#tap {
  margin-top: 1.4rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  font-size: clamp(0.6rem, 2vw, 0.78rem);
  letter-spacing: 0.3em; text-indent: 0.3em;
  text-transform: uppercase; color: var(--gold);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
body.paused #tap { animation: none; opacity: 1; }
#gate.leaving { transition: opacity 0.35s ease; opacity: 0; pointer-events: none; }

/* ---- CAM 01 ---- */
#intro { position: fixed; inset: 0; z-index: 30; background: var(--bg); }
#punch {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
#intro .crt { z-index: 1; }
/* Darkens the frame a step with each hit so the white cracks stay readable over
   bright asphalt, and the screen closes in toward the final break. */
#dim {
  position: absolute; inset: 0; z-index: 2; background: #000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
}
#crack {
  position: absolute; z-index: 3;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  pointer-events: none;
  will-change: transform, opacity;
}
#crack.pop { animation: pop 0.11s ease-out; }
@keyframes pop {
  from { transform: translate(-50%,-50%) scale(1.3); opacity: 0.35; }
  to   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
}
#hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
/* The intercept bar owns the top strip, so the US camera's line sits under it. */
#intro .hudline.top { top: calc(2.1rem + env(safe-area-inset-top)); }
.bracket {
  position: absolute; width: clamp(16px, 4vw, 30px); height: clamp(16px, 4vw, 30px);
  border: 2px solid var(--hud); opacity: 0.75;
}
.bracket.tl { top: 3.4%; left: 2.4%; border-right: 0; border-bottom: 0; }
.bracket.tr { top: 3.4%; right: 2.4%; border-left: 0; border-bottom: 0; }
.bracket.bl { bottom: 3.4%; left: 2.4%; border-right: 0; border-top: 0; }
.bracket.br { bottom: 3.4%; right: 2.4%; border-left: 0; border-top: 0; }
#warn {
  position: absolute; z-index: 5;
  left: 50%; top: 22%; transform: translateX(-50%);
  font-size: clamp(0.62rem, 2.3vw, 0.9rem);
  letter-spacing: 0.24em; text-indent: 0.24em; line-height: 1.9;
  color: var(--red); text-transform: uppercase;
  text-shadow: 0 0 18px rgba(0,0,0,0.95);
  pointer-events: none;
}
#warn b { color: var(--gold); font-weight: 700; }
#warn.flash { animation: warnflash 0.62s steps(1, end); }
@keyframes warnflash {
  0%, 20%, 40% { opacity: 1; }
  10%, 30% { opacity: 0; }
  41%, 100% { opacity: 1; }
}
#intro.shake { animation: shake 0.26s linear; }
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-13px,7px); }
  40% { transform: translate(10px,-9px); }
  60% { transform: translate(-7px,-6px); }
  80% { transform: translate(6px,8px); }
}
#skip {
  position: absolute; z-index: 6;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
}

/* ---- signal lost ---- */
#burst {
  position: fixed; inset: 0; z-index: 36;
  background: url("img/static.jpg?v=4") center / cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0;
}
#burst > span {
  font-size: clamp(0.7rem, 3vw, 1.15rem);
  letter-spacing: 0.3em; text-indent: 0.3em;
  color: var(--fg); text-transform: uppercase;
  /* The static underneath eats plain text, so the label needs its own ground. */
  background: rgba(5,5,5,0.86);
  border: 1px solid var(--red);
  padding: 0.6rem 1.1rem;
}
#burst.on { animation: burst 0.42s steps(1, end); }
@keyframes burst {
  0% { opacity: 0.95; } 25% { opacity: 0.3; }
  50% { opacity: 0.9; } 75% { opacity: 0.15; }
  100% { opacity: 0; }
}
#shatter { position: fixed; inset: 0; z-index: 35; pointer-events: none; }

/* ---- dossier ---- */
#links { position: fixed; inset: 0; z-index: 10; }
#links[aria-hidden="true"] { visibility: hidden; }
#bgwrap { position: absolute; inset: 0; overflow: hidden; }
#bgwrap video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 0.9s ease;
}
#bgwrap video.on { opacity: 1; }
#bgshade {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(5,5,5,0.58) 0%, rgba(5,5,5,0.9) 100%);
}
#linkstack {
  position: relative; height: 100%;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: clamp(0.55rem, 1.8vh, 0.95rem);
  padding: clamp(3rem, 9vh, 5rem) clamp(1rem, 6vw, 4rem);
  /* Extra room at the bottom so the footer line clears the corner controls,
     which are absolutely placed and would otherwise sit on top of it. */
  padding-bottom: clamp(4.2rem, 11vh, 5.5rem);
  /* body is overflow:hidden, so without this a short phone would silently clip
     the bottom links instead of letting anyone reach them. */
  overflow-y: auto;
}
#dossier { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.kicker, .secthead, .fieldlabel, .monitored {
  font-size: clamp(0.52rem, 1.8vw, 0.68rem);
  letter-spacing: 0.28em; text-indent: 0.28em;
  text-transform: uppercase; color: var(--hud);
}
.kicker { color: var(--red); }
#linkstack .wordmark {
  font-size: clamp(2rem, 7vw, 3.6rem);
  text-shadow: 0 2px 30px rgba(0,0,0,0.85);
}
/* ---- agent file ---- */
#dossier { position: relative; }
.idcard {
  margin-top: clamp(0.6rem, 2vh, 1rem);
  display: flex; align-items: center; justify-content: center;
  gap: clamp(0.6rem, 2.6vw, 1.1rem);
  flex-wrap: wrap;
}
.photo {
  position: relative; flex: none;
  width: clamp(66px, 17vw, 92px);
  border: 1px solid rgba(154,163,173,0.45);
  background: #000;
}
.photo > img { width: 100%; display: block; filter: grayscale(0.35) contrast(1.08); }
.photo .chop {
  position: absolute; right: -22%; bottom: -12%;
  width: 74%; opacity: 0.92; filter: none;
}
.fields {
  text-align: left;
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: clamp(0.48rem, 1.5vw, 0.6rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.fields dt { color: var(--hud); opacity: 0.8; }
.fields dd { color: var(--fg); letter-spacing: 0.14em; }
.fields dd.active { color: var(--ok); }

#stamp {
  /* In the file row's flow rather than absolutely placed: at every width it has
     to clear both the wordmark and the field text, and the rotation alone gives
     the corners enough overlap to still read as stamped onto the page. */
  position: relative; z-index: 2; flex: none;
  width: clamp(88px, 21vw, 132px);
  margin-left: -0.35rem;
  transform: rotate(-15deg) scale(1.85);
  opacity: 0;
  pointer-events: none;
}
#stamp img { width: 100%; display: block; }
#stamp > span {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.12em; color: var(--red);
  font-size: clamp(0.68rem, 2.4vw, 0.98rem);
  letter-spacing: 0.12em; text-indent: 0.12em; line-height: 1.05;
}
#stamp > span [lang="zh-CN"] { font-size: 1.6em; font-weight: 700; letter-spacing: 0.08em; }
#stamp > span b { font-size: 0.92em; font-weight: 700; white-space: nowrap; letter-spacing: 0.06em; }
/* The reveal beat: it lands after the glass clears. */
#stamp.in { animation: stampin 0.26s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; }
@keyframes stampin {
  from { opacity: 0; transform: rotate(-15deg) scale(1.85); }
  70%  { opacity: 1; transform: rotate(-15deg) scale(0.94); }
  to   { opacity: 1; transform: rotate(-15deg) scale(1); }
}

.chip {
  position: absolute; top: 0.4rem; right: 0.55rem;
  font-size: clamp(0.4rem, 1.15vw, 0.5rem);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ok); opacity: 0.85;
}
.chip [lang="zh-CN"] { letter-spacing: 0.06em; }
.secthead {
  margin-top: clamp(0.4rem, 2vh, 1.1rem);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(154,163,173,0.28);
  width: min(34rem, 100%);
}
#linkstack nav {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(0.5rem, 1.6vh, 0.85rem);
  width: min(34rem, 100%);
}
.row {
  position: relative;   /* the INFILTRATED chip sits in the corner */
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  width: 100%;
  padding: clamp(0.7rem, 1.9vh, 1.05rem) 1rem;
  color: var(--fg); text-decoration: none;
  border: 1px solid rgba(154,163,173,0.35);
  background: rgba(5,5,5,0.45);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.row:hover, .row:focus-visible { transform: scale(1.03); background: rgba(5,5,5,0.68); }
.row .net {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.2rem, 4.1vw, 1.6rem);
  letter-spacing: 0.08em; text-indent: 0.08em; text-transform: uppercase;
}
.row .handle { font-size: 0.72rem; color: #aeb6bf; letter-spacing: 0.1em; }
.row.kick .net { color: #53fc18; }
.row.kick:hover, .row.kick:focus-visible { border-color: #53fc18; }
.row.twitch .net { color: #a970ff; }
.row.twitch:hover, .row.twitch:focus-visible { border-color: #a970ff; }
.row.discord .net { color: #7d87f5; }
.row.discord:hover, .row.discord:focus-visible { border-color: #7d87f5; }
/* Secondary rows: the streams and the server are what the site is for, so
   anything else sits a step quieter rather than competing with them. */
.row.minor { padding: clamp(0.45rem, 1.3vh, 0.72rem) 1rem; }
.row.minor .net { font-size: clamp(0.92rem, 3vw, 1.12rem); }
.row.minor .handle { font-size: 0.66rem; }
.row.instagram .net { color: #ff6b9d; }
.row.instagram:hover, .row.instagram:focus-visible { border-color: #ff6b9d; }
.monitored {
  margin-top: clamp(0.5rem, 2.2vh, 1.3rem);
  display: flex; flex-direction: column; gap: 0.2rem;
  color: rgba(154,163,173,0.72);
}

#corner {
  position: absolute;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex; gap: 0.5rem;
}
#skip, #corner button {
  font: inherit; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--hud); background: rgba(5,5,5,0.6);
  border: 1px solid rgba(154,163,173,0.4);
  padding: 0.42rem 0.85rem; cursor: pointer;
}
#skip:hover, #corner button:hover { color: var(--fg); border-color: var(--hud); }

#toast {
  position: absolute; left: 50%; transform: translate(-50%, 8px);
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  font-size: clamp(0.6rem, 2vw, 0.75rem);
  letter-spacing: 0.2em; text-indent: 0.2em; text-transform: uppercase;
  color: var(--gold); background: rgba(5,5,5,0.85);
  border: 1px solid rgba(255,222,0,0.45);
  padding: 0.5rem 0.95rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.ns {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column; justify-content: center; gap: 1.2rem;
  font-size: 1.4rem;
}
.ns a { color: var(--fg); }
.ns .wordmark.big { font-size: clamp(2rem, 8vw, 3.4rem); }

@media (prefers-reduced-motion: reduce) {
  #tap, .rec { animation: none; opacity: 1; }
  .row, #toast { transition: none; }
  #warn.flash, #burst.on { animation: none; }
  #stamp.in { animation: none; opacity: 1; transform: rotate(-15deg) scale(1); }
}
