:root {
  --paper: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #121a24;
  --muted: #5f6c7b;
  --faint: #8c98a6;
  --line: #d8e0e8;
  --line-strong: #b7c4d0;
  --blue: #1e4c8f;
  --blue-2: #173a70;
  --teal: #087568;
  --teal-soft: #dff1ee;
  --amber: #a85a16;
  --amber-soft: #faead8;
  --red: #a33a2f;
  --green: #0b7a52;
  --shadow: 0 18px 48px rgba(31, 48, 68, 0.09);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 26, 36, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 26, 36, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding-bottom: 56px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 26px 0 16px;
  border-bottom: 2px solid var(--ink);
}

.brand-kicker,
.eyebrow,
.meta-grid,
.mono,
.chip,
.nav-link,
.metric-label,
.panel-title,
.rail-label,
.status-line,
.wire,
.event-log,
.step-index,
.video-meta {
  font-family: "IBM Plex Mono", Consolas, monospace;
}

.brand-kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.brand h1 {
  margin: 7px 0 4px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(2rem, 1.5rem + 2vw, 3.7rem);
  line-height: 0.98;
  font-weight: 500;
}

.brand h1 span {
  color: var(--faint);
  font-style: italic;
}

.brand-sub {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 16px;
  font-style: italic;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 0;
}

.metric {
  min-height: 82px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-label {
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 25px;
  font-weight: 700;
}

.metric-value small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.workbench {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-body {
  padding: 15px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 4px 9px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.chip.secure {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #a8d8d1;
}

.chip.risk {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ecc79c;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button,
.btn {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
}

.segmented button.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 5px 14px rgba(18, 26, 36, 0.07);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-color: var(--line-strong);
  background: var(--surface);
}

.btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.btn.primary {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.btn.primary:hover {
  background: var(--blue-2);
  border-color: var(--blue-2);
}

.btn:disabled {
  cursor: not-allowed;
  color: var(--faint);
  background: var(--surface-2);
  border-color: var(--line);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.module-list {
  display: grid;
  gap: 10px;
}

.module-card {
  width: 100%;
  padding: 13px;
  text-align: left;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.module-card:hover,
.module-card.active {
  color: var(--ink);
  border-color: var(--blue);
  box-shadow: 0 12px 24px rgba(30, 76, 143, 0.1);
}

.module-card strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.module-card span {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
}

.module-meta {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
  min-height: 450px;
}

.path-col {
  padding: 18px;
}

.path-col.vulnerable {
  background: linear-gradient(180deg, rgba(250, 234, 216, 0.72), rgba(255, 255, 255, 0.5));
}

.path-col.secure {
  background: linear-gradient(180deg, rgba(223, 241, 238, 0.8), rgba(255, 255, 255, 0.5));
}

.path-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-weight: 700;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.swatch.v {
  background: var(--amber);
}

.swatch.s {
  background: var(--teal);
}

.decision-stack {
  display: grid;
  gap: 10px;
}

.decision {
  padding: 13px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.decision b {
  display: block;
  margin-bottom: 6px;
}

.decision p {
  margin: 0;
  color: var(--muted);
}

.decision .kv {
  display: grid;
  gap: 5px;
  margin-top: 9px;
  color: var(--muted);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
}

.center-rail {
  position: relative;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(18, 26, 36, 0.08) 14px 15px);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.center-node {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  box-shadow: 0 0 0 8px rgba(18, 26, 36, 0.08);
}

.center-node.diverged {
  background: var(--amber);
}

.center-node.aligned {
  background: var(--teal);
}

.wire {
  padding: 15px 18px;
  color: #dbeafe;
  background: #111a27;
  border-top: 1px solid #253246;
  font-size: 12px;
  overflow-x: auto;
}

.wire code {
  white-space: pre-wrap;
}

.hl {
  color: #fff3c4;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 15px;
  font-size: 12px;
}

.event-row {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty {
  color: var(--faint);
  font-style: italic;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
}

.onboarding-grid {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.rail {
  position: sticky;
  top: 16px;
}

.stage-list {
  display: grid;
}

.stage-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.stage-item:last-child {
  border-bottom: 0;
}

.stage-item:hover,
.stage-item.current {
  color: var(--ink);
  background: var(--surface-2);
}

.step-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 99px;
  color: var(--faint);
  border: 1px solid var(--line-strong);
  font-size: 11px;
}

.stage-item.done .step-index {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.progress {
  height: 9px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
}

.progress i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--blue);
  transition: width 0.25s ease;
}

.content-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.content-head {
  display: grid;
  gap: 6px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.content-head h2 {
  margin: 0;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.45rem, 1.2rem + 1vw, 2.25rem);
  font-weight: 500;
}

.content-body {
  padding: 22px;
}

.content-body .lead {
  color: var(--ink);
  font-size: 17px;
}

.content-body p {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-box,
.term,
.exercise,
.trace-card,
.actor-card {
  padding: 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.info-box strong,
.term strong,
.actor-card strong {
  display: block;
  color: var(--ink);
  margin-bottom: 5px;
}

.video-frame {
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #233047;
  border-radius: var(--radius);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
}

.video-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  color: #cbd5e1;
  background: #111827;
  border-top: 1px solid #263244;
  font-size: 11px;
}

.trace {
  display: grid;
  gap: 10px;
}

.trace-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
}

.trace-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: white;
  background: var(--blue);
  border-radius: 99px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
}

.trace-wire {
  margin-top: 7px;
  padding: 9px;
  color: #dbeafe;
  background: #111827;
  border-radius: 4px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
}

.actor-grid,
.term-grid,
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.actor-card {
  min-height: 118px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.choice {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.choice:hover,
.choice.selected {
  color: var(--ink);
  border-color: var(--blue);
}

.choice.correct {
  color: var(--green);
  background: var(--teal-soft);
  border-color: #9dd4cb;
}

.choice.wrong {
  color: var(--red);
  background: #fde8e6;
  border-color: #f2b0aa;
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.colophon {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 24px 0 0;
  color: var(--faint);
  font-size: 12px;
}

@media (max-width: 980px) {
  .topbar,
  .workbench,
  .onboarding-grid,
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: flex-start;
  }

  .status-strip,
  .split,
  .actor-grid,
  .term-grid,
  .exercise-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rail {
    position: static;
  }

  .center-rail {
    min-height: 78px;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1240px);
  }

  .status-strip,
  .split,
  .actor-grid,
  .term-grid,
  .exercise-grid,
  .event-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding-top: 18px;
  }

  .brand h1 {
    font-size: 2.25rem;
  }

  .content-body,
  .path-col {
    padding: 16px;
  }

  .footer-actions,
  .colophon {
    align-items: stretch;
    flex-direction: column;
  }

  .btn,
  .nav-link {
    width: 100%;
  }
}
