/* ── 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;
  --analyzer-h: 270px;
  --guide-w: 52%;
}

/* ── 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: grid;
  grid-template-columns: minmax(360px, var(--guide-w)) 10px minmax(360px, 1fr);
  height: calc(100vh - var(--header-h) - var(--analyzer-h) - 8px);
  min-height: 250px;
  gap: 0;
  padding: 8px;
}

.main-splitter {
  cursor: col-resize;
  position: relative;
  margin: 0 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(74, 144, 217, 0.18), transparent);
}

.main-splitter::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(74, 144, 217, 0.45);
  box-shadow: 0 0 18px rgba(74, 144, 217, 0.35);
}

.main-splitter:hover::before,
body.main-resizing .main-splitter::before {
  background: rgba(76, 175, 118, 0.8);
  box-shadow: 0 0 24px rgba(76, 175, 118, 0.45);
}

#level-select-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 10%, rgba(74,144,217,0.16), transparent 34%),
    radial-gradient(circle at 80% 80%, rgba(76,175,118,0.12), transparent 32%),
    rgba(8, 10, 14, 0.98);
}

#level-select-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.level-select-card {
  width: min(940px, 94vw);
  border: 1px solid rgba(74,144,217,0.22);
  background: rgba(13, 15, 20, 0.92);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  border-radius: 16px;
  padding: 28px;
}

.level-select-kicker,
.level-select-title,
.level-select-sub,
.level-select-note {
  text-align: center;
}

.level-select-kicker {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: #4caf76;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.level-select-title {
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 30px;
  color: #e8eaf0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.level-select-ascii {
  margin: 18px auto 12px;
  padding: 14px;
  max-width: 720px;
  color: #4a90d9;
  border-color: rgba(74,144,217,0.16);
  background: rgba(0,0,0,0.25);
  font-size: 11px;
  line-height: 1.25;
}

.level-select-sub {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.level-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.level-card:hover {
  transform: translateY(-3px);
  border-color: rgba(74,144,217,0.55);
  background: rgba(74,144,217,0.08);
}

.level-card.recommended {
  border-color: rgba(76,175,118,0.38);
}

.level-name {
  font-family: 'Fira Code', monospace;
  font-size: 18px;
  color: #e8eaf0;
  text-transform: uppercase;
}

.level-desc {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}

.level-command {
  margin-top: auto;
  color: #4caf76;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
}

.level-select-note {
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 12px;
}

@media (max-width: 820px) {
  .level-grid {
    grid-template-columns: 1fr;
  }
}

/* ── browser-native packet analyzer ── */
#packet-analyzer {
  position: relative;
  z-index: 2;
  height: var(--analyzer-h);
  margin: 0 8px 8px;
  display: grid;
  grid-template-rows: 7px auto minmax(0, 1fr);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

body.analyzer-minimized {
  --analyzer-h: 43px;
}

body.analyzer-minimized #packet-analyzer {
  grid-template-rows: 7px auto 0;
}

body.analyzer-minimized .packet-body {
  display: none;
}

.packet-resize-handle {
  height: 7px;
  cursor: ns-resize;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  position: relative;
}

.packet-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 2px;
  width: 46px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(138, 147, 168, 0.45);
}

.packet-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  background: #0d0e11;
  overflow-x: hidden;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(138, 147, 168, 0.45) transparent;
}

.packet-toolbar::-webkit-scrollbar {
  height: 4px;
}

.packet-toolbar::-webkit-scrollbar-track {
  background: transparent;
}

.packet-toolbar::-webkit-scrollbar-thumb {
  background: rgba(138, 147, 168, 0.45);
  border-radius: 3px;
}

.packet-title {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-g);
  text-transform: uppercase;
  white-space: nowrap;
}

.packet-toolbar-main,
.packet-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.packet-toolbar-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.packet-filter,
.packet-search {
  flex: 1;
  height: 24px;
  min-width: 140px;
  background: #0a0b0d;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  padding: 0 8px;
  outline: none;
}

.packet-search {
  flex: 0 1 170px;
}

.packet-filter:focus,
.packet-search:focus {
  border-color: rgba(76, 175, 118, 0.45);
}

.packet-stats {
  min-width: 120px;
  max-width: 260px;
  color: var(--text-dim);
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiregasm-status {
  flex: 0 0 auto;
  width: 110px;
  color: #6a8ab0;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-health {
  display: flex;
  gap: 5px;
  align-items: center;
}

.header-health {
  padding: 4px 7px;
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: 999px;
  background: rgba(5, 10, 18, 0.58);
}

.service-chip {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 2px 7px 2px 16px;
  position: relative;
  color: var(--text-dim);
  white-space: nowrap;
}

.service-chip::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.service-chip.up {
  border-color: rgba(76, 175, 118, 0.35);
  color: #4caf76;
  background: rgba(76, 175, 118, 0.07);
}

.service-chip.up::before {
  background: #4caf76;
  box-shadow: 0 0 6px rgba(76, 175, 118, 0.7);
}

.service-chip.down {
  border-color: rgba(217, 79, 79, 0.35);
  color: #d94f4f;
  background: rgba(217, 79, 79, 0.07);
}

.service-chip.down::before {
  background: #d94f4f;
  box-shadow: 0 0 6px rgba(217, 79, 79, 0.55);
}

.packet-button {
  height: 24px;
  border: 1px solid rgba(74, 144, 217, 0.3);
  border-radius: 4px;
  background: rgba(74, 144, 217, 0.07);
  color: var(--accent-s);
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  cursor: pointer;
  white-space: nowrap;
}

.packet-button.active {
  border-color: rgba(76, 175, 118, 0.45);
  background: rgba(76, 175, 118, 0.1);
  color: var(--accent-g);
}

.packet-body {
  display: grid;
  grid-template-columns: minmax(430px, 1.35fr) minmax(270px, 0.75fr) minmax(270px, 0.75fr);
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
}

.packet-table-wrap,
.packet-details,
.packet-hex {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-right: 1px solid var(--border);
}

.packet-hex {
  border-right: none;
  padding: 9px 10px;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #8fbf9f;
  background: #0a0b0d;
}

.packet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
}

.packet-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  color: #6a8ab0;
  background: #0d0e11;
  border-bottom: 1px solid var(--border);
  padding: 6px 7px;
  font-weight: 700;
}

.packet-table td {
  padding: 5px 7px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.packet-table tr {
  cursor: pointer;
}

.packet-table tr:hover td,
.packet-table tr.selected td {
  background: rgba(74, 144, 217, 0.08);
  color: var(--text);
}

.packet-table tr.marked td {
  color: #e0c46a;
}

.packet-table tr.packet-color-alert td {
  background: rgba(217, 79, 79, 0.065);
}

.packet-table tr.packet-color-control td {
  color: #8a93c8;
}

.packet-table tr.packet-color-tcp td {
  color: #9abbe0;
}

.packet-table tr.packet-color-udp td {
  color: #9fd0a7;
}

.packet-details {
  padding: 8px 10px;
  background: #101114;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
}

.detail-row span {
  color: #6a8ab0;
  font-family: 'Fira Code', monospace;
}

.detail-row b {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.wiregasm-row span {
  color: #4caf76;
}

.empty-state {
  color: var(--text-dim);
  font-size: 12px;
  padding: 12px;
}

.packet-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 160px;
  background: #0d0e11;
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  padding: 5px;
}

.packet-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.packet-context-menu button:hover {
  background: rgba(74, 144, 217, 0.12);
}

#stream-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.56);
}

