/* ctrl z — fósforo verde */
:root {
  --bg: #030603;
  --panel: #071007;
  --fg: #8dff7f;
  --fg-hi: #d6ffcc;
  --fg-mid: #4fc244;
  --fg-dim: #2a6a25;
  --line: #1d4a1a;
  --glow: 0 0 6px rgba(141, 255, 127, .45), 0 0 18px rgba(141, 255, 127, .15);
  --ui: "VT323", ui-monospace, monospace;
  --px: "Silkscreen", "VT323", monospace;
  --read: "IBM Plex Mono", ui-monospace, monospace;
  --gut: clamp(16px, 3vw, 28px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #000;
  color: var(--fg);
  font: 21px/1.35 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px dashed var(--fg-hi); outline-offset: 3px; }
.dim { color: var(--fg-dim); }
[hidden] { display: none !important; }
::selection { background: var(--fg); color: var(--bg); }

/* tubo: a moldura do monitor */
.tube {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at center, #0a170a 0%, var(--bg) 70%);
  text-shadow: var(--glow);
}

/* ---------- efeitos de tela ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.fx i { position: absolute; inset: 0; }
.scan {
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.28) 2px 3px);
}
.noise {
  opacity: .08;
  background: url("assets/noise.png") repeat;
  background-size: 128px 128px;
  animation: grain .6s steps(3) infinite;
}
.vig {
  box-shadow: inset 0 0 120px 30px rgba(0,0,0,.85), inset 0 0 0 10px #000;
  border-radius: 18px;
}
@keyframes grain {
  0% { transform: translate(0,0); } 25% { transform: translate(-12px,6px); }
  50% { transform: translate(8px,-10px); } 75% { transform: translate(-4px,12px); }
}
.flick { background: #000; opacity: 0; }
.fx-on .flick { animation: flick 6s infinite; }
@keyframes flick {
  0%, 96%, 100% { opacity: 0; } 96.5% { opacity: .14; } 97% { opacity: .02; } 98% { opacity: .1; }
}
/* clarão de ligar a tela (só a camada fixa, nunca a página inteira) */
.pwr { background: var(--fg-hi); opacity: 0; transform: scaleY(.004); }
.pwr.go { animation: pwr .5s ease-out; }
@keyframes pwr {
  0% { opacity: .9; transform: scaleY(.004); }
  45% { opacity: .5; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1); }
}
body:not(.fx-on) .noise, body:not(.fx-on) .scan, body:not(.fx-on) .flick { display: none; }
body:not(.fx-on) .tube { text-shadow: none; }

/* ---------- BOOT ---------- */
.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 32px;
  padding: 48px var(--gut);
  text-align: center;
  cursor: default;
}
.boot-log {
  margin: 0;
  font: 20px/1.4 var(--ui);
  white-space: pre-wrap;
  text-align: left;
  width: min(560px, 100%);
  min-height: 12em;
  color: var(--fg-mid);
}
.boot-log .w { color: var(--fg-hi); }
.boot-log .cur { animation: blink 1s steps(1) infinite; }
.boot-end { display: grid; gap: 28px; justify-items: center; animation: on .6s ease-out both; }
.glitch {
  position: relative;
  margin: 0;
  font: clamp(30px, 7vw, 76px)/1 var(--px);
  letter-spacing: .02em;
  color: var(--fg);
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
}
.glitch::before { color: var(--fg-hi); clip-path: inset(0 0 62% 0); animation: gl1 3.2s infinite steps(1); }
.glitch::after { color: var(--fg-dim); clip-path: inset(58% 0 0 0); animation: gl2 2.7s infinite steps(1); }
@keyframes gl1 { 0%,88%,100% { transform: none; } 89% { transform: translateX(-6px); } 92% { transform: translateX(4px); } }
@keyframes gl2 { 0%,80%,100% { transform: none; } 81% { transform: translateX(7px); } 85% { transform: translateX(-3px); } }
.key {
  background: none; border: 0; padding: 10px 14px;
  font-size: 22px;
  animation: blink 1.1s steps(1) infinite;
}
.key:hover, .key:focus-visible { animation: none; background: var(--fg); color: var(--bg); text-shadow: none; }
.skip {
  position: fixed; right: var(--gut); bottom: 18px; z-index: 60;
  background: none; border: 1px solid var(--line); padding: 2px 12px;
  color: var(--fg-dim);
}
.skip:hover { color: var(--fg); border-color: var(--fg-dim); }
@keyframes blink { 50% { opacity: 0; } }
@keyframes on {
  0% { opacity: 0; transform: scaleY(.02); }
  60% { opacity: 1; transform: scaleY(1.02); }
  100% { transform: none; }
}

