/* ── CSS Variables — Minimalist IR Lab Theme ──────────── */
:root {
  --bg: #101114;
  --panel-bg: #13151a;
  --border: rgba(255, 255, 255, 0.07);
  --border-hi: rgba(255, 255, 255, 0.18);
  --accent-a: #d94f4f;
  /* muted alert red  */
  --accent-s: #4a90d9;
  /* muted info blue  */
  --accent-g: #4caf76;
  /* muted ok green   */
  --text: #c2c8d4;
  --text-dim: #8a93a8;
  --header-h: 52px;
  --ctrl-h: 36px;
}

/* ── Light Theme Variables ── */
body.light-theme {
  --bg: #f4f5f7;
  --panel-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-hi: rgba(0, 0, 0, 0.25);
  --text: #2d333b;
  --text-dim: #6e7781;
}

body.light-theme #header { background: #ffffff; }
body.light-theme .vm-header { background: #f8f9fa; color: #2d333b; }
body.light-theme #guide-panel .panel-header { background: #f8f9fa; color: #1e4a7a; }
body.light-theme pre { background: rgba(0, 0, 0, 0.04); color: #2d333b; border-color: rgba(0, 0, 0, 0.1); }
body.light-theme code { background: rgba(0, 0, 0, 0.06); color: #1e4a7a; border-color: rgba(0, 0, 0, 0.1); }
body.light-theme .instr-box pre { color: #2d333b; }
body.light-theme textarea.term { background: #ffffff; }
body.light-theme .answer-input { color: #2d333b; border-color: rgba(0, 0, 0, 0.2); }
body.light-theme .endlab-card { background: #ffffff; border-color: rgba(0,0,0,0.1); }
body.light-theme .endlab-title { color: #2d333b; }
body.light-theme .boot-inner { background: #ffffff; padding: 20px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); }
body.light-theme #boot-overlay { background: rgba(244, 245, 247, 0.95); }

/* Guide Panel Light Theme Overrides */
body.light-theme .g-intro { color: #2d333b; border-color: rgba(0,0,0,0.1); }
body.light-theme .g-intro ul li { color: #5a6070; }
body.light-theme .g-intro ul li::before { color: #8a93a8; }
body.light-theme .step-block { border-color: rgba(0,0,0,0.1); }
body.light-theme .step-label { color: #1e4a7a; }
body.light-theme .step-heading { color: #2d333b; }
body.light-theme .body-text { color: #5a6070; }
body.light-theme .body-text b { color: #2d333b; }
body.light-theme .story-beat { color: #2d333b; }
body.light-theme .callout { color: #5a6070; background: rgba(74, 144, 217, 0.08); border-left-color: rgba(74, 144, 217, 0.6); }
body.light-theme .callout b { color: #2d333b; }
body.light-theme .hint-box { color: #3a5070; background: rgba(74, 144, 217, 0.05); border-color: rgba(74, 144, 217, 0.4); }
body.light-theme .warn { color: #8a6a2a; background: rgba(217, 150, 50, 0.08); border-left-color: rgba(217, 150, 50, 0.6); }
body.light-theme .cmd-label { color: #5a6070; }
body.light-theme #guide-scroll { color: #2d333b; }


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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  height: 100vh;
}

/* subtle dot-grid instead of bright neon lines */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ── header ── */
#header {
  position: relative;
  z-index: 10;
  height: var(--header-h);
  background: #0d0e11;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

#header h1 {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #e8eaf0;
  white-space: nowrap;
  text-transform: uppercase;
}

.threat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-a);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.header-sep {
  flex: 1;
}

#status {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--accent-g);
  background: rgba(76, 175, 118, 0.06);
  border: 1px solid rgba(76, 175, 118, 0.18);
  border-radius: 3px;
  padding: 3px 10px;
  white-space: nowrap;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── header buttons ── */
.hbtn {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 4px;
  border: 1px solid;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}

.hbtn-info {
  background: rgba(74, 144, 217, 0.07);
  border-color: rgba(74, 144, 217, 0.3);
  color: var(--accent-s);
}

.hbtn-info:hover {
  background: rgba(74, 144, 217, 0.15);
}

.hbtn-reset {
  background: rgba(217, 79, 79, 0.07);
  border-color: rgba(217, 79, 79, 0.3);
  color: var(--accent-a);
}

.hbtn-reset:hover {
  background: rgba(217, 79, 79, 0.16);
}

.hbtn-endlab {
  background: rgba(76, 175, 118, 0.08);
  border-color: rgba(76, 175, 118, 0.3);
  color: #4caf76;
}

.hbtn-endlab:hover {
  background: rgba(76, 175, 118, 0.18);
  border-color: rgba(76, 175, 118, 0.5);
}

/* ── instructions overlay — inside attacker vm-container ── */
#instructions {
  display: none;
  position: absolute;
  /* fills .vm-container */
  inset: 0;
  z-index: 20;
  background: rgba(10, 11, 13, 0.97);
  backdrop-filter: blur(2px);
  flex-direction: column;
}

#instructions.show {
  display: flex;
}

.instr-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  background: transparent;
}

/* title row */
.instr-box h2 {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-s);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

/* scrollable body */
.instr-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.instr-scroll::-webkit-scrollbar {
  width: 4px;
}

.instr-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.instr-scroll::-webkit-scrollbar-thumb {
  background: rgba(74, 144, 217, 0.25);
  border-radius: 2px;
}

.instr-box ol {
  padding-left: 20px;
  line-height: 1.9;
  font-size: 13px;
  list-style: none;
  padding-left: 0;
}

.instr-box ul {
  padding-left: 18px;
  margin-top: 4px;
}

.instr-box li {
  margin-bottom: 8px;
}

.instr-box code {
  font-family: 'Fira Code', monospace;
  font-size: 11.5px;
  background: rgba(74, 144, 217, 0.08);
  border: 1px solid rgba(74, 144, 217, 0.18);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--accent-s);
}

.instr-box pre {
  font-family: 'Fira Code', monospace;
  font-size: 11.5px;
  background: #0d0e11;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 9px 12px;
  margin: 6px 0;
  color: var(--accent-g);
  overflow-x: auto;
}

.instr-flag {
  background: rgba(217, 79, 79, 0.06);
  border: 1px solid rgba(217, 79, 79, 0.25);
  border-radius: 5px;
  padding: 9px 12px;
  margin: 8px 0;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: var(--accent-a);
}

/* close button row — stays fixed at the bottom */
.instr-close {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── main layout ── */
#container {
  position: relative;
  z-index: 1;
  display: flex;
  height: calc(100vh - var(--header-h));
  gap: 8px;
  padding: 8px;
}

/* ── VM panel ── */
.vm-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.vm-panel.active-panel {
  border-color: var(--border-hi);
}

.vm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #0d0e11;
}

.vm-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vm-header.attacker {
  color: var(--accent-a);
}

.vm-header.attacker .vm-dot {
  background: var(--accent-a);
}

.vm-header.snort {
  color: var(--accent-s);
}

.vm-header.snort .vm-dot {
  background: var(--accent-s);
}

.vm-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  text-transform: none;
  letter-spacing: 0;
}

.vm-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── serial textarea ── */
textarea.term {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0a0b0d;
  border: none;
  resize: none;
  outline: none;
  padding: 10px 14px;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-y: auto;
  cursor: text;
  box-sizing: border-box;
  caret-color: transparent;
}

textarea.term.attacker {
  color: #d98080;
}

textarea.term.snort {
  color: #7ab8e0;
}

.xterm-viewport::-webkit-scrollbar {
  width: 8px;
}

.xterm-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.3);
  border-radius: 4px;
}

/* Ensure xterm text does not overlap the custom scrollbar */
.xterm .xterm-screen {
  padding-right: 12px;
}

/* scanline — very subtle */
.vm-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom,
      transparent, transparent 3px,
      rgba(0, 0, 0, 0.04) 3px, rgba(0, 0, 0, 0.04) 4px);
  pointer-events: none;
  z-index: 5;
}