#stream-overlay.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.stream-card {
  width: min(900px, 92vw);
  height: min(620px, 78vh);
  display: grid;
  grid-template-rows: 40px 1fr;
  background: #0d0e11;
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  overflow: hidden;
}

.stream-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
}

.stream-header button {
  margin-left: auto;
  border: 1px solid rgba(217, 79, 79, 0.3);
  background: rgba(217, 79, 79, 0.08);
  color: var(--accent-a);
  border-radius: 4px;
  height: 24px;
  padding: 0 9px;
  cursor: pointer;
}

.stream-body {
  min-height: 0;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #0a0b0d;
  color: #8fbf9f;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.65;
}

.stream-chunk {
  border-left: 3px solid rgba(74, 144, 217, 0.65);
  margin-bottom: 14px;
  padding: 0 0 0 10px;
}

.stream-chunk.server {
  border-left-color: rgba(76, 175, 118, 0.65);
}

.stream-direction {
  color: #6a8ab0;
  font-size: 11px;
  margin-bottom: 5px;
}

.stream-chunk.server .stream-direction {
  color: #4caf76;
}

.stream-chunk pre {
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.025);
  color: #9fcfad;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ── 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;
}



/* --- Extracted from index.html --- */
    #guide-panel {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: var(--panel-bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      min-height: 0;
      /* critical: allows flex children to shrink below content size */
    }

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

    #guide-scroll {
      flex: 1;
      overflow-y: auto;
      padding: 18px 20px;
      font-size: 13px;
      line-height: 1.7;
      color: #b8c0cc;
    }

    #guide-scroll::-webkit-scrollbar {
      width: 4px;
    }

    #guide-scroll::-webkit-scrollbar-track {
      background: transparent;
    }

    #guide-scroll::-webkit-scrollbar-thumb {
      background: rgba(74, 144, 217, 0.2);
      border-radius: 2px;
    }

    .g-intro {
      font-size: 13px;
      color: #c2c8d4;
      line-height: 1.85;
      margin-bottom: 24px;
      padding-bottom: 18px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .g-intro p {
      margin-bottom: 10px;
    }

    .g-intro ul {
      list-style: none;
      padding: 0;
      margin: 8px 0 8px 12px;
    }

    .g-intro ul li {
      color: #9aa0ad;
      margin-bottom: 3px;
    }

    .g-intro ul li::before {
      content: "- ";
      color: #4a5060;
    }

    .step-block {
      margin-bottom: 28px;
      padding-bottom: 24px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .step-block:last-child {
      border-bottom: none;
    }

    .step-label {
      font-family: 'Fira Code', monospace;
      font-size: 9px;
      letter-spacing: 0.15em;
      color: #4a90d9;
      text-transform: uppercase;
      margin-bottom: 4px;
    }

    .step-heading {
      font-size: 15px;
      font-weight: 700;
      color: #e8eaf0;
      margin-bottom: 12px;
    }

    .body-text {
      font-size: 12.5px;
      color: #9aa0ad;
      line-height: 1.8;
      margin-bottom: 10px;
    }

    .body-text b {
      color: #c2c8d4;
      font-weight: 600;
    }

    .body-text ul {
      list-style: none;
      padding: 0;
      margin: 6px 0 6px 10px;
    }

    .body-text ul li {
      margin-bottom: 2px;
    }

    .body-text ul li::before {
      content: "- ";
      color: #4a5060;
    }

    .story-beat {
      font-size: 12.5px;
      color: #c2c8d4;
      line-height: 1.8;
      margin: 12px 0;
    }

    .callout {
      border-left: 2px solid rgba(74, 144, 217, 0.35);
      padding: 10px 14px;
      margin: 12px 0;
      font-size: 12px;
      color: #8a93a8;
      line-height: 1.75;
      background: rgba(74, 144, 217, 0.03);
    }

    .callout b {
      color: #c2c8d4;
    }

    .hint-box {
      border: 1px dashed rgba(74, 144, 217, 0.25);
      border-radius: 5px;
      padding: 10px 14px;
      margin: 12px 0;
      font-size: 12px;
      color: #6a8ab0;
      line-height: 1.75;
      background: rgba(74, 144, 217, 0.03);
    }

    .warn {
      border-left: 2px solid rgba(217, 150, 50, 0.4);
      padding: 8px 12px;
      margin: 10px 0;
      font-size: 12px;
      color: #b89050;
      background: rgba(217, 150, 50, 0.04);
    }

    .cmd-label {
      font-family: 'Fira Code', monospace;
      font-size: 9px;
      color: #4a5060;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      margin: 14px 0 2px;
    }

    pre {
      font-family: 'Fira Code', monospace;
      font-size: 11.5px;
      background: #0d0e11;
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: 5px;
      padding: 10px 14px;
      color: #4caf76;
      overflow-x: auto;
      margin: 0 0 8px;
    }

    code {
      font-family: 'Fira Code', monospace;
      font-size: 11.5px;
      color: #4a90d9;
      background: rgba(74, 144, 217, 0.08);
      border: 1px solid rgba(74, 144, 217, 0.15);
      border-radius: 3px;
      padding: 1px 5px;
    }

    /* ── Editable question boxes ── */
    .question-box {
      background: rgba(76, 175, 118, 0.04);
      border: 1px dashed rgba(76, 175, 118, 0.25);
      border-radius: 6px;
      padding: 14px 16px;
      margin: 14px 0;
      font-size: 12px;
      color: #4caf76;
      line-height: 2.2;
    }

    .question-box label {
      display: block;
      color: #8a93a8;
      margin-bottom: 2px;
      font-size: 11.5px;
    }

    .answer-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }

    .answer-input {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 4px;
      padding: 5px 10px;
      font-family: 'Fira Code', monospace;
      font-size: 12px;
      color: #c2c8d4;
      outline: none;
      width: 160px;
      transition: border-color 0.2s, background 0.2s;
    }

    .answer-input:focus {
      border-color: rgba(74, 144, 217, 0.4);
    }

    .answer-input.correct {
      border-color: rgba(76, 175, 118, 0.6);
      background: rgba(76, 175, 118, 0.07);
      color: #4caf76;
    }

    .answer-input.wrong {
      border-color: rgba(217, 79, 79, 0.5);
      background: rgba(217, 79, 79, 0.05);
      color: #d94f4f;
    }

    .check-icon {
      font-size: 14px;
      opacity: 0;
      transition: opacity 0.3s;
    }

    .check-icon.show {
      opacity: 1;
    }

    .flag-box {
      background: rgba(217, 79, 79, 0.05);
      border: 1px solid rgba(217, 79, 79, 0.2);
      border-radius: 6px;
      padding: 14px 16px;
      margin: 14px 0;
      font-family: 'Fira Code', monospace;
      font-size: 12.5px;
      color: #d94f4f;
      line-height: 2;
    }

    .ip-hi {
      color: #d94f4f;
      font-weight: 700;
      border: 1px solid rgba(217, 79, 79, 0.5);
      background: rgba(217, 79, 79, 0.08);
      border-radius: 3px;
      padding: 0 4px;
      font-family: 'Fira Code', monospace;
    }

    .po-hi {
      color: #4caf76;
      font-weight: 700;
      border: 1px solid rgba(76, 175, 118, 0.5);
      background: rgba(76, 175, 118, 0.08);
      border-radius: 3px;
      padding: 0 4px;
      font-family: 'Fira Code', monospace;
    }

    .kw-hi {
      color: #e0a030;
      font-weight: 700;
      border: 1px solid rgba(224, 160, 48, 0.5);
      background: rgba(224, 160, 48, 0.08);
      border-radius: 3px;
      padding: 0 4px;
      font-family: 'Fira Code', monospace;
    }

    .blank {
      display: inline-block;
      min-width: 80px;
      border-bottom: 1.5px solid currentColor;
      margin: 0 4px;
      font-family: 'Fira Code', monospace;
      font-size: 11px;
      text-align: center;
      padding: 0 4px;
      opacity: .6;
    }

    .blank.r {
      color: #d94f4f;
    }

    .blank.g {
      color: #4caf76;
    }

    .blank.y {
      color: #e0a030;
    }

    .rule-anatomy {
      font-family: 'Fira Code', monospace;
      font-size: 11px;
      line-height: 2;
      margin: 10px 0;
    }

    .ra-kw {
      color: #4a90d9;
      font-weight: 700;
    }

    .ra-v {
      color: #e0a030;
    }

    .ra-d {
      color: #4a5060;
    }

    .ra-g {
      color: #4caf76;
    }

    details.ref-details summary {
      font-family: 'Fira Code', monospace;
      font-size: 10px;
      color: #4a90d9;
      letter-spacing: 0.08em;
      cursor: pointer;
      padding: 8px 0;
      list-style: none;
      display: flex;
      align-items: center;
      gap: 6px;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      margin-top: 18px;
      text-transform: uppercase;
    }

    /* ── Glitch Animation ── */
    .glitch {
      display: inline-block;
      position: relative;
      animation: anim-glitch 2.5s infinite linear;
    }

    @keyframes anim-glitch {

      0%,
      4%,
      8%,
      100% {
        transform: translate(0);
        opacity: 1;
        filter: none;
      }

      2% {
        transform: translate(-2px, 2px) skewX(10deg);
        color: #4a90d9;
        opacity: 0.8;
        filter: hue-rotate(90deg);
      }

      6% {
        transform: translate(2px, -2px) skewX(-10deg);
        color: #d94f4f;
        opacity: 0.8;
        filter: hue-rotate(-90deg);
      }
    }

    /* ── Rule Anatomy Shifting (Slot Machine Effect) ── */
    .slot-machine {
      display: inline-flex;
      flex-direction: column;
      height: 2em;
      overflow: hidden;
      vertical-align: top;
      position: relative;
    }

    .slot-track {
      display: flex;
      flex-direction: column;
    }

    .slot-item {
      height: 2em;
      display: flex;
      align-items: center;
      white-space: nowrap;
    }

    .slide-proto {
      animation: s-proto 4s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    }

    @keyframes s-proto {

      0%,
      40% {
        transform: translateY(0);
      }

      50%,
      90% {
        transform: translateY(-2em);
      }

      100% {
        transform: translateY(0);
      }
    }

    .slide-sip {
      animation: s-sip 6s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    }

    @keyframes s-sip {

      0%,
      25% {
        transform: translateY(0);
      }

      33%,
      58% {
        transform: translateY(-2em);
      }

      66%,
      91% {
        transform: translateY(-4em);
      }

      100% {
        transform: translateY(0);
      }
    }

    .slide-sport {
      animation: s-sport 4.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    }

    @keyframes s-sport {

      0%,
      40% {
        transform: translateY(0);
      }

      50%,
      90% {
        transform: translateY(-2em);
      }

      100% {
        transform: translateY(0);
      }
    }

    /* ── Confetti canvas ── */
    #confetti-canvas {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 9999;
    }

    /* ── End Lab Modal ── */
    #endlab-overlay {
      position: fixed;
      inset: 0;
      z-index: 9000;
      background: rgba(6, 7, 10, 0.97);
      backdrop-filter: blur(6px);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    #endlab-overlay.show {
      opacity: 1;
      visibility: visible;
    }

    /* CRT scanlines on the modal backdrop */
    #endlab-overlay::before {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.14) 2px,
        rgba(0,0,0,0.14) 4px
      );
      pointer-events: none;
    }

    .endlab-card {
      position: relative;
      z-index: 1;
      width: min(560px, 90vw);
      background: #0d0f14;
      border: 1px solid rgba(76,175,118,0.2);
      border-radius: 10px;
      padding: 40px 40px 32px;
      display: flex;
      flex-direction: column;
      gap: 28px;
      box-shadow: 0 0 60px rgba(76,175,118,0.06), 0 24px 64px rgba(0,0,0,0.6);
      animation: card-drop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
    }

    @keyframes card-drop {
      from { opacity: 0; transform: translateY(-20px) scale(0.97); }
      to   { opacity: 1; transform: translateY(0)   scale(1); }
    }

    .endlab-header {
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }

    .endlab-check {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: rgba(76,175,118,0.1);
      border: 2px solid rgba(76,175,118,0.35);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      color: #4caf76;
    }

    .endlab-title {
      font-family: 'Fira Code', monospace;
      font-size: 14px;
      font-weight: 700;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: #e8eaf0;
    }

    .endlab-sub {
      font-size: 12px;
      color: #5a6070;
      letter-spacing: 0.05em;
    }

    /* Time display */
    .endlab-time-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 18px;
      background: rgba(76,175,118,0.04);
      border: 1px solid rgba(76,175,118,0.12);
      border-radius: 8px;
    }

    .endlab-time-label {
      font-family: 'Fira Code', monospace;
      font-size: 9px;
      letter-spacing: 0.25em;
      text-transform: uppercase;
      color: #3a6a4a;
    }

    .endlab-time {
      font-family: 'Fira Code', monospace;
      font-size: 40px;
      font-weight: 700;
      color: #4caf76;
      letter-spacing: 0.06em;
      line-height: 1;
      text-shadow: 0 0 20px rgba(76,175,118,0.35);
    }

    .endlab-time-sub {
      font-family: 'Fira Code', monospace;
      font-size: 10px;
      color: #2d4a35;
      letter-spacing: 0.12em;
    }

    /* Feedback section */
    .endlab-feedback {
      display: flex;
      gap: 20px;
      align-items: center;
    }

    .endlab-qr {
      flex-shrink: 0;
      width: 100px;
      height: 100px;
      border: 1px dashed rgba(74,144,217,0.3);
      border-radius: 6px;
      background: rgba(74,144,217,0.03);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      color: #2d4a6a;
      font-family: 'Fira Code', monospace;
      font-size: 9px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      text-align: center;
      cursor: pointer;
      transition: background 0.2s, border-color 0.2s;
    }

    .endlab-qr:hover {
      background: rgba(74,144,217,0.07);
      border-color: rgba(74,144,217,0.5);
    }

    .endlab-qr svg {
      width: 36px;
      height: 36px;
      opacity: 0.3;
    }

    .endlab-feedback-text {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .endlab-feedback-title {
      font-family: 'Fira Code', monospace;
      font-size: 10px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: #4a90d9;
    }

    .endlab-feedback-body {
      font-size: 12px;
      color: #5a6070;
      line-height: 1.7;
    }

    .endlab-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-family: 'Fira Code', monospace;
      font-size: 11px;
      color: #4a90d9;
      background: rgba(74,144,217,0.07);
      border: 1px solid rgba(74,144,217,0.25);
      border-radius: 4px;
      padding: 6px 12px;
      text-decoration: none;
      transition: background 0.2s, border-color 0.2s;
      width: fit-content;
    }

    .endlab-link:hover {
      background: rgba(74,144,217,0.14);
      border-color: rgba(74,144,217,0.45);
    }

    /* Footer buttons */
    .endlab-footer {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      padding-top: 4px;
      border-top: 1px solid rgba(255,255,255,0.05);
    }

    /* ── Boot Loading Overlay ── */
    #boot-overlay {
      position: fixed;
      inset: 0;
      z-index: 8888;
      background: #06070a;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: opacity 0.8s ease, visibility 0.8s ease;
    }

    #boot-overlay.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }

    /* CRT scanlines */
    #boot-overlay::before {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.18) 2px,
        rgba(0,0,0,0.18) 4px
      );
      pointer-events: none;
      z-index: 1;
    }

    .boot-inner {
      position: relative;
      z-index: 2;
      width: min(980px, 92vw);
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .boot-logo {
      font-family: 'Fira Code', monospace;
      font-size: clamp(9px, 1.05vw, 13px);
      color: #4a90d9;
      line-height: 1.15;
      letter-spacing: 0.015em;
      white-space: pre;
      text-align: center;
      animation: boot-logo-in 0.6s ease both;
      text-shadow: 0 0 18px rgba(74, 144, 217, 0.28);
    }

    .boot-logo pre {
      margin: 0;
      padding: 0;
      border: none;
      background: transparent;
      overflow: hidden;
      white-space: pre;
      animation: boot-ascii-pulse 3.2s ease-in-out infinite;
    }

    @keyframes boot-ascii-pulse {
      0%, 100% {
        opacity: 0.88;
        filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.22));
      }
      50% {
        opacity: 1;
        filter: drop-shadow(0 0 22px rgba(96, 165, 250, 0.42));
      }
    }

    @keyframes boot-logo-in {
      from { opacity: 0; transform: translateY(-8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .boot-title {
      font-family: 'Fira Code', monospace;
      font-size: 11px;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      color: #4a90d9;
      text-align: center;
      animation: boot-logo-in 0.6s 0.2s ease both;
    }

    .boot-divider {
      border: none;
      border-top: 1px solid rgba(74,144,217,0.15);
      margin: 0;
      animation: boot-logo-in 0.5s 0.3s ease both;
    }

    .boot-fact {
      font-family: 'Fira Code', monospace;
      font-size: 11px;
      line-height: 1.6;
      color: #4caf76;
      border: 1px solid rgba(76, 175, 118, 0.16);
      background: rgba(76, 175, 118, 0.06);
      border-radius: 6px;
      padding: 10px 12px;
      text-align: center;
      animation: boot-logo-in 0.5s 0.35s ease both;
    }

    .boot-fact-chips {
      margin-bottom: 8px;
      color: #75b7ff;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .boot-log {
      font-family: 'Fira Code', monospace;
      font-size: 11px;
      color: #2d3a4a;
      line-height: 1.85;
      min-height: 120px;
      max-height: 180px;
      overflow: hidden;
      position: relative;
      animation: boot-logo-in 0.5s 0.4s ease both;
    }

    .boot-log-line {
      display: block;
      animation: log-appear 0.15s ease both;
    }

    .boot-log-line.ok   { color: #2a5a3a; }
    .boot-log-line.warn { color: #5a4a1a; }
    .boot-log-line.info { color: #2d3a4a; }

    .boot-log-line .tag-ok   { color: #4caf76; font-weight: 700; }
    .boot-log-line .tag-warn { color: #e0a030; font-weight: 700; }
    .boot-log-line .tag-info { color: #4a90d9; font-weight: 700; }

    @keyframes log-appear {
      from { opacity: 0; transform: translateX(-6px); }
      to   { opacity: 1; transform: translateX(0); }
    }

    .boot-progress-wrap {
      display: flex;
      flex-direction: column;
      gap: 8px;
      animation: boot-logo-in 0.5s 0.5s ease both;
    }

    .boot-progress-label {
      font-family: 'Fira Code', monospace;
      font-size: 10px;
      color: #3a5070;
      letter-spacing: 0.12em;
      display: flex;
      justify-content: space-between;
    }

    .boot-bar-track {
      height: 3px;
      background: rgba(74,144,217,0.08);
      border-radius: 2px;
      overflow: hidden;
    }

    .boot-bar-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #1a4a80, #4a90d9, #61b5ff);
      border-radius: 2px;
      transition: width 0.4s ease;
      box-shadow: 0 0 8px rgba(74,144,217,0.4);
    }

    .boot-status {
      font-family: 'Fira Code', monospace;
      font-size: 10px;
      color: #2d4a5a;
      letter-spacing: 0.1em;
      text-align: center;
      animation: boot-logo-in 0.5s 0.6s ease both;
    }

    .boot-status .cursor-blink {
      display: inline-block;
      width: 7px;
      height: 11px;
      background: #4a90d9;
      vertical-align: middle;
      margin-left: 3px;
      animation: cur-blink 1s step-start infinite;
    }

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

/* ── Firewall Gauntlet level selector ── */
#level-select-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 3000 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 10%, rgba(74,144,217,0.16), transparent 34%),
    radial-gradient(circle at 80% 80%, rgba(76,175,118,0.12), transparent 32%),
    rgba(8, 10, 14, 0.98);
}

#level-select-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.level-select-card {
  width: min(940px, 94vw);
  border: 1px solid rgba(74,144,217,0.22);
  background: rgba(13, 15, 20, 0.94);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  border-radius: 16px;
  padding: 28px;
}

.level-select-kicker,
.level-select-title,
.level-select-sub,
.level-select-note {
  text-align: center;
}

.level-select-kicker {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: #4caf76;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.level-select-title {
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 30px;
  color: #e8eaf0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.level-select-ascii {
  margin: 18px auto 12px;
  padding: 14px;
  max-width: 720px;
  color: #4a90d9;
  border-color: rgba(74,144,217,0.16);
  background: rgba(0,0,0,0.25);
  font-size: 11px;
  line-height: 1.25;
}

.level-select-sub {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.level-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.level-card:hover {
  transform: translateY(-3px);
  border-color: rgba(74,144,217,0.55);
  background: rgba(74,144,217,0.08);
}

.level-card.recommended {
  border-color: rgba(76,175,118,0.38);
}

.level-name {
  font-family: 'Fira Code', monospace;
  font-size: 18px;
  color: #e8eaf0;
  text-transform: uppercase;
}

.level-desc {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}

.level-command {
  margin-top: auto;
  color: #4caf76;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
}

.level-select-note {
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 12px;
}

@media (max-width: 820px) {
  .level-grid {
    grid-template-columns: 1fr;
  }
}

/* ── BlueWall completion overlay ── */
#level-complete-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 25%, rgba(76,175,118,0.18), transparent 34%),
    rgba(5, 8, 12, 0.94);
}

#level-complete-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.level-complete-card {
  width: min(620px, 92vw);
  border: 1px solid rgba(76,175,118,0.32);
  background: rgba(13, 15, 20, 0.96);
  box-shadow: 0 24px 90px rgba(0,0,0,0.5), 0 0 48px rgba(76,175,118,0.08);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
}

.level-complete-kicker {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: #4caf76;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.level-complete-title {
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 34px;
  color: #e8eaf0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.level-complete-ascii {
  margin: 18px auto;
  color: #4caf76;
  background: rgba(76,175,118,0.05);
  border-color: rgba(76,175,118,0.18);
  font-size: 12px;
  line-height: 1.25;
}

.level-complete-copy {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.level-complete-button {
  margin-top: 22px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid rgba(76,175,118,0.4);
  background: rgba(76,175,118,0.1);
  color: #4caf76;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.level-complete-button:hover {
  background: rgba(76,175,118,0.18);
}

.boot-fact pre {
  margin: 0 0 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: #4a90d9;
  font-size: 10px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.level-complete-flag {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(76, 175, 118, 0.45);
  border-radius: 8px;
  background: rgba(76, 175, 118, 0.08);
  color: #4caf76;
  font-family: "Fira Code", monospace;
  font-size: 13px;
  word-break: break-all;
}

.guide-quiz {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto minmax(80px, 1fr);
  align-items: center;
  gap: 10px;
  margin: 10px 0 20px;
  padding: 12px;
  border: 1px solid rgba(74, 144, 217, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.guide-answer {
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(74, 144, 217, 0.35);
  border-radius: 6px;
  background: #090b0f;
  color: #e8eaf0;
  font-family: "Fira Code", monospace;
  font-size: 12px;
  outline: none;
}

.guide-answer:focus {
  border-color: rgba(74, 144, 217, 0.75);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.12);
}

.guide-check-answer {
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(74, 144, 217, 0.45);
  border-radius: 6px;
  background: rgba(74, 144, 217, 0.10);
  color: #75b7ff;
  font-family: "Fira Code", monospace;
  font-size: 12px;
  cursor: pointer;
}

.guide-check-answer:hover {
  background: rgba(74, 144, 217, 0.18);
}

.guide-result {
  font-family: "Fira Code", monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.guide-quiz.correct {
  border-color: rgba(76, 175, 118, 0.45);
  background: rgba(76, 175, 118, 0.08);
}

.guide-quiz.correct .guide-result {
  color: #4caf76;
}

.guide-quiz.wrong {
  border-color: rgba(217, 79, 79, 0.45);
  background: rgba(217, 79, 79, 0.06);
}

.guide-quiz.wrong .guide-result {
  color: #ff7777;
}

@media (max-width: 760px) {
  .guide-quiz {
    grid-template-columns: 1fr;
  }
}

/* ── BlueWall UI polish overrides ─────────────────────────────── */
:root {
  --bg: #070b12;
  --panel-bg: rgba(13, 18, 28, 0.92);
  --panel-bg-2: rgba(9, 13, 22, 0.96);
  --border: rgba(96, 165, 250, 0.16);
  --border-hi: rgba(96, 165, 250, 0.38);
  --accent-a: #ff4d5f;
  --accent-s: #60a5fa;
  --accent-g: #37d67a;
  --text: #d7deea;
  --text-dim: #8d99ae;
}

body {
  background:
    radial-gradient(circle at 15% -10%, rgba(37, 99, 235, 0.16), transparent 34%),
    radial-gradient(circle at 90% 105%, rgba(16, 185, 129, 0.11), transparent 30%),
    linear-gradient(180deg, #070b12 0%, #090d14 100%);
}

body::before {
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.7), rgba(0,0,0,0.15));
}

#header {
  height: 48px;
  background: rgba(5, 8, 13, 0.88);
  border-bottom: 1px solid rgba(96, 165, 250, 0.16);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
}

#header h1 {
  font-size: 13px;
  letter-spacing: 0.18em;
}

#status,
.hbtn,
.packet-button {
  border-radius: 8px;
}

#container {
  padding: 10px;
}

#guide-panel,
.vm-panel,
#packet-analyzer {
  background:
    linear-gradient(180deg, rgba(18, 25, 39, 0.92), rgba(9, 13, 22, 0.96));
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: 12px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

#guide-panel .panel-header,
.vm-header,
.packet-toolbar {
  min-height: 38px;
  background: rgba(5, 8, 13, 0.72);
  border-bottom: 1px solid rgba(96, 165, 250, 0.13);
  color: #8cc8ff;
}

#guide-panel .panel-header::after,
.vm-header::after {
  content: 'LIVE';
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid rgba(55, 214, 122, 0.24);
  border-radius: 999px;
  color: #37d67a;
  font-size: 9px;
  letter-spacing: 0.12em;
  opacity: 0.8;
}

.vm-header .vm-badge {
  margin-left: 10px;
  color: #9fb3ce;
}

#guide-scroll {
  padding: 22px 24px;
}

#guide-scroll h1 {
  color: #eef4ff;
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

#guide-scroll h2 {
  margin-top: 26px;
  color: #d7deea;
  font-size: 18px;
}

#guide-scroll p {
  color: #a8b3c5;
  line-height: 1.65;
}

#guide-scroll pre {
  border-radius: 10px;
  background: rgba(3, 7, 13, 0.78);
  border: 1px solid rgba(96, 165, 250, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.guide-quiz {
  grid-template-columns: minmax(210px, 360px) auto minmax(100px, 1fr);
  border-radius: 12px;
  border-color: rgba(96, 165, 250, 0.18);
  background: rgba(5, 10, 18, 0.52);
}

.guide-answer {
  border-radius: 9px;
  background: rgba(3, 7, 13, 0.95);
  border-color: rgba(96, 165, 250, 0.24);
}

.guide-check-answer {
  border-radius: 9px;
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.34);
}

.guide-quiz.correct {
  border-color: rgba(55, 214, 122, 0.42);
  background: rgba(16, 185, 129, 0.10);
}

.guide-quiz.wrong {
  border-color: rgba(255, 77, 95, 0.44);
  background: rgba(255, 77, 95, 0.08);
}

.vm-container {
  background: #03070d;
}

.xterm {
  padding: 2px;
}

.xterm .xterm-viewport,
.xterm .xterm-screen {
  background-color: #03070d !important;
}

#packet-analyzer {
  margin: 0 10px 10px;
}

.packet-title {
  color: #37d67a;
}

.packet-table th,
.packet-details,
.packet-toolbar {
  background: rgba(5, 8, 13, 0.86);
}

.packet-table tr:hover td,
.packet-table tr.selected td {
  background: rgba(96, 165, 250, 0.12);
}

.level-select-card {
  background:
    radial-gradient(circle at 20% 0%, rgba(96, 165, 250, 0.10), transparent 38%),
    rgba(9, 13, 22, 0.94);
  border-color: rgba(96, 165, 250, 0.22);
  border-radius: 22px;
}

.level-card {
  border-radius: 16px;
  background: rgba(18, 25, 39, 0.72);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.level-card.recommended {
  border-color: rgba(55, 214, 122, 0.38);
  box-shadow: 0 0 0 1px rgba(55, 214, 122, 0.06);
}

.level-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  opacity: 0.18;
  background: radial-gradient(circle at 20% 10%, var(--level-neon), transparent 42%);
  animation: level-neon-drift 3.6s ease-in-out infinite;
}

.level-card::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--level-neon), transparent);
  opacity: 0.72;
  animation: level-scan 2.4s linear infinite;
}