/* ---------- MESA ---------- */
.desk {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px var(--gut) 28px;
}
.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.bar-name { font-family: var(--px); font-size: 14px; letter-spacing: .08em; }
.bar-clock { text-align: center; font-size: 22px; }
.bar-tools { display: flex; gap: 8px; justify-content: flex-end; }
.tog {
  background: none; border: 1px solid var(--line);
  padding: 0 10px; font-size: 18px; color: var(--fg-dim);
}
.tog[aria-pressed="true"] { color: var(--bg); background: var(--fg-mid); border-color: var(--fg-mid); text-shadow: none; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

/* janela genérica */
.win {
  background: var(--panel);
  border: 2px solid var(--fg-dim);
  box-shadow: 5px 5px 0 #000, 0 0 24px rgba(141,255,127,.06);
}
.win-t {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 2px 10px;
  background: var(--fg-mid);
  color: var(--bg);
  text-shadow: none;
  font-size: 19px;
  line-height: 1.3;
}
.win-d { letter-spacing: 3px; }
.x {
  background: none; border: 0; padding: 0 6px;
  font-size: 22px; line-height: 1; color: var(--bg);
}
.x:hover, .x:focus-visible { background: var(--bg); color: var(--fg); outline-color: var(--bg); }

/* monitor */
.monitor { display: flex; flex-direction: column; }
.screen {
  --x: 50%; --y: 50%; --r: 130px;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin: 14px 14px 0;
  border: 2px solid #000;
  border-radius: 14px / 18px;
  background: #020502;
  box-shadow: inset 0 0 60px rgba(0,0,0,.9), 0 0 0 6px #0c1a0c, 0 0 0 8px var(--line);
  touch-action: none;
  cursor: crosshair;
}
.layer {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center;
  gap: 4px;
  text-align: center;
  padding: 20px;
}
.layer p { margin: 0; }
.layer .big { font: clamp(20px, 3.2vw, 34px)/1.1 var(--px); margin-top: 10px; }
.base { color: var(--fg-mid); }
.base canvas {
  width: clamp(110px, 18vw, 170px);
  height: auto;
  image-rendering: pixelated;
  opacity: .8;
}
.hidden-l {
  background: #000;
  -webkit-mask: radial-gradient(circle var(--r) at var(--x) var(--y), #000 0 55%, transparent 100%);
          mask: radial-gradient(circle var(--r) at var(--x) var(--y), #000 0 55%, transparent 100%);
}
.vejo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 30%;
  filter: contrast(1.15) brightness(1.05);
}
.hidden-l .big {
  position: relative;
  color: var(--fg-hi);
  background: rgba(0,0,0,.65);
  padding: 4px 10px;
}
.hidden-l { place-content: end center; padding-bottom: 22px; }
.hint { margin: 8px 0 0; text-align: center; font-size: 17px; color: var(--fg-dim); }

/* terminal */
.term { margin: 12px 14px 14px; border-top: 1px dashed var(--line); padding-top: 8px; }
.term-out {
  height: 8.2em;
  overflow-y: auto;
  font-size: 19px;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
}
.term-out p { margin: 0; white-space: pre-wrap; }
.term-out .me { color: var(--fg-dim); }
.term-out .her { color: var(--fg-hi); }
.term-in { display: flex; gap: 8px; align-items: center; }
.term-in label { color: var(--fg-hi); }
.term-in input {
  flex: 1; min-width: 0;
  background: transparent; border: 0;
  color: var(--fg-hi);
  font: inherit; font-size: 20px;
  caret-color: var(--fg);
  text-shadow: var(--glow);
}
.term-in input::placeholder { color: var(--fg-dim); }
.term-in input:focus { outline: none; }
.term-in:focus-within { box-shadow: 0 1px 0 var(--fg-dim); }

/* lateral */
.side { display: grid; gap: 18px; align-content: start; }
.status-body { padding: 16px 16px 14px; text-align: center; }
.avatar {
  width: 112px; height: 112px;
  margin: 0 auto 10px;
  border: 2px solid var(--fg-dim);
  padding: 4px;
  background: #000;
}
.avatar img, .avatar canvas {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.avatar img { filter: grayscale(1) sepia(1) hue-rotate(58deg) saturate(3.2) brightness(.9) contrast(1.2); }
.who { margin: 0; font: 15px/1.3 var(--px); letter-spacing: .04em; color: var(--fg-hi); }
.alias { margin: 2px 0 12px; font-size: 18px; }
.conds { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; }
.conds li {
  border: 1px solid var(--line);
  padding: 1px 6px;
  font-size: 18px;
  letter-spacing: .06em;
}
.conds li:nth-child(odd) { background: rgba(141,255,127,.05); }
.meters { margin: 0; display: grid; gap: 2px; font-size: 18px; }
.meters div { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); }
.meters dt { color: var(--fg-dim); }
.meters dd { margin: 0; }

.nav { display: grid; }
.nav-b {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  font-size: 23px;
  line-height: 1.1;
}
.nav-b:first-of-type { border-top: 0; }
.nav-b .n { grid-row: span 2; align-self: center; font-family: var(--px); font-size: 13px; color: var(--fg-dim); }
.nav-b .s { font-size: 16px; color: var(--fg-dim); }
.nav-b:hover, .nav-b:focus-visible {
  background: var(--fg); color: var(--bg); text-shadow: none; outline-offset: -4px;
}
.nav-b:hover .n, .nav-b:hover .s, .nav-b:focus-visible .n, .nav-b:focus-visible .s { color: var(--bg); }

/* ---------- CHAT ---------- */
.chat {
  position: fixed;
  right: var(--gut); bottom: 84px; /* acima do selo do Netlify */
  width: min(380px, calc(100vw - 2 * var(--gut)));
  max-height: min(560px, 72vh);
  display: flex; flex-direction: column;
  z-index: 30;
  background: #030803;
  border: 2px solid var(--fg-mid);
  box-shadow: 6px 6px 0 #000, 0 0 30px rgba(141,255,127,.12);
  animation: on .4s ease-out;
}
.chat-t .dim { color: #0d2a0b; }
.live {
  display: inline-block; width: 8px; height: 8px; margin-right: 4px;
  background: var(--bg); animation: blink 1.4s steps(1) infinite;
  vertical-align: 1px;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 4px;
  font-size: 19px;
  line-height: 1.25;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
}
.msg { margin: 0 0 7px; word-wrap: break-word; }
.msg .t { color: var(--fg-dim); font-size: 15px; margin-right: 4px; }
.msg .u { margin-right: 6px; }
.msg.a .u { color: var(--fg-hi); }
.msg.a .u::before { content: "@"; color: var(--fg-dim); }
.msg.b .u { color: #b9e86a; }
.msg.c .u { color: #6fd6a4; }
.msg.me .u { color: var(--fg-dim); }
.msg.s { color: var(--fg-dim); font-style: italic; text-align: center; font-size: 17px; }
.msg.del .txt { color: var(--fg-dim); font-style: italic; }
.msg.a .txt { color: var(--fg-hi); }
.typing { margin: 0; padding: 0 12px 6px; font-size: 16px; color: var(--fg-dim); }
.chat-opts { display: grid; gap: 6px; padding: 8px 12px 12px; border-top: 1px dashed var(--line); }
.chat-opts:empty { display: none; }
.opt {
  background: none; border: 1px solid var(--fg-dim);
  padding: 3px 10px; text-align: center; font-size: 19px;
}
.opt:hover, .opt:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; }
.chat-in {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line);
}
.chat-in input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--fg-hi); font: inherit; font-size: 19px;
  caret-color: var(--fg); text-shadow: var(--glow);
  padding: 2px 0;
}
.chat-in input::placeholder { color: var(--fg-dim); }
.chat-in input:focus { outline: none; border-bottom-color: var(--fg-mid); }
.chat-in button {
  background: none; border: 1px solid var(--fg-dim);
  padding: 0 10px; font-size: 18px;
}
.chat-in button:hover, .chat-in button:focus-visible { background: var(--fg); color: var(--bg); text-shadow: none; }
.chat-pill {
  position: fixed; left: var(--gut); bottom: 18px; z-index: 30;
  background: var(--panel); border: 2px solid var(--fg-mid);
  padding: 4px 14px; font-size: 20px;
  box-shadow: 4px 4px 0 #000;
}
.chat-pill:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.badge {
  display: inline-block; min-width: 1.4em; margin-left: 6px; padding: 0 4px;
  background: var(--fg-hi); color: var(--bg); text-shadow: none; text-align: center;
  animation: blink 1s steps(1) infinite;
}

/* ---------- JANELAS ---------- */
.modal {
  width: min(760px, calc(100vw - 2 * var(--gut)));
  max-height: calc(100dvh - 48px);
  padding: 0;
  color: var(--fg);
  text-shadow: var(--glow);
  border-color: var(--fg-mid);
  overflow: hidden;
  flex-direction: column;
}
.modal[open] { display: flex; animation: on .35s ease-out both; }
.modal::backdrop { background: rgba(0, 4, 0, .78); }
body:not(.fx-on) .modal { text-shadow: none; }
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1 1 0;
  background: none; border: 0; border-right: 1px solid var(--line);
  padding: 8px 10px 6px; text-align: center;
  font-size: 18px; line-height: 1.1; color: var(--fg-dim);
}
.tab:last-child { border-right: 0; }
.tab b { display: block; font: 13px var(--px); letter-spacing: .06em; }
.tab[aria-selected="true"] { color: var(--bg); background: var(--fg); text-shadow: none; }
.tab:not([aria-selected="true"]):hover { color: var(--fg); }

