/* OPERATION: REDACTED — Hacker Theme v4.0 */
:root {
  --green: #00ff41;
  --green-dim: #093;
  --blue: #00bfff;
  --pink: #c792ea;
  --orange: #ff6b00;
  --yellow: #ff0;
  --red: #f33;
  --bg: #0a0a0a;
  --bg2: #111;
  --bg3: #1a1a1a;
  --border: #333;
  --glow-green: rgb(0 255 65 / 15%);
  --glow-green-strong: rgb(0 255 65 / 40%);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--green);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
}

/* --- CRT Scanline Overlay --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgb(0 0 0 / 6%) 2px,
    rgb(0 0 0 / 6%) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* --- CRT Vignette / Curvature --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgb(0 0 0 / 55%) 100%);
  pointer-events: none;
  z-index: 9998;
}

::selection { background: var(--green); color: var(--bg); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }

/* ================================================================
   BOOT SEQUENCE
   ================================================================ */
#boot {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--green);
}

#boot-logo {
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  color: var(--green);
  text-shadow: 0 0 8px var(--green), 0 0 20px rgb(0 255 65 / 40%);
  margin-bottom: 20px;
}

#boot-lines {
  font-size: 13px;
  color: var(--green-dim);
  text-align: center;
  letter-spacing: 2px;
}

#boot .bl {
  margin: 4px 0;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

#boot p {
  margin-top: 30px;
  font-size: 15px;
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

#cursor {
  animation: blink 1s step-end infinite;
  color: var(--green);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ================================================================
   GAME LAYOUT
   ================================================================ */
#game {
  display: none;
  width: 100%;
  height: 100vh;
  flex-direction: column;
}

/* --- Header --- */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg2);
  border-bottom: 2px solid var(--green);
  box-shadow: 0 0 15px rgb(0 255 65 / 10%);
}

#logo {
  font-family: Impact, 'Arial Black', sans-serif;
  font-size: 18px;
  color: var(--green);
  text-shadow: 0 0 10px var(--green), 0 0 25px rgb(0 255 65 / 30%);
  letter-spacing: 3px;
  text-transform: uppercase;
}

#user {
  font-size: 10px;
  color: #444;
  letter-spacing: 1px;
  text-transform: none;
  opacity: 0.6;
}

#user a {
  color: var(--green-dim);
  text-decoration: none;
}

#user a:hover {
  color: var(--green);
  text-decoration: underline;
}

#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
#sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid rgb(0 255 65 / 20%);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.panel {
  border: 1px solid rgb(0 255 65 / 20%);
  background: var(--bg);
  padding: 10px;
  font-size: 10px;
  box-shadow: 0 0 8px rgb(0 255 65 / 4%);
}

.panel-title {
  color: var(--pink);
  font-family: Impact, 'Arial Black', sans-serif;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--pink);
  margin-bottom: 6px;
  padding-bottom: 4px;
  font-size: 11px;
  text-shadow: 0 0 8px rgb(199 146 234 / 30%);
}

.row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.lbl {
  color: var(--green-dim);
  text-transform: uppercase;
  font-size: 9px;
}

.val {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
  font-weight: bold;
  font-size: 14px;
}

#bar-wrap {
  height: 14px;
  border: 1px solid var(--green-dim);
  margin-top: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 6px rgb(0 255 65 / 10%);
}

#bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  box-shadow: 0 0 10px var(--green), 0 0 20px rgb(0 255 65 / 20%);
  transition: width 0.4s;
}

#wopr {
  text-align: center;
  padding: 5px;
  border: 1px solid var(--green);
  color: var(--green);
  letter-spacing: 2px;
  font-size: 10px;
  text-transform: uppercase;
  text-shadow: 0 0 6px var(--green);
}

#leakbtn {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 2px solid var(--pink);
  color: var(--pink);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: inherit;
  font-size: 11px;
  text-shadow: 0 0 8px var(--pink);
}

#leakbtn:hover {
  background: var(--pink);
  color: var(--bg);
  box-shadow: 0 0 20px var(--pink);
}

#leakbtn:disabled {
  opacity: 0.3;
  cursor: default;
  box-shadow: none;
}

#leakbtn:disabled:hover {
  background: transparent;
  color: var(--pink);
  box-shadow: none;
}

/* ================================================================
   TERMINAL — Main game terminal styled like the landing page demo
   ================================================================ */
#term {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 2px solid var(--green);
  border-radius: 8px;
  margin: 6px;
  box-shadow: 0 0 30px rgb(0 255 65 / 15%), inset 0 0 40px rgb(0 255 65 / 2%);
  overflow: hidden;
}

#term-title {
  background: #111;
  border-bottom: 1px solid rgb(0 255 65 / 30%);
  padding: 10px 18px;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  color: var(--green);
  text-shadow: 0 0 6px rgb(0 255 65 / 40%);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  box-shadow: 0 0 6px currentcolor;
}

