.molecula-page {
  --mol-cream: #faf7ef;
  --mol-violet: #402675;
  --mol-bg: #281a3b;
  --mol-board: #1c132b;
  --mol-panel: #392952;
  --mol-edge: #7d6a96;
  --mol-muted: #dbcfe9;
  --mol-lime: #e2fc77;
  --mol-paper: #fffdf8;
  background: var(--mol-cream);
  padding: 1.55rem 0 3.5rem;
}

.molecula-shell { max-width: 1180px; }
.molecula-page [hidden] { display: none !important; }
.molecula-back { display: inline-block; font-weight: 750; text-decoration: underline; text-underline-offset: .2em; }
.molecula-intro {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: end;
  gap: clamp(1rem, 4vw, 4rem);
  margin: 1.25rem 0 1.65rem;
}
.molecula-eyebrow {
  margin: 0 0 .35rem;
  color: var(--mol-violet);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.molecula-intro h1 {
  margin: 0;
  font-size: clamp(3.7rem, 8vw, 6.4rem);
  line-height: .98;
  letter-spacing: -.065em;
}
.molecula-intro h1 em {
  color: var(--mol-violet);
  font-family: var(--serif);
  font-weight: 400;
  white-space: nowrap;
}
.molecula-opening p { margin: 0; }
.molecula-opening .molecula-hook { margin-bottom: .25rem; font-size: clamp(1.14rem, 2.3vw, 1.52rem); font-weight: 820; line-height: 1.25; }

.molecula-lab {
  min-width: 0;
  padding: clamp(.8rem, 2.7vw, 1.8rem);
  color: #fff;
  border-radius: 1.05rem;
  background: var(--mol-bg);
}
.molecula-lab-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding-bottom: 1rem;
}
.molecula-task { min-width: 0; }
.molecula-task p { margin: 0; }
.molecula-task .molecula-progress { margin-bottom: .35rem; color: var(--mol-lime); font-size: .82rem; font-weight: 750; }
.molecula-task h2 {
  margin: 0 0 .28rem;
  color: #fff;
  font-size: clamp(1.45rem, 3.4vw, 2.15rem);
  line-height: 1.14;
}
#molecula-instruction { color: var(--mol-muted); line-height: 1.45; }
.molecula-picker { flex: 0 1 13rem; min-width: min(100%, 11rem); }
.molecula-picker label, .molecula-controls label { display: block; font-size: .86rem; font-weight: 750; }
.molecula-page select {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  padding: .36rem .55rem;
  color: #fff;
  background: #4a3864;
  border: 1px solid #b6a4ce;
  border-radius: .48rem;
  font: inherit;
  cursor: pointer;
}
.molecula-page :is(select, button, input, [tabindex="-1"]):focus-visible {
  outline: 3px solid var(--mol-lime);
  outline-offset: 3px;
}

