:root {
  --glass: #07060a;
  --pink: #ff3fc4;
  --pink-hot: #ff9ae3;
  --pink-dim: #8a1f6c;
  --pink-deep: #3a0f2f;
  --gold: #e5c060;
  --cyan: #00dcff;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  /* one shared column: the bar and the document line up on both edges,
     and the whole block centres once the viewport is wider than the column */
  --pad: clamp(14px, 3vw, 28px);
  --col: 820px;
  --gutter: max(var(--pad), calc((100% - var(--col)) / 2));
  --crt: "VT323", "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html, body {
  background: var(--glass);
  color: var(--pink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- the screen fills the viewport ---------- */
.room, .monitor { height: 100dvh; }
.screen {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at center, #140a14 0%, var(--glass) 75%);
  box-shadow: inset 0 0 120px rgba(0,0,0,.9), inset 0 0 16px rgba(255,63,196,.12);
  overflow: hidden;
}
/* scanlines + phosphor flicker + vignette */
.screen::before, .screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.screen::before {
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.28) 2px 3px);
  animation: flick 6s infinite steps(1);
}
.screen::after { background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }
@keyframes flick { 0%,100% { opacity: .9 } 47% { opacity: .75 } 48% { opacity: .95 } }

.bar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px var(--gutter);
  font-family: var(--crt); font-size: clamp(15px, 2vw, 20px); letter-spacing: .06em;
  color: var(--pink-hot);
  border-bottom: 1px solid var(--pink-deep);
  text-shadow: 0 0 6px rgba(255,63,196,.7);
  position: relative; z-index: 6;
}
.bar-right { white-space: nowrap; flex-shrink: 0; }
.bar-right b { color: var(--gold); font-weight: 400; }

.scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(16px, 3vw, 32px) var(--gutter) 30vh;
  scrollbar-width: thin; scrollbar-color: var(--pink-dim) transparent;
}

