/* naturfag-atomer.css — Atomlaboratoriet (DeepSeek, jf. DEEPSEEK_ATOMLAB_OPGAVE.md).
   Lyst, fysisk skolelaboratorium i Plejeplan-farverne. Modellen er det største
   element; tekst er støtte. Alt er tastaturbart og mindst 44 × 44 px. */

.atomlab {
  --al-navy: #1f3864;
  --al-blue: #2e75b6;
  --al-proton: #c0392b;
  --al-neutron: #8a93a6;
  --al-electron: #2e75b6;
  --al-pair: #7c3aed;
  --al-highlight: #d97706;
  --al-ink: #17243b;
  --al-muted: #66738a;
  --al-line: #dce5f0;
  --al-mist: #f2f6fb;
  --al-paper: #ffffff;
  --al-soft: #eaf2fb;
  --al-focus: #fbbf24;

  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  background: linear-gradient(180deg, #f7fafd 0%, #ffffff 220px);
  border: 1px solid var(--al-line);
  border-radius: 20px;
  color: var(--al-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 20px 54px rgba(25, 50, 88, 0.08);
}

.atomlab * { box-sizing: border-box; }

/* ── Hoved ─────────────────────────────────────────────────────────── */
.atomlab__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.atomlab__title { margin: 0; font-size: 1.7rem; line-height: 1.15; color: var(--al-navy); }
.atomlab__sub { margin: 4px 0 0; color: var(--al-muted); }
.atomlab__intro { max-width: 64ch; margin: 10px 0 0; color: var(--al-ink); font-size: 1rem; line-height: 1.55; }
.atomlab__progress { margin: 0; padding: 8px 14px; background: var(--al-soft); border-radius: 999px; color: var(--al-navy); font-weight: 700; font-size: 0.9rem; }

/* Kun ét læringstrin vises ad gangen. */
.atomlab-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
.atomlab-step { min-height: 48px; padding: 8px 10px; border: 1px solid var(--al-line); border-radius: 12px; background: var(--al-paper); color: var(--al-muted); font: inherit; font-size: 0.875rem; font-weight: 700; cursor: pointer; }
.atomlab-step[aria-current="step"] { color: #fff; background: var(--al-navy); border-color: var(--al-navy); }
.atomlab-step:disabled { cursor: not-allowed; opacity: 0.48; }
.atomlab-step:focus-visible { outline: 3px solid var(--al-focus); outline-offset: 2px; }
.atomlab-deck > [hidden] { display: none !important; }
.atomlab-next { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ── Tegnforklaring (altid synlig) ─────────────────────────────────── */
.atomlab__legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 20px; padding: 10px 14px; background: var(--al-paper); border: 1px solid var(--al-line); border-radius: 14px; font-size: 0.875rem; color: var(--al-ink); }
.atomlab__legend dt { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-weight: 600; }
.atomlab__legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.atomlab__legend-dot--proton { background: var(--al-proton); }
.atomlab__legend-dot--neutron { background: var(--al-neutron); }
.atomlab__legend-dot--elektron { background: var(--al-electron); }
.atomlab__legend-dot--par { background: var(--al-pair); }
.atomlab__legend-dot--taethed { background: radial-gradient(circle, var(--al-pair) 30%, transparent 70%); border: 1px solid var(--al-pair); }

/* ── Mission ───────────────────────────────────────────────────────── */
.atomlab-mission { margin: 26px 0 0; padding: 20px; background: var(--al-paper); border: 1px solid var(--al-line); border-radius: 18px; }
.atomlab-mission__head { margin-bottom: 14px; }
.atomlab-kicker { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--al-blue); font-weight: 700; }
.atomlab-mission__head h3 { margin: 0 0 6px; font-size: 1.25rem; color: var(--al-navy); }
.atomlab-opgave { margin: 0; color: var(--al-muted); font-size: 0.95rem; }

.atomlab-mission__body { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.atomlab-stage { flex: 1 1 420px; min-width: 0; }
.atomlab-controls { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.atomlab-stage svg { display: block; width: 100%; height: auto; max-height: 380px; }

/* ── SVG-model ────────────────────────────────────────────────────── */
.al-shell { fill: none; stroke: #b9c6d8; stroke-dasharray: 3 4; }
.al-nucleus { fill: #f4f6fa; stroke: var(--al-navy); stroke-width: 2; }
.al-p { fill: var(--al-proton); }
.al-n { fill: var(--al-neutron); }
.al-e { fill: var(--al-electron); }
.al-e--unpaired { stroke: var(--al-highlight); stroke-width: 2.5px; }
.al-pair-ring { fill: none; stroke: var(--al-pair); stroke-dasharray: 3 4; }
.al-atom-core { fill: var(--al-soft); stroke: var(--al-navy); stroke-width: 2; }
.al-atom-core--h { fill: #eef4fb; }
.al-core-label { fill: var(--al-navy); font-size: 20px; font-weight: 700; }
.al-lewis-o { fill: var(--al-navy); font-size: 44px; font-weight: 700; }
.al-bond { stroke: var(--al-navy); stroke-width: 2.5px; }
.al-model-note { fill: var(--al-muted); font-size: 13px; }
.al-lattice-ion { fill: var(--al-soft); stroke: var(--al-navy); stroke-width: 1.5px; }
.al-lattice-ion--na { fill: #e9f3ff; stroke: #2563a6; }
.al-lattice-ion--cl { fill: #ecf8ee; stroke: #35824b; }
.al-attraction { stroke: #9aabc1; stroke-width: 2; stroke-dasharray: 3 5; }
.al-el-move { transition: transform 0.55s ease; }
.atomlab--reduced .al-el-move { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .al-el-move { transition: none !important; }
}

/* ── Kontroller og feedback ───────────────────────────────────────── */
.atomlab-readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.atomlab-readouts div { min-width: 0; background: var(--al-mist); border-radius: 12px; padding: 10px 6px; text-align: center; }
.atomlab-readouts dt { min-width: 0; overflow-wrap: anywhere; hyphens: auto; font-size: 0.875rem; color: var(--al-muted); margin-bottom: 4px; }
.atomlab-readouts dd { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--al-navy); }

.atomlab-stepper { display: flex; align-items: center; gap: 10px; }
.atomlab-stepper > span { flex: 1; font-size: 0.9rem; color: var(--al-ink); }
.atomlab-stepper__val { min-width: 2.2em; text-align: center; font-weight: 700; font-size: 1.05rem; color: var(--al-navy); }

.atomlab-btn { min-height: 44px; min-width: 44px; padding: 10px 14px; border: 1px solid var(--al-line); background: var(--al-paper); color: var(--al-navy); border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; }
.atomlab-btn:hover { border-color: var(--al-blue); }
.atomlab-btn:focus-visible { outline: 3px solid var(--al-focus); outline-offset: 2px; }
.atomlab-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.atomlab-btn[hidden] { display: none; }
.atomlab-btn--primary { background: var(--al-navy); border-color: var(--al-navy); color: #fff; }
.atomlab-btn--primary:hover { background: var(--al-blue); border-color: var(--al-blue); }
.atomlab-btn--ghost { background: transparent; border-color: transparent; color: var(--al-muted); }
.atomlab-btn--quick { min-width: 72px; color: var(--al-blue); background: var(--al-soft); }

.atomlab-feedback { margin: 0; padding: 12px 14px; background: var(--al-mist); border-radius: 12px; font-size: 0.92rem; line-height: 1.45; color: var(--al-ink); }
.atomlab-feedback--ok { background: #ecf7f0; color: #14532d; }

.atomlab-playback { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Mission 2: Lewis-prikker ─────────────────────────────────────── */
.atomlab-lewis { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 6px; justify-content: center; margin: 10px auto; }
.atomlab-lewis__o { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; color: var(--al-navy); }
.atomlab-lewis__slot { min-width: 44px; min-height: 44px; border: 1px dashed var(--al-line); border-radius: 10px; background: var(--al-paper); font-size: 1.3rem; line-height: 1; color: var(--al-electron); cursor: pointer; }
.atomlab-lewis__slot:hover { border-color: var(--al-blue); }
.atomlab-lewis__slot:focus-visible { outline: 3px solid var(--al-focus); outline-offset: 2px; }
.atomlab-lewis__slot--on { background: var(--al-soft); border-style: solid; border-color: var(--al-blue); }
.atomlab-count { text-align: center; color: var(--al-muted); font-size: 0.9rem; margin: 6px 0 0; }

/* ── Afsluttende udfordring ───────────────────────────────────────── */
.atomlab-scenario { margin: 0 0 14px; padding: 14px; border: 1px solid var(--al-line); border-radius: 14px; }
.atomlab-scenario legend { font-weight: 700; color: var(--al-navy); padding: 0 6px; }
.atomlab-scenario p { margin: 6px 0 10px; font-size: 0.94rem; line-height: 1.45; }
.atomlab-choice { display: flex; gap: 18px; margin-bottom: 10px; }
.atomlab-choice label { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.atomlab-scenario textarea { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--al-line); border-radius: 10px; font: inherit; resize: vertical; }
.atomlab-scenario textarea:focus-visible { outline: 3px solid var(--al-focus); outline-offset: 2px; }
.atomlab-scenario > label { display: block; margin-bottom: 6px; font-size: 0.875rem; color: var(--al-muted); }
.atomlab-done { margin: 6px 0 0; font-weight: 700; color: #14532d; }

/* ── Begrænsninger og kilder ──────────────────────────────────────── */
.atomlab-limits { margin-top: 22px; border: 1px solid var(--al-line); border-radius: 14px; background: var(--al-mist); }
.atomlab-limits summary { cursor: pointer; padding: 14px 16px; font-weight: 700; color: var(--al-navy); }
.atomlab-limits ul { margin: 0; padding: 0 16px 14px 34px; color: var(--al-muted); font-size: 0.88rem; }
.atomlab-limits li { margin-bottom: 6px; }

.atomlab-sources { margin-top: 22px; padding: 16px; background: var(--al-paper); border: 1px solid var(--al-line); border-radius: 14px; }
.atomlab-sources__status { margin: 0 0 8px; font-size: 0.85rem; color: var(--al-muted); }
.atomlab-sources h4 { margin: 0 0 8px; color: var(--al-navy); }
.atomlab-sources ul { margin: 0; padding-left: 20px; }
.atomlab-sources a { color: var(--al-blue); text-decoration: none; }
.atomlab-sources a:hover { text-decoration: underline; }
.atomlab-sources__meta { margin: 10px 0 0; font-size: 0.8rem; color: var(--al-muted); }

/* ── Mobil (390 px uden vandret overløb) ──────────────────────────── */
@media (max-width: 640px) {
  .atomlab { padding: 16px 14px 28px; }
  .atomlab-mission { padding: 14px; }
  .atomlab-mission__body { flex-direction: column; }
  .atomlab-stage { flex: 1 1 auto; width: 100%; }
  .atomlab-controls { flex: 1 1 auto; width: 100%; }
  .atomlab__head { flex-direction: column; align-items: flex-start; }
  .atomlab-steps { display: flex; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
  .atomlab-step { flex: 0 0 132px; scroll-snap-align: start; }
  .atomlab-readouts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .atomlab-stepper { flex-wrap: wrap; }
  .atomlab-stepper > span { flex-basis: 100%; }
}
