:root {
  --bg: var(--theme-learning-surface-416);
  --panel: var(--theme-learning-surface-417);
  --border: var(--theme-learning-border-418);
  --neon: var(--theme-learning-primary-419);
  --text: var(--theme-learning-ink-420);
  --muted: var(--theme-learning-muted-421);
  --bad: var(--theme-learning-error-422);
  --warn: var(--theme-learning-error-423);
  --good: var(--theme-learning-primary-424);
  --blue: var(--theme-learning-info-425);
  --purple: var(--theme-learning-info-426);
  --orange: var(--theme-learning-error-427);
  --term-bg: var(--theme-learning-surface-428);
  --term-text: var(--theme-learning-ink-20);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: 'Geist', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  cursor: none;

  /* Required for custom reticle */
}

/* --- TACTICAL RETICLE SYSTEM --- */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 50px;
  height: 50px;
  border: 2px solid var(--neon);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10000;
  transition: width 0.2s, height 0.2s, border-color 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 4px var(--theme-learning-success-429);
  background-image: linear-gradient(90deg, var(--neon) 25%, transparent 25%, transparent 75%, var(--neon) 75%),
                      linear-gradient(180deg, var(--neon) 25%, transparent 25%, transparent 75%, var(--neon) 75%);
  background-position: center;
  background-size: 100% 2px, 2px 100%;
  background-repeat: no-repeat;
}

.cursor::before, .cursor::after {
  content: '';
  position: absolute;
  opacity: 0.8;
}

.cursor::before {
  width: 50%;
  height: 1px;
  border-top: 2px dotted var(--neon);
}

.cursor::after {
  height: 50%;
  width: 1px;
  border-left: 2px dotted var(--neon);
}

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  background: var(--theme-catalog-surface-31);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10001;
  box-shadow: 0 0 4px var(--theme-component-border-7);
}

.cursor.active {
  width: 70px;
  height: 70px;
  border-color: var(--theme-component-border-7);
  box-shadow: 0 0 15px var(--neon);
}

/* Hide cursor on all interactive elements */

button, a, select, input, .node, .cable, .nav-tab {
  cursor: none !important;
}

/* --- NAVIGATION TABS --- */

.nav-bar {
  display: none;
}

.nav-title {
  font-weight: bold;
  margin-right: 20px;
  color: var(--theme-component-ink-5);
  letter-spacing: 1px;
}

.nav-tab {
  background: transparent;
  border: 1px solid var(--theme-learning-border-117);
  color: var(--theme-component-muted-6);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-tab:hover {
  background: var(--theme-learning-inset-115);
  color: var(--theme-component-ink-5);
}

.nav-tab.active {
  background: var(--blue);
  color: var(--theme-component-ink-5);
  border-color: var(--blue);
  font-weight: bold;
}

/* --- LAYOUT --- */

.app-container {
  display: grid;
  grid-template-columns: 65fr 35fr;
  width: 100%;
  height: 100vh;
  min-height: 0;
  flex: 0 0 100vh;
  overflow: hidden;
}

/* --- MAP AREA --- */

.map-area {
  position: relative;
  background: radial-gradient(circle at 50% 20%, var(--theme-learning-inset-430) 0%, var(--theme-learning-page-431) 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 20px 14px;
  overflow-y: auto;
}

.map-topbar {
  position: absolute;
  top: 18px;
  left: 140px;
  right: 20px;
  min-height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  z-index: 100;
  pointer-events: none;
}

.map-heading {
  padding-top: 6px;
  min-width: 0;
}

.map-heading h2 {
  color: var(--theme-component-ink-5);
  margin: 0 0 6px 0;
  font-size: 24px;
  line-height: 1.1;
}

.map-heading div {
  font-size: 14px;
  font-weight: normal;
  color: var(--theme-learning-muted-132);
}

.map-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: auto;
}

/* BRANDING LOGO */

.branding-logo-link {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 100;
}

.branding-logo {
  width: 105px;
  height: 70px;
  object-fit: contain;
  background: var(--theme-learning-page-432);
  border: 1px solid var(--theme-learning-border-117);
  border-radius: 8px;
  padding: 0;
  opacity: 0.9;
  transition: opacity 0.2s, transform 0.2s, border-color 0.2s;
}

.branding-logo:hover {
  opacity: 1;
  transform: scale(1.05);
  border-color: var(--neon);
}

/* BACK TO SIMULATIONS BUTTON */

.back-nav {
  position: static;
}

.lab-btn-nav {
  background: transparent;
  border: 1px solid var(--neon);
  color: var(--neon);
  padding: 8px 16px;
  border-radius: 4px;
  font-family: 'Geist', sans-serif;
  text-transform: uppercase;
  font-weight: bold;
  text-decoration: none;
  font-size: 14px;
  transition: 0.2s;
}

.lab-btn-nav:hover {
  background: var(--neon);
  color: var(--theme-component-on-primary-3);
  box-shadow: 0 0 15px var(--neon);
}

/* LEGEND - REPOSITIONED TO THE RIGHT OF LOGO */

.legend {
  position: absolute;
  top: 108px;
  left: 140px;
  background: var(--theme-component-page-17);
  border: 1px solid var(--theme-learning-border-117);
  border-radius: 8px;
  padding: 10px 15px;
  z-index: 10;
  min-height: auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0 15px;
  max-width: min(520px, calc(100% - 400px));
  align-content: center;
  box-shadow: 0 0 20px var(--theme-learning-shadow-color-14);
}

.legend-title {
  color: var(--neon);
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
  margin-bottom: 5px;
  width: 100%;
  border-bottom: 1px solid var(--theme-learning-border-434);
  padding-bottom: 2px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--theme-learning-ink-20);
  font-size: 14px;
}

