/**
 * GCSE Computer Science - Networks & Protocols
 * Immersive, Living Network Simulation Stylesheet
 * High-craft, tactile interaction design (Zero framework dependencies)
 */
@import url('../../shared/styles.css');

/* Main Stage Container */
.network-stage-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 20px 48px 20px;
  position: relative;
  z-index: 1;
}

.header-inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Header Brand Formatting */
.header-brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-divider {
  height: 18px;
  width: 1px;
  background: var(--border-color);
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
}

.theme-btn {
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Tab Views */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

/* ========================================================================= */
/* DYNAMIC STORYLINE DIRECTOR BAR                                            */
/* ========================================================================= */
.story-director {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 16px 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.story-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  animation: pulseRipple 1.8s infinite;
}

@keyframes pulseRipple {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.story-phase-pill {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-primary);
  background: var(--accent-soft-bg);
  border: 1px solid var(--accent-soft-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.story-content {
  flex: 1 1 420px;
}

.story-headline {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}

.story-caption {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.story-caption strong {
  color: var(--text-primary);
}

/* Scrubber Controls */
.story-scrubber-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}

.scrubber-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-surface-elevated);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.scrubber-progress {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width 150ms ease;
}

.scrubber-thumb {
  position: absolute;
  top: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transform: translateX(-50%);
  cursor: grab;
  transition: left 150ms ease;
}

.scrubber-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.tactile-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.tactile-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
}

.tactile-btn.play-btn {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

.tactile-btn.play-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.tactile-btn.reset-btn {
  font-size: 11px;
}

/* ========================================================================= */
/* THE LIVING PANORAMIC NETWORK WORLD                                        */
/* ========================================================================= */
.living-world {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.world-canvas-wrapper {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
}

html.dark .world-canvas-wrapper {
  background: #0b1120;
}

#worldSvg {
  width: 100%;
  height: auto;
  display: block;
}

/* Links / Cables */
.wire-link {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 3.5;
  transition: stroke 200ms ease, stroke-width 200ms ease;
}

.wire-link.active-wire {
  stroke: var(--accent-primary);
  stroke-width: 4.5;
}

.wireless-wave-path {
  stroke-dasharray: 6, 6;
  animation: wirelessDash 1.2s linear infinite;
}

@keyframes wirelessDash {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

.fibre-link {
  stroke: #94a3b8;
}

html.dark .fibre-link {
  stroke: #475569;
}

.backbone-cable {
  stroke-linecap: round;
}

.backbone-cable.congested-wire {
  stroke: #ef4444 !important;
  stroke-dasharray: 6, 6;
  animation: congestionPulse 0.8s ease infinite alternate;
}

@keyframes congestionPulse {
  from { stroke-opacity: 0.6; stroke-width: 3.5; }
  to { stroke-opacity: 1; stroke-width: 5; }
}

/* Nodes */
.world-node {
  cursor: pointer;
  transition: transform 150ms ease;
}

.node-halo {
  stroke-width: 3;
  fill: var(--bg-surface);
  transition: all 200ms ease;
}

.halo-device {
  stroke: #3b82f6;
  fill: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
}

.halo-mast {
  stroke: #10b981;
  fill: rgba(16, 185, 129, 0.08);
  color: #10b981;
}

.halo-router {
  stroke: #8b5cf6;
  fill: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}

.halo-dns {
  stroke: #f59e0b;
  fill: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
}

.halo-server {
  stroke: #06b6d4;
  fill: rgba(6, 182, 212, 0.08);
  color: #06b6d4;
}

.node-device-body, .node-router-body, .node-dns-body, .node-server-body {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.world-node.standby-server {
  opacity: 0.45;
  transition: opacity 250ms ease;
}

.world-node.standby-server:hover {
  opacity: 0.8;
}

.world-node.active-node {
  opacity: 1 !important;
}

.world-node.active-node .node-halo {
  stroke-width: 5;
  filter: drop-shadow(0 0 10px currentColor);
}

.world-node.congested-node .node-halo {
  stroke: #ef4444;
  fill: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.node-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  fill: var(--text-primary);
  text-anchor: middle;
}

.node-ip, .node-desc, .node-ping {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  fill: var(--text-muted);
  text-anchor: middle;
}

.node-spec-tag {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  fill: var(--text-muted);
  text-anchor: middle;
}

.node-action-prompt {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  fill: #ef4444;
  text-anchor: middle;
}

/* Animated Tangible Packets */
.world-packet-sprite {
  cursor: pointer;
}

.world-packet-sprite:hover .packet-pod-rect {
  stroke-width: 2.8;
  filter: drop-shadow(0 0 12px #3b82f6);
}

.packet-pod-rect {
  rx: 6;
  stroke-width: 1.8;
  stroke: #2563eb;
  fill: #3b82f6;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
  transition: stroke-width 120ms ease, filter 120ms ease;
}

.world-packet-sprite.packet-dns .packet-pod-rect {
  stroke: #d97706;
  fill: #f59e0b;
}

.world-packet-sprite.packet-glitched .packet-pod-rect {
  stroke: #b91c1c;
  fill: #ef4444;
  animation: glitchShake 0.4s infinite;
}

@keyframes glitchShake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1.5px, 1.5px); }
  50% { transform: translate(1.5px, -1.5px); }
  75% { transform: translate(-1.5px, -1.5px); }
  100% { transform: translate(0, 0); }
}

.packet-pod-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* Floating Canvas Cards (Pure opacity transition to preserve SVG translate attribute) */
.floating-canvas-card {
  pointer-events: none;
  transition: opacity 200ms ease;
}

.callout-rect {
  fill: var(--bg-surface);
  stroke: var(--accent-primary);
  stroke-width: 1.8;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.15));
}

.callout-text {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  fill: var(--text-primary);
  text-anchor: middle;
  dominant-baseline: middle;
}

/* ========================================================================= */
/* TACTILE DOCK: SENDER PHONE + ENVELOPE INSPECTOR + RECIPIENT PHONE        */
/* ========================================================================= */
.interactive-stage-dock {
  display: grid;
  grid-template-columns: 290px minmax(360px, 1fr) 290px;
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 1160px) {
  .interactive-stage-dock {
    grid-template-columns: 1fr;
  }
}

/* Physical Device Mockup */
.physical-device {
  background: #0f172a;
  border: 3px solid #334155;
  border-radius: 28px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.device-speaker {
  width: 44px;
  height: 4px;
  background: #475569;
  border-radius: 2px;
  margin: 4px auto 8px auto;
}

/* Prominent Mode Switcher Tabs */
.sender-mode-tabs {
  display: flex;
  gap: 4px;
  background: #1e293b;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid #334155;
}

.mode-tab-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.mode-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.mode-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.device-screen {
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  border: 1px solid #cbd5e1;
  min-height: 290px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

html.dark .device-screen {
  background: #1e293b;
  border-color: #334155;
}

.screen-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #f8fafc;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-bottom: 1px solid #e2e8f0;
}

html.dark .screen-top-bar {
  background: #0f172a;
  border-bottom-color: #334155;
}

.mode-toggle-link {
  color: var(--accent-primary);
  cursor: pointer;
  font-weight: 600;
}

.mode-toggle-link:hover {
  text-decoration: underline;
}

.device-app-view {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* Chat App Header */
.chat-app-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}

.chat-app-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.chat-app-sub {
  font-size: 10.5px;
  color: #10b981;
  font-weight: 600;
}

/* Message Composer with Green Send Arrow */
.message-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  padding: 4px 6px 4px 12px;
}

