/* AI hacker screen — xscript.net */

:root {
  --bg: #07090c;
  --panel: #0c1016;
  --panel-head: #111720;
  --line: #1c2631;
  --line-bright: #2e3c4a;
  --text: #e6f1f7;
  --muted: #7f8fa0;
  --dim: #4a5866;
  --red: #ff3854;
  --amber: #ffb830;
  --green: #46f08c;
  --font-data: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-label: 'Barlow Condensed', 'Arial Narrow', var(--font-data);
}

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

html { background: var(--bg); }

body {
  font-family: var(--font-data);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}

button, input { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------- App shell ----------
   The phase sets the accent colour; elements that use it fade between phases. */
.ai {
  --accent: #35d0ff;
  --accent-rgb: 53, 208, 255;
  height: 100vh;
  min-height: 680px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.ai[data-phase="awakening"] { --accent: #ffb830; --accent-rgb: 255, 184, 48; }
.ai[data-phase="takeover"] { --accent: #ff3854; --accent-rgb: 255, 56, 84; }
.ai[data-phase="contained"] { --accent: #46f08c; --accent-rgb: 70, 240, 140; }
.ai:fullscreen { height: 100vh; width: 100vw; min-height: 0; }
.ai:-webkit-full-screen { height: 100vh; width: 100vw; min-height: 0; }

/* Faint scanlines over the whole screen (static) */
.ai::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
  z-index: 40;
}

/* Edge glow: steady by default, a slow 0.5 Hz breath during the takeover */
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  box-shadow: inset 0 0 140px rgba(var(--accent-rgb), 0.12);
  transition: box-shadow 1.2s;
}
.ai[data-phase="takeover"] .vignette {
  box-shadow: inset 0 0 160px rgba(var(--accent-rgb), 0.26);
  animation: breathe 2s ease-in-out infinite;
}
.ai.is-paused .vignette { animation-play-state: paused; }

/* ---------- Header ---------- */
.ah {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: var(--panel-head);
  border-bottom: 2px solid var(--accent);
  flex: 0 0 auto;
  transition: border-color 1.2s;
}
.ah-left, .ah-right { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 0; }
.ah-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.ah-logo {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--accent);
  color: #05080b;
  font-size: 1rem;
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.55);
  transition: background-color 1.2s, box-shadow 1.2s;
}
.ah-name { display: flex; flex-direction: column; line-height: 1.05; }
.ah-title {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.2em;
  color: var(--text);
}
.ah-sub { font-family: var(--font-label); font-size: 0.72rem; letter-spacing: 0.24em; color: var(--muted); white-space: nowrap; }

.ah-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-label);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #05080b;
  background: var(--accent);
  padding: 3px 10px;
  white-space: nowrap;
  transition: background-color 1.2s;
}
.ah-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.ai.is-paused .ah-status { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--muted); }
.ai.is-paused .ah-status .dot { animation: none; }

.ah-sim {
  font-family: var(--font-label);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  border: 1px dashed var(--line-bright);
  padding: 3px 7px;
  white-space: nowrap;
}

.ah-center { display: flex; flex-direction: column; align-items: center; line-height: 1; flex: 0 0 auto; }
.ah-phase {
  font-family: var(--font-label);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-shadow: 0 0 16px rgba(var(--accent-rgb), 0.45);
  white-space: nowrap;
  transition: color 1.2s;
}
.ah-phase-sub { margin-top: 4px; font-family: var(--font-label); font-size: 0.74rem; letter-spacing: 0.18em; color: var(--muted); white-space: nowrap; }

