:root {
  --ink: #16324a;
  --ink-2: #284861;
  --muted: #617687;
  --line: #d7e1e7;
  --soft: #f4f8fa;
  --panel: #ffffff;
  --green: #128a68;
  --green-dark: #0c6a51;
  --green-soft: #e6f6f0;
  --blue-soft: #eaf2f8;
  --warn: #9a5e08;
  --warn-soft: #fff5dc;
  --danger: #a43f3f;
  --danger-soft: #fdecec;
  --shadow: 0 14px 34px rgba(20, 50, 72, .09);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: #f7fafb;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 54px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand strong { display: block; font-size: 1.02rem; }
.brand small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.home-link { color: var(--ink-2); font-weight: 750; text-decoration: none; }

main { width: min(1420px, calc(100% - 32px)); margin: 0 auto; }
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 46px 0 28px;
}
.eyebrow, .panel-kicker {
  margin: 0 0 7px;
  color: var(--green-dark);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .13em;
}
h1 { margin: 0; font-size: clamp(2.15rem, 5vw, 4.2rem); line-height: .98; letter-spacing: -.045em; }
.hero-copy { max-width: 760px; margin: 18px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.65; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; max-width: 420px; }
.hero-badges span, .mag-badge {
  border: 1px solid #b8d8cc;
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .83rem;
  font-weight: 800;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  background: #eaf0f3;
  border-radius: 16px;
  margin-bottom: 18px;
}
.mode-tab {
  border: 0;
  border-radius: 11px;
  padding: 13px 10px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 850;
}
.mode-tab:hover { background: rgba(255,255,255,.6); }
.mode-tab.active { background: #fff; color: var(--green-dark); box-shadow: 0 3px 12px rgba(25, 55, 74, .09); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(330px, .75fr);
  gap: 18px;
}
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.three-panel, .viewer-panel { padding: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-heading.compact { margin-bottom: 10px; }
.panel-heading h2, .section-heading h2, .practice-card h2, .readiness-intro h2, .limitations h2 { margin: 0; font-size: clamp(1.2rem, 2vw, 1.65rem); letter-spacing: -.02em; }
.panel-kicker { font-size: .7rem; }

.primary-btn, .secondary-btn, .objective-btn, .slide-btn {
  min-height: 42px;
  border-radius: 11px;
  font-weight: 850;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.primary-btn { border: 1px solid var(--green); background: var(--green); color: white; padding: 10px 16px; }
.primary-btn:hover { background: var(--green-dark); }
.secondary-btn { border: 1px solid var(--line); background: #fff; color: var(--ink-2); padding: 9px 14px; }
.secondary-btn:hover { border-color: #9db0bd; }
.secondary-btn:disabled, .primary-btn:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(18, 138, 104, .23); outline-offset: 2px; }

.three-stage {
  position: relative;
  width: 100%;
  min-height: 520px;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.98) 0 22%, rgba(232,239,243,.95) 61%, rgba(216,226,232,.96) 100%);
  border: 1px solid #d4dfe5;
  touch-action: none;
}
.three-stage canvas { display: block; width: 100%; height: 100%; }
.three-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  z-index: 1;
}
.three-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(170,187,197,.65);
  color: #4f6575;
  font-size: .78rem;
  font-weight: 750;
  pointer-events: none;
}
.part-info {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  background: var(--green-soft);
  border-radius: 10px;
}
.part-info strong { font-size: .97rem; }
.part-info span { color: #4f6a62; font-size: .88rem; line-height: 1.45; }

.eyepiece-shell {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
  margin: 6px auto 18px;
  border-radius: 50%;
  overflow: hidden;
  background: #e5e5df;
  border: 14px solid #202a30;
  box-shadow: inset 0 0 0 4px #73818a, inset 0 0 42px rgba(0,0,0,.3), 0 10px 25px rgba(25,49,63,.12);
}
.eyepiece-shell canvas { width: 100%; height: 100%; display: block; }
.crosshair::before, .crosshair::after {
  content: "";
  position: absolute;
  background: rgba(37, 62, 76, .13);
  pointer-events: none;
}
.crosshair::before { width: 1px; height: 20px; left: 50%; top: calc(50% - 10px); }
.crosshair::after { height: 1px; width: 20px; top: 50%; left: calc(50% - 10px); }
.viewer-readouts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.viewer-readouts div { padding: 9px 10px; border-radius: 10px; background: var(--soft); border: 1px solid #e1e8ec; }
.viewer-readouts span { display: block; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.viewer-readouts strong { display: block; margin-top: 2px; font-size: .95rem; }
.lens-controls-area {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.lens-controls-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.lens-controls-heading h3 { margin: 2px 0 0; font-size: 1rem; }
.lens-controls-heading > span { max-width: 190px; color: var(--muted); font-size: .74rem; line-height: 1.35; text-align: right; }
.lens-controls-area .lab-controls { grid-template-columns: 1fr; gap: 9px; }
.lens-controls-area .control-card { padding: 11px 12px; border-radius: 11px; }
.lens-controls-area .control-card.full { grid-column: auto; }
.lens-controls-area .control-card h3 { margin-bottom: 8px; }
.lens-controls-area .control-card p.control-help { margin-top: 6px; }
.lens-controls-area .objective-btn,
.lens-controls-area .slide-btn,
.lens-controls-area .secondary-btn { min-height: 40px; }

.task-card { margin-top: 12px; padding: 14px; border-radius: 13px; background: var(--ink); color: #fff; }
.task-label { color: #9ce2ca; font-size: .66rem; font-weight: 900; letter-spacing: .13em; }
.task-card strong { display: block; margin-top: 5px; font-size: 1.05rem; }
.task-card p { margin: 6px 0 0; color: #d8e4ea; font-size: .87rem; line-height: 1.45; }

.mode-section { margin: 18px 0 0; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.mode-section.hidden, .hidden { display: none !important; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading > p { margin: 0; max-width: 520px; color: var(--muted); line-height: 1.55; }
.diagram-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 20px; }
.diagram-card { background: #f7fafb; border: 1px solid #dbe5ea; border-radius: 16px; padding: 10px; min-width: 0; }
.microscope-diagram { display: block; width: 100%; height: auto; }
.diagram-numbers circle { fill: var(--ink); }
.diagram-numbers text { fill: white; }
.parts-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.parts-legend li { margin: 0; }
.parts-legend button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid #dfe7eb;
  background: #fff;
  border-radius: 11px;
  padding: 8px 10px;
  color: var(--ink);
}
.parts-legend button:hover { border-color: #9eb8ab; background: #f8fcfa; }
.parts-legend b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: white; }
.parts-legend strong { display: block; font-size: .88rem; }
.parts-legend small { display: block; color: var(--muted); font-size: .75rem; line-height: 1.35; margin-top: 1px; }

.practice-card, .readiness-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.practice-card p, .readiness-intro p { color: var(--muted); margin: 7px 0 0; line-height: 1.55; }
.practice-score { min-width: 132px; text-align: center; padding: 13px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); }
.practice-score span { display: block; color: var(--muted); font-size: .78rem; font-weight: 750; }
.practice-score strong { display: block; font-size: 1.65rem; margin: 2px 0; }
.feedback { margin: 16px 0; padding: 13px 15px; border-radius: 11px; border: 1px solid var(--line); line-height: 1.45; }
.feedback.neutral { background: var(--soft); color: var(--ink-2); }
.feedback.good { background: var(--green-soft); border-color: #abd8c7; color: #145a46; }
.feedback.warn { background: var(--warn-soft); border-color: #ebcf8c; color: #7c4c07; }
.feedback.bad { background: var(--danger-soft); border-color: #efbcbc; color: #833232; }

.lab-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.control-card { min-width: 0; padding: 14px; border: 1px solid #dbe4e9; border-radius: 14px; background: #fbfcfd; }
.control-card.full { grid-column: 1 / -1; }
.control-card h3 { margin: 0 0 11px; font-size: .93rem; }
.control-card p.control-help { margin: 9px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch {
  position: relative;
  width: 58px;
  height: 32px;
  flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #afbbc3; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; top: 4px; left: 4px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 6px rgba(0,0,0,.16); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(26px); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.objective-btn, .slide-btn { border: 1px solid #cfdbe1; background: #fff; color: var(--ink-2); padding: 8px 6px; }
.objective-btn.active, .slide-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.range-row + .range-row { margin-top: 10px; }
.range-row label { font-size: .8rem; font-weight: 800; }
.range-value { min-width: 42px; text-align: right; color: var(--green-dark); font-weight: 900; font-size: .81rem; }
input[type="range"] { width: 100%; accent-color: var(--green); }
.slide-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.checklist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.check-item { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; border: 1px solid #dfe6ea; border-radius: 10px; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.check-item::before { content: "○"; font-weight: 900; color: #9aabb5; }
.check-item.done { background: var(--green-soft); border-color: #b9dccf; color: #1f5e4c; }
.check-item.done::before { content: "✓"; color: var(--green-dark); }

.readiness-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.muted-controls { opacity: .46; pointer-events: none; }
.results-card { margin-top: 16px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: #fbfcfd; }
.results-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.results-score { font-size: 2rem; font-weight: 950; color: var(--green-dark); }
.results-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.results-list li { padding: 9px 10px; border-radius: 9px; background: var(--soft); font-size: .83rem; }
.results-list li.pass { background: var(--green-soft); color: #1f5e4c; }
.results-list li.fail { background: var(--warn-soft); color: #784a07; }

.limitations { margin: 18px 0 38px; padding: 20px 22px; border-left: 4px solid #8aa2b1; background: #edf3f6; border-radius: 12px; }
.limitations h2 { font-size: 1rem; }
.limitations p { margin: 7px 0 0; color: #516977; line-height: 1.55; font-size: .88rem; }
footer { display: flex; justify-content: space-between; gap: 18px; padding: 24px clamp(18px, 4vw, 54px); border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .84rem; }
footer a { color: var(--ink); font-weight: 800; text-decoration: none; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .three-stage { min-height: 470px; }
  .diagram-layout { grid-template-columns: 1fr; }
  .parts-legend { grid-template-columns: repeat(2, 1fr); }
  .lab-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checklist { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  main { width: min(100% - 20px, 1420px); }
  .site-header { padding: 12px 14px; }
  .brand small { display: none; }
  .home-link { font-size: .82rem; }
  .hero { display: block; padding-top: 30px; }
  .hero-badges { justify-content: flex-start; margin-top: 18px; }
  .mode-tabs { grid-template-columns: repeat(2, 1fr); }
  .three-stage { min-height: 410px; }
  .three-panel, .viewer-panel, .mode-section { padding: 14px; border-radius: 15px; }
  .section-heading, .practice-card, .readiness-intro { display: block; }
  .section-heading > p { margin-top: 8px; }
  .practice-score { margin-top: 14px; }
  .parts-legend { grid-template-columns: 1fr; }
  .lab-controls, .checklist, .results-list { grid-template-columns: 1fr; }
  .control-card.full { grid-column: auto; }
  .readiness-actions { justify-content: flex-start; margin-top: 14px; }
  footer { display: block; }
  footer a { display: inline-block; margin-top: 8px; }
}

@media (max-width: 430px) {
  .panel-heading { align-items: flex-start; }
  .three-stage { min-height: 345px; }
  .three-hint { font-size: .69rem; }
  .viewer-readouts { grid-template-columns: 1fr 1fr; }
  .lens-controls-heading { align-items: flex-start; flex-direction: column; }
  .lens-controls-heading > span { max-width: none; text-align: left; }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
