@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght=0,300;0,400;0,500;0,600;0,700;1,400&family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:ital,wght=0,400;0,700;1,400&display=swap");

:root {
  color-scheme: dark;

  /* Fonts */
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "Space Mono", monospace;

  /* Color Palette: Optic Fiber Industrial Diagnostic Terminal */
  --bg-obsidian: #07090c;
  --bg-chassis: #0d1015;
  --bg-panel: #13171f;
  --bg-panel-hover: #1b202a;
  --line-border: rgba(56, 74, 95, 0.3);
  --line-border-strong: rgba(56, 74, 95, 0.6);
  --text-primary: #f1f3f6;
  --text-secondary: #a3b3c5;
  --text-muted: #62768e;

  /* Protocol Accent Colors */
  --sig-tcp: #ff8800; /* Signal Amber */
  --sig-tcp-soft: rgba(255, 136, 0, 0.08);
  --sig-tcp-border: rgba(255, 136, 0, 0.3);

  --sig-udp: #00b0ff; /* Signal Electric Cyan */
  --sig-udp-soft: rgba(0, 176, 255, 0.08);
  --sig-udp-border: rgba(0, 176, 255, 0.3);

  --sig-quic: #00e676; /* Signal Laser Green */
  --sig-quic-soft: rgba(0, 230, 118, 0.08);
  --sig-quic-border: rgba(0, 230, 118, 0.3);

  /* Diagnostic Indicators */
  --color-success: #00e676;
  --color-warning: #ffb300;
  --color-error: #ff3d00;

  --color-success-soft: rgba(0, 230, 118, 0.1);
  --color-warning-soft: rgba(255, 179, 0, 0.1);
  --color-error-soft: rgba(255, 61, 0, 0.1);

  /* Layout and Sizing */
  --radius-tech: 4px;
  --radius-md: 6px;
  --content-max-width: 1200px;
  --shadow-glow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Base resets & typography scale */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
}

/* Oscilloscope Dot Grid Pattern */
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.07;
  background-image: radial-gradient(var(--text-secondary) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black 50%, transparent 95%);
}

/* Site Layout elements */
.shell {
  width: min(var(--content-max-width), calc(100% - 32px));
  margin-inline: auto;
}

h1,
h2,
h3,
h4 {
  margin-bottom: 0;
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  text-transform: uppercase;
}

h3 {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

h4 {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

p {
  margin-top: 0;
  margin-bottom: 0;
}

code,
pre {
  font-family: var(--font-mono);
}

/* Accessibility Skip Link */
.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-180%);
  border: 1px solid var(--sig-tcp);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  color: var(--sig-tcp);
  padding: 8px 16px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Site Header */
.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-inline: max(16px, calc((100vw - var(--content-max-width)) / 2));
  border-bottom: 1px solid var(--line-border);
  background: rgba(7, 9, 12, 0.85);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  min-width: 0;
  color: var(--text-primary);
}

.logo-container {
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.brand .logo-container {
  width: 44px;
  height: 44px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.14);
}

.brand img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand span {
  display: grid;
  line-height: 1.05;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.brand small {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.back-link {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-decoration: none;
  border: 1px solid var(--line-border);
  padding: 6px 12px;
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  transition: all 150ms ease;
}

.back-link:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-panel);
}

/* Eyebrows, labels & status tokens */
.eyebrow,
.note-label,
.protocol-mark,
.stack-label,
.panel-kicker,
.status-token,
.question-number,
.scenario-label {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--sig-tcp);
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  align-items: center;
  gap: 48px;
  padding-block: 72px 56px;
}

.hero-lead,
.section-lead {
  max-width: 640px;
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.5;
}

.hero-note {
  position: relative;
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  padding: 24px;
  box-shadow: var(--shadow-glow);
}

.hero-note::before {
  content: "DIAGNOSTIC CORE";
  position: absolute;
  top: -9px;
  left: 12px;
  background: var(--bg-obsidian);
  padding-inline: 6px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  border: 1px solid var(--line-border);
}

