:root {
  --ink: #1f4eae;
  --ink-deep: #173b8c;
  --blue: #4f5bc8;
  --cyan: #2fc2d8;
  --cyan-soft: #80e2ea;
  --lavender: #7b66ea;
  --ice: #f3f7fb;
  --mist: #eaf0f6;
  --white: #ffffff;
  --text: #22314d;
  --muted: #637189;
  --line: #dce7f1;
  --shadow: 0 22px 70px rgba(23, 59, 140, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(135deg, #f8fbff 0%, #eef7fb 52%, #f6f4ff 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(47, 194, 216, 0.42);
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 30px 24px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-block {
  display: block;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.suite-label,
.eyebrow {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 3rem;
  line-height: 1.02;
  color: var(--ink-deep);
}

h3 {
  margin-bottom: 14px;
  color: var(--ink-deep);
  font-size: 1.55rem;
  line-height: 1.12;
}

p {
  line-height: 1.6;
}

.lab-nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav-item span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--white);
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-radius: 8px;
}

.nav-item.is-active,
.nav-item:hover {
  background: var(--white);
  border-color: var(--line);
  box-shadow: 0 12px 32px rgba(31, 78, 174, 0.1);
}

.competency-panel,
.info-panel,
.results-panel {
  padding: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(31, 78, 174, 0.09);
}

.competency-panel {
  margin-top: auto;
}

.progress-bar {
  width: 100%;
  height: 9px;
  overflow: hidden;
  background: var(--mist);
  border-radius: 999px;
}

.progress-bar span {
  display: block;
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--lavender));
  transition: width 180ms ease;
}