.level-card[data-start-level="easy"] {
  --level-neon: #22c55e;
  border-color: rgba(34, 197, 94, 0.42);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.08);
}

.level-card[data-start-level="medium"] {
  --level-neon: #06b6d4;
  border-color: rgba(6, 182, 212, 0.48);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.12);
}

.level-card[data-start-level="hard"] {
  --level-neon: #f43f5e;
  border-color: rgba(244, 63, 94, 0.44);
  box-shadow: 0 0 28px rgba(244, 63, 94, 0.10);
}

.level-card[data-start-level="easy"] .level-name {
  color: #86efac;
  text-shadow: 0 0 18px rgba(34, 197, 94, 0.42);
}

.level-card[data-start-level="medium"] .level-name {
  color: #67e8f9;
  text-shadow: 0 0 18px rgba(6, 182, 212, 0.44);
}

.level-card[data-start-level="hard"] .level-name {
  color: #fb7185;
  text-shadow: 0 0 18px rgba(244, 63, 94, 0.46);
}

.level-card[data-start-level="easy"] .level-command {
  color: #4ade80;
}

.level-card[data-start-level="medium"] .level-command {
  color: #22d3ee;
}

.level-card[data-start-level="hard"] .level-command {
  color: #fb7185;
}

.level-card:hover {
  transform: translateY(-5px) scale(1.015);
  border-color: var(--level-neon);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.30),
    0 0 34px color-mix(in srgb, var(--level-neon) 34%, transparent);
}