.abtn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-bright);
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.abtn:hover, .abtn:focus-visible { background: rgba(255, 255, 255, 0.08); border-color: var(--text); }
.abtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.abtn.is-accent { color: var(--accent); border-color: var(--accent); }
.abtn.is-accent:hover, .abtn.is-accent:focus-visible { background: rgba(var(--accent-rgb), 0.14); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Main grid ---------- */
.agrid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.7fr) minmax(290px, 0.82fr);
  gap: 8px;
  padding: 8px 10px;
}
.col { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.ph {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 10px 4px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-head);
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
}
.ph-title { font-family: var(--font-label); font-size: 0.92rem; font-weight: 700; letter-spacing: 0.18em; color: var(--text); }
.ph-title::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 8px;
  vertical-align: 2px;
  background: var(--accent);
  transition: background-color 1.2s;
}
.ph-note { margin-left: auto; font-family: var(--font-label); font-size: 0.74rem; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.pb { flex: 1 1 auto; min-height: 0; overflow: hidden; position: relative; }
.cv-wrap { position: relative; min-height: 0; overflow: hidden; }
.cv-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.p-train { flex: 1 1 52%; }
.p-attn { flex: 1 1 48%; }
.p-net { flex: 1 1 64%; }
.p-voice { flex: 1 1 36%; min-height: 170px; }
.p-sys { flex: 0 0 auto; }
.p-stream { flex: 1 1 auto; min-height: 120px; }

/* ---------- Training ---------- */
.train { display: flex; flex-direction: column; }
.tr-read {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 8px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--line);
}
.rd { display: flex; flex-direction: column; min-width: 0; border-left: 2px solid var(--accent); padding-left: 7px; transition: border-color 1.2s; }
.rd-l { font-family: var(--font-label); font-size: 0.74rem; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap; }
.rd-v { font-size: 0.86rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.train .cv-wrap { flex: 1 1 auto; }

.attn { display: flex; }
.attn .cv-wrap { flex: 1 1 auto; }

/* ---------- Voice ---------- */
.voice { display: grid; grid-template-columns: minmax(150px, 36%) 1fr; }
.voice .cv-wrap { border-right: 1px solid var(--line); }
.vc { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 18px; min-width: 0; }
.vc-k { font-family: var(--font-label); font-size: 0.8rem; letter-spacing: 0.24em; color: var(--muted); }
.vc-t {
  font-size: clamp(0.95rem, 1.45vw, 1.6rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  text-shadow: 0 0 18px rgba(var(--accent-rgb), 0.45);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.vc-t.is-live::after { content: '▌'; color: var(--accent); animation: blink 1s steps(2, start) infinite; }

/* ---------- Systems ---------- */
.sys { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 7px; }
.sy {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 6px;
  padding: 5px 7px 7px;
  border: 1px solid var(--line-bright);
  background: rgba(255, 255, 255, 0.015);
  min-width: 0;
  overflow: hidden;
  transition: background-color 0.6s, border-color 0.6s;
}
.sy-n { font-family: var(--font-label); font-size: 0.86rem; font-weight: 700; letter-spacing: 0.08em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sy-c { font-size: 0.56rem; letter-spacing: 0.06em; color: var(--dim); align-self: center; white-space: nowrap; }
.sy-s { grid-column: 1 / -1; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.sy-b { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.05); }
.sy-b i { display: block; height: 100%; width: 0; background: var(--red); }

.sy.is-scan { border-color: var(--amber); }
.sy.is-scan .sy-s { color: var(--amber); }
.sy.is-probe { border-color: var(--red); background: rgba(255, 56, 84, 0.08); animation: pulseBorder 1.6s ease-in-out infinite; }
.sy.is-probe .sy-s { color: var(--red); }
.sy.is-owned { border-color: var(--red); background: rgba(255, 56, 84, 0.82); }
.sy.is-owned .sy-n, .sy.is-owned .sy-s { color: #fff; }
.sy.is-owned .sy-c { color: rgba(255, 255, 255, 0.7); }
.sy.is-owned .sy-b i { background: #fff; }
.sy.is-restored { border-color: var(--green); background: rgba(70, 240, 140, 0.08); }
.sy.is-restored .sy-s { color: var(--green); }
.sy.is-restored .sy-b i { background: var(--green); }

/* ---------- Token stream ---------- */
.stream { display: flex; flex-direction: column; justify-content: flex-end; padding: 4px 0; }
.ts-row {
  display: grid;
  grid-template-columns: 56px 40px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 3px 10px;
  font-size: 0.68rem;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  flex: 0 0 auto;
}
.ts-t { color: var(--dim); font-size: 0.6rem; white-space: nowrap; }
.ts-k { font-family: var(--font-label); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; color: var(--accent); white-space: nowrap; }
.ts-x { color: #b9c6d1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.k-say .ts-x { color: #fff; font-weight: 600; }
.k-sys .ts-k { color: var(--muted); }
.k-sys .ts-x { color: var(--muted); }
.tk { background: rgba(255, 255, 255, 0.045); border-radius: 2px; }
.tk-b { background: rgba(var(--accent-rgb), 0.14); }
.ts-row.is-live .ts-x::after { content: '▌'; color: var(--accent); animation: blink 1s steps(2, start) infinite; }

/* ---------- Status / director bar ---------- */
.ab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 14px;
  border-top: 1px solid var(--line-bright);
  background: var(--panel-head);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}
.ab-data { display: flex; align-items: center; gap: 18px; min-width: 0; overflow: hidden; }
.ab-item { display: inline-flex; align-items: center; gap: 6px; }
.ab-item b { color: var(--text); font-weight: 600; }
.ab-item.is-bad b { color: var(--red); }
.cont-bar { display: inline-block; width: 70px; height: 7px; background: #05080b; border: 1px solid var(--line-bright); }
.cont-bar span { display: block; height: 100%; width: 100%; background: var(--accent); transition: background-color 1.2s; }
.ab-ctl { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ab-ctl .abtn { padding: 4px 8px; font-size: 0.62rem; }
.ab-ctl-l { font-family: var(--font-label); font-size: 0.76rem; letter-spacing: 0.16em; }
.ab-sep { width: 1px; height: 18px; background: var(--line-bright); margin: 0 4px; }

/* ---------- Custom line dialog ---------- */
.say {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 11, 0.78);
  padding: 16px;
}
.say-box {
  width: min(560px, 100%);
  border: 1px solid var(--accent);
  background: var(--panel);
  padding: 20px 22px;
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.18);
}
.say-kicker { font-family: var(--font-label); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.22em; color: var(--accent); margin-bottom: 12px; }
.say-label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.say-input {
  width: 100%;
  background: #05080b;
  color: var(--text);
  border: 1px solid var(--line-bright);
  padding: 10px 12px;
  font-size: 0.9rem;
}
.say-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.say-help { font-size: 0.68rem; line-height: 1.6; color: var(--muted); margin: 10px 0 14px; }
.say-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Prank reveal ---------- */
.prank {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 12, 9, 0.96);
  padding: 20px;
  animation: fadeIn 0.5s ease-out;
}
.prank-box { text-align: center; max-width: 640px; }
.prank-kicker { font-family: var(--font-label); font-size: 1rem; letter-spacing: 0.3em; color: var(--green); font-weight: 700; }
.prank-title {
  font-family: var(--font-label);
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  line-height: 1.05;
  margin: 10px 0 14px;
}
.prank-text { font-size: 0.88rem; line-height: 1.7; color: #b9d4c4; margin: 0 auto 8px; max-width: 54ch; }
.prank-small { font-size: 0.7rem; color: var(--muted); margin-top: 12px; }
.prank .abtn { margin-top: 18px; color: var(--green); border-color: var(--green); padding: 9px 16px; font-size: 0.76rem; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes blink { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes pulseBorder { 0%, 100% { border-color: var(--red); } 50% { border-color: rgba(255, 56, 84, 0.35); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Reference content ---------- */
.tool-info {
  max-width: 900px;
  margin: 44px auto 40px;
  padding: 0 24px;
  color: #a3afba;
  line-height: 1.7;
  font-size: 0.92rem;
}
.tool-info h1 { color: var(--text); font-size: 1.3rem; letter-spacing: 0.03em; margin-bottom: 14px; line-height: 1.35; }
.tool-info h2 {
  color: var(--text);
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 32px 0 10px;
  padding-left: 10px;
  border-left: 3px solid #35d0ff;
}
.tool-info h3 { color: var(--text); font-size: 0.94rem; margin: 22px 0 6px; }
.tool-info p { margin-bottom: 12px; }
.tool-info ul, .tool-info ol { margin: 0 0 12px 22px; }
.tool-info li { margin-bottom: 6px; }
.tool-info a { color: #6fdcff; }
.tool-info strong { color: var(--text); }
.tool-info kbd {
  font-family: var(--font-data);
  font-size: 0.8em;
  border: 1px solid var(--line-bright);
  border-bottom-width: 2px;
  padding: 0 5px;
  border-radius: 3px;
  color: var(--text);
}
.tool-info code { font-family: var(--font-data); font-size: 0.86em; color: var(--text); background: rgba(255, 255, 255, 0.06); padding: 0 4px; border-radius: 3px; }
.glossary { margin: 0 0 12px; }
.glossary dt { color: var(--text); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.84rem; margin-top: 16px; }
.glossary dd { margin: 4px 0 0; }

.site-foot {
  border-top: 1px solid var(--line-bright);
  background: var(--panel-head);
  padding: 15px;
  text-align: center;
  font-size: 0.8rem;
}
.site-foot-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-foot-links a { color: var(--text); text-decoration: none; }
.site-foot-links a:hover { text-decoration: underline; }
.site-foot-note { color: var(--muted); font-size: 0.72rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  .ab-data .ab-item:nth-child(3) { display: none; }
}

@media (max-width: 1380px) {
  .ah-sub, .ah-sim { display: none; }
  .ah-phase { font-size: 1.4rem; }
  .ah .abtn { padding: 6px 7px; letter-spacing: 0.06em; }
  .ah-right { gap: 6px; }
}

@media (max-width: 1100px) {
  .ai { height: auto; min-height: 0; }
  .ah { flex-wrap: wrap; }
  .ah-left, .ah-right { flex: 1 1 auto; }
  .ah-center { order: -1; width: 100%; }
  .ah-sim { display: inline-block; }
  .agrid { grid-template-columns: 1fr 1fr; }
  .col-mid { grid-column: 1 / -1; order: -1; }
  .p-net { flex: 0 0 auto; height: 400px; }
  .p-voice { flex: 0 0 auto; height: 210px; }
  .p-train { flex: 0 0 auto; height: 270px; }
  .p-attn { flex: 0 0 auto; height: 250px; }
  .p-stream { flex: 0 0 auto; height: 280px; }
  .ab { flex-wrap: wrap; white-space: normal; justify-content: center; }
  .ab-data { flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
  .ab-data .ab-item:nth-child(3) { display: inline-flex; }
  .ab-ctl { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 680px) {
  .agrid { grid-template-columns: 1fr; padding: 6px; gap: 6px; }
  .col { gap: 6px; }
  .p-net { height: 320px; }
  .ah-right { justify-content: center; }
  .ah-left { justify-content: center; flex-wrap: wrap; }
  .ah-phase { font-size: 1.2rem; }
  .voice { grid-template-columns: 130px 1fr; }
  .vc { padding: 10px 12px; }
  .vc-t { font-size: 0.95rem; }
  .ab-sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ah-status .dot, .vc-t.is-live::after, .ts-row.is-live .ts-x::after,
  .sy.is-probe, .ai[data-phase="takeover"] .vignette, .prank { animation: none; }
  .vignette, .ah, .ah-logo, .ah-status, .ah-phase, .ph-title::before, .rd, .cont-bar span, .sy { transition: none; }
}
