:root {
  --bg: #f6fbff;
  --card: #ffffff;
  --text: #17324a;
  --muted: #5a7388;
  --line: #d8e8f4;
  --primary: #2f80ed;
  --primary-soft: #eaf4ff;
  --green: #2fa36b;
  --yellow: #fff2a8;
  --shadow: 0 12px 28px rgba(18, 51, 84, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #edf7ff 0%, var(--bg) 100%);
}

.hero {
  padding: 48px 16px;
  color: white;
  background: linear-gradient(135deg, #276fd0, #31a86c);
  overflow: hidden;
}

.hero__content,
.container {
  max-width: 1080px;
  margin: 0 auto;
}

.hero__content {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  opacity: .95;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

h2 { margin-top: 0; }
.hero__text { max-width: 680px; font-size: 1.05rem; }
.hero__actions,
.step-row,
.quiz-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero__art {
  position: relative;
  min-height: 160px;
}

.bubble {
  position: absolute;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 1.8rem;
  animation: floaty 5s ease-in-out infinite;
}
.bubble--a { left: 8px; top: 30px; }
.bubble--b { left: 100px; top: 0; animation-delay: .7s; }
.bubble--c { right: 18px; top: 60px; animation-delay: 1.4s; }

.btn {
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn--primary { background: var(--primary); color: white; }
.btn--secondary { background: white; color: var(--text); }

.container { padding: 20px 14px 42px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.focus-note {
  background: #fffbe8;
  border: 1px solid #f1df97;
  border-radius: 16px;
  padding: 14px 16px;
}
.focus-note p { margin-bottom: 0; }
.section-head { margin-bottom: 12px; }
.section-head p { color: var(--muted); margin-bottom: 0; }

.explore-grid,
.prep-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 16px;
  align-items: start;
}

.microscope-stage,
.slide-stage {
  position: relative;
  min-height: 340px;
  border-radius: 18px;
  border: 2px dashed #c5ddec;
  background: linear-gradient(180deg, #fbfdff 0%, #edf7ff 100%);
  overflow: hidden;
}

.microscope-stage {
  background: radial-gradient(circle at 70% 18%, #ffffff 0%, #eef8ff 36%, #dff0ff 100%);
}

.microscope-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(47, 128, 237, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 128, 237, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: .45;
  pointer-events: none;
}

.stage-label {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .9rem;
  font-weight: 700;
}

.scope-svg {
  position: absolute;
  inset: 18px 12px 12px;
  width: calc(100% - 24px);
  height: calc(100% - 30px);
  z-index: 1;
  filter: drop-shadow(0 12px 22px rgba(29, 64, 99, 0.14));
}

.scope-group {
  cursor: pointer;
  transition: transform .25s ease, filter .25s ease;
}

.scope-group .scope-fill {
  fill: url(#scopeMetal);
  stroke: #365f86;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill .25s ease, stroke .25s ease, filter .25s ease;
}

.scope-group .scope-fill.dark {
  fill: url(#scopeDark);
}

.scope-group .scope-fill.light {
  fill: url(#scopeLight);
  stroke: #7db0d7;
}

.scope-group .scope-detail {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scope-group .scope-detail.dark {
  stroke: rgba(34, 54, 73, 0.45);
}

.scope-group:hover {
  filter: drop-shadow(0 0 8px rgba(47, 128, 237, 0.18));
}

.scope-group.is-active {
  filter: drop-shadow(0 0 10px rgba(255, 214, 107, 0.45));
}

.scope-group.is-active .scope-fill {
  fill: url(#scopeActive);
  stroke: #cc8f12;
}

.scope-group.is-active .scope-detail {
  stroke: rgba(255, 255, 255, 0.95);
}

.scope-halo {
  position: absolute;
  left: 120px;
  top: 60px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 241, 164, 0.38), rgba(255, 241, 164, 0));
  filter: blur(4px);
  animation: pulse 3s ease-in-out infinite;
}

.scope-beam {
  position: absolute;
  left: 171px;
  top: 165px;
  width: 58px;
  height: 110px;
  opacity: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 236, 149, 0), rgba(255, 236, 149, 0.85), rgba(255, 236, 149, 0));
  transition: opacity .25s ease;
}

.microscope-stage.beam-on .scope-beam {
  opacity: .85;
  animation: beamGlow 1.6s ease-in-out infinite alternate;
}

.scope-specimen {
  position: absolute;
  left: 184px;
  top: 190px;
  width: 56px;
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid #99c8ec;
  z-index: 2;
}

.scope-spark {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff6b8;
  box-shadow: 0 0 0 4px rgba(255, 243, 163, 0.22);
  opacity: 0;
  z-index: 2;
}
.spark-1 { left: 150px; top: 110px; }
.spark-2 { left: 244px; top: 84px; animation-delay: .45s; }

.microscope-stage.spark-on .scope-spark {
  opacity: 1;
  animation: sparkle 1.4s ease-in-out infinite;
}

.microscope-stage.wheel-spin [data-scope-part="trieb"] {
  transform-origin: 174px 160px;
  animation: spinSoft 1s ease-in-out 2;
}

.toolbox { display: grid; gap: 12px; }
.tool-list,
.mini-grid,
.rule-grid,
.station-grid,
.summary-list {
  display: grid;
  gap: 10px;
}
.tool-list.two-cols,
.mini-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.rule-grid,
.station-grid,
.summary-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.tool-btn,
.mini-card,
.step-btn {
  border: 1px solid var(--line);
  background: #f8fbff;
  border-radius: 14px;
  padding: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.tool-btn:hover,
.mini-card:hover,
.step-btn:hover { background: var(--primary-soft); }
.tool-btn.active,
.mini-card.active,
.step-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.progress {
  margin: 0;
  font-weight: 700;
  color: var(--green);
}

.micro-tip {
  margin: -4px 0 0;
  font-size: .92rem;
  color: var(--muted);
}

.info-card {
  background: #f4f9ff;
  border: 1px solid #cfe2f4;
  border-radius: 16px;
  padding: 14px;
}
.info-card h3 { margin-top: 0; }
.info-card.is-pop { animation: popIn .28s ease; }

.game-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  align-items: start;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.score-pill {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbff, #edf6ff);
  border: 1px solid #d4e7f7;
  text-align: center;
}

.score-pill span {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
}

.score-pill small {
  color: var(--muted);
}

.quiz--missions {
  gap: 10px;
}

.mission-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfdff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.mission-head {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.mission-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef6ff;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 700;
}

.option-row {
  display: grid;
  gap: 8px;
}

.option-btn {
  width: 100%;
  border: 1px solid #d7e7f4;
  background: #f8fbff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.option-btn:hover {
  transform: translateY(-1px);
  background: #eef7ff;
}

.option-btn.correct {
  background: #eafaf1;
  border-color: #7dd0a0;
  color: #0c6a38;
}

.option-btn.wrong {
  background: #fff1f1;
  border-color: #ffb8b8;
  color: #a22b2b;
}

.option-btn:disabled {
  cursor: default;
}

.reaction-card.success {
  background: #edfdf4;
  border-color: #9ad7b2;
}

.reaction-card.error {
  background: #fff5f5;
  border-color: #f0bbbb;
}

.reaction-card.finish {
  background: #fffbe8;
  border-color: #f1df97;
}

.name-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.name-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #cfe2f4;
  margin-bottom: 12px;
  font: inherit;
}

.leaderboard {
  margin: 12px 0 0;
  padding-left: 20px;
}

.leaderboard li {
  margin-bottom: 8px;
  color: var(--muted);
}

.slide-base {
  position: absolute;
  left: 60px;
  right: 60px;
  top: 135px;
  height: 70px;
  border-radius: 18px;
  background: rgba(255,255,255,.76);
  border: 3px solid #8fc2eb;
}
.water-drop,
.sample-piece,
.cover-slip,
.focus-ring {
  position: absolute;
  opacity: 0;
  transition: .25s ease;
}
.slide-stage.step-1 .water-drop,
.slide-stage.step-2 .water-drop,
.slide-stage.step-3 .water-drop,
.slide-stage.step-4 .water-drop,
.slide-stage.step-5 .water-drop,
.slide-stage.step-2 .sample-piece,
.slide-stage.step-3 .sample-piece,
.slide-stage.step-4 .sample-piece,
.slide-stage.step-5 .sample-piece,
.slide-stage.step-3 .cover-slip,
.slide-stage.step-4 .cover-slip,
.slide-stage.step-5 .cover-slip,
.slide-stage.step-5 .focus-ring {
  opacity: 1;
}
.water-drop {
  left: 148px;
  top: 150px;
  width: 74px;
  height: 38px;
  border-radius: 50%;
  background: rgba(78, 173, 255, 0.45);
  border: 2px solid #4fa5eb;
}
.sample-piece {
  left: 170px;
  top: 158px;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #7ad98c;
  border: 2px solid #2d9151;
}
.cover-slip {
  left: 132px;
  top: 124px;
  width: 120px;
  height: 14px;
  border-radius: 4px;
  background: rgba(255,255,255,.82);
  border: 2px solid #b9d7ee;
  transform: rotate(-22deg);
}
.slide-stage.step-4 .cover-slip,
.slide-stage.step-5 .cover-slip {
  transform: rotate(0deg);
}
.focus-ring {
  left: 126px;
  top: 118px;
  width: 130px;
  height: 88px;
  border-radius: 16px;
  border: 3px dashed rgba(47, 128, 237, 0.75);
  animation: pulse 2s ease-in-out infinite;
}

.focus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.lens-stage {
  position: relative;
  min-height: 280px;
  border-radius: 18px;
  border: 2px dashed #c5ddec;
  background: radial-gradient(circle at 50% 45%, #fefeff 0%, #edf7ff 62%, #dceffd 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.lens-stage::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 128, 237, 0.1), rgba(47, 128, 237, 0) 70%);
  animation: pulse 3s ease-in-out infinite;
}

.lens-shell {
  position: relative;
  z-index: 1;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 14px solid #4c83c3;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(230,244,255,.82));
  box-shadow: inset 0 0 0 10px rgba(255,255,255,.45), 0 18px 35px rgba(28, 74, 122, 0.12);
  display: grid;
  place-items: center;
}

.lens-stage.is-sharp .lens-shell {
  box-shadow: inset 0 0 0 10px rgba(255,255,255,.45), 0 0 0 10px rgba(47, 128, 237, 0.12), 0 18px 35px rgba(28, 74, 122, 0.12);
}

.lens-sample {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, #d9f4ff, #c9ecff);
  filter: blur(5px) saturate(.8);
  transition: filter .2s ease, transform .2s ease;
}

.cell-dot {
  position: absolute;
  border-radius: 50%;
  background: rgba(110, 189, 95, 0.92);
  border: 2px solid #2e8a47;
  animation: drift 3.5s ease-in-out infinite;
}

.cell-dot--1 { width: 30px; height: 30px; left: 18px; top: 18px; }
.cell-dot--2 { width: 24px; height: 24px; right: 24px; top: 26px; animation-delay: .5s; }
.cell-dot--3 { width: 28px; height: 28px; left: 30px; bottom: 20px; animation-delay: 1s; }
.cell-dot--4 { width: 22px; height: 22px; right: 30px; bottom: 26px; animation-delay: 1.5s; }

.sample-label {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(255,255,255,.95);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .8rem;
  font-weight: 700;
}

.slider-label {
  font-weight: 700;
}

.focus-slider {
  width: 100%;
  accent-color: var(--primary);
}

.focus-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
}

.rule-card,
.station-card,
.summary-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #d7e7f4;
}
.rule-card strong {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
}
.station-card span,
.summary-item {
  color: var(--muted);
}

.quiz {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.result {
  font-weight: 700;
  color: var(--green);
}

.footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
}
code {
  background: #edf6ff;
  padding: 2px 6px;
  border-radius: 6px;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes popIn {
  0% { transform: scale(.98); }
  100% { transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes beamGlow {
  0% { transform: scaleY(.96); opacity: .65; }
  100% { transform: scaleY(1.04); opacity: .95; }
}
@keyframes sparkle {
  0%, 100% { transform: scale(.85); opacity: .35; }
  50% { transform: scale(1.2); opacity: 1; }
}
@keyframes spinSoft {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(24deg); }
  100% { transform: rotate(0deg); }
}
@keyframes drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

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

@media (max-width: 820px) {
  .hero__content,
  .explore-grid,
  .prep-grid,
  .focus-grid,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .hero__art {
    min-height: 100px;
  }
}