@keyframes level-neon-drift {
  0%, 100% { transform: translate3d(-8%, -8%, 0) scale(1); opacity: 0.16; }
  50% { transform: translate3d(16%, 12%, 0) scale(1.24); opacity: 0.34; }
}

@keyframes level-scan {
  0% { transform: translateX(-42%); opacity: 0.15; }
  35% { opacity: 0.85; }
  100% { transform: translateX(42%); opacity: 0.15; }
}

#boot-overlay {
  background:
    radial-gradient(circle at 50% 10%, rgba(96, 165, 250, 0.14), transparent 36%),
    radial-gradient(circle at 75% 85%, rgba(255, 77, 95, 0.10), transparent 30%),
    rgba(3, 7, 13, 0.97);
}

.boot-inner {
  padding: 24px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 18px;
  background: rgba(5, 8, 13, 0.52);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

/* ── BlueWall home + theme refinements ─────────────────────────── */
#level-select-overlay {
  background:
    radial-gradient(circle at 50% 18%, rgba(59, 130, 246, 0.20), transparent 34%),
    radial-gradient(circle at 85% 85%, rgba(20, 184, 166, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(2, 6, 23, 0.97), rgba(4, 12, 23, 0.98));
}

.level-select-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: min(1120px, 92vw);
  min-height: min(720px, 86vh);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.level-select-card > * {
  position: relative;
  z-index: 2;
}

.level-select-ascii {
  position: relative;
  z-index: 2;
  width: min-content;
  max-width: 100%;
  margin: 22px auto 8px;
  padding: 22px 26px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.16), transparent 64%),
    rgba(3, 7, 13, 0.42);
  color: rgba(125, 190, 255, 0.88);
  font-size: clamp(10px, 1.18vw, 18px);
  line-height: 1.08;
  text-align: center;
  overflow: hidden;
  pointer-events: none;
  box-shadow:
    0 0 42px rgba(96, 165, 250, 0.16),
    inset 0 0 40px rgba(96, 165, 250, 0.08);
  text-shadow:
    0 0 16px rgba(96, 165, 250, 0.50),
    0 0 36px rgba(96, 165, 250, 0.28);
}

