/* Look: Machine-POV aus Person of Interest (Referenzbilder in refrence/). Schwarz/Weiss, Farbe nur als Signal:
   weiss = beobachtet, gelb = kennt die Machine / Auswahl, schwarz-gelb = Analog Interface, rot = Bedrohung, grau = kein Signal. */
@font-face { font-family: "Jost"; src: url("/_/fonts/Jost-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "ShareTech"; src: url("/_/fonts/ShareTechMono-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #030405; --panel: rgba(5,6,7,.78); --line: #1f2428; --line2: #2c3237; --off: #4d545a;
  --text: #e6e9ec; --dim: #8a9299; --faint: #7b848d; --white: #f2f2f2;
  --yellow: #f2e02a; --red: #d81e27; --red2: #ff4a4a; --ink: #0a0a0a;
  --sans: "Jost", "Futura", "Futura PT", "Century Gothic", sans-serif;
  --mono: "ShareTech", "Share Tech Mono", "Menlo", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* Hintergrund nur auf html, sonst verdeckt body das Netz (#net, z-index -1) */
html { background: var(--bg); }
html, body { margin: 0; min-height: 100%; color: var(--text); font: 500 14px var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
button, .btn { font: 600 11px var(--sans); letter-spacing: .14em; padding: 6px 11px 5px; background: #000; color: var(--white);
  border: 1.5px solid var(--white); cursor: pointer; border-radius: 3px; text-decoration: none; display: inline-block; white-space: nowrap; }
button:hover, .btn:hover { background: var(--white); color: var(--ink); }
.btn.y, .btn.y:hover { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }   /* Auswahl */
input { font: 500 14px var(--sans); letter-spacing: .08em; padding: 9px 11px; background: #050607; color: #eee;
  border: 1.5px solid var(--line2); border-radius: 3px; width: 100%; }
input:focus { outline: none; border-color: var(--white); }
.mono { font-family: var(--mono); letter-spacing: .04em; }
[hidden] { display: none !important; }

#net { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
/* Kamerabild: Scanlines, Vignette, Seitenstreben */
#grain { position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px),
              radial-gradient(ellipse 80% 75% at 50% 50%, transparent 62%, rgba(0,0,0,.55) 100%); }
#grain::before, #grain::after { content: ""; position: absolute; top: 12%; bottom: 12%; width: 9px; border-left: 1px solid rgba(235,235,235,.2);
  background: linear-gradient(rgba(220,220,220,.35), rgba(220,220,220,.35)) 0 50% / 7px 14px no-repeat,
              linear-gradient(rgba(220,220,220,.25), rgba(220,220,220,.25)) 0 22% / 4px 2px no-repeat,
              linear-gradient(rgba(220,220,220,.25), rgba(220,220,220,.25)) 0 78% / 4px 2px no-repeat; }
#grain::before { left: 6px; }
#grain::after { right: 6px; transform: scaleX(-1); }

.brand { color: var(--white); text-decoration: none; font-weight: 600; letter-spacing: .32em; font-size: 13px; white-space: nowrap; }
.brand::before { content: ""; display: inline-block; width: 9px; height: 9px; border: 2px solid var(--yellow); margin-right: 10px; vertical-align: -1px; }

/* Machine-Textfeld: schwarz, weisser Rahmen, Kopfzeile + invertierter Balken ("EVALUATING STRATEGIES. / MULTIPLE ...") */
.panel { background: #000; border: 2px solid var(--white); border-radius: 6px; overflow: hidden; }
.panel .hd { margin: 0; padding: 10px 16px 7px; font-size: 22px; font-weight: 500; letter-spacing: .1em; color: var(--white); }
.bar { display: block; background: var(--white); color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: .12em; padding: 3px 16px 2px; }
.bar.y { background: var(--yellow); }
.panel .body { padding: 16px; }

/* MPOV-Zielrahmen: gestrichelt, volle Ecken, Mittelmarken nach innen. Farbe ueber --c. */
.mpov { position: relative; --c: var(--white); }
.mpov::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  --h: repeating-linear-gradient(90deg, var(--c) 0 12px, transparent 0 20px);
  --v: repeating-linear-gradient(180deg, var(--c) 0 12px, transparent 0 20px);
  --s: linear-gradient(var(--c), var(--c));
  background:
    var(--s) 50% 0 / 2px 10px, var(--s) 50% 100% / 2px 10px, var(--s) 0 50% / 10px 2px, var(--s) 100% 50% / 10px 2px,
    var(--s) 0 0 / 16px 2px, var(--s) 0 0 / 2px 16px, var(--s) 100% 0 / 16px 2px, var(--s) 100% 0 / 2px 16px,
    var(--s) 0 100% / 16px 2px, var(--s) 0 100% / 2px 16px, var(--s) 100% 100% / 16px 2px, var(--s) 100% 100% / 2px 16px,
    var(--h) 0 0 / 100% 2px, var(--h) 0 100% / 100% 2px, var(--v) 0 0 / 2px 100%, var(--v) 100% 0 / 2px 100%;
  background-repeat: no-repeat; }
.mpov.y, .mpov.by, .mpov.hot { --c: var(--yellow); }
.mpov.off { --c: var(--off); }

/* getippter Text: --n = Zeichenzahl */
.type { display: inline-block; animation: type calc(var(--n) * 55ms) steps(var(--n)) .25s both; }
@keyframes type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.cur { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------------- login / terminal-gate */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; }
.login .sub { font-size: 17px; color: var(--dim); letter-spacing: .12em; margin: 0 0 20px; }
.login label { display: block; font-size: 10px; letter-spacing: .22em; color: var(--dim); font-weight: 600; margin: 0 0 6px; }
.login input { margin-bottom: 16px; }
.login input[name=code] { font-size: 22px; letter-spacing: .45em; padding: 5px 11px; font-variant-numeric: tabular-nums; }
.login button { width: 100%; padding: 10px; font-size: 12px; background: var(--white); color: var(--ink); border-color: var(--white); }
.login button:hover { background: var(--yellow); border-color: var(--yellow); }
.error { color: var(--red2); font-size: 12px; font-weight: 600; letter-spacing: .14em; margin: 16px 0 0; text-transform: uppercase;
  border: 2px solid var(--red); border-radius: 4px; padding: 7px 10px 6px; text-align: center; }
.error:empty { display: none; }

/* ---------------------------------------------------------------- portal */
#top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 52px; background: #000; border-bottom: 1px solid var(--line); }
#top nav { display: flex; height: 100%; }
#top nav a { display: flex; align-items: center; padding: 0 12px; color: var(--white); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: .2em; border-bottom: 2px solid transparent; }
#top nav a[aria-current] { border-bottom-color: var(--white); }
#top nav a:not([aria-current]) { color: var(--dim); }
#top nav a:hover { color: var(--white); }
#top nav a i { font-style: normal; color: var(--faint); margin-right: 7px; }
#live { margin-left: auto; font-size: 10px; font-weight: 600; letter-spacing: .16em; color: var(--white); white-space: nowrap; }
#live::before { content: "● "; }
#live.busy { color: var(--dim); }
#live.hot { color: var(--red2); }
/* Kameralabel wie "SUB6_BRKRM_04 / 15:08:01" */
#cam { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; white-space: nowrap; color: var(--white); }
#cam .loc { font-size: 12px; font-weight: 600; letter-spacing: .16em; }
#cam .time { font-size: 18px; letter-spacing: .14em; font-variant-numeric: tabular-nums; }

main { padding: 18px 24px; max-width: 1400px; margin: 0 auto; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 20px; }
.head h1 { margin: 0; font-size: 22px; letter-spacing: .16em; color: var(--white); font-weight: 500; }
.head h1 b { color: var(--yellow); font-weight: 500; }
.head .route { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.sel { background: var(--yellow); color: var(--ink); padding: 2px 8px 1px; border-radius: 2px; text-decoration: none; }

#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 22px; }
.node { background: var(--panel); padding: 16px 18px 8px; }
.node header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.node h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: .14em; color: var(--white); overflow-wrap: anywhere; }
.node .lat { font-size: 13px; letter-spacing: .1em; color: var(--white); white-space: nowrap; font-variant-numeric: tabular-nums; }
.node .strip { margin-top: 6px; padding: 3px 10px 2px; background: var(--white); color: var(--ink); font-size: 11px; font-weight: 600; letter-spacing: .16em; border-radius: 2px; }
.node.y .strip { background: var(--yellow); }
.node.by h2 { color: var(--yellow); }
.node.by .strip { background: #000; color: var(--yellow); box-shadow: inset 0 0 0 1.5px var(--yellow); }
.node.off h2, .node.off .lat { color: var(--dim); }
.node.off .strip { background: var(--off); color: #d5d9dc; }
.status { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 11px; font-weight: 600; letter-spacing: .14em; }
.status i { font-style: normal; background: var(--white); color: var(--ink); padding: 2px 6px 1px; border-radius: 2px; }
.node.off .status i { background: var(--off); color: #d5d9dc; }
.node.off .status b { color: var(--dim); }
.status b { font-weight: 600; color: var(--white); }
.node .role { font-size: 10px; letter-spacing: .16em; color: var(--faint); margin-top: 8px; }
.node .meta { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 6px 0 10px; font-size: 11px; color: var(--dim); }
.node .meta .mono { color: var(--text); }
.node.off .meta .mono { color: var(--dim); }

.svc { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 4px 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.svc .t { font-size: 10px; font-weight: 600; letter-spacing: .14em; color: var(--faint); }
.svc .n { font-size: 12px; font-weight: 600; letter-spacing: .16em; color: var(--text); min-width: 0; }
.svc .n small { display: block; font: 400 10px var(--mono); letter-spacing: .02em; color: var(--faint); margin-top: 3px; overflow-wrap: anywhere; }
.svc.down .n { color: var(--faint); }
.svc.on { box-shadow: inset 2px 0 var(--yellow); padding-left: 8px; margin-left: -8px; }
.svc.on .n { color: var(--yellow); }
.svc .act { display: flex; gap: 6px; align-items: center; }
.ms { font-size: 12px; letter-spacing: .06em; color: var(--white); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.svc.down .ms { color: var(--dim); }
/* einmaliger Aufbau beim ersten Laden */
.rv { animation: rv .35s both; }
@keyframes rv { from { opacity: 0; clip-path: inset(0 100% 0 0); } }

footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 24px 28px; max-width: 1400px; margin: 0 auto;
  font-size: 10px; letter-spacing: .16em; color: var(--faint); }

#boot { position: fixed; inset: 0; z-index: 40; background: #000; display: grid; place-items: center; transition: opacity .4s; }
#boot pre { font: 500 19px/1.55 var(--sans); letter-spacing: .12em; color: var(--white); margin: 0; padding: 16px; min-width: min(100%, 24em); white-space: pre-wrap; }
#boot.done { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- terminal */
body.term { height: 100vh; display: flex; flex-direction: column; }
body.term #title { color: var(--yellow); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
body.term .login { flex: 1; min-height: 0; }
#screen { flex: 1; min-height: 0; padding: 8px 12px; background: var(--bg); }
#screen .xterm { height: 100%; }
#screen .xterm-viewport { background: var(--bg) !important; }

/* ---------------------------------------------------------------- mail */
main.mail { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }
main.mail aside .body { padding: 6px 16px 16px; }
main.mail aside label { display: block; font-size: 10px; letter-spacing: .22em; color: var(--dim); font-weight: 600; margin: 0 0 6px; }
main.mail aside form button { width: 100%; }
#addrs { list-style: none; margin: 0 0 18px; padding: 0; }
#addrs li { display: flex; border-top: 1px solid var(--line); }
#addrs li:first-child { border-top: 0; }
#addrs .pick { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 0; border-radius: 0;
  padding: 10px 2px 9px; font-size: 12px; letter-spacing: .14em; color: var(--text); overflow-wrap: anywhere; }
#addrs .pick:hover { background: none; color: var(--white); }
#addrs .pick b { background: var(--white); color: var(--ink); padding: 1px 6px 0; border-radius: 2px; font-weight: 600; letter-spacing: .06em; align-self: center; }
#addrs .pick b:empty { display: none; }
#addrs li.on { box-shadow: inset 2px 0 var(--yellow); }
#addrs li.on .pick { color: var(--yellow); padding-left: 10px; }
#addrs .x { background: none; border: 0; color: var(--faint); padding: 0 8px; font-size: 12px; }
#addrs .x:hover { color: var(--white); background: none; }
.addr-in { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.addr-in input { flex: 1; min-width: 0; }
.addr-in span { color: var(--dim); font-size: 12px; }
button.arm, #addrs .x.arm { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }

#list { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.msg { display: grid; grid-template-columns: 64px minmax(0, 220px) minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 11px 16px;
  border-top: 1px solid var(--line); text-decoration: none; color: var(--dim); }
.msg:first-child { border-top: 0; }
.msg:hover { background: rgba(255,255,255,.05); }
.msg .f, .msg .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .f { font-weight: 600; letter-spacing: .06em; }
.msg .d, .msg .t { font-size: 12px; color: var(--faint); }
.msg.new { color: var(--white); box-shadow: inset 2px 0 var(--white); }
.empty { padding: 34px 16px; margin: 0; text-align: center; color: var(--faint); font-size: 12px; letter-spacing: .16em; }

#read .head { margin-top: 0; }
#read .act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#read .hd { font-size: 20px; letter-spacing: .04em; overflow-wrap: anywhere; }
#meta { letter-spacing: .06em; overflow-wrap: anywhere; }
#frame { display: block; width: 100%; height: calc(100vh - 220px); min-height: 360px; border: 0; background: var(--bg); }

/* ---------------------------------------------------------------- files */
#crumbs a { text-decoration: none; overflow-wrap: anywhere; }
#crumbs a.y { color: var(--yellow); }
#files { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.file { display: grid; grid-template-columns: minmax(0, 1fr) 80px 120px auto; gap: 16px; align-items: center; padding: 7px 16px; border-top: 1px solid var(--line); color: var(--dim); }
.file:first-child { border-top: 0; }
.file:hover { background: rgba(255,255,255,.05); }
.file .n { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.file .n.d { color: var(--white); font-weight: 600; letter-spacing: .06em; }
.file .n.off { color: var(--faint); }
.file .s, .file .t { font-size: 12px; color: var(--faint); text-align: right; }
.file .act { display: flex; gap: 6px; justify-content: flex-end; }

@media (max-width: 860px) {
  .file { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; }
  .file .t { display: none; }
  .file .act { grid-column: 1 / -1; }
  main.mail { grid-template-columns: 1fr; }
  body.reading main.mail aside { display: none; }
  .msg { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; }
  .msg .f { order: 1; } .msg .d { order: 2; } .msg .s { order: 3; grid-column: 1 / -1; } .msg .t { display: none; }
}
@media (max-width: 700px) { #grain::before, #grain::after { display: none; } main, footer { padding-left: 16px; padding-right: 16px; } }
@media (max-width: 560px) {
  #top { gap: 10px; padding: 0 12px; }
  #cam, #top nav a i { display: none; }
  #top nav a { padding: 0 8px; }
  #live { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .node { padding: 14px 14px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .rv, .type, .cur { animation: none; }
  #boot { display: none; }
}