html.dark .message-composer {
  background: #1e293b;
  border-color: #334155;
}

.composer-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}

.composer-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.composer-send-btn:hover {
  background: #059669;
  transform: scale(1.06);
}

.composer-chips {
  display: flex;
  gap: 4px;
}

.chat-chip {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}

.chat-chip:hover {
  background: var(--accent-soft-bg);
  color: var(--accent-primary);
  border-color: var(--accent-soft-border);
}

/* Browser View */
.browser-address-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  padding: 4px 6px 4px 10px;
}

html.dark .browser-address-bar {
  background: #1e293b;
  border-color: #334155;
}

.browser-domain-select {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.browser-go-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.browser-hint-text {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 8px 10px;
  border-radius: var(--radius-md);
}

/* Slicer Tray */
.packet-slicer-tray {
  padding: 10px 12px;
  border-top: 1px dashed #cbd5e1;
  background: #f8fafc;
}

html.dark .packet-slicer-tray {
  background: #0f172a;
  border-top-color: #334155;
}

.tray-label {
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.slicer-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.slicer-chip {
  padding: 4px 8px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #3b82f6;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #2563eb;
  font-weight: 700;
}

html.dark .slicer-chip {
  background: #1e293b;
}

/* ========================================================================= */
/* CONTEXTUAL ENVELOPE INSPECTOR (The Unfolded Shipping Tag)                 */
/* ========================================================================= */
.contextual-envelope-inspector {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.dark .contextual-envelope-inspector {
  background: var(--bg-surface);
}

.envelope-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

html.dark .envelope-ribbon {
  background: var(--bg-surface-elevated);
  border-bottom-color: var(--border-color);
}

.envelope-badge {
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stamp-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stamp-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.stamp-btn.active {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

.envelope-body {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 10px;
  flex: 1;
}

@media (max-width: 980px) {
  .envelope-body {
    grid-template-columns: 1fr;
  }
}

.envelope-section {
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.section-tag-stamp {
  font-size: 9.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.header-section { border-left: 3px solid #3b82f6; }
.header-section .section-tag-stamp { color: #3b82f6; }

.payload-section { border-left: 3px solid #10b981; }
.payload-section .section-tag-stamp { color: #10b981; }

.trailer-section { border-left: 3px solid #8b5cf6; }
.trailer-section .section-tag-stamp { color: #8b5cf6; }

.tag-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  font-size: 11px;
}

.meta-field-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tag-meta-grid .full-row {
  grid-column: span 2;
}

.meta-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-field-col strong, .tag-meta-grid strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 11px;
  word-break: break-all;
}

.sub-explain {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: normal;
}

.payload-letter-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.payload-size-label {
  font-size: 10.5px;
  color: var(--text-muted);
}

.wax-seal-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.seal-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.seal-valid {
  background: var(--bg-success-soft);
  color: var(--text-success);
  border: 1px solid var(--border-success);
}

.seal-corrupted {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.exam-mini-tip {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================================================= */
/* RECIPIENT PHONE / DESTINATION SHELF                                       */
/* ========================================================================= */
.destination-buffer-shelf {
  padding: 10px 12px;
  border-bottom: 1px dashed #cbd5e1;
  background: #f8fafc;
}

html.dark .destination-buffer-shelf {
  background: #0f172a;
  border-bottom-color: #334155;
}

.shelf-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.shelf-title {
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.shelf-status-pill {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.shelf-slots {
  display: flex;
  gap: 4px;
}

.shelf-slot {
  flex: 1;
  padding: 5px 6px;
  border-radius: 4px;
  border: 1px dashed var(--border-color);
  background: var(--bg-surface);
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: center;
  transition: all 150ms ease;
}

.shelf-slot.filled {
  border-style: solid;
  border-color: var(--border-success);
  background: var(--bg-success-soft);
  color: var(--text-success);
  font-weight: 700;
}

.destination-rendered-app {
  padding: 14px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dest-chat-bubble {
  background: #065f46;
  border-radius: 12px 12px 12px 2px;
  padding: 8px 12px;
  color: #ecfdf5;
  font-size: 12.5px;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dest-chat-bubble.waiting {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
}

.dest-chat-bubble.corrupt-blocked {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 12px 12px 12px 2px;
  padding: 10px 12px;
}

.corrupt-alert-badge {
  display: inline-block;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 5px;
  letter-spacing: 0.05em;
}

.corrupt-alert-body {
  font-size: 11.5px;
  line-height: 1.4;
  color: #fecaca;
  margin-bottom: 8px;
}

.tcp-retransmit-action-btn {
  display: block;
  width: 100%;
  padding: 6px 10px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.tcp-retransmit-action-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.shelf-slot.corrupt {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  font-weight: 800;
}

.shelf-status-pill.corrupt {
  color: #ef4444 !important;
  font-weight: 800;
}

.bubble-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 10px;
  color: #a7f3d0;
  margin-top: 4px;
}

.tick-marks {
  color: #38bdf8;
  font-weight: 800;
}

/* ========================================================================= */
/* TAB 2 & TAB 3: STANDALONE CLEAN STAGES                                    */
/* ========================================================================= */
.standalone-stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.standalone-stage-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.standalone-stage-header p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
}

/*/* ========================================================================= */
/* TAB 2: TOPOLOGIES PLAYGROUND STYLING (MATCHING PACKET ROUTING HERO LOOK) */
/* ========================================================================= */
.topo-pill-group {
  display: flex;
  gap: 6px;
  background: var(--bg-surface-elevated);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.topo-pill {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topo-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.topo-pill.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.topo-preset-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

html.dark .topo-preset-bar {
  background: var(--bg-surface);
}

.topo-preset-label {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.topo-preset-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.topo-preset-btn {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.topo-preset-btn:hover {
  background: var(--accent-soft-bg);
  color: var(--accent-primary);
  border-color: var(--accent-soft-border);
  transform: translateY(-1px);
}

.topo-preset-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* ========================================================================= */
/* NETWORK BUILDER WORKBENCH CONTAINER                                      */
/* ========================================================================= */
.topo-workbench-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.topo-workbench-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 10px 16px;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

html.dark .topo-workbench-toolbar {
  background: #111827;
  border-color: #1f2937;
}

.topo-tb-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topo-tb-tag {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.topo-tool-buttons {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.topo-tool-btn {
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
  user-select: none;
}

.topo-tool-btn:hover {
  background: var(--accent-soft-bg);
  color: var(--accent-primary);
  border-color: var(--accent-soft-border);
  transform: translateY(-1px);
}

.topo-tool-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.topo-tool-btn.active .tool-icon {
  transform: scale(1.1);
}

.tool-icon {
  font-size: 13px;
  display: inline-block;
  transition: transform var(--transition-fast);
}

.topo-tb-divider {
  width: 1px;
  height: 28px;
  background: var(--border-color);
  margin: 0 4px;
}

@media (max-width: 900px) {
  .topo-tb-divider {
    display: none;
  }
}

.topo-sim-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

@media (max-width: 1100px) {
  .topo-sim-group {
    margin-left: 0;
  }
}

.topo-sim-selects {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.topo-flow-arrow {
  color: var(--accent-primary);
  font-weight: 800;
}

.topo-node-select {
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-root);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  font-family: var(--font-mono);
}

.topo-node-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-soft-bg);
}

.topo-action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================================================= */
/* TOPOLOGY STAGE BOX & CANVAS                                              */
/* ========================================================================= */
.topo-stage-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

html.dark .topo-stage-box {
  background: var(--bg-surface);
}

.topo-canvas-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.topo-hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topo-stage-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topo-hud-hint {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-md);
}

.topo-stage-body {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

@media (max-width: 768px) {
  .topo-stage-body {
    flex-direction: column;
  }
}

.topo-tool-dock {
  width: 72px;
  flex-shrink: 0;
  background: var(--bg-surface-elevated, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

html.dark .topo-tool-dock {
  background: #0f172a;
  border-color: #1e293b;
}

@media (max-width: 768px) {
  .topo-tool-dock {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    padding: 8px;
  }
}

.dock-divider {
  width: 80%;
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

@media (max-width: 768px) {
  .dock-divider {
    width: 1px;
    height: 28px;
    margin: 0 4px;
  }
}

.topo-tool-dock .topo-tool-btn {
  width: 100%;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

@media (max-width: 768px) {
  .topo-tool-dock .topo-tool-btn {
    width: auto;
    padding: 6px 10px;
    flex-direction: row;
  }
}

.topo-tool-dock .topo-tool-btn:hover {
  background: var(--accent-soft-bg);
  color: var(--accent-primary);
  border-color: var(--accent-soft-border);
  transform: translateY(-1px);
}

.topo-tool-dock .topo-tool-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.topo-tool-dock .tool-icon {
  font-size: 18px;
  line-height: 1;
}

.topo-tool-dock .tool-label {
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.topo-canvas-container {
  flex: 1;
  min-width: 0;
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0b1120 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  min-height: 470px;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.5);
}

#topoSvg {
  width: 100%;
  height: auto;
  min-height: 460px;
  display: block;
}

/* Tools SVG cursor styles */
.cursor-crosshair { cursor: crosshair !important; }
.cursor-scissors { cursor: cell !important; }
.cursor-scissors .topo-node-g,
.cursor-scissors .topo-cable-item { cursor: cell !important; }
.cursor-delete { cursor: not-allowed !important; }
.cursor-delete .topo-node-g,
.cursor-delete .topo-cable-item { cursor: pointer !important; }

/* SVG Node Interactivity */
.topo-node-g {
  cursor: grab;
  transition: transform 120ms ease;
  user-select: none;
}

.topo-node-g.dragging {
  cursor: grabbing !important;
}

.topo-node-g:hover .node-halo-circle {
  stroke-opacity: 0.9;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}

.topo-node-g.cable-selected .node-halo-circle {
  stroke: #10b981 !important;
  stroke-width: 4 !important;
  stroke-dasharray: 6 3;
  animation: rotateHalo 3s linear infinite;
}

@keyframes rotateHalo {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 36; }
}

.topo-cable-line {
  stroke: #475569;
  stroke-linecap: round;
  transition: stroke 200ms ease, stroke-width 200ms ease;
}

.topo-cable-line.healthy:hover {
  stroke: #60a5fa;
  stroke-width: 4.5px;
}

.topo-temp-cable {
  stroke: #3b82f6;
  stroke-width: 2.5;
  stroke-dasharray: 5, 5;
  pointer-events: none;
}

/* Severed cable styling */
.topo-cable-severed {
  stroke: #ef4444;
  stroke-dasharray: 5, 5;
}

.severed-badge-rect {
  fill: #ef4444;
  rx: 4px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.severed-badge-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* Feedback panel */
.topo-live-feedback {
  margin-top: 14px;
  padding: 12px 18px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.feedback-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  border: 1.5px solid var(--accent-primary);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.feedback-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  flex: 1;
}

/* ========================================================================= */
/* DIAGNOSTICS & GCSE EXAM REVISION DASHBOARD                                */
/* ========================================================================= */
.topo-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.4fr);
  gap: 18px;
  align-items: stretch;
}

@media (max-width: 1040px) {
  .topo-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.topo-metrics-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

html.dark .topo-metrics-card {
  background: var(--bg-surface);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}

.topo-metrics-card h4 {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}

.topo-classified-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft-bg);
  color: var(--accent-primary);
  border: 1px solid var(--accent-soft-border);
  font-family: var(--font-mono);
}

html.dark .topo-classified-tag {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.35);
}

.topo-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.metric-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.metric-val {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

/* GCSE Exam Fact Card */
.topo-fact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fact-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.fact-card-header h4 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.fact-quick-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-root);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.fact-tab-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fact-tab-btn:hover {
  color: var(--text-primary);
}

.fact-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

.fact-card-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.fact-card-body strong {
  color: var(--text-primary);
}

.fact-card-body ul {
  margin: 8px 0;
  padding-left: 20px;
}

.fact-card-body li {
  margin-bottom: 4px;
}

.fact-exam-tip {
  padding: 10px 14px;
  background: var(--accent-soft-bg);
  border-radius: var(--radius-md);
  border-left: 3.5px solid var(--accent-primary);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* ========================================================================= */
/* TAB 3: TCP/IP 4 LAYERS (CONVEYOR BELT & RUSSIAN DOLL STYLING)             */
/* ========================================================================= */
.layer-preset-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.layer-preset-label {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.layer-preset-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layer-pill {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.layer-pill:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.layer-pill.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* ========================================================================= */
/* TAB 3: TCP/IP 4-LAYER MODEL (U-SHAPE ARCHITECTURE & ENVELOPE INSPECTOR)   */
/* ========================================================================= */
.layer-preset-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layer-preset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.layer-preset-label {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.layer-preset-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layer-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.layer-input-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.layer-message-input {
  flex: 1;
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.layer-message-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-soft);
}

/* Story Director & Stepper Controls Bar (Above the Sim) */
.layer-story-director {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 18px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.story-director-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.story-director-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.layer-tactile-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.u-story-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.u-step-indicator {
  font-size: 10.5px;
  font-weight: 900;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #ffffff;
}

.u-layer-tag {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.layer-phase-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  color: #1d4ed8;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

html.dark .layer-phase-pill {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color);
  color: var(--accent-primary);
}

.u-story-header-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.u-story-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.u-teen-subtitle {
  font-size: 13.5px;
  font-weight: 800;
  color: #0369a1; /* Sky-700 in light mode */
  font-style: normal;
}

html.dark .u-teen-subtitle {
  color: #38bdf8; /* Sky-400 in dark mode */
}

.u-story-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

@media (max-width: 960px) {
  .layer-story-director {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .story-director-controls {
    justify-content: flex-end;
  }
}

/* ========================================================================= */
/* FULL-WIDTH TWO-COMPUTER U-SHAPED STACK SIMULATION                         */
/* ========================================================================= */
.u-stack-stage {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.u-columns-container {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(380px, 1.45fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1120px) {
  .u-columns-container {
    grid-template-columns: 1fr;
  }
}

.u-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.u-column-header {
  margin: 6px 0 2px 0;
}

.u-dir-badge {
  font-size: 10.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sender-column .u-dir-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
}

html.dark .sender-column .u-dir-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.receiver-column .u-dir-badge {
  background: #ecfdf5;
  color: #047857;
  border: 1.5px solid #a7f3d0;
}

html.dark .receiver-column .u-dir-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Device Workstation Card (Full Column Width) */
.u-device-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  width: 100%;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.u-device-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 16px rgba(59, 130, 246, 0.2);
}

/* Realistic Monitor Display with Browser/Server Window */
.u-device-screen {
  width: 100%;
  height: 86px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: all var(--transition-fast);
}

html.dark .u-device-screen {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.screen-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  height: 22px;
}

html.dark .screen-titlebar {
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.screen-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.screen-dots i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.screen-dots i:nth-child(1) { background: #ef4444; }
.screen-dots i:nth-child(2) { background: #f59e0b; }
.screen-dots i:nth-child(3) { background: #10b981; }

.screen-window-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #64748b;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.dark .screen-window-title {
  color: #94a3b8;
}

.screen-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.screen-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.screen-indicator.active {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.screen-indicator.receiving {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulseRipple 1.2s infinite;
}

.screen-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.screen-sub-label {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

html.dark .screen-sub-label {
  color: #94a3b8;
}

.screen-text {
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.dark .screen-text {
  color: #f8fafc;
}

.screen-text.text-delivered {
  color: #059669;
}

html.dark .screen-text.text-delivered {
  color: #34d399;
}

.screen-text.text-receiving {
  color: #d97706;
}

html.dark .screen-text.text-receiving {
  color: #fbbf24;
}

.screen-text.text-idle {
  color: #64748b;
}

html.dark .screen-text.text-idle {
  color: #94a3b8;
}

/* Monitor Neck & Base */
.u-device-neck {
  width: 20px;
  height: 12px;
  background: #cbd5e1;
  border-radius: 1px;
}

html.dark .u-device-neck {
  background: #475569;
}

.u-device-base {
  width: 72px;
  height: 6px;
  background: #94a3b8;
  border-radius: 0 0 4px 4px;
  margin-bottom: 8px;
}

html.dark .u-device-base {
  background: #64748b;
}

.u-device-info-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.u-device-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.u-device-ip {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
}

/* Layer Boxes */
.u-layer-box {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  opacity: 0.6;
}

.u-layer-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background var(--transition-fast);
}

/* Layer Identity Colors for borders / numbers */
.u-layer-box[data-layer="4"]::before { background: #10b981; }
.u-layer-box[data-layer="3"]::before { background: #06b6d4; }
.u-layer-box[data-layer="2"]::before { background: #3b82f6; }
.u-layer-box[data-layer="1"]::before { background: #f59e0b; }

.u-layer-box:hover {
  opacity: 0.85;
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.u-layer-box.active {
  opacity: 1;
  transform: scale(1.02);
}

/* Layer Active States - Light Mode (High Contrast & Clear) */
.u-layer-box[data-layer="4"].active {
  border-color: #059669;
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15), 0 4px 12px rgba(5, 150, 105, 0.15);
}

.u-layer-box[data-layer="3"].active {
  border-color: #0891b2;
  background: #ecfeff;
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.15), 0 4px 12px rgba(8, 145, 178, 0.15);
}

.u-layer-box[data-layer="2"].active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(37, 99, 235, 0.15);
}

.u-layer-box[data-layer="1"].active {
  border-color: #d97706;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15), 0 4px 12px rgba(217, 119, 6, 0.15);
}

/* Layer Active States - Dark Mode */
html.dark .u-layer-box[data-layer="4"].active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}

html.dark .u-layer-box[data-layer="3"].active {
  border-color: #06b6d4;
  background: rgba(6, 182, 212, 0.12);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.3);
}

html.dark .u-layer-box[data-layer="2"].active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

html.dark .u-layer-box[data-layer="1"].active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}

.u-layer-num {
  font-size: 10.5px;
  font-weight: 900;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}

.u-layer-box[data-layer="4"].active .u-layer-num { background: #059669; border-color: #059669; color: #ffffff; }
.u-layer-box[data-layer="3"].active .u-layer-num { background: #0891b2; border-color: #0891b2; color: #ffffff; }
.u-layer-box[data-layer="2"].active .u-layer-num { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.u-layer-box[data-layer="1"].active .u-layer-num { background: #d97706; border-color: #d97706; color: #ffffff; }

html.dark .u-layer-box[data-layer="4"].active .u-layer-num { background: #10b981; border-color: #10b981; }
html.dark .u-layer-box[data-layer="3"].active .u-layer-num { background: #06b6d4; border-color: #06b6d4; }
html.dark .u-layer-box[data-layer="2"].active .u-layer-num { background: #3b82f6; border-color: #3b82f6; }
html.dark .u-layer-box[data-layer="1"].active .u-layer-num { background: #f59e0b; border-color: #f59e0b; }

.u-layer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.u-layer-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.u-layer-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.u-stack-arrow {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  padding: 1px 0;
  opacity: 0.6;
}

.u-stack-arrow.active {
  color: #2563eb;
  opacity: 1;
  transform: scale(1.15);
  text-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

html.dark .u-stack-arrow.active {
  color: #60a5fa;
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.6);
}

/* ========================================================================= */
/* CENTER CONDUIT: LOGICAL PEER PROTOCOL BRIDGES & ACTIVE PACKET STATE      */
/* ========================================================================= */
.u-center-conduit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.conduit-channel-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  width: 100%;
  height: 180px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.channel-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.channel-status-pill {
  font-size: 10.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

html.dark .channel-status-pill {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.channel-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-headline {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.channel-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.conduit-badge {
  background: #f8fafc;
  color: #475569;
  border: 1.5px solid #cbd5e1;
}

html.dark .conduit-badge {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.conduit-title {
  font-size: 10.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.conduit-level {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0.45;
}

.conduit-level.active {
  opacity: 1;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
  background: var(--bg-surface);
  transform: scale(1.02);
}

.conduit-bridge-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bridge-line {
  flex: 1;
  height: 1px;
  border-top: 1px dashed var(--border-color);
}

.conduit-level.active .bridge-line {
  border-top-style: solid;
}

.conduit-level[data-layer="4"].active .bridge-line { border-color: #10b981; }
.conduit-level[data-layer="3"].active .bridge-line { border-color: #06b6d4; }
.conduit-level[data-layer="2"].active .bridge-line { border-color: #3b82f6; }
.conduit-level[data-layer="1"].active .bridge-line { border-color: #f59e0b; }

.bridge-tag {
  font-size: 9.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.app-tag { background: rgba(16, 185, 129, 0.12); color: #047857; }
html.dark .app-tag { color: #34d399; }

.trans-tag { background: rgba(6, 182, 212, 0.12); color: #0e7490; }
html.dark .trans-tag { color: #67e8f9; }

.net-tag { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
html.dark .net-tag { color: #93c5fd; }

.link-tag { background: rgba(245, 158, 11, 0.12); color: #92400e; }
html.dark .link-tag { color: #fde68a; }

.conduit-content {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

/* Dynamic Packet Split / Reassembly Visuals */
.conduit-action-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.conduit-action-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.split-packets-grid {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 3px 0;
}

.split-packet-card {
  flex: 1;
  min-width: 105px;
  background: var(--bg-surface-elevated);
  border: 1.5px solid #06b6d4;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(6, 182, 212, 0.15);
  animation: wrapScaleIn 0.25s ease forwards;
}

.split-packet-header {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: #0e7490;
  font-size: 9.5px;
}

html.dark .split-packet-header {
  color: #67e8f9;
}

.split-packet-data {
  background: var(--bg-surface);
  padding: 3px 6px;
  border-radius: 3px;
  color: var(--text-primary);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--border-color);
}

.reassemble-chain-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1.5px solid #06b6d4;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.reassemble-tag {
  background: #06b6d4;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9.5px;
}

/* Bottom Wire Highway - Clean Light Mode & Dark Mode */
.u-wire-highway {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-lg);
  margin-top: 8px;
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.dark .u-wire-highway {
  background: #0f172a;
  border: 1.5px solid #334155;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.u-wire-highway.active-wire {
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2), inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .u-wire-highway.active-wire {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.wire-arrow-left,
.wire-arrow-right {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #475569;
  white-space: nowrap;
}

html.dark .wire-arrow-left,
html.dark .wire-arrow-right {
  color: #94a3b8;
}

.wire-track-line {
  flex: 1;
  height: 32px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.wire-glowing-pulse {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d97706, #0284c7, #d97706);
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.4);
}

html.dark .wire-glowing-pulse {
  background: linear-gradient(90deg, #f59e0b, #38bdf8, #f59e0b);
  box-shadow: 0 0 8px #f59e0b;
}

.wire-moving-packet {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #d97706;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #92400e;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
  transition: all 0.5s ease;
  left: 0%;
}

html.dark .wire-moving-packet {
  background: #1e293b;
  border: 1.5px solid #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.wire-moving-packet .packet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d97706;
  box-shadow: 0 0 6px #d97706;
}

html.dark .wire-moving-packet .packet-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

/* ========================================================================= */
/* LOWER DECK: PACKET ENVELOPE INSPECTOR & AQA SPEC (Below the Sim)          */
/* ========================================================================= */
.layer-lower-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
  gap: 20px;
  width: 100%;
  margin-top: 20px;
}

@media (max-width: 960px) {
  .layer-lower-deck {
    grid-template-columns: 1fr;
  }
}

/* The Envelope Visualizer Card */
.u-envelope-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.envelope-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.envelope-title {
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.envelope-state-pill {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
}

html.dark .envelope-state-pill {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

/* Dynamic Envelope Nested Stack */
.envelope-visual-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.env-tag-card {
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition-fast);
  animation: wrapScaleIn 0.25s ease forwards;
}

/* Tag Link (MAC / Ethernet) */
.env-tag-card.tag-link {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  font-weight: 700;
}

html.dark .env-tag-card.tag-link {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
  color: #fde68a;
}

/* Tag Internet (IP) */
.env-tag-card.tag-internet {
  background: #eff6ff;
  border: 1.5px solid #3b82f6;
  color: #1e40af;
  font-weight: 700;
}

html.dark .env-tag-card.tag-internet {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  color: #93c5fd;
}

/* Tag Transport (TCP) */
.env-tag-card.tag-transport {
  background: #ecfeff;
  border: 1.5px solid #06b6d4;
  color: #0e7490;
  font-weight: 700;
}

html.dark .env-tag-card.tag-transport {
  background: rgba(6, 182, 212, 0.12);
  border-color: #06b6d4;
  color: #67e8f9;
}

/* Tag Payload (Application Data) */
.env-tag-card.tag-payload {
  background: #ecfdf5;
  border: 1.5px solid #10b981;
  color: #065f46;
  font-weight: 700;
}

html.dark .env-tag-card.tag-payload {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #6ee7b7;
}

.env-tag-card.tag-stripped {
  opacity: 0.45;
  text-decoration: line-through;
  border-style: dashed;
}

.env-status-badge {
  font-size: 10px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.env-status-badge.badge-attached {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html.dark .env-status-badge.badge-attached {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: none;
}

.env-status-badge.badge-peeled {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

html.dark .env-status-badge.badge-peeled {
  background: #ef4444;
  color: #ffffff;
  border: none;
}

/* Why Layers Exist (AQA Core Spec) */
.layer-why-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.layer-why-box h5 {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.layer-why-box ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.layer-why-box li {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.layer-why-box li strong {
  color: var(--text-primary);
}

/* Tab 4: Revision Cards */
.revision-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.rev-card {
  background: var(--paper-card);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.rev-card h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-primary);
  margin: 0 0 10px 0;
}

.rev-card p, .rev-card li {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.rev-card ul {
  margin: 0;
  padding-left: 20px;
}

.alert-card {
  border: 1px solid var(--border-danger);
  border-left: 4px solid var(--cardinal-red);
  background: var(--red-tint);
}

/* ========================================================================= */
/* TAB 4: ENCRYPTION & PUBLIC KEY LAB (SIMON SINGH PAINT POT ANALOGY)        */
/* ========================================================================= */

.crypto-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.crypto-palette-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.crypto-intro-paragraph {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 960px;
  margin-top: 8px;
}

.crypto-intro-paragraph strong {
  color: var(--text-primary);
}

/* Stepper Panel & Integrated Controller Bar */
.crypto-stepper-panel {
  background: #f0f4f9; /* Soft Light Cool Slate Pastel */
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 23, 54, 0.04);
}

.crypto-controller-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.crypto-tactile-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crypto-toolbar-divider {
  flex: 1;
}

.math-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  transition: all var(--transition-fast);
}

.math-toggle-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.math-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  transition: all var(--transition-fast);
}

.math-toggle-btn.active .math-status-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.crypto-steps-track {
  display: flex;
  align-items: center;
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  gap: 8px;
  overflow-x: auto;
}

.crypto-step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.crypto-step-pill:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.crypto-step-pill.active {
  opacity: 1;
  border-color: var(--accent-primary);
  background: var(--accent-soft-bg);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.crypto-step-pill .step-num {
  font-size: 11px;
  font-weight: 900;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}

.crypto-step-pill .step-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.crypto-step-arrow {
  color: var(--text-muted);
  font-size: 11px;
}

/* Dynamic Storyteller Banner */
.crypto-story-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: center;
}

@media (max-width: 960px) {
  .crypto-story-banner {
    grid-template-columns: 1fr;
  }
}

.story-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.crypto-phase-badge {
  font-size: 10.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-soft-bg);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.story-principle-badge {
  font-size: 10.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.crypto-story-headline {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.crypto-story-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.story-banner-hud {
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}

.hud-label {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 700;
}

.hud-value {
  color: var(--text-primary);
  font-weight: 800;
}

/* ========================================================================= */
/* FULL-WIDTH PANORAMIC STAGE                                                */
/* ========================================================================= */
.crypto-panoramic-stage {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.25fr) minmax(300px, 1fr);
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  min-height: 520px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  margin-bottom: 24px;
}

@media (max-width: 1160px) {
  .crypto-panoramic-stage {
    grid-template-columns: 1fr;
  }
}

.stage-zone {
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 480px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.zone-alice {
  border-top: 4px solid #ef4444;
}

.zone-bob {
  border-top: 4px solid #3b82f6;
}

.zone-internet {
  border-top: 4px solid #f59e0b;
  background: var(--bg-root);
}

html.dark .zone-internet {
  background: #0b1120;
}

.zone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zone-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zone-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-primary);
  font-family: var(--font-mono);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.zone-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.zone-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.zone-shield-badge {
  font-size: 11px;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.zone-warning-badge {
  font-size: 11px;
  font-weight: 800;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

/* ========================================================================= */
/* TACTILE 3D PAINT BUCKETS & WORKSPACE                                      */
/* ========================================================================= */
.bucket-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  padding: 16px 0 12px 0;
  animation: wrapScaleIn 0.3s ease forwards;
}

.bucket-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* Static Slot Placeholder for Step 1 */
.bucket-card.bucket-placeholder {
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.bucket-placeholder-box {
  width: 96px;
  height: 114px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  text-align: center;
  padding: 8px;
}

html.dark .bucket-placeholder-box {
  background: rgba(255, 255, 255, 0.02);
}

.bucket-placeholder-box .placeholder-icon {
  font-size: 18px;
  color: var(--text-muted);
}

.bucket-placeholder-box .placeholder-text {
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bucket-placeholder-box .placeholder-sub {
  font-size: 9px;
  color: var(--text-muted);
}

.bucket-tag-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-public { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.badge-secret { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.badge-mix { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.badge-key { background: #d1fae5; color: #047857; border: 1.5px solid #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.2); }

html.dark .badge-public { background: rgba(250, 204, 21, 0.2); color: #facc15; border: 1px solid rgba(250, 204, 21, 0.4); }
html.dark .badge-secret { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
html.dark .badge-mix { background: rgba(249, 115, 22, 0.2); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.4); }
html.dark .badge-key { background: rgba(16, 185, 129, 0.25); color: #34d399; border: 1.5px solid #10b981; box-shadow: 0 0 12px rgba(16, 185, 129, 0.3); }

/* Large Tactile 3D Paint Bucket */
.paint-bucket-3d {
  width: 96px;
  height: 114px;
  border-radius: 12px 12px 20px 20px;
  background: linear-gradient(135deg, #334155, #1e293b 70%, #0f172a);
  border: 2.5px solid #64748b;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), inset 0 2px 6px rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.paint-bucket-3d:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.paint-bucket-3d.glowing-key {
  border-color: #10b981;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.45), 0 10px 25px rgba(0, 0, 0, 0.35);
  animation: keyGlowPulse 2s infinite ease-in-out;
}

@keyframes keyGlowPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 16px rgba(16, 185, 129, 0.2); }
}

.bucket-rim-3d {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: linear-gradient(180deg, #cbd5e1, #94a3b8 60%, #64748b);
  border-radius: 9px 9px 0 0;
  border-bottom: 2px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  z-index: 4;
}

.bucket-liquid-fill {
  width: 100%;
  height: 72%;
  background: #facc15;
  transition: all 500ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.35);
}

.bucket-liquid-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(255, 255, 255, 0.3);
}

.bucket-title-text {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 4px;
}

.bucket-color-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Palette Swatch Control */
.bucket-picker-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.bucket-picker-pill input[type="color"] {
  -webkit-appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
}

.bucket-picker-pill input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.bucket-picker-pill input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Two Buckets Side-by-Side Mixing Display */
.mixing-stage-flex {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.mixing-arrow-operator {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-muted);
}

/* ========================================================================= */
/* CENTER ZONE: THE PUBLIC INTERNET HIGHWAY & EVE                            */
/* ========================================================================= */
.internet-highway-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 16px 0 10px 0;
  position: relative;
  min-height: 200px;
}

.center-public-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  background: rgba(245, 158, 11, 0.06);
  border: 1.5px dashed rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.08);
  animation: wrapScaleIn 0.3s ease forwards;
}

html.dark .center-public-showcase {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(250, 204, 21, 0.4);
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.12);
}

.public-showcase-title {
  font-size: 11px;
  font-weight: 900;
  color: #b45309;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

html.dark .public-showcase-title {
  color: #facc15;
}

/* Animated Wire Cable Highway */
.wire-transit-track {
  width: 100%;
  height: 64px;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06);
}

html.dark .wire-transit-track {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.cable-glowing-pulse {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0284c7, #6366f1, #0284c7);
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.5);
}

html.dark .cable-glowing-pulse {
  background: linear-gradient(90deg, #38bdf8, #818cf8, #38bdf8);
  box-shadow: 0 0 16px #38bdf8;
}

.transit-cart {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 2px solid #0284c7;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.25);
  z-index: 10;
  transition: all 0.4s ease;
}

.cart-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
}

.transit-cart.cart-alice {
  left: 8%;
  border-color: #ea580c;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.25);
}

.transit-cart.cart-bob {
  right: 8%;
  border-color: #059669;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.25);
}

.transit-cart.cart-ciphertext {
  left: 8%;
  background: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.25);
}

html.dark .transit-cart {
  background: #1e293b;
  color: #ffffff;
}

html.dark .transit-cart.cart-alice {
  border-color: #f97316;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.5);
}

html.dark .transit-cart.cart-bob {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

html.dark .transit-cart.cart-ciphertext {
  background: #020617;
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* Animations */
@keyframes cartAliceToBob {
  0% { left: 5%; opacity: 1; transform: scale(0.9); }
  50% { left: 45%; opacity: 1; transform: scale(1.1); box-shadow: 0 0 25px #f97316; }
  100% { left: 82%; opacity: 1; transform: scale(0.9); }
}

@keyframes cartBobToAlice {
  0% { right: 5%; opacity: 1; transform: scale(0.9); }
  50% { right: 45%; opacity: 1; transform: scale(1.1); box-shadow: 0 0 25px #10b981; }
  100% { right: 82%; opacity: 1; transform: scale(0.9); }
}

@keyframes cartCipherZoom {
  0% { left: 5%; opacity: 1; }
  100% { left: 82%; opacity: 1; }
}

.transit-cart.animate-a2b {
  animation: cartAliceToBob 1.8s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.transit-cart.animate-b2a {
  animation: cartBobToAlice 1.8s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.transit-cart.animate-cipher {
  animation: cartCipherZoom 1.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

/* Eve's Radar Card */
.eve-radar-card {
  background: #ffffff;
  border: 1.5px solid #10b981;
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.12);
  font-family: var(--font-mono);
}

html.dark .eve-radar-card {
  background: #020617;
  border: 1.5px solid #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

.eve-radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(16, 185, 129, 0.25);
  padding-bottom: 8px;
}

.radar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #047857;
}

html.dark .radar-status {
  color: #22c55e;
}

.radar-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

html.dark .radar-pulse {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.radar-tag {
  font-size: 9.5px;
  font-weight: 800;
  color: #b45309;
}

html.dark .radar-tag {
  color: #f59e0b;
}

.eve-captured-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.eve-capture-slot {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

html.dark .eve-capture-slot {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slot-lbl {
  font-size: 9px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

html.dark .slot-lbl {
  color: #94a3b8;
}

.slot-preview {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #e2e8f0;
  transition: all var(--transition-fast);
}

html.dark .slot-preview {
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: #334155;
}

.slot-preview.slot-locked {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  font-weight: 900;
  border-style: dashed;
}

.slot-txt {
  font-size: 10px;
  color: #1e293b;
  text-align: center;
}

html.dark .slot-txt {
  color: #f1f5f9;
}

.slot-txt.text-danger {
  color: #ef4444;
}

.eve-radar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eve-crack-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1.5px solid #ef4444;
  color: #dc2626;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.eve-crack-btn:hover {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

html.dark .eve-crack-btn {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

html.dark .eve-crack-btn:hover {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

.eve-log-message {
  font-size: 11px;
  line-height: 1.5;
  color: #334155;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid #ef4444;
}

html.dark .eve-log-message {
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.5);
}

/* ========================================================================= */
/* SLEEK WHATSAPP PHONE PRESENTATION (STEP 6 PAYOFF)                        */
/* ========================================================================= */
.whatsapp-phone-mockup {
  width: 100%;
  max-width: 320px;
  background: #0b141a;
  border: 2px solid #202c33;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  animation: wrapScaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.phone-top-bar {
  background: #202c33;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phone-contact-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-avatar-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #00a884;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.phone-contact-name {
  font-size: 12.5px;
  font-weight: 800;
  color: #e9edef;
}

.phone-e2ee-tag {
  font-size: 9.5px;
  font-weight: 800;
  color: #00a884;
  background: rgba(0, 168, 132, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.phone-chat-screen {
  padding: 16px 14px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #0b141a radial-gradient(circle at center, rgba(17, 27, 33, 0.7) 0, #0b141a 100%);
}

.phone-bubble {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.phone-bubble.sender {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  border-top-right-radius: 0;
}

.phone-bubble.receiver {
  align-self: flex-start;
  background: #005c4b;
  color: #e9edef;
  border-top-left-radius: 0;
  border: 1.5px solid #00a884;
}

.phone-composer-bar {
  background: #202c33;
  padding: 10px;
  display: flex;
  gap: 8px;
}

.phone-input-field {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 14px;
  color: #e9edef;
  font-size: 12px;
  outline: none;
}

.phone-input-field:focus {
  box-shadow: 0 0 0 1.5px #00a884;
}

.phone-send-btn {
  background: #00a884;
  border: none;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.phone-send-btn:hover {
  background: #06cf9c;
  transform: scale(1.04);
}

/* ========================================================================= */
/* ========================================================================= */
/* MATHEMATICAL TRANSLATION EMBEDDED IN DIAGRAM (NUMBERS & FORMULAS)         */
/* ========================================================================= */

/* Math Number Tag Directly Under Paint Pots */
.pot-math-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 5px 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-fast);
}

.pot-math-badge .math-sub {
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pot-math-badge .math-val {
  font-size: 12.5px;
  font-weight: 900;
  color: #0284c7;
  letter-spacing: 0.02em;
}

.pot-math-badge.math-key-matched {
  background: #fef9c3;
  border-color: #ca8a04;
  box-shadow: 0 2px 10px rgba(202, 138, 4, 0.2);
}

.pot-math-badge.math-key-matched .math-sub {
  color: #854d0e;
}

.pot-math-badge.math-key-matched .math-val {
  color: #a16207;
}

html.dark .pot-math-badge {
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html.dark .pot-math-badge .math-sub {
  color: #94a3b8;
}

html.dark .pot-math-badge .math-val {
  color: #38bdf8;
}

html.dark .pot-math-badge.math-key-matched {
  background: rgba(234, 179, 8, 0.15);
  border-color: #eab308;
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.4);
}

html.dark .pot-math-badge.math-key-matched .math-sub {
  color: #fef08a;
}

html.dark .pot-math-badge.math-key-matched .math-val {
  color: #facc15;
}

/* Formula Ribbon Directly Under Mixing Arrows & Down-Arrows */
.mixing-arrow-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0;
  width: 100%;
}

.mixing-down-arrow {
  font-size: 22px;
  font-weight: 900;
  color: #0284c7;
  line-height: 1;
  animation: pulseArrow 1.5s infinite alternate ease-in-out;
}

html.dark .mixing-down-arrow {
  color: #38bdf8;
}

@keyframes pulseArrow {
  0% { transform: translateY(-2px); opacity: 0.7; }
  100% { transform: translateY(2px); opacity: 1; }
}

.arrow-math-formula {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #1e293b;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  letter-spacing: 0.02em;
}

.arrow-math-formula strong {
  color: #0284c7;
  font-weight: 900;
}

.arrow-math-formula .formula-label {
  color: #64748b;
  font-size: 9.5px;
  text-transform: uppercase;
  margin-right: 4px;
}

html.dark .arrow-math-formula {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

html.dark .arrow-math-formula strong {
  color: #38bdf8;
}

html.dark .arrow-math-formula .formula-label {
  color: #94a3b8;
}

/* Formula Ribbon Under Public Wire & Transit */
.wire-math-formula {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 7px 16px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #1e293b;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.wire-math-formula strong {
  color: #0284c7;
  font-weight: 800;
}

.wire-math-formula .math-sub {
  color: #64748b;
  font-size: 10px;
  text-transform: uppercase;
  margin-right: 6px;
}

html.dark .wire-math-formula {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.4);
  color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

html.dark .wire-math-formula strong {
  color: #38bdf8;
}

html.dark .wire-math-formula .math-sub {
  color: #94a3b8;
}

.shared-key-emblem {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fef9c3;
  border: 1.5px solid #ca8a04;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #854d0e;
  font-weight: 800;
  font-size: 14px;
}

html.dark .shared-key-emblem {
  background: rgba(234, 179, 8, 0.15);
  border-color: #eab308;
  color: #facc15;
}

.shared-key-title {
  color: #047857;
  font-size: 14px;
  font-weight: 800;
}

html.dark .shared-key-title {
  color: #34d399;
}

/* Stepper Controller Buttons Theming */
.crypto-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.crypto-ctrl-btn:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.crypto-ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.crypto-ctrl-btn.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.crypto-ctrl-btn.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.5);
}

/* Dispatch Arrows for Step 2 (Public Key Distribution Both Ways) */
.dispatch-arrows-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin-top: 12px;
}

.dispatch-arrow-card {
  flex: 1;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.dispatch-arrow-sym {
  font-size: 22px;
  font-weight: 900;
  color: #0284c7;
  line-height: 1;
}

.dispatch-dir {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #b45309;
}

html.dark .dispatch-arrow-card {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

html.dark .dispatch-arrow-sym {
  color: #38bdf8;
}

html.dark .dispatch-dir {
  color: #facc15;
}

/* ========================================================================= */
/* MULTI-ROW DERIVATION TIMELINE (STEPS 4 & 5 ACCUMULATED ROWS)              */
/* ========================================================================= */
.derivation-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.derivation-row {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.derivation-row.row-active {
  border-color: #3b82f6;
  background: #f0f7ff;
}

.derivation-row.row-key-result {
  border-color: #ca8a04;
  background: #fefce8;
  box-shadow: 0 2px 12px rgba(202, 138, 4, 0.15);
}

html.dark .derivation-row {
  background: rgba(15, 23, 42, 0.75);
  border-color: var(--border-color);
  box-shadow: none;
}

html.dark .derivation-row.row-active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(15, 23, 42, 0.9);
}

html.dark .derivation-row.row-key-result {
  border-color: rgba(234, 179, 8, 0.6);
  background: rgba(234, 179, 8, 0.08);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.15);
}

.derivation-row-tag {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

html.dark .derivation-row-tag {
  color: var(--text-muted);
}

.derivation-row-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.mixing-inputs-compact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mixing-plus {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-muted);
}

.derivation-arrow-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.derivation-arrow-compact span {
  font-size: 16px;
  color: #0284c7;
  font-weight: 900;
}

html.dark .derivation-arrow-compact span {
  color: #38bdf8;
}

.mixing-output-compact {
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-swap-highlight {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 0;
}

.swap-direction-icon {
  font-size: 20px;
  color: #0284c7;
  font-weight: 900;
}

html.dark .swap-direction-icon {
  color: #38bdf8;
}

.swap-status-text {
  font-size: 11px;
  color: #475569;
  font-family: var(--font-mono);
  max-width: 140px;
  line-height: 1.35;
}

html.dark .swap-status-text {
  color: var(--text-secondary);
}

/* Compact Bucket Styling for Multi-Row Views */
.paint-bucket-3d.bucket-compact {
  width: 60px;
  height: 72px;
  border-radius: 8px 8px 14px 14px;
  border-width: 2px;
}

.bucket-compact .bucket-rim-3d {
  height: 12px;
}

.bucket-card.card-compact {
  gap: 3px;
}

.card-compact .bucket-title-text {
  font-size: 10.5px;
  margin-top: 1px;
}

.card-compact .bucket-color-tag {
  font-size: 9.5px;
}

.card-compact .bucket-tag-badge {
  font-size: 8.5px;
  padding: 1px 6px;
}

.card-compact .pot-math-badge {
  padding: 2px 6px;
  margin-top: 2px;
}

.card-compact .pot-math-badge .math-sub {
  font-size: 8px;
}

.card-compact .pot-math-badge .math-val {
  font-size: 10.5px;
}

/* Toggle Visibility: Hide math when user turns math OFF */
#tab-encryption:not(.show-math) .pot-math-badge,
#tab-encryption:not(.show-math) .arrow-math-formula,
#tab-encryption:not(.show-math) .wire-math-formula,
#tab-encryption:not(.show-math) .math-toggle-target {
  display: none !important;
}

/* ========================================================================= */
/* ENCRYPTION REFERENCE & EXAM NOTES (CLEAN FULL-WIDTH SECTION)              */
/* ========================================================================= */
.crypto-reference-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin-top: 24px;
}

.reference-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 18px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.reference-content-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reference-block {
  padding: 16px 20px;
  background: var(--bg-root);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.reference-block h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.reference-block p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 6px 0 0 0;
}

.reference-block code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
}

.reference-block.alert-block {
  border-left: 3.5px solid #f59e0b;
  background: rgba(245, 158, 11, 0.04);
}

/* ========================================================================= */
/* INTERACTIVE HOVER & TAP TOOLTIPS (GCSE EXPLANATION CARDS)                */
/* ========================================================================= */
.network-tooltip {
  position: fixed;
  z-index: 99999;
  max-width: 320px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-left: 3.5px solid #f5b700;
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.45), 0 6px 12px -3px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
  transform: translateY(4px);
}

.network-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.network-tooltip .tooltip-header {
  font-weight: 800;
  font-size: 12.5px;
  color: #f5b700;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.network-tooltip .tooltip-body {
  color: #e2e8f0;
  font-size: 11.5px;
  line-height: 1.5;
}

.network-tooltip .tooltip-spec-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

/* Subtle interactive indicators */
.info-hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-surface-elevated, #f1f5f9);
  color: var(--text-muted, #64748b);
  font-size: 9.5px;
  font-weight: 800;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  border: 1px solid var(--border-color, #cbd5e1);
  transition: all 120ms ease;
}

.meta-field-col:hover .info-hint-icon,
.envelope-section:hover .info-hint-icon {
  background: #f5b700;
  color: #0f172a;
  border-color: #f5b700;
}

.world-node {
  cursor: pointer;
}

.world-node:hover .node-halo {
  stroke-width: 3.5px;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}

/* Rendered Web Viewport in Destination Screen */
.dest-web-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.browser-rendered-page {
  background: #ffffff;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-color, #e2e8f0);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.browser-site-header {
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.site-url {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #0f172a;
  flex: 1;
}

.site-badge {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.browser-site-content {
  padding: 10px 12px;
}

.site-hero-headline {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.site-hero-lead {
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
  margin: 0 0 8px 0;
}

.site-packet-receipts {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.receipt-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0284c7;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

html.dark .browser-rendered-page {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

html.dark .browser-site-header {
  background: #1e293b;
  border-bottom-color: #334155;
}

html.dark .site-url {
  color: #f1f5f9;
}

html.dark .site-hero-headline {
  color: #f8fafc;
}

html.dark .site-hero-lead {
  color: #94a3b8;
}

html.dark .receipt-tag {
  background: #1e293b;
  border-color: #334155;
  color: #38bdf8;
}

html.dark .alert-card {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  border-left-color: #f87171;
}

html.dark .alert-card h3 {
  color: #fca5a5;
}