/* ---------- text on the glass ---------- */
.boot { margin: 0 0 24px; font-family: var(--crt); font-size: clamp(16px, 2.2vw, 21px); color: var(--pink-dim); white-space: pre-wrap; text-shadow: 0 0 4px rgba(255,63,196,.4); }
.doc { max-width: var(--col); margin: 0; font-size: clamp(13px, 1.55vw, 15.5px); line-height: 1.75; text-shadow: 0 0 5px rgba(255,63,196,.55), 0 0 1px var(--pink); }
.doc p { margin: 0 0 14px; }
.classified { font-family: var(--crt); font-size: clamp(18px, 2.4vw, 24px); color: var(--gold); text-shadow: 0 0 8px rgba(229,192,96,.6); letter-spacing: .12em; }
.doc h1 { font-family: var(--crt); font-weight: 400; font-size: clamp(38px, 7vw, 72px); line-height: 1; margin: 6px 0 12px; color: var(--pink-hot); letter-spacing: .04em; text-shadow: 0 0 14px rgba(255,63,196,.9), 0 0 2px #fff; white-space: nowrap; }
.sub { color: var(--pink-hot); }
.doc h2 { font-family: var(--crt); font-weight: 400; font-size: clamp(19px, 2.5vw, 25px); letter-spacing: .06em; margin: 30px 0 8px; color: var(--pink-hot); white-space: nowrap; }
.doc h2::before { content: "▌"; margin-right: 8px; color: var(--pink); }
.complete { margin-top: 48px !important; text-align: center; font-family: var(--crt); font-size: 20px; color: var(--pink-hot); }

/* ---------- sealed sections ---------- */
.sealed {
  position: relative; margin: 6px 0 14px; padding: 12px 14px 14px;
  border: 1px solid var(--pink); background: rgba(255,63,196,.08); cursor: pointer;
  box-shadow: 0 0 12px rgba(255,63,196,.45), inset 0 0 18px rgba(255,63,196,.18);
  animation: glow 2.4s ease-in-out infinite;
  outline: none;
}
.sealed:hover, .sealed:focus-visible { background: rgba(255,63,196,.16); animation-duration: .8s; }
.sealed-tag { margin: 0 0 8px !important; font-family: var(--crt); font-size: clamp(16px, 2vw, 19px); letter-spacing: .12em; color: var(--gold); text-shadow: 0 0 8px rgba(229,192,96,.7); }
.cipher { margin: 0 !important; color: var(--pink-hot); word-break: break-all; text-shadow: 0 0 6px var(--pink), 0 0 14px rgba(255,63,196,.6); }
@keyframes glow { 0%,100% { box-shadow: 0 0 8px rgba(255,63,196,.35), inset 0 0 14px rgba(255,63,196,.12); } 50% { box-shadow: 0 0 22px rgba(255,63,196,.8), inset 0 0 26px rgba(255,63,196,.3); } }

.decrypted { border-left: 2px solid var(--pink); padding-left: 12px; }
.decrypted p { margin: 0 0 8px !important; }
.signed-line { font-family: var(--crt); font-size: clamp(18px, 2.3vw, 22px); letter-spacing: .05em; }
.signed-line b { color: #fff; font-weight: 400; }
.breach { color: var(--gold); text-shadow: 0 0 8px rgba(229,192,96,.75); border-bottom: 1px dashed var(--gold); }
.war { margin: 18px 0 6px !important; font-family: var(--crt); font-size: clamp(28px, 4.6vw, 48px); line-height: 1.05; letter-spacing: .03em; color: #fff; text-shadow: 0 0 12px #ff2d55, 0 0 30px rgba(255,45,85,.7); }
.screen.alarm::after { background: radial-gradient(ellipse at center, rgba(255,20,60,.0) 30%, rgba(255,20,60,.45) 100%); animation: alarm .5s steps(2) 5; }
.screen.alarm .bar { color: #ff5a7a; text-shadow: 0 0 8px #ff2d55; }
@keyframes alarm { 50% { opacity: .15; } }
.status { margin-top: 36px !important; padding-top: 12px; border-top: 1px dashed var(--pink-dim); font-family: var(--crt); font-size: clamp(18px, 2.3vw, 22px); letter-spacing: .06em; color: var(--pink-hot); }

/* ---------- pop-up windows ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(7,6,10,.55); backdrop-filter: blur(2px); }
.modal[hidden] { display: none; }
.window { width: min(460px, 100%); background: #0d070c; border: 2px solid var(--pink); box-shadow: 0 0 0 4px #0d070c, 0 0 0 5px var(--pink-dim), 0 0 50px rgba(255,63,196,.45); color: var(--pink); animation: pop .18s ease-out; }
.window-wide { width: min(560px, 100%); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.win-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--pink); color: #14040f; font-family: var(--crt); font-size: 19px; letter-spacing: .08em; }
.win-x { appearance: none; border: 0; background: #14040f; color: var(--pink); width: 26px; height: 22px; font: 700 16px/1 var(--mono); cursor: pointer; }
.win-body { padding: 18px 18px 20px; font-size: 14px; line-height: 1.6; text-shadow: 0 0 5px rgba(255,63,196,.45); }
.win-body p { margin: 0 0 12px; }
.win-q { color: #fff; font-size: 15px; }
.win-hint { color: var(--pink-dim); font-size: 13px; }
.field { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--pink-dim); padding: 10px 12px; background: #07030a; }
.caret { font-family: var(--crt); font-size: 22px; color: var(--pink-hot); }
.field input { flex: 1; min-width: 0; appearance: none; border: 0; outline: none; background: transparent; color: #fff; font: 700 18px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; caret-color: var(--pink); position: relative; z-index: 2; }
.flicker { position: absolute; inset: 0 12px 0 34px; display: flex; align-items: center; font: 400 14px/1 var(--mono); letter-spacing: .3em; color: var(--pink-dim); overflow: hidden; white-space: nowrap; pointer-events: none; opacity: .55; z-index: 1; }
.field:focus-within { border-color: var(--pink); box-shadow: 0 0 14px rgba(255,63,196,.35); }
.win-status { min-height: 1.4em; margin: 10px 0 12px !important; font-family: var(--crt); font-size: 19px; letter-spacing: .1em; }
.win-status.bad { color: #ff5a5a; text-shadow: 0 0 8px rgba(255,90,90,.7); }
.win-status.good { color: var(--gold); }
.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.transmit { display: inline-block; appearance: none; border: 1px solid var(--pink); background: transparent; color: var(--pink-hot); font-family: var(--crt); font-size: 21px; letter-spacing: .14em; padding: 6px 18px; cursor: pointer; text-decoration: none; }
.transmit:hover, .transmit:focus-visible { background: var(--pink); color: #14040f; outline: none; }

@media (max-width: 640px) {
  body { overflow: hidden; }
  .bar { font-size: 14px; }
  .bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .doc h1 { white-space: normal; }
  .doc h2 { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .screen::before, .sealed { animation: none; }
}