.level-select-kicker {
  color: #38d9a9;
}

.level-select-title {
  font-size: clamp(30px, 3.2vw, 54px);
  letter-spacing: 0.22em;
  text-shadow: 0 0 34px rgba(96, 165, 250, 0.28);
}

.level-select-sub {
  margin: 18px auto 0;
  max-width: 720px;
}

.level-grid {
  margin-top: 34px;
}

body.light-theme {
  --bg: #eaf5ff;
  --panel-bg: rgba(248, 252, 255, 0.94);
  --panel-bg-2: rgba(238, 247, 255, 0.96);
  --border: rgba(14, 116, 144, 0.18);
  --border-hi: rgba(2, 132, 199, 0.40);
  --accent-a: #e11d48;
  --accent-s: #0284c7;
  --accent-g: #059669;
  --text: #102033;
  --text-dim: #516174;
  background:
    radial-gradient(circle at 18% -10%, rgba(56, 189, 248, 0.34), transparent 36%),
    radial-gradient(circle at 90% 105%, rgba(14, 165, 233, 0.22), transparent 34%),
    linear-gradient(180deg, #f3f9ff, #e6f3ff);
  color: var(--text);
}

body.light-theme::before {
  background-image:
    linear-gradient(rgba(2, 132, 199, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(2, 132, 199, 0.07) 1px, transparent 1px);
}

body.light-theme #header,
body.light-theme #guide-panel .panel-header,
body.light-theme .vm-header,
body.light-theme .packet-toolbar {
  background: rgba(238, 247, 255, 0.88);
  color: #075985;
  border-color: rgba(2, 132, 199, 0.18);
}

body.light-theme #guide-panel,
body.light-theme .vm-panel,
body.light-theme #packet-analyzer,
body.light-theme .level-select-card,
body.light-theme .level-card,
body.light-theme .guide-quiz {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(235, 247, 255, 0.92));
  border-color: rgba(2, 132, 199, 0.20);
  box-shadow: 0 14px 40px rgba(14, 116, 144, 0.12);
}

body.light-theme #level-select-overlay {
  background:
    radial-gradient(circle at 50% 18%, rgba(56, 189, 248, 0.34), transparent 34%),
    radial-gradient(circle at 84% 86%, rgba(125, 211, 252, 0.30), transparent 30%),
    linear-gradient(135deg, rgba(240, 249, 255, 0.96), rgba(224, 242, 254, 0.98));
}