.dot.r { background: var(--red); }
.dot.y { background: var(--yellow); }
.dot.g { background: var(--green); }

#output {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.8;
  color: var(--green);
  min-height: 200px;
}

/* --- Colored output lines matching the landing page demo --- */
#output .line {
  white-space: nowrap;
  overflow-x: auto;
}

#output .line.prompt {
  color: #00ff41;
  text-shadow: 0 0 4px rgb(0 255 65 / 40%);
}

#output .line.cmd {
  color: #fff;
}

/* Command line wrapper — each $ command on its own line */
#output .cmdline {
  white-space: nowrap;
  overflow-x: auto;
}

#output .cmdline .prompt {
  color: #00ff41;
  text-shadow: 0 0 4px rgb(0 255 65 / 40%);
}

#output .cmdline .cmd {
  color: #fff;
}

#output .line.dim {
  color: #606060;
  opacity: 0.85;
}

#output .line.warn {
  color: #f90;
  text-shadow: 0 0 4px rgb(255 153 0 / 40%);
}

#output .line.success {
  color: #00ff41;
  text-shadow: 0 0 4px rgb(0 255 65 / 40%);
}

#output .line.dir {
  color: var(--blue-dim, #08c);
}

#output .line.anon {
  color: #999;
  text-shadow: 0 0 4px rgb(153 153 153 / 30%);
  font-weight: bold;
  font-size: 13px;
}

#input-line {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid rgb(0 255 65 / 20%);
  background: rgb(0 0 0 / 30%);
}

#prompt {
  color: #00ff41;
  white-space: pre;
  margin-right: 4px;
  font-size: 13px;
  text-shadow: 0 0 4px rgb(0 255 65 / 40%);
}

#input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  caret-color: var(--green);
  text-shadow: 0 0 3px rgb(0 255 65 / 30%);
}

#input::selection {
  background: var(--green);
  color: var(--bg);
}

/* ================================================================
   X11 WINDOW BACKDROP
   ================================================================ */
#x11-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 65%);
  z-index: 9000;
  display: none;
  animation: fadeBackdrop 0.18s ease;
}

#x11-backdrop.active { display: block; }

@keyframes fadeBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ================================================================
   PREVIEW PANEL — X11 Window Overlay
   ================================================================ */
#preview-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(800px, 92vw);
  min-width: 320px;
  max-height: 88vh;
  background: #0d0d0d;
  border: 2px solid #555;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 0 0 2px #222, 0 8px 32px rgb(0 0 0 / 70%), 0 0 40px rgb(0 255 65 / 4%);
  z-index: 9001;
  display: none;
  flex-direction: column;
  animation: x11Appear 0.2s ease;
}

#preview-panel.active { display: flex; }

@keyframes x11Appear {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.93); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* X11 window title bar */
.preview-header {
  background: linear-gradient(180deg, #4a6d8c, #3a5a7a);
  padding: 5px 10px;
  font-size: 11px;
  color: #e0e8f0;
  font-family: Helvetica, Arial, sans-serif;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #2a4a6a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}

.preview-header .x11-title {
  font-weight: bold;
  font-size: 12px;
  text-shadow: 0 1px 1px rgb(0 0 0 / 40%);
}

/* X11 close button */
.preview-header .x11-close {
  width: 20px;
  height: 20px;
  background: linear-gradient(180deg, #c66, #a44);
  border: 1px solid #833;
  border-radius: 2px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%);
  flex-shrink: 0;
}

.preview-header .x11-close:hover {
  background: linear-gradient(180deg, #d77, #b55);
}

.preview-header .x11-close:active {
  background: linear-gradient(180deg, #955, #733);
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 40%);
}

#resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 5;
  background: linear-gradient(135deg, transparent 50%, #555 50%, #555 55%, transparent 55%);
}

#resize-handle:hover {
  background: linear-gradient(135deg, transparent 50%, #888 50%, #888 55%, transparent 55%);
}

/* Window content area */
#preview-content {
  padding: 12px;
  font-size: 16px;
  line-height: 1.55;
  color: #ccc;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#preview-content .classified-banner {
  font-size: 18px;
  text-align: center;
  padding: 6px;
  background: rgb(255 0 0 / 10%);
  border: 1px solid var(--red);
  color: var(--red);
  margin-bottom: 10px;
  letter-spacing: 2px;
}

#preview-content .watermark { display: none; }

#preview-content .doc-title {
  font-size: 22px;
  color: var(--yellow);
  text-align: center;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--yellow);
  padding-bottom: 6px;
}