.note-label {
  color: var(--color-warning);
  font-size: 0.65rem;
}

.hero-note strong {
  display: block;
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.hero-note p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Technical Sections */
.section {
  padding-block: 64px;
  border-top: 1px dashed var(--line-border);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

/* Control Help & UI Messages */
.control-help {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* Inputs & Form Fields */
button,
input {
  font-family: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Standard Buttons: Heavy Mechanical keycap feel */
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  background: var(--bg-chassis);
  color: var(--text-primary);
  box-shadow: 0 2px 0 var(--line-border);
  transition: all 120ms ease;
  cursor: pointer;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--line-border-strong);
  background: var(--bg-panel);
}

.button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.button.primary {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-obsidian);
  box-shadow: 0 2px 0 var(--text-secondary);
}

.button.primary:hover {
  background: #ffffff;
  color: var(--bg-obsidian);
  box-shadow: 0 3px 0 var(--text-primary);
}

.button.secondary {
  background: transparent;
  color: var(--text-secondary);
}

/* Section 1: Learner Setup Grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
}

.mode-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  padding: 20px;
  cursor: pointer;
  transition: all 150ms ease;
}

.mode-option:hover {
  border-color: var(--text-secondary);
  background: var(--bg-panel);
}

.mode-option:has(input:checked) {
  border-color: var(--sig-tcp);
  background: var(--sig-tcp-soft);
  box-shadow: inset 0 0 0 1px var(--sig-tcp-border);
}

.mode-option input {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  accent-color: var(--sig-tcp);
}

.mode-option-body {
  display: grid;
  gap: 6px;
}

.mode-option-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
}

.mode-option-copy {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.mode-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
}

.inline-status {
  color: var(--color-success);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Sections & Technical Cards */
.primer-grid,
.stack-grid,
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.explain-card,
.stack-card,
.scenario-card {
  position: relative;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  padding: 24px;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.explain-card:hover,
.stack-card:hover,
.scenario-card:hover {
  border-color: var(--line-border-strong);
  background: var(--bg-panel);
}

.explain-card {
  min-height: 200px;
}

.explain-card h3,
.stack-card h3,
.scenario-card h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
  text-transform: uppercase;
}

.explain-card p,
.stack-card p,
.scenario-card > p:not(.scenario-label) {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Section 3: Protocol Stack Cards */
.stack-card {
  min-height: 200px;
}

.stack-card-accent {
  border-color: var(--sig-quic-border);
  background: var(--sig-quic-soft);
}

.stack-label {
  margin-bottom: 20px;
  color: var(--text-secondary);
  display: block;
}

.stack-flow {
  display: flex;
  min-height: 48px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.stack-flow code,
.stack-flow strong {
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
  padding: 4px 8px;
}

.stack-flow code {
  color: var(--color-success);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.stack-flow strong {
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.stack-flow > span {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.boundary-note {
  display: inline-block;
  margin-top: 12px;
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-tech);
  color: var(--color-warning);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--color-warning-soft);
}

/* Section 4: The Comparison Lab (Oscilloscope Panel) */
.lab-section {
  scroll-margin-top: 72px;
}

.lab-heading {
  align-items: flex-start;
}

.live-status {
  flex: 0 0 auto;
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
  color: var(--text-primary);
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.lab-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  align-items: end;
  gap: 24px;
  border-block: 1px solid var(--line-border);
  padding-block: 24px;
  background: var(--bg-chassis);
  padding-inline: 16px;
  border-radius: var(--radius-tech);
}

.preset-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.preset-fieldset legend {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preset-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.preset-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
  padding: 12px;
  cursor: pointer;
  transition: all 120ms ease;
}

.preset-option:hover {
  border-color: var(--text-secondary);
  background: var(--bg-panel-hover);
}

.preset-option:has(input:checked) {
  border-color: var(--sig-tcp);
  background: var(--sig-tcp-soft);
  box-shadow: inset 0 0 0 1px var(--sig-tcp-border);
}

.preset-option input {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  accent-color: var(--sig-tcp);
}

.preset-option span {
  display: grid;
  gap: 4px;
}

.preset-option strong {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.preset-option small {
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.3;
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.lab-actions .control-help {
  flex: 1 0 100%;
  text-align: right;
  margin-bottom: 8px;
}

/* Shared Timeline Panel: Visual trace line design */
.timeline-panel {
  margin-top: 24px;
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  padding: 24px;
  box-shadow: var(--shadow-glow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h3 {
  margin-top: 4px;
  font-family: var(--font-display);
  text-transform: uppercase;
}

.panel-kicker {
  margin-bottom: 0;
  color: var(--text-muted);
}

.status-token {
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  color: var(--text-secondary);
  background: var(--bg-panel);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  white-space: nowrap;
}

.shared-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 24px 0 0;
  list-style: none;
}

.shared-timeline li {
  display: grid;
  gap: 8px;
  min-height: 96px;
  padding-top: 12px;
  transition: all 250ms ease;
  position: relative;
}

.shared-timeline li::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--bg-chassis);
  border: 2px solid var(--line-border);
  border-radius: 50%;
  transition: all 250ms ease;
  z-index: 2;
}

.shared-timeline li::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: -12px;
  height: 2px;
  background: var(--line-border);
  transition: all 250ms ease;
  z-index: 1;
}

.shared-timeline li:last-child::after {
  right: 0;
}

/* Timeline Active / Completed Traces */
.shared-timeline li[data-state="next"]::after {
  background: var(--sig-tcp);
}
.shared-timeline li[data-state="next"]::before {
  background: var(--sig-tcp);
  border-color: var(--sig-tcp);
  box-shadow: 0 0 8px var(--sig-tcp);
}

.shared-timeline li[data-state="done"]::after {
  background: var(--sig-quic);
}
.shared-timeline li[data-state="done"]::before {
  background: var(--sig-quic);
  border-color: var(--sig-quic);
}

.timeline-state {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.shared-timeline li[data-state="next"] .timeline-state {
  color: var(--sig-tcp);
}

.shared-timeline li[data-state="done"] .timeline-state {
  color: var(--sig-quic);
}

.timeline-copy {
  display: grid;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.timeline-copy strong {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-display);
  text-transform: uppercase;
}

/* Protocol Lanes Grid: The Oscilloscope Interface */
.lane-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.lane {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  display: flex;
  flex-direction: column;
}

.lane-header,
.lane-model,
.resource-panel,
.event-panel,
.lane-result {
  margin-inline: 20px;
}

.lane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
}

.protocol-mark {
  margin-bottom: 6px;
  color: var(--text-muted);
}

.lane-header h3 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.protocol-badge {
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  color: var(--text-secondary);
  background: var(--bg-panel);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.protocol-badge.badge-tcp {
  border-color: var(--sig-tcp-border);
  color: var(--sig-tcp);
  background: var(--sig-tcp-soft);
}

.protocol-badge.badge-udp {
  border-color: var(--sig-udp-border);
  color: var(--sig-udp);
  background: var(--sig-udp-soft);
}

.protocol-badge.badge-quic {
  border-color: var(--sig-quic-border);
  color: var(--sig-quic);
  background: var(--sig-quic-soft);
}

.lane-model {
  min-height: 42px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Resources & Events modules */
.resource-panel,
.event-panel {
  border-top: 1px solid var(--line-border);
  padding-top: 18px;
}

.event-panel {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.resource-count,
.event-count {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.resource-list,
.event-list {
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}

/* Chunks delivered display inside lane resources */
.resource-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
  padding: 8px 12px;
  font-size: 0.8rem;
  transition: all 150ms ease;
}

.resource-name {
  font-weight: 600;
  color: var(--text-primary);
}

.resource-progress {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.resource-state {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Resource status colored rows */
.resource-row[data-status="delivered"] {
  border-color: rgba(0, 230, 118, 0.25);
  background: rgba(0, 230, 118, 0.02);
}
.resource-row[data-status="delivered"] .resource-state {
  color: var(--color-success);
}

.resource-row[data-status="delivered-out-of-order"] {
  border-color: rgba(0, 176, 255, 0.25);
  background: rgba(0, 176, 255, 0.02);
}
.resource-row[data-status="delivered-out-of-order"] .resource-state {
  color: var(--sig-udp);
}

.resource-row[data-status="partial"],
.resource-row[data-status="receiving"] {
  border-color: rgba(255, 179, 0, 0.25);
  background: rgba(255, 179, 0, 0.02);
}
.resource-row[data-status="partial"] .resource-state,
.resource-row[data-status="receiving"] .resource-state {
  color: var(--color-warning);
}

.resource-row[data-status="blocked"] {
  border-color: rgba(255, 61, 0, 0.25);
  background: rgba(255, 61, 0, 0.02);
}
.resource-row[data-status="blocked"] .resource-state {
  color: var(--color-error);
}

/* Event List Scrollable Console style */
.event-list {
  display: grid;
  max-height: 280px;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-border-strong) transparent;
  padding-right: 4px;
}

.event-item,
.event-placeholder {
  display: grid;
  gap: 4px;
  border-left: 2px solid var(--line-border-strong);
  background: var(--bg-panel);
  padding: 8px 12px;
  font-size: 0.72rem;
  border-radius: 0 var(--radius-tech) var(--radius-tech) 0;
}

.event-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.event-copy {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  line-height: 1.4;
}

.event-placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-mono);
  background: transparent;
  border-left: 1px dashed var(--line-border);
}

/* Color Coding event list boundaries by action kind */
.event-item[data-kind="delivered"],
.event-item[data-kind="datagram"],
.event-item[data-kind="stream-progress"] {
  border-left-color: var(--color-success);
  background: rgba(0, 230, 118, 0.03);
}

.event-item[data-kind="reassembled"] {
  border-left-color: var(--sig-udp);
  background: rgba(0, 176, 255, 0.03);
}

.event-item[data-kind="blocked"],
.event-item[data-kind="stream-wait"] {
  border-left-color: var(--color-warning);
  background: rgba(255, 179, 0, 0.03);
}

.event-item[data-kind="dropped"] {
  border-left-color: var(--color-error);
  background: rgba(255, 61, 0, 0.03);
}
.event-item[data-kind="dropped"] .event-meta {
  color: var(--color-error);
}

.event-item[data-kind="retransmit"],
.event-item[data-kind="reordered"] {
  border-left-color: var(--sig-tcp);
  background: rgba(255, 136, 0, 0.03);
}

/* Lane Result Terminal Block */
.lane-result {
  min-height: 96px;
  margin-top: auto;
  margin-bottom: 20px;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
  padding: 14px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.result-status {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.lane-result.result-running {
  border-color: var(--sig-tcp);
  background: var(--sig-tcp-soft);
}
.lane-result.result-running .result-status {
  color: var(--sig-tcp);
}

.lane-result.result-complete {
  border-color: var(--color-success);
  background: var(--color-success-soft);
}
.lane-result.result-complete .result-status {
  color: var(--color-success);
}

.lane-result.result-partial {
  border-color: var(--color-warning);
  background: var(--color-warning-soft);
}
.lane-result.result-partial .result-status {
  color: var(--color-warning);
}

.lane-result.result-blocked {
  border-color: var(--color-error);
  background: var(--color-error-soft);
}
.lane-result.result-blocked .result-status {
  color: var(--color-error);
}

.lane-result p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  line-height: 1.45;
}

/* Section 5: Comparison Checkpoint */
.question-list {
  display: grid;
  gap: 16px;
}

.question-card {
  border: 1px solid var(--line-border);
  border-radius: var(--radius-tech);
  background: var(--bg-chassis);
  padding: 24px;
}

.question-number,
.scenario-label {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-mono);
}

.question-card h3 {
  font-size: 1.15rem;
  max-width: 800px;
  text-transform: uppercase;
}

.answer-options,
.scenario-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.answer-button,
.scenario-options button {
  min-height: 38px;
  border: 1px solid var(--line-border-strong);
  border-radius: var(--radius-tech);
  background: var(--bg-panel);
  color: var(--text-secondary);
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: all 120ms ease;
  cursor: pointer;
}

.answer-button:hover,
.scenario-options button:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-panel-hover);
}

.answer-button.is-selected,
.scenario-options button.is-selected {
  border-color: var(--sig-tcp);
  background: var(--sig-tcp-soft);
  color: var(--sig-tcp);
  box-shadow: inset 0 0 0 1px var(--sig-tcp-border);
}

.answer-feedback {
  margin-top: 16px;
  border-left: 3px solid var(--sig-tcp);
  background: var(--sig-tcp-soft);
  color: var(--text-primary);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-radius: 0 var(--radius-tech) var(--radius-tech) 0;
}

.answer-feedback.is-correct {
  border-left-color: var(--color-success);
  background: var(--color-success-soft);
}

.answer-feedback.is-not-quite {
  border-left-color: var(--color-warning);
  background: var(--color-warning-soft);
}

/* Section 6: Scenarios Selection */
.scenario-card {
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.scenario-card > p:not(.scenario-label) {
  min-height: 60px;
}

.scenario-answer {
  margin-top: auto;
  border-top: 1px dashed var(--line-border);
  padding-top: 16px;
  color: var(--color-success);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.scenario-answer p {
  margin-top: 6px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Footer Section */
.site-footer {
  border-top: 1px solid var(--line-border);
  background: var(--bg-chassis);
  padding-block: 32px;
  margin-top: 64px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-inner p {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-align: right;
}

/* Responsive Breakpoints & Adaptive Layouts */
@media (max-width: 1040px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-block: 48px 36px;
  }

  .hero-note {
    max-width: 500px;
  }

  .lane-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .lane-model {
    min-height: auto;
  }

  .event-list {
    max-height: 240px;
  }
}

@media (max-width: 780px) {
  .shell {
    width: calc(100% - 24px);
  }

  .site-header {
    padding-inline: 12px;
  }

  .section {
    padding-block: 48px;
  }

  .primer-grid,
  .stack-grid,
  .scenario-grid,
  .mode-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .explain-card {
    min-height: auto;
  }

  .lab-controls {
    grid-template-columns: 1fr;
  }

  .lab-actions {
    justify-content: flex-start;
  }

  .lab-actions .control-help {
    text-align: left;
  }

  .shared-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .shared-timeline li::after {
    right: -16px;
  }

  .shared-timeline li:nth-child(2n)::after {
    right: 0;
  }

  .section-heading,
  .lab-heading,
  .mode-actions,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .footer-inner p {
    text-align: left;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .site-header {
    height: 68px;
  }

  .brand .logo-container {
    width: 38px;
    height: 38px;
  }

  .brand span {
    display: none;
  }

  .back-link {
    font-size: 0.68rem;
    padding: 4px 8px;
  }

  .preset-options,
  .shared-timeline {
    grid-template-columns: 1fr;
  }

  .shared-timeline li::after {
    right: 0;
  }

  .shared-timeline li {
    min-height: auto;
  }

  .resource-row {
    grid-template-columns: 1fr auto;
  }

  .resource-state {
    grid-column: 1 / -1;
  }

  .resource-progress {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

/* Reduced Motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Windows High Contrast / Forced Colors compatibility */
@media (forced-colors: active) {
  .button,
  .mode-option,
  .preset-option,
  .answer-button,
  .scenario-options button,
  .lane-result,
  .resource-row,
  .event-item {
    border: 1px solid CanvasText;
  }

  .button.primary,
  .mode-option:has(input:checked),
  .preset-option:has(input:checked),
  .answer-button.is-selected,
  .scenario-options button.is-selected {
    background: Highlight;
    color: HighlightText;
  }
}