/* NODES & GRID */

.core-zone {
  display: flex;
  gap: 60px;
  margin-bottom: 28px;
  margin-top: 150px;
  z-index: 2;
  position: relative;
}

.department-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1400px;
  padding: 10px 30px 18px 30px;
}

.node {
  --status-color: var(--warn);
  --border-style: dashed;
  background: var(--theme-learning-inset-435);
  border: 3px var(--border-style) var(--status-color);
  border-radius: 8px;
  padding: 12px 10px;
  width: 100%;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  user-select: none;
  box-shadow: 0 4px 6px var(--theme-learning-shadow-color-436);
}

.node:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px var(--theme-learning-shadow-color-437);
}

.node.selected {
  border-color: var(--theme-component-border-7);
  border-style: solid;
  box-shadow: 0 0 35px var(--status-color);
  transform: scale(1.05);
  z-index: 10;
}

.node-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.node-label {
  font-size: 14px;
  font-weight: bold;
  color: var(--theme-learning-ink-438);
}

.node-sub {
  font-size: 14px;
  color: var(--theme-component-muted-6);
  margin-top: 4px;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.router-node {
  width: 300px;
  height: auto;
  min-height: 112px;
  background: var(--theme-learning-page-432);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-color: var(--theme-learning-border-439);
  border-style: solid;
  border-width: 3px;
  padding: 16px;
  z-index: 5;
}

/* --- TABLE VIEW (Level 3) --- */

.table-view-container {
  width: 100%;
  max-width: 1200px;
  display: none;
  flex-direction: column;
  gap: 20px;
  margin-top: 140px;
}

.big-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  background: var(--theme-learning-page-16);
  box-shadow: 0 0 20px var(--theme-learning-shadow-color-14);
  border-radius: 8px;
  overflow: hidden;
}

.big-table th {
  background: var(--theme-learning-inset-115);
  padding: 15px;
  text-align: left;
  color: var(--neon);
  border-bottom: 2px solid var(--theme-learning-border-117);
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 1px;
}

.big-table td {
  padding: 10px;
  border-bottom: 1px solid var(--theme-learning-border-117);
  color: var(--theme-learning-ink-119);
  font-family: monospace;
  font-size: 15px;
}

.big-table tr:hover {
  background: var(--theme-learning-page-125);
}

.worksheet-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--theme-learning-page-440);
  border: 1px solid var(--theme-learning-border-117);
  border-radius: 8px;
  padding: 10px 14px;
}