#preview-content .section-heading {
  font-size: 16px;
  color: var(--blue);
  border-bottom: 1px solid var(--blue);
  margin: 10px 0 6px;
  padding-bottom: 3px;
  letter-spacing: 2px;
}

#preview-content p {
  margin: 4px 0;
  color: #aaa;
  font-size: 16px;
}

#preview-content strong {
  color: var(--green);
}

#preview-content .doc-sources {
  font-size: 13px;
  color: #666;
  border-top: 1px solid #333;
  margin-top: 12px;
  padding-top: 6px;
}

#preview-content .doc-sources ul {
  list-style: square;
  padding-left: 16px;
}

#preview-content .doc-footer-disclaimer {
  font-size: 11px;
  color: #555;
  border-top: 1px solid #333;
  margin-top: 10px;
  padding-top: 6px;
}

#preview-content .sub-class {
  font-size: 13px;
  display: block;
}

#preview-content .ref-block {
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #333;
}

/* Clearfix for ref-block to contain floated stamp */
#preview-content .ref-block::after {
  content: '';
  display: table;
  clear: both;
}

#preview-content .ref-block .label {
  color: var(--green-dim);
}

#preview-content .stamp-area {
  font-family: Impact, 'Arial Black', sans-serif;
  font-size: 18px;
  color: var(--red);
  text-align: center;
  border: 2px solid var(--red);
  padding: 4px;
  transform: rotate(-3deg);
  opacity: 0.8;
  max-width: 160px;
  float: right;
  margin: 0 0 6px 10px;
}

#preview-content .doc-title {
  font-size: 15px;
  color: var(--yellow);
  text-align: center;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--yellow);
  padding-bottom: 6px;
}

#preview-content .handling-instructions {
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #333;
}

/* ================================================================
   WOPR THREAT BAR
   ================================================================ */
#wopr-wrap {
  width: 100%;
  height: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-top: 6px;
  overflow: hidden;
}

#wopr-bar {
  height: 100%;
  width: 10%;
  background: var(--green);
  transition: width 0.5s ease, background 0.5s ease;
}

@keyframes woprPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#wopr-bar.wopr-enraged {
  animation: woprPulse 0.6s ease-in-out infinite;
}

/* ================================================================
   STATUS BAR
   ================================================================ */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--bg2);
  border-top: 2px solid var(--green);
  box-shadow: 0 0 12px rgb(0 255 65 / 8%);
  font-size: 10px;
  color: var(--blue);
  height: 28px;
}

#status-dir {
  font-size: 10px;
  color: var(--green);
  text-shadow: 0 0 4px var(--green);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* ================================================================
   JUICE — screen shake, flashes, streak fire, glitch
   ================================================================ */
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 3px); }
  40% { transform: translate(4px, -3px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}
#game.screen-shake { animation: screenShake 0.4s ease; }

@keyframes flashGreen {
  0% { background: rgb(0 255 65 / 25%); }
  100% { background: transparent; }
}

@keyframes flashRed {
  0% { background: rgb(255 0 0 / 25%); }
  100% { background: transparent; }
}
body.flash-real::after { animation: flashGreen 0.35s ease; }
body.flash-decoy::after { animation: flashRed 0.35s ease; }

@keyframes glitchLogo {
  0%, 100% { transform: translate(0, 0); text-shadow: 0 0 10px var(--green); }
  20% { transform: translate(-1px, 1px); text-shadow: 2px 0 var(--red), -2px 0 var(--blue); }
  40% { transform: translate(1px, -1px); text-shadow: -2px 0 var(--red), 2px 0 var(--blue); }
  60% { transform: translate(0, 0); text-shadow: 0 0 10px var(--green); }
}
#logo.wopr-glitch { animation: glitchLogo 0.3s steps(2) infinite; }

#header.wopr-danger {
  border-bottom-color: var(--red);
  box-shadow: 0 0 20px rgb(255 0 0 / 30%);
  animation: dangerPulse 1s ease-in-out infinite;
}

@keyframes dangerPulse {
  0%, 100% { border-bottom-color: var(--red); }
  50% { border-bottom-color: #900; }
}

#wopr-status-label {
  font-size: 9px;
  text-align: center;
  margin-top: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#streak-panel {
  display: none;
}

#streak-panel.active {
  display: block;
}

#streak-val {
  color: var(--orange);
  text-shadow: 0 0 8px var(--orange);
}

#sound-toggle {
  cursor: pointer;
  color: var(--green-dim);
  font-size: 11px;
  margin-left: 10px;
  user-select: none;
}
#sound-toggle:hover { color: var(--green); }

@media (width <= 900px) {
  #sidebar { display: none; }

  #preview-panel {
    width: 94vw;
    min-width: 280px;
    max-height: 92vh;
  }

  #term {
    border-left: 1px solid var(--green);
    border-right: 1px solid var(--green);
  }
}