.molecula-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 1fr);
  align-items: start;
  gap: .9rem;
}
.molecula-layout:has(#molecula-stage[hidden]) { grid-template-columns: minmax(0, 1fr); }
.molecula-stage {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--mol-board);
  border: 1px solid var(--mol-edge);
  border-radius: .72rem;
}
.molecula-stage svg {
  display: block;
  width: 100%;
  height: clamp(10.5rem, 24vw, 17rem);
  background: radial-gradient(#8b73aa53 .8px, transparent .8px) 0 0 / 16px 16px,
    radial-gradient(ellipse at center, #352249, #1c132b 75%);
}
.molecula-stage figcaption {
  padding: .58rem .8rem;
  border-top: 1px solid #6e5b86;
  color: var(--mol-muted);
  font-size: .87rem;
  line-height: 1.35;
}
.molecula-stage summary { color: #f1e7fb; cursor: pointer; }
.molecula-stage summary:focus-visible { outline: 2px solid var(--mol-lime); outline-offset: 3px; }
.molecula-stage figcaption p { margin: .45rem 0 0; }
.molecula-node, .molecula-node circle {
  fill: #372646;
  stroke: #c6aedf;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}
.molecula-page circle[data-element="H"] { fill: #d9c6ff; stroke: #f5eaff; stroke-dasharray: none; }
.molecula-page circle[data-element="O"] { fill: #ff9fb8; stroke: #ffd1de; stroke-dasharray: none; }
.molecula-page circle[data-element="C"] { fill: #a5ddd6; stroke: #dbfff8; stroke-dasharray: none; }
.molecula-symbol {
  fill: #221734;
  stroke: none;
  font: 800 1.45rem var(--sans);
  dominant-baseline: central;
  text-anchor: middle;
}
.molecula-symbol:is([data-element=""], [data-element="empty"]),
.molecula-node[data-element="empty"] + .molecula-symbol,
.molecula-node:not([data-element]) .molecula-symbol { fill: #eadcff; }
.molecula-bond { stroke: #b7aad0; stroke-width: 4; stroke-linecap: round; }
.molecula-bond[data-state="empty"] { stroke-dasharray: 6 6; opacity: .7; }
.molecula-wedge { fill: #b7aad0; }

.molecula-workbench {
  min-width: 0;
  padding: clamp(.72rem, 1.8vw, 1.2rem);
  background: var(--mol-panel);
  border: 1px solid var(--mol-edge);
  border-radius: .72rem;
}
.molecula-target { color: var(--mol-lime); margin: 0 0 .62rem; font-weight: 800; }
.molecula-target:empty { display: none; }
.molecula-controls fieldset,
#molecula-compare fieldset {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
  gap: .55rem .75rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.molecula-controls legend, #molecula-compare legend { padding: 0; margin: 0 0 .35rem; font-weight: 750; }
.molecula-controls select { margin-top: .18rem; }
.molecula-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: .5rem .65rem;
}
.molecula-controls > fieldset { grid-column: 1 / -1; }
.molecula-control { min-width: 0; }
.molecula-count {
  margin: .6rem 0 0;
  color: #eee3f9;
  font-weight: 750;
  line-height: 1.4;
}
.molecula-actions { display: flex; flex-wrap: wrap; gap: .42rem; margin-top: .75rem; }
.molecula-button, .molecula-button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .32rem .72rem;
  color: #fff;
  background: transparent;
  border: 1px solid #c4aedf;
  border-radius: .5rem;
  font: inherit;
  font-size: .87rem;
  font-weight: 800;
  cursor: pointer;
}
.molecula-button:hover { background: #59437c; }
.molecula-button-primary { color: #1e1729; background: var(--mol-lime); border-color: var(--mol-lime); }
.molecula-button-primary:hover { background: #f4ffbe; }
.molecula-button-primary:disabled { color: #eae0f1; background: #655377; border-color: #9984b0; cursor: default; }
.molecula-next { margin-top: .75rem; }
.molecula-hint,
.molecula-feedback:not(:empty) {
  margin: .75rem 0 0;
  padding: .56rem .7rem;
  color: #fff;
  background: #291e3a;
  border-radius: .38rem;
  border-left: 3px solid #c7afe9;
  font-size: .92rem;
  line-height: 1.45;
}
.molecula-feedback:empty { margin: 0; }
.molecula-feedback:is([data-state="success"], [data-state="correct"], [data-state="solved"]) { border-color: var(--mol-lime); }
.molecula-feedback:is([data-state="try"], [data-state="retry"], [data-state="incorrect"], [data-state="error"]) { border-color: #ffb6c9; }

.molecula-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .68rem;
}
.molecula-compare-card {
  min-width: 0;
  padding: .75rem;
  background: #291e3a;
  border: 1px solid var(--mol-edge);
  border-radius: .58rem;
}
.molecula-compare-card :is(h3, p) { margin: .18rem 0; overflow-wrap: anywhere; }
.molecula-compare-card h3 + p { color: var(--mol-lime); font-size: clamp(1rem, 3.5vw, 1.35rem); font-weight: 800; }
.molecula-compare-card svg { display: block; max-width: 100%; height: auto; }
#molecula-compare .molecula-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: .4rem;
  margin-top: .55rem;
}
.molecula-options label,
#molecula-compare label:has(input[type="radio"]) {
  display: flex;
  gap: .45rem;
  align-items: center;
  min-height: 44px;
  padding: .31rem .55rem;
  color: #fff;
  border: 1px solid #b5a3cf;
  border-radius: .48rem;
  cursor: pointer;
  line-height: 1.25;
}
#molecula-compare input[type="radio"] { flex: 0 0 auto; accent-color: var(--mol-lime); }
#molecula-compare label:has(input:checked) { background: #51406d; }

.molecula-explanation,
.molecula-book {
  display: grid;
  align-items: center;
  gap: clamp(.85rem, 3vw, 1.65rem);
}
.molecula-explanation {
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  margin: 2rem 0 1.2rem;
}
.molecula-explanation h2,
.molecula-extras h2 {
  margin: 0 0 .45rem;
  font-size: clamp(1.5rem, 3.6vw, 2.35rem);
  line-height: 1.14;
  letter-spacing: -.036em;
}
.molecula-explanation p { margin: 0 0 .6rem; }
.molecula-extras { display: grid; gap: .85rem; }
.molecula-model,
.molecula-share,
.molecula-book {
  color: var(--ink);
  background: var(--mol-paper);
  border: 1px solid #d9cfe6;
  padding: clamp(.78rem, 2.5vw, 1.4rem);
  border-radius: .62rem;
}
.molecula-model h3 { margin: 0 0 .42rem; }
.molecula-model ul { margin: 0; padding-inline-start: 1.17rem; }
.molecula-model a { color: #452b72; text-decoration: underline; text-underline-offset: .2em; font-weight: 750; }
.molecula-share-actions, .molecula-book-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.molecula-share-message { margin: .42rem 0 .65rem; font-weight: 700; }
.molecula-share-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .35rem .65rem;
  color: #452b72;
  background: #fff;
  border: 1px solid #7658a0;
  border-radius: .45rem;
  font-weight: 750;
  cursor: pointer;
}
.molecula-share-action:hover { background: #f0e9fa; }
.molecula-share-manual textarea { display: block; width: min(100%, 45rem); padding: .4rem; font: inherit; }
.molecula-share-note { font-size: .88rem; }
.molecula-book { grid-template-columns: minmax(4.8rem, 8.5rem) minmax(0, 1fr); }
.molecula-book-cover { display: block; width: 100%; height: auto; border-radius: .27rem; }
.molecula-book-actions .button { min-height: 44px; }
.molecula-extras :is(button, textarea, summary):focus-visible { outline-color: var(--mol-violet); }

@media (max-width: 760px) {
  .molecula-page { padding-top: 1rem; }
  .molecula-intro,
  .molecula-layout,
  .molecula-explanation { grid-template-columns: 1fr; }
  .molecula-intro { margin: .7rem 0 .95rem; gap: .5rem; }
  .molecula-intro h1 { font-size: clamp(2.5rem, 11vw, 4.25rem); }
  .molecula-opening p:last-child { line-height: 1.35; }
  .molecula-stage svg { height: 8.1rem; }
  .molecula-lab-heading { gap: .55rem; align-items: start; flex-wrap: wrap; padding-bottom: .65rem; }
  .molecula-picker { flex: 1 1 8rem; min-width: 0; }
  #molecula-instruction { font-size: .9rem; }
}
@media (max-width: 440px) {
  .molecula-compare-grid { grid-template-columns: 1fr; }
  .molecula-book { align-items: start; grid-template-columns: clamp(3.5rem, 18vw, 4.8rem) minmax(0, 1fr); }
}