#progressText {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  min-width: 0;
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.mode-pill {
  flex: 0 0 auto;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lab-section {
  display: none;
}

.lab-section.is-active {
  display: block;
}

.section-grid {
  display: grid;
  gap: 24px;
}

.section-grid {
  grid-template-columns: minmax(280px, 0.86fr) minmax(360px, 1.14fr);
  align-items: stretch;
}

.anatomy-grid {
  grid-template-columns: minmax(420px, 1.2fr) minmax(280px, 0.8fr);
}

.teaching-copy {
  padding: 28px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overview-teaching-card {
  display: grid;
  align-content: start;
  gap: 18px;
}

.overview-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: rgba(234, 240, 246, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overview-tab {
  min-height: 44px;
  padding: 10px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.overview-tab.is-active,
.overview-tab[aria-selected="true"] {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 10px 24px rgba(31, 78, 174, 0.16);
}

.overview-tab-panel {
  display: none;
}

.overview-tab-panel.is-active {
  display: grid;
  gap: 14px;
}

.overview-tab-panel p {
  margin-bottom: 0;
}

.translation-callout,
.interactive-card {
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.translation-callout {
  border-left: 5px solid var(--cyan);
}

.translation-callout strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-deep);
}

.interactive-card {
  display: grid;
  gap: 14px;
  box-shadow: 0 12px 28px rgba(31, 78, 174, 0.08);
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 12px;
  align-items: center;
}

input[type="range"] {
  accent-color: var(--cyan);
  padding: 0;
}

output {
  color: var(--ink-deep);
  font-weight: 900;
  text-align: right;
}

.percent-results,
.comparison-grid {
  display: grid;
  gap: 10px;
}

.percent-results {
  grid-template-columns: repeat(2, 1fr);
}

.percent-results div,
.comparison-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--ice);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.percent-results strong,
.comparison-row strong {
  color: var(--ink-deep);
}

.percent-results span,
.comparison-row span {
  color: var(--cyan);
  font-weight: 900;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.diagram-stage {
  min-height: 520px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.diagram-stage svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
}

.overview-stage {
  display: grid;
  place-items: center;
}

.overview-diagram-image {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.measurement-line {
  stroke: var(--cyan);
  stroke-width: 5;
  stroke-linecap: round;
}

.measurement-line.muted {
  stroke: var(--lavender);
  opacity: 0.52;
}

.site-row circle,
#siteDots circle {
  fill: var(--ink);
  stroke: var(--white);
  stroke-width: 4;
}

.site-row text,
.legend-callouts text,
.anatomy-labels text,
#measurementLabels text {
  fill: var(--ink-deep);
  font-size: 18px;
  font-weight: 800;
}

.legend-callouts text {
  font-size: 16px;
}

.anatomy-stage {
  display: grid;
  place-items: center;
}

.anatomy-image-map {
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 1039 / 874;
}

.anatomy-base-image,
.anatomy-overlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.anatomy-base-image {
  position: relative;
}

.anatomy-overlay {
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease, filter 160ms ease;
}

.anatomy-overlay.is-active {
  opacity: 1;
  filter: drop-shadow(0 12px 18px rgba(31, 78, 174, 0.18));
}

.anatomy-hotspot,
.anatomy-landmark {
  position: absolute;
  z-index: 3;
  min-height: 30px;
  padding: 6px 9px;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(31, 78, 174, 0.12);
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(31, 78, 174, 0.05);
  opacity: 0.58;
  transition: opacity 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.anatomy-landmark {
  color: var(--ink-deep);
  background: rgba(47, 194, 216, 0.16);
  border-color: rgba(47, 194, 216, 0.22);
  opacity: 0.7;
}

.anatomy-hotspot:hover,
.anatomy-hotspot:focus-visible,
.anatomy-hotspot.is-active,
.anatomy-landmark:hover,
.anatomy-landmark:focus-visible,
.anatomy-landmark.is-active {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(31, 78, 174, 0.18);
  opacity: 1;
}

.frontopolar-hotspot {
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
}

.frontal-hotspot {
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
}

.central-hotspot {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.temporal-left-hotspot {
  top: 49%;
  left: 23%;
}

.temporal-right-hotspot {
  top: 49%;
  right: 23%;
}

.parietal-hotspot {
  top: 66%;
  left: 50%;
  transform: translateX(-50%);
}

.occipital-hotspot {
  top: 78%;
  left: 50%;
  transform: translateX(-50%);
}

.nasion-hotspot {
  top: 3%;
  left: 50%;
  transform: translateX(-50%);
}

.inion-hotspot {
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
}

.preauricular-left-hotspot {
  top: 55%;
  left: 5%;
}

.preauricular-right-hotspot {
  top: 55%;
  right: 5%;
}

.info-panel {
  align-self: stretch;
}

.mini-visual {
  min-height: 150px;
  margin-top: 20px;
  background: linear-gradient(135deg, rgba(47, 194, 216, 0.14), rgba(123, 102, 234, 0.14));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.mini-visual::before {
  content: "";
  display: block;
  width: 118px;
  height: 118px;
  margin: 16px auto;
  background: var(--mini, linear-gradient(135deg, var(--cyan), var(--lavender)));
  border-radius: 50% 50% 42% 42%;
  box-shadow: inset 0 -18px 0 rgba(255, 255, 255, 0.36);
}

.mini-visual.has-image::before {
  display: none;
}

.mini-visual img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  background: var(--white);
}

.measurement-slideshow {
  display: grid;
  grid-template-columns: 300px minmax(360px, 1fr) 320px;
  gap: 24px;
}

.slideshow-copy,
.slideshow-panel {
  padding: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.slideshow-panel {
  display: flex;
  flex-direction: column;
}

.slideshow-panel #slideDescription {
  min-height: 4.8em;
}

.slide-progress {
  width: 100%;
  height: 9px;
  margin-top: 20px;
  overflow: hidden;
  background: var(--mist);
  border-radius: 999px;
}

.slide-progress span {
  display: block;
  width: 5%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--lavender));
  transition: width 180ms ease;
}

.slide-count {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.slideshow-stage {
  display: grid;
  place-items: center;
}

.measurement-slide-image {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  border-radius: 8px;
}

label {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  color: var(--ink-deep);
  font-weight: 800;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

input {
  width: 100%;
  padding: 12px;
  color: var(--ink-deep);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.slideshow-actions,
.quiz-options {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.slideshow-actions {
  grid-template-columns: repeat(2, 1fr);
}

.slide-nav-button,
.quiz-options button,
.primary-action {
  min-height: 44px;
  color: var(--ink);
  font-weight: 900;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.slide-nav-button.primary,
.slide-nav-button:hover,
.quiz-options button:hover,
.primary-action {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-color: transparent;
}

.slide-step-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.slide-step-button {
  aspect-ratio: 1;
  min-height: 34px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.slide-step-button:hover,
.slide-step-button.is-active {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-color: transparent;
}

.practice-games {
  display: grid;
  gap: 24px;
}

.game-card {
  padding: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.game-header p {
  margin-bottom: 0;
}

.game-score {
  flex: 0 0 auto;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 900;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.round-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  background: rgba(234, 240, 246, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.round-button {
  min-height: 42px;
  color: var(--ink);
  font-weight: 900;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.round-button.is-active,
.round-button:hover {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}

.placement-board-wrap {
  display: grid;
  grid-template-columns: minmax(320px, 640px) 220px;
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.placement-board {
  position: relative;
  width: 100%;
  max-height: 58vh;
  aspect-ratio: 1039 / 874;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.placement-board-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.placement-region-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.placement-region-overlay.is-visible {
  opacity: 1;
}

.drop-target {
  position: absolute;
  z-index: 2;
  min-width: 72px;
  min-height: 34px;
  padding: 6px 8px;
  color: rgba(31, 78, 174, 0.62);
  font-size: 0.78rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.42);
  border: 1px dashed rgba(31, 78, 174, 0.36);
  border-radius: 8px;
  transform: translate(-50%, -50%);
}

.drop-target:hover,
.drop-target.is-selected {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  border-style: solid;
}

.drop-target.is-correct {
  color: var(--white);
  background: var(--ink);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(31, 78, 174, 0.24);
}

.drop-target.is-miss {
  border-color: #c42412;
  box-shadow: 0 0 0 3px rgba(196, 36, 18, 0.14);
}

.placement-board[data-round="sites"] .drop-target {
  min-width: 38px;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.34);
}

.placement-board[data-round="sites"] .drop-target.is-correct {
  color: var(--white);
  font-size: 0.74rem;
  background: var(--ink);
  border-color: var(--white);
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95), 0 8px 18px rgba(31, 78, 174, 0.22);
}

.placement-complete-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  padding: 9px 12px;
  color: var(--white);
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(31, 78, 174, 0.22);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.placement-board.is-complete {
  box-shadow: 0 0 0 3px rgba(47, 194, 216, 0.34), 0 18px 42px rgba(31, 78, 174, 0.16);
}

.placement-board.is-complete .placement-complete-badge {
  opacity: 1;
  transform: translateY(0);
}

.drag-bank {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--ice);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.drag-bank[data-round="sites"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.drag-chip {
  min-height: 38px;
  color: var(--ink);
  font-weight: 900;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.drag-chip:hover,
.drag-chip.is-selected {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-color: transparent;
}

.game-feedback,
.quiz-feedback {
  min-height: 28px;
  margin: 16px 0 0;
  color: var(--ink);
  font-weight: 800;
}

.math-question-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quiz-prompt {
  color: var(--ink-deep);
  font-size: 1.35rem;
  font-weight: 900;
}

.math-answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
}

.certificate-card {
  border-color: rgba(31, 78, 174, 0.18);
}

.certificate-card.is-unlocked {
  background:
    linear-gradient(135deg, rgba(47, 194, 216, 0.1), rgba(123, 102, 234, 0.1)),
    rgba(255, 255, 255, 0.88);
  border-color: rgba(47, 194, 216, 0.42);
}

.certificate-card.is-unlocked .game-score {
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-color: transparent;
}

.certificate-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.certificate-actions input:disabled,
.certificate-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-action {
  width: 100%;
}

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

  .sidebar {
    position: static;
  }

  .lab-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .competency-panel {
    margin-top: 0;
  }

  .section-grid,
  .anatomy-grid,
  .measurement-slideshow {
    grid-template-columns: 1fr;
  }

  .placement-board-wrap {
    grid-template-columns: 1fr;
  }

  .placement-board {
    max-width: 640px;
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  h2 {
    font-size: 2rem;
  }

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

  .nav-item {
    grid-template-columns: 36px 1fr;
    padding: 10px;
  }

  .overview-tabs,
  .percent-results {
    grid-template-columns: 1fr;
  }

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

  .slide-step-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .game-header,
  .math-answer-row,
  .certificate-actions {
    grid-template-columns: 1fr;
  }

  .game-header {
    display: grid;
  }

  .round-switch {
    grid-template-columns: 1fr;
  }

  output {
    text-align: left;
  }

  .diagram-stage {
    min-height: 380px;
    padding: 10px;
  }

  .diagram-stage svg {
    min-height: 360px;
  }
}