.worksheet-key-title {
  color: var(--neon);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 4px;
}

.worksheet-key-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--theme-learning-ink-20);
  font: 700 14px 'Consolas', monospace;
  border: 1px solid var(--theme-component-border-13);
  background: var(--theme-catalog-surface-130);
  padding: 6px 8px;
  border-radius: 4px;
}

.table-input {
  background: var(--theme-learning-page-431);
  border: 1px solid var(--theme-learning-border-434);
  color: var(--theme-component-ink-5);
  padding: 8px;
  width: 100%;
  font-family: 'Consolas', monospace;
  border-radius: 4px;
  transition: all 0.3s;
}

.table-input:focus {
  outline: none;
  border-color: var(--blue);
}

.table-input.correct {
  border-color: var(--good);
  color: var(--good);
  background: var(--theme-learning-success-bg-441);
}

.table-input.incorrect {
  border-color: var(--bad);
  color: var(--bad);
  background: var(--theme-learning-error-bg-442);
}

/* --- CLI SIDEBAR --- */

.sidebar {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid var(--border);
  background: var(--theme-learning-page-16);
  flex-shrink: 0;
}

.terminal-window {
  flex-grow: 1;
  background: var(--term-bg);
  padding: 15px;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: var(--term-text);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.term-line {
  margin-bottom: 5px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.term-prompt {
  color: var(--neon);
  font-weight: bold;
  margin-right: 8px;
}

.term-input {
  background: transparent;
  border: none;
  color: var(--theme-component-ink-5);
  font-family: inherit;
  font-size: inherit;
  width: 100%;
  outline: none;
  caret-color: var(--neon);
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  background: var(--theme-learning-inset-135);
  color: var(--theme-component-ink-5);
  border-top: 1px solid var(--theme-learning-border-434);
  flex-shrink: 0;
}

.btn:hover {
  background: var(--theme-learning-inset-443);
}

.btn-doc {
  background: var(--blue);
  color: var(--theme-component-ink-5);
}

.btn-doc:hover {
  background: var(--theme-learning-info-444);
}

/* --- OVERLAYS --- */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--theme-component-page-62);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.success-banner {
  font-size: 40px;
  color: var(--neon);
  font-weight: bold;
  text-transform: uppercase;
  text-shadow: 0 0 30px var(--neon);
  margin-bottom: 20px;
  animation: popIn 0.5s ease;
}

#successOverlay .success-banner {
  max-width: calc(100vw - 32px);
  font-size: clamp(24px, 5vw, 40px);
  text-align: center;
}

#successOverlay .completion-close {
  margin-top: 15px;
  min-height: 40px;
  max-width: calc(100vw - 32px);
  color: var(--theme-component-ink-2);
}