.reader {
  overflow-y: auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 5vw, 56px) 40px;
  text-align: center;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
}
.reader:focus { outline: none; }
.reader h2 {
  margin: 0 0 4px;
  font: 18px/1.2 var(--px);
  letter-spacing: .06em;
  color: var(--fg-hi);
}
.reader .sub { margin: 0 0 26px; color: var(--fg-dim); font-size: 19px; }
.reader p.par {
  max-width: 60ch;
  margin: 0 auto 1.15em;
  font: 15px/1.75 var(--read);
  color: #bff5b6;
  text-shadow: 0 0 4px rgba(141,255,127,.25);
  text-wrap: pretty;
}
.reader p.par b { color: var(--fg); font-weight: 600; }
.reader .end { margin-top: 30px; color: var(--fg-dim); font-size: 18px; }
.redact {
  background: var(--fg-hi);
  color: transparent;
  text-shadow: none;
  padding: 0 2px;
  cursor: help;
  transition: background .25s, color .25s;
}
.redact:hover, .redact:focus, .redact.show { background: transparent; color: var(--fg-hi); }

.ficha-img { margin: 0 auto 18px; width: min(200px, 60%); border: 2px solid var(--line); }
.ficha-img img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.ficha h2 { font-size: 20px; margin-bottom: 20px; }
.ficha-dl { margin: 0 auto; max-width: 440px; display: grid; gap: 0; }
.ficha-dl div { padding: 7px 0; border-bottom: 1px dotted var(--line); }
.ficha-dl dt { font-size: 16px; color: var(--fg-dim); letter-spacing: .08em; text-transform: uppercase; }
.ficha-dl dd { margin: 0; font-size: 22px; color: var(--fg-hi); }