body.light-theme .level-select-ascii {
  color: rgba(3, 105, 161, 0.82);
  border-color: rgba(2, 132, 199, 0.24);
  background:
    radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.20), transparent 64%),
    rgba(240, 249, 255, 0.66);
  text-shadow:
    0 0 14px rgba(2, 132, 199, 0.24),
    0 0 30px rgba(56, 189, 248, 0.20);
}

body.light-theme .level-select-title,
body.light-theme #guide-scroll h1,
body.light-theme #guide-scroll h2,
body.light-theme .level-name {
  color: #0f172a;
}

body.light-theme .level-select-sub,
body.light-theme #guide-scroll p,
body.light-theme .level-desc {
  color: #475569;
}

body.light-theme pre,
body.light-theme #guide-scroll pre,
body.light-theme .guide-answer,
body.light-theme .packet-filter,
body.light-theme .packet-search,
body.light-theme .vm-container,
body.light-theme .packet-details,
body.light-theme .packet-hex {
  background: rgba(240, 249, 255, 0.92);
  color: #075985;
  border-color: rgba(2, 132, 199, 0.18);
}

body.light-theme code {
  background: rgba(186, 230, 253, 0.50);
  color: #0369a1;
  border-color: rgba(2, 132, 199, 0.18);
}

body.light-theme .hbtn-info,
body.light-theme .packet-button {
  background: rgba(14, 165, 233, 0.10);
  border-color: rgba(2, 132, 199, 0.26);
  color: #0284c7;
}

body.light-theme .service-chip.up {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

body.light-theme .service-chip.down {
  background: rgba(225, 29, 72, 0.08);
  color: #be123c;
}

/* ── BlueWall operator console: restrained IDS theme ───────────── */
:root {
  --bg: #05070a;
  --panel-bg: #0b1017;
  --panel-bg-2: #070b10;
  --border: rgba(100, 116, 139, 0.24);
  --border-hi: rgba(56, 189, 248, 0.32);
  --accent-a: #ef4444;
  --accent-s: #38bdf8;
  --accent-g: #22c55e;
  --text: #d8dee9;
  --text-dim: #8b98a8;
}

body:not(.light-theme) {
  background:
    linear-gradient(180deg, rgba(9, 14, 21, 0.98), rgba(3, 6, 10, 0.99)),
    #05070a;
}

body:not(.light-theme)::before {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.026) 1px, transparent 1px);
  background-size: 32px 32px;
}