.sheet-header {
  border-bottom: 1px solid var(--theme-learning-border-117);
  padding-bottom: 20px;
  margin-bottom: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-title {
  color: var(--theme-component-ink-5);
  font-size: 28px;
  font-weight: bold;
  font-family: 'Geist', sans-serif;
}

.sheet-close {
  cursor: pointer;
  color: var(--theme-learning-muted-120);
  font-size: 28px;
  transition: color 0.2s;
}

.sheet-close:hover {
  color: var(--theme-component-ink-5);
}

.sheet-section {
  margin-bottom: 35px;
  border-bottom: 1px solid var(--theme-learning-border-117);
  padding-bottom: 30px;
}

.sheet-section:last-child {
  border-bottom: none;
}

.sheet-h2 {
  color: var(--neon);
  font-size: 18px;
  text-transform: uppercase;
  border-left: 4px solid var(--neon);
  padding-left: 15px;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.sheet-h3 {
  color: var(--theme-component-ink-5);
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: bold;
  color: var(--blue);
}

.sheet-p {
  color: var(--theme-learning-ink-20);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.sheet-card {
  background: var(--theme-catalog-surface-169);
  border: 1px solid var(--theme-learning-border-117);
  border-radius: 8px;
  padding: 16px;
}

.sheet-card strong {
  color: var(--theme-component-ink-5);
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 18px;
  color: var(--theme-learning-ink-119);
  font-size: 14px;
}

.sheet-table th, .sheet-table td {
  border: 1px solid var(--theme-learning-border-117);
  padding: 9px 10px;
  vertical-align: top;
  text-align: left;
}

.sheet-table th {
  color: var(--neon);
  background: var(--theme-learning-success-bg-447);
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: .6px;
}

.sheet-callout {
  border-left: 4px solid var(--blue);
  background: var(--theme-learning-info-bg-448);
  padding: 14px 16px;
  color: var(--theme-learning-info-449);
  line-height: 1.65;
  margin: 14px 0;
}

.sheet-warn {
  border-left-color: var(--warn);
  background: var(--theme-learning-error-bg-450);
  color: var(--theme-learning-warning-451);
}

@media (max-width: 850px) {

  .sheet-grid {
    grid-template-columns: 1fr;
  }
}

.code-block {
  background: var(--theme-component-page-63);
  padding: 15px;
  border-radius: 6px;
  font-family: 'Consolas', monospace;
  color: var(--theme-learning-muted-132);
  border: 1px solid var(--theme-learning-border-117);
  font-size: 14px;
  margin-top: 10px;
  white-space: pre-wrap;
}

.code-green {
  color: var(--good);
}

.code-blue {
  color: var(--blue);
}

@keyframes popIn {

  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cable {
  fill: none;
  stroke: var(--theme-learning-border-117);
  stroke-width: 2px;
}

/* Configuration workbench */
[hidden] { display: none !important; }
.app-container { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); height: auto; min-height: 760px; flex: 1 0 auto; overflow: visible; }
.map-topbar { position: relative; top: auto; left: auto; right: auto; width: 100%; flex-wrap: wrap; pointer-events: auto; }
.legend { position: relative; top: auto; left: auto; max-width: 100%; width: 100%; margin-top: 20px; }
.core-zone { margin-top: 28px; gap: 20px; width: 100%; justify-content: center; }
.router-node { max-width: 270px; width: 45%; }
.department-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); padding: 10px 0; gap: 12px; }
.sidebar { min-width: 0; height: auto; overflow: visible; }
#guiPanel { padding: 24px; }
#guiPanel h2 { overflow-wrap: anywhere; }
#guiPanel fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 18px; display: grid; gap: 12px; }
#guiPanel input, #guiPanel select { width: 100%; min-width: 0; padding: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--muted); border-radius: 5px; }
#guiPanel .btn { margin-top: 18px; border: 1px solid var(--neon); border-radius: 6px; }
#labFeedback { padding: 18px; white-space: pre-wrap; border-top: 1px solid var(--border); }
.terminal-window { min-height: 480px; max-height: 850px; }
.table-view-container { margin-top: 24px; overflow-x: auto; }
.big-table { min-width: 850px; }
.node:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.cables-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@media (max-width: 850px) { .app-container { grid-template-columns: minmax(0,1fr); } .map-area { padding: 18px 12px; } .sidebar { border-left: 0; border-top: 1px solid var(--border); } .core-zone { gap: 12px; } .map-actions { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { .node, .success-banner { transition: none; animation: none; } }

/* Border geometry retained from the retired palette layer. */
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .nav-tab{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .branding-logo{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .legend{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .legend-title{border-bottom-width:1px;border-bottom-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .big-table th{border-bottom-width:2px;border-bottom-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .big-table td{border-bottom-width:1px;border-bottom-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .worksheet-key{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .worksheet-key-item{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .table-input{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .hints-box{border-top-width:1px;border-top-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .hint-cat{border-bottom-width:1px;border-bottom-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .btn{border-top-width:1px;border-top-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .cut-sheet-modal{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .sheet-header{border-bottom-width:1px;border-bottom-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .sheet-section{border-bottom-width:1px;border-bottom-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .sheet-card{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .sheet-table th, html.bb-page-2814aed15a[data-bb-theme="patriotic"] .sheet-table td{border-width:1px;border-style:solid;}
html.bb-page-2814aed15a[data-bb-theme="patriotic"] .code-block{border-width:1px;border-style:solid;}