.off .tag {
  display: table;
  margin: 30px auto 14px;
  padding: 2px 12px;
  background: var(--fg-mid); color: var(--bg); text-shadow: none;
  font-size: 13px;
}
.off .tag:first-child { margin-top: 0; }
.off .log {
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  text-align: left;
  font: 14px/1.7 var(--read);
  white-space: pre-wrap;
  color: #bff5b6;
}
.off .log em { color: var(--fg); font-style: normal; }
#offCred p { margin: 0 0 4px; }

.nojs { position: fixed; inset: auto 0 40% 0; text-align: center; color: var(--fg); z-index: 99; }

/* ---------- responsivo ---------- */
@media (min-width: 1180px) {
  .grid { grid-template-columns: 280px minmax(0, 1fr) 350px; max-width: 1560px; align-items: start; }
  .side { order: -1; }
  .chat {
    position: sticky; top: 14px; right: auto; bottom: auto;
    width: auto;
    height: calc(100dvh - 92px);
    max-height: 760px;
    animation: none;
    box-shadow: 5px 5px 0 #000, 0 0 24px rgba(141,255,127,.06);
  }
  #chatMin, .chat-pill { display: none !important; }
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  body { font-size: 20px; }
  .bar { grid-template-columns: 1fr auto; }
  .bar-clock { display: none; }
  .side { grid-template-columns: 1fr; }
  .screen { aspect-ratio: 4 / 5; --r: 105px; margin: 10px 10px 0; }
  .term { margin: 10px; }
  .desk { padding-bottom: 84px; }
  .chat { right: 0; left: 0; bottom: 0; width: auto; max-height: 70dvh; border-width: 2px 0 0; }
  .chat-in { padding-bottom: 64px; }
  .chat-pill { bottom: 14px; padding: 8px 18px; font-size: 22px; }
  .modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-width: 0; }
  .reader p.par { font-size: 14.5px; }
  .vig { border-radius: 0; box-shadow: inset 0 0 80px 20px rgba(0,0,0,.8); }
}