body:not(.light-theme) #header,
body:not(.light-theme) #guide-panel .panel-header,
body:not(.light-theme) .vm-header,
body:not(.light-theme) .packet-toolbar {
  background: #070b10;
  border-color: rgba(100, 116, 139, 0.22);
  box-shadow: none;
}

body:not(.light-theme) #guide-panel,
body:not(.light-theme) .vm-panel,
body:not(.light-theme) #packet-analyzer,
body:not(.light-theme) .level-select-card {
  background: linear-gradient(180deg, #0b1017, #070b10);
  border-color: rgba(100, 116, 139, 0.24);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

body:not(.light-theme) #level-select-overlay {
  background:
    radial-gradient(circle at 50% -10%, rgba(14, 165, 233, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(3, 7, 13, 0.96), rgba(1, 4, 8, 0.98));
}

body:not(.light-theme) .level-select-card {
  width: min(1080px, 92vw);
  min-height: min(680px, 84vh);
  border-radius: 14px;
}

body:not(.light-theme) .level-select-kicker {
  color: #64748b;
  letter-spacing: 0.34em;
}

body:not(.light-theme) .level-select-title {
  color: #e5e7eb;
  text-shadow: none;
  letter-spacing: 0.18em;
}

body:not(.light-theme) .level-select-ascii {
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: #05080d;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.9);
  text-shadow: none;
}

body:not(.light-theme) .level-card {
  background: #0d131c;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 10px;
  box-shadow: none;
  transform: none;
}

body:not(.light-theme) .level-card::before,
body:not(.light-theme) .level-card::after {
  display: none;
}

body:not(.light-theme) .level-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.42);
  background: #101824;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

body:not(.light-theme) .level-card[data-start-level="easy"],
body:not(.light-theme) .level-card[data-start-level="medium"],
body:not(.light-theme) .level-card[data-start-level="hard"] {
  box-shadow: none;
}

body:not(.light-theme) .level-card[data-start-level="easy"] {
  border-left: 3px solid #22c55e;
}

body:not(.light-theme) .level-card[data-start-level="medium"] {
  border-left: 3px solid #38bdf8;
}

body:not(.light-theme) .level-card[data-start-level="hard"] {
  border-left: 3px solid #ef4444;
}

body:not(.light-theme) .level-card[data-start-level="easy"] .level-name,
body:not(.light-theme) .level-card[data-start-level="medium"] .level-name,
body:not(.light-theme) .level-card[data-start-level="hard"] .level-name {
  color: #e5e7eb;
  text-shadow: none;
}

body:not(.light-theme) .level-card[data-start-level="easy"] .level-command {
  color: #86efac;
}

body:not(.light-theme) .level-card[data-start-level="medium"] .level-command {
  color: #7dd3fc;
}

body:not(.light-theme) .level-card[data-start-level="hard"] .level-command {
  color: #fca5a5;
}

body:not(.light-theme) .level-desc,
body:not(.light-theme) .level-select-sub,
body:not(.light-theme) .level-select-note {
  color: #94a3b8;
}

body:not(.light-theme) #status,
body:not(.light-theme) .header-health,
body:not(.light-theme) .hbtn,
body:not(.light-theme) .packet-button {
  border-radius: 4px;
  box-shadow: none;
}

body:not(.light-theme) .boot-inner,
body:not(.light-theme) #boot-overlay {
  box-shadow: none;
}

/* ── BlueWall light mode: blue analyst dashboard ───────────────── */
body.light-theme {
  --bg: #e8f2fb;
  --panel-bg: #f8fbff;
  --panel-bg-2: #edf6ff;
  --border: rgba(15, 80, 124, 0.18);
  --border-hi: rgba(2, 104, 160, 0.34);
  --accent-a: #c2414b;
  --accent-s: #0369a1;
  --accent-g: #047857;
  --text: #102033;
  --text-dim: #52657a;
  background:
    linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(219, 234, 254, 0.98)),
    #e8f2fb;
  color: var(--text);
}

body.light-theme::before {
  background-image:
    linear-gradient(rgba(2, 104, 160, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(2, 104, 160, 0.055) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.72;
}

body.light-theme #header,
body.light-theme #guide-panel .panel-header,
body.light-theme .vm-header,
body.light-theme .packet-toolbar {
  background: #eaf4ff;
  color: #075985;
  border-color: rgba(15, 80, 124, 0.18);
  box-shadow: none;
}

body.light-theme #guide-panel,
body.light-theme .vm-panel,
body.light-theme #packet-analyzer,
body.light-theme .level-select-card,
body.light-theme .level-card,
body.light-theme .guide-quiz,
body.light-theme .level-complete-card,
body.light-theme .endlab-card {
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
  border-color: rgba(15, 80, 124, 0.18);
  box-shadow: 0 14px 34px rgba(15, 80, 124, 0.10);
}

body.light-theme #level-select-overlay {
  background:
    radial-gradient(circle at 50% -10%, rgba(14, 165, 233, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(219, 234, 254, 0.98));
}

body.light-theme .level-select-card {
  border-radius: 14px;
}

body.light-theme .level-select-kicker {
  color: #0f766e;
  letter-spacing: 0.34em;
}

body.light-theme .level-select-title,
body.light-theme #header h1,
body.light-theme #guide-scroll h1,
body.light-theme #guide-scroll h2,
body.light-theme .level-name,
body.light-theme .level-complete-title {
  color: #0f172a;
  text-shadow: none;
}

body.light-theme .level-select-ascii {
  color: #0369a1;
  border: 1px solid rgba(2, 104, 160, 0.22);
  background: #eff8ff;
  box-shadow: inset 0 0 0 1px rgba(186, 230, 253, 0.7);
  text-shadow: none;
}

body.light-theme .level-card {
  border: 1px solid rgba(15, 80, 124, 0.18);
  border-radius: 10px;
  box-shadow: none;
  transform: none;
}

body.light-theme .level-card::before,
body.light-theme .level-card::after {
  display: none;
}

body.light-theme .level-card:hover {
  transform: translateY(-2px);
  background: #f1f8ff;
  border-color: rgba(2, 104, 160, 0.32);
  box-shadow: 0 12px 28px rgba(15, 80, 124, 0.12);
}

body.light-theme .level-card[data-start-level="easy"] {
  border-left: 3px solid #059669;
}

body.light-theme .level-card[data-start-level="medium"] {
  border-left: 3px solid #0284c7;
}

body.light-theme .level-card[data-start-level="hard"] {
  border-left: 3px solid #dc2626;
}

body.light-theme .level-card[data-start-level="easy"] .level-name,
body.light-theme .level-card[data-start-level="medium"] .level-name,
body.light-theme .level-card[data-start-level="hard"] .level-name {
  color: #0f172a;
  text-shadow: none;
}

body.light-theme .level-card[data-start-level="easy"] .level-command {
  color: #047857;
}

body.light-theme .level-card[data-start-level="medium"] .level-command {
  color: #0369a1;
}

body.light-theme .level-card[data-start-level="hard"] .level-command {
  color: #b91c1c;
}

body.light-theme .level-desc,
body.light-theme .level-select-sub,
body.light-theme .level-select-note,
body.light-theme #guide-scroll p,
body.light-theme .level-complete-copy {
  color: #52657a;
}

body.light-theme pre,
body.light-theme #guide-scroll pre,
body.light-theme .guide-answer,
body.light-theme .packet-filter,
body.light-theme .packet-search,
body.light-theme .packet-details,
body.light-theme .packet-hex,
body.light-theme .stream-body {
  background: #f1f8ff;
  color: #075985;
  border-color: rgba(15, 80, 124, 0.16);
}

body.light-theme .vm-container,
body.light-theme .xterm .xterm-viewport,
body.light-theme .xterm .xterm-screen {
  background-color: #f3f8ff !important;
}

body.light-theme code {
  background: #dff0ff;
  color: #075985;
  border-color: rgba(15, 80, 124, 0.14);
}

body.light-theme .hbtn,
body.light-theme .packet-button,
body.light-theme #status,
body.light-theme .header-health {
  border-radius: 4px;
  box-shadow: none;
}

body.light-theme .hbtn-info,
body.light-theme .packet-button {
  background: #e2f2ff;
  border-color: rgba(2, 104, 160, 0.22);
  color: #075985;
}

body.light-theme .hbtn-reset {
  background: #fff1f2;
  border-color: rgba(190, 18, 60, 0.20);
  color: #be123c;
}

body.light-theme .hbtn-endlab {
  background: #ecfdf5;
  border-color: rgba(4, 120, 87, 0.20);
  color: #047857;
}

body.light-theme .packet-table th {
  background: #eaf4ff;
  color: #075985;
}

body.light-theme .packet-table td {
  color: #475569;
}

body.light-theme .packet-table tr:hover td,
body.light-theme .packet-table tr.selected td {
  background: #dff0ff;
  color: #102033;
}

body.light-theme .service-chip.up {
  border-color: rgba(4, 120, 87, 0.24);
  background: #ecfdf5;
  color: #047857;
}

body.light-theme .service-chip.down {
  border-color: rgba(190, 18, 60, 0.20);
  background: #fff1f2;
  color: #be123c;
}

body.light-theme .boot-inner {
  background: #f8fbff;
  border-color: rgba(15, 80, 124, 0.18);
  box-shadow: 0 18px 42px rgba(15, 80, 124, 0.12);
}

body.light-theme #boot-overlay {
  background:
    radial-gradient(circle at 50% -10%, rgba(14, 165, 233, 0.18), transparent 32%),
    rgba(240, 249, 255, 0.96);
}

/* ── Mission guide cards ───────────────────────────────────────── */
.lab-hero {
  position: relative;
  overflow: hidden;
  margin: 10px 0 18px;
  padding: 24px 28px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(12, 18, 31, 0.94), rgba(7, 10, 18, 0.94)),
    repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.04) 0 1px, transparent 1px 16px);
}

