.lead-lab {
  --lab-navy: #102a43;
  --lab-blue: #0878d1;
  --lab-blue-soft: #eaf5ff;
  --lab-green: #158765;
  --lab-amber: #b96500;
  --lab-red: #c43d4b;
  padding: clamp(1rem, 2.5vw, 2rem);
  background: linear-gradient(145deg, #f8fbff 0%, #eef6ff 100%);
}

.fundamentals-module-guide {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #d9e4ed;
  background: linear-gradient(110deg, #f7fbff, #eef6ff);
}

.fundamentals-module-guide.compact {
  grid-template-columns: 1fr;
}

.module-guide-copy strong,
.module-guide-copy span { display: block; }
.module-guide-copy strong { color: #102a43; font-size: 1rem; }
.module-guide-copy span { margin-top: 0.15rem; color: #5d7183; font-size: 0.86rem; line-height: 1.45; }

.module-section-nav {
  display: flex;
  gap: 0.45rem;
  padding-bottom: 0.15rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.module-section-nav a {
  flex: 0 0 auto;
  padding: 0.48rem 0.68rem;
  border: 1px solid #c7d9e7;
  border-radius: 999px;
  background: #fff;
  color: #24516f;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.module-section-nav a:hover,
.module-section-nav a:focus-visible {
  border-color: #0878d1;
  color: #0067b5;
  outline: none;
}

.quick-check-button {
  border-color: #0878d1;
  background: #0878d1;
  color: #fff;
}

.quick-check-button:hover { background: #0065b3; }

/* Practice and assessment open directly into the placement workspace. The
   instructional sequence belongs only to Tutorial mode. */
.lead-lab:not([data-mode="tutorial"]) .lab-steps,
.lead-lab:not([data-mode="tutorial"]) .lab-navigation {
  display: none;
}

.lead-lab:not([data-mode="tutorial"]) .lab-step-panel:not([data-step-panel="3"]) {
  display: none;
}

.lead-lab:not([data-mode="tutorial"]) .lab-step-panel[data-step-panel="3"] {
  display: block;
}

.lead-lab-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.lead-lab-header h2 {
  margin: 0.2rem 0 0.55rem;
  color: var(--lab-navy);
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: -0.03em;
}

.lead-lab-header p {
  max-width: 760px;
  margin: 0;
  color: #526579;
  line-height: 1.65;
}

.eyebrow,
.step-kicker {
  color: var(--lab-blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.lab-mode-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 0.3rem;
  border: 1px solid #c9d9e8;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 42, 67, 0.08);
}

.lab-mode {
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #526579;
  font-weight: 700;
  cursor: pointer;
}

.lab-mode.active {
  background: var(--lab-navy);
  color: #fff;
}

.lab-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  padding: 0;
  margin: 0 0 1.25rem;
  list-style: none;
}

.lab-step {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem;
  border: 1px solid #d5e1ec;
  border-radius: 12px;
  background: rgba(255,255,255,0.75);
  color: #526579;
  font-weight: 750;
  cursor: pointer;
}

.lab-step span {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #dce8f2;
  color: var(--lab-navy);
  font-size: 0.8rem;
}

.lab-step.active,
.lab-step.completed {
  border-color: #7ebbea;
  background: #fff;
  color: var(--lab-blue);
}

.lab-step.active span,
.lab-step.completed span {
  background: var(--lab-blue);
  color: #fff;
}

.lead-lab-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.85fr) minmax(430px, 1.4fr);
  gap: 1.25rem;
  align-items: stretch;
}

.lab-instruction-card,
.lab-workspace {
  border: 1px solid #d7e3ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(16, 42, 67, 0.08);
}

.lab-instruction-card {
  min-height: 590px;
  padding: clamp(1rem, 2.4vw, 1.6rem);
  display: flex;
  flex-direction: column;
}

.lab-step-panel { display: none; }
.lab-step-panel.active { display: block; }

.lab-step-panel h3 {
  margin: 0.45rem 0 1rem;
  color: var(--lab-navy);
  font-size: 1.25rem;
}

.landmark-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

.landmark-list div {
  padding: 0.75rem 0.85rem;
  border-left: 3px solid #73b8ed;
  border-radius: 0 10px 10px 0;
  background: #f5faff;
}

.landmark-list dt { color: var(--lab-navy); font-weight: 800; }
.landmark-list dd { margin: 0.2rem 0 0; color: #53687b; line-height: 1.45; }

.lab-note {
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #fff8e8;
  color: #674914;
  font-size: 0.9rem;
  line-height: 1.5;
}

.measurement-fields {
  display: grid;
  gap: 0.7rem;
}

.measurement-fields label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #314b61;
  font-weight: 650;
}

.measurement-fields input {
  width: 76px;
  min-height: 42px;
  padding: 0.4rem 0.55rem;
  border: 1px solid #afc4d7;
  border-radius: 8px;
  font: inherit;
}

.measurement-output {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-top: 1rem;
}

.measurement-result {
  padding: 0.7rem;
  border: 1px solid #cfe0ee;
  border-radius: 10px;
  background: var(--lab-blue-soft);
}

.measurement-result strong,
.measurement-result span { display: block; }
.measurement-result strong { color: var(--lab-navy); font-size: 1.05rem; }
.measurement-result span { color: #607487; font-size: 0.78rem; }

.electrode-progress {
  display: grid;
  gap: 0.35rem;
  margin: 0.8rem 0;
  color: #526579;
  font-size: 0.86rem;
}

.electrode-progress progress { width: 100%; accent-color: var(--lab-blue); }

.electrode-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 0.45rem;
  max-height: 245px;
  overflow: auto;
  padding: 0.15rem;
}

.electrode-bin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.9rem 0 0.45rem;
  color: var(--lab-navy);
  font-weight: 800;
}

.electrode-bin-header small {
  color: #6a7d8e;
  font-size: 0.75rem;
  font-weight: 650;
}

.electrode-choice {
  min-height: 43px;
  padding: 0.35rem;
  border: 1px solid #b9cbd9;
  border-radius: 9px;
  background: #fff;
  color: var(--lab-navy);
  font-weight: 800;
  cursor: pointer;
  touch-action: none;
}

.electrode-choice:hover,
.electrode-choice:focus-visible,
.electrode-choice.selected {
  border-color: var(--lab-blue);
  background: var(--lab-blue-soft);
  color: #005da8;
}

.electrode-choice.placed { background: #edf9f4; border-color: #7ac5ab; color: #116f54; }
.electrode-choice.dragging { opacity: 0.5; transform: scale(0.96); }

.electrode-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100000;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #0878d1;
  color: #fff;
  box-shadow: 0 12px 32px rgba(16, 42, 67, 0.38);
  font: 800 0.8rem Inter, sans-serif;
  line-height: 1;
  pointer-events: none;
  will-change: transform;
}

body.electrode-is-dragging {
  cursor: grabbing;
  user-select: none;
}

.verification-list {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  list-style: none;
}

.verification-list li {
  position: relative;
  padding: 0.65rem 0.7rem 0.65rem 2.35rem;
  border-radius: 9px;
  background: #f4f7fa;
  color: #526579;
}

.verification-list li::before {
  content: "○";
  position: absolute;
  left: 0.8rem;
  color: #8395a5;
  font-weight: 900;
}

.verification-list li.passed { background: #eaf8f2; color: #116b50; }
.verification-list li.passed::before { content: "✓"; color: var(--lab-green); }

.lab-results { min-height: 48px; margin-top: 0.75rem; line-height: 1.45; }
.lab-results.success { color: var(--lab-green); }
.lab-results.warning { color: var(--lab-amber); }

.lab-navigation {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.25rem;
}

.lab-workspace {
  min-width: 0;
  overflow: hidden;
}

.head-toolbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #dce6ef;
}

.head-toolbar strong,
.head-toolbar span { display: block; }
.head-toolbar strong { color: var(--lab-navy); }
.head-toolbar span { margin-top: 0.15rem; color: #63788a; font-size: 0.8rem; }

.head-toolbar-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.icon-button {
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border: 1px solid #c9d8e4;
  border-radius: 9px;
  background: #fff;
  color: #365167;
  font-weight: 700;
  cursor: pointer;
}

.icon-button:disabled { opacity: 0.45; cursor: not-allowed; }

.head-stage {
  min-height: 510px;
  display: grid;
  place-items: center;
  padding: 0.5rem;
  background: radial-gradient(circle at center, #ffffff 0%, #f2f7fb 75%);
}

.head-stage.drag-over {
  background: radial-gradient(circle at center, #fff 0%, #e0f3ff 78%);
  box-shadow: inset 0 0 0 4px rgba(8, 120, 209, 0.3);
}

#lead-lab-svg {
  width: min(100%, 500px);
  height: auto;
  max-height: 530px;
  touch-action: none;
  cursor: crosshair;
}

.scalp-shape { fill: #fffaf6; stroke: #17364d; stroke-width: 3; }
.nose-shape,
.ear-shape { fill: #f5ded0; stroke: #17364d; stroke-width: 3; }

.measurement-guides path,
.measurement-guides ellipse {
  fill: none;
  stroke: #8fb7d5;
  stroke-width: 1.5;
  stroke-dasharray: 7 6;
}

.landmark-markers circle { fill: #e56b6f; stroke: #fff; stroke-width: 2; }
.landmark-markers text { fill: #8d3541; font-size: 12px; font-weight: 800; text-anchor: middle; }

.target-site circle {
  fill: rgba(8,120,209,0.08);
  stroke: rgba(8,120,209,0.45);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.target-site text { fill: #4a6b84; font-size: 11px; font-weight: 750; text-anchor: middle; }
.target-site.hint circle { fill: rgba(241,155,44,0.3); stroke: #d87900; stroke-width: 3; }
.lead-lab[data-mode="practice"] .target-site text { display: none; }
.lead-lab[data-mode="assessment"] .target-layer,
.lead-lab[data-mode="assessment"] .measurement-guides { opacity: 0; }

.placed-site { cursor: grab; }
.placed-site.dragging { cursor: grabbing; }
.placed-site circle { fill: var(--lab-blue); stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 3px 4px rgba(16,42,67,0.25)); }
.placed-site text { fill: #fff; font-size: 10px; font-weight: 850; text-anchor: middle; pointer-events: none; }
.placed-site.selected circle { fill: #f19b2c; }
.placed-site.correct circle { fill: var(--lab-green); }
.placed-site.incorrect circle { fill: var(--lab-red); }

.head-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem;
  border-top: 1px solid #dce6ef;
  color: #63788a;
  font-size: 0.78rem;
}

.legend-dot { width: 10px; height: 10px; display: inline-block; margin-right: 0.3rem; border-radius: 50%; }
.legend-dot.landmark { background: #e56b6f; }
.legend-dot.guide { border: 1px dashed #5f93ba; }
.legend-dot.electrode { background: var(--lab-blue); }

.lab-mode:focus-visible,
.lab-step:focus-visible,
.icon-button:focus-visible,
.electrode-choice:focus-visible,
#lead-lab-svg:focus-visible {
  outline: 3px solid rgba(8,120,209,0.35);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .lead-lab-header { flex-direction: column; gap: 1rem; }
  .lead-lab-grid { grid-template-columns: 1fr; }
  .lab-instruction-card { min-height: auto; }
  .head-stage { min-height: 450px; }
}

@media (max-width: 620px) {
  .lead-lab { padding: 0.75rem; }
  .lab-mode-switcher { width: 100%; }
  .lab-mode { flex: 1; }
  .lab-steps { grid-template-columns: repeat(2, 1fr); }
  .lab-step { justify-content: flex-start; min-height: 48px; }
  .measurement-output { grid-template-columns: 1fr; }
  .electrode-palette { grid-template-columns: repeat(4, 1fr); max-height: none; }
  .head-toolbar { align-items: flex-start; flex-direction: column; }
  .head-toolbar-actions { width: 100%; }
  .icon-button { flex: 1; }
  .head-stage { min-height: 390px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lead-lab *, .lead-lab *::before, .lead-lab *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