/* telas de toque: efeitos mais leves pra não estourar a memória do navegador */
@media (pointer: coarse), (max-width: 900px) {
  :root { --glow: 0 0 5px rgba(141, 255, 127, .35); }
  .noise { animation: none; }
  .glitch::before, .glitch::after { animation-duration: 6s; }
}

/* ---------- modo leve (iPhone) ---------- */
html.lite { --glow: none; }
html.lite *, html.lite *::before, html.lite *::after { text-shadow: none !important; }
html.lite .tube { background: #050b05; }
html.lite .noise, html.lite .flick, html.lite .pwr { display: none !important; }
html.lite .vig { box-shadow: none; border-radius: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65) 100%); }
html.lite .glitch::before, html.lite .glitch::after { display: none; }
html.lite .boot-end, html.lite .chat, html.lite .modal[open] { animation: none; }
html.lite .screen { box-shadow: 0 0 0 6px #0c1a0c, 0 0 0 8px var(--line); cursor: pointer; touch-action: auto; }
html.lite .hidden-l { -webkit-mask: none; mask: none; opacity: 0; transition: opacity .3s; }
html.lite .screen.on .hidden-l, html.lite .screen.peek .hidden-l { opacity: 1; }
html.lite .reader p.par { color: #c8f7c0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  .noise { display: none; }
}