.lab-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(56, 189, 248, 0.18), transparent 30%),
    linear-gradient(90deg, rgba(34, 197, 94, 0.08), transparent 42%);
  pointer-events: none;
}

.lab-hero::after {
  content: "DEFENDER PLAYBOOK";
  position: absolute;
  right: 18px;
  bottom: 14px;
  color: rgba(148, 163, 184, 0.22);
  font: 700 12px var(--mono);
  letter-spacing: 0.34em;
}

.lab-hero.easy {
  border-color: rgba(34, 197, 94, 0.32);
}

.lab-hero.medium {
  border-color: rgba(56, 189, 248, 0.34);
}

.lab-hero.hard {
  border-color: rgba(248, 113, 113, 0.34);
}

.lab-hero-kicker {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  color: #4ade80;
  font: 700 12px var(--mono);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.lab-hero.medium .lab-hero-kicker {
  color: #38bdf8;
}

.lab-hero.hard .lab-hero-kicker {
  color: #fb7185;
}

#guide-scroll .lab-hero h1 {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  color: #f8fafc;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.04em;
}

#guide-scroll .lab-hero p {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0;
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1.6;
}

.mission-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 24px;
}

.mission-strip span {
  border: 1px solid rgba(59, 130, 246, 0.20);
  border-left: 3px solid #38bdf8;
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.62);
  color: #dbeafe;
  font: 700 12px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#guide-scroll h2 {
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

#guide-scroll ul {
  margin: 10px 0 18px 22px;
}

#guide-scroll li {
  margin: 7px 0;
  color: var(--text-dim);
}

.guide-code-wrap {
  position: relative;
  margin: 10px 0 16px;
  border: 1px solid rgba(59, 130, 246, 0.20);
  border-radius: 10px;
  background: rgba(3, 7, 13, 0.74);
  overflow: hidden;
}

#guide-scroll .guide-code-wrap pre.copy-ready {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding-right: 14px;
  background: transparent;
}

.guide-copy {
  display: block;
  margin: 8px 8px 0 auto;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 6px;
  padding: 5px 9px;
  background: rgba(14, 165, 233, 0.10);
  color: #7dd3fc;
  font: 700 11px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.guide-copy:hover,
.guide-copy.copied {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

body:not(.light-theme) .vm-header.snort {
  background:
    linear-gradient(90deg, rgba(8, 47, 73, 0.88), rgba(5, 8, 13, 0.92) 58%),
    #05080d;
  border-bottom-color: rgba(56, 189, 248, 0.42);
  color: #dbeafe;
}

body:not(.light-theme) .vm-header.snort .vm-badge {
  color: #7dd3fc;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.40);
}

body:not(.light-theme) .vm-header.snort .vm-dot {
  background: #38bdf8 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.75);
}

body.light-theme .lab-hero {
  background:
    linear-gradient(135deg, rgba(241, 248, 255, 0.96), rgba(219, 234, 254, 0.96)),
    repeating-linear-gradient(90deg, rgba(2, 104, 160, 0.05) 0 1px, transparent 1px 16px);
  border-color: rgba(2, 104, 160, 0.22);
}

body.light-theme .lab-hero::before {
  background:
    radial-gradient(circle at 18% 20%, rgba(14, 165, 233, 0.16), transparent 30%),
    linear-gradient(90deg, rgba(4, 120, 87, 0.08), transparent 42%);
}

body.light-theme #guide-scroll .lab-hero h1 {
  color: #0f172a;
}

body.light-theme #guide-scroll .lab-hero p {
  color: #475569;
}

body.light-theme .mission-strip span {
  background: #eff8ff;
  border-color: rgba(2, 104, 160, 0.16);
  border-left-color: #0284c7;
  color: #075985;
}

body.light-theme .guide-copy {
  background: #dff0ff;
  border-color: rgba(2, 104, 160, 0.22);
  color: #075985;
}

body.light-theme .guide-code-wrap {
  background: #f1f8ff;
  border-color: rgba(2, 104, 160, 0.16);
}

body.light-theme .guide-copy:hover,
body.light-theme .guide-copy.copied {
  background: #dcfce7;
  border-color: rgba(4, 120, 87, 0.24);
  color: #047857;
}

body.light-theme .vm-header.snort {
  background: linear-gradient(90deg, #dff0ff, #f8fbff 68%);
  border-bottom-color: rgba(2, 104, 160, 0.28);
}

@media (max-width: 980px) {
  .mission-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .mission-strip {
    grid-template-columns: 1fr;
  }
}
