.workspace:has(#course:not([hidden]) .lesson-hero) .cover {min-height:108px}
.workspace:has(#course:not([hidden]) .lesson-hero) .cover-type {padding:22px 32px}
.workspace:has(#course:not([hidden]) .lesson-hero) .cover #heading {font-size:2rem}
.workspace:has(#course:not([hidden]) .lesson-hero) #cover-subtitle {display:none}
.workspace:has(#course:not([hidden]) .lesson-hero) > section {background:#191725;color:#faf4ff;border-color:#514459}
#course:has(.lesson-hero) {--paper:#222030; --outline:#51455e; --accent:#ebc5ff; --muted:#c9bed2; color:#faf4ff; margin-top:8px}
#course:has(.lesson-hero) .trail {display:inline; font-size:.9rem; color:var(--muted)}
#course:has(.lesson-hero) .back {margin:6px 0 12px 12px; background:transparent; color:#edcbfa; text-decoration:underline}
.lesson-hero {position:relative; isolation:isolate; display:flex; flex-direction:column; justify-content:flex-end; overflow:hidden; min-height:clamp(225px,38vw,355px); border:1px solid #675473; border-radius:18px; padding:clamp(20px,4vw,46px); background:#30223e url('/lesson-media/cover.jpg') center/cover}
.lesson-hero::before {content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#16101eee,transparent 86%),linear-gradient(0deg,#171321cc,transparent 64%)}
.lesson-hero h2 {max-width:85%;font:500 clamp(2.15rem,6.8vw,4.6rem)/1.04 Georgia,serif;letter-spacing:-.045em;margin:0;text-wrap:balance;text-shadow:0 2px 18px #141018}
.lesson-hero .progress {font-size:.91rem;font-weight:550;color:#f7dfb8;margin:15px 0 0}
#course:has(.lesson-hero) .part,charge-model {background:var(--paper);border:1px solid var(--outline);border-radius:16px;padding:clamp(16px,3vw,28px);margin:16px 0}
#course:has(.lesson-hero) .part h3,charge-model h3 {font:600 clamp(1.2rem,2.8vw,1.65rem)/1.24 system-ui;letter-spacing:-.025em}
#course:has(.lesson-hero) .part p {max-width:68ch;color:#ece4f1}
#course:has(.lesson-hero) .part > button {width:auto; background:#ddc1ee;color:#282032}
#course:has(.lesson-hero) .choices button {background:#302a3c;border:1px solid #5e506d;color:#fff2ff;transition:background .2s,transform .2s}
#course:has(.lesson-hero) .choices button:hover {background:#45344f;transform:translateX(2px)}
#course:has(.lesson-hero) .progress {color:#f4d49e}
.lesson-figure {margin:16px 0; background:#181629; border:1px solid #494052;border-radius:12px;overflow:hidden}
.lesson-figure img {display:block;width:100%;height:auto;max-height:220px;object-fit:contain;border-radius:0;box-shadow:none}
.lesson-figure figcaption {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 14px;font-size:.9rem;color:#d9cddd}
.lesson-figure button {width:auto;background:transparent;color:#eed1ff;text-decoration:underline}
charge-model {display:block;overflow:hidden}
.model-title {display:flex;align-items:center;justify-content:space-between;gap:10px}
.model-title h3 {margin:0}
.model-title span {font:600 .84rem monospace; color:#e1b8ff;border:1px solid #655275;border-radius:7px;padding:.25rem .5rem}
charge-model canvas {display:block; width:100%;height:clamp(190px,31vw,286px);margin-top:16px;touch-action:none;cursor:grab;border-radius:12px;background:radial-gradient(ellipse at 50% 58%,#39304c,#1b1729 70%);}
charge-model canvas:active {cursor:grabbing}
charge-model select {width:100%;min-height:44px;border:1px solid #786582;background:#2c2638;border-radius:8px;color:inherit;padding:.5rem;font:inherit}
.model-help {font-size:.9rem;color:var(--muted)}
.model-controls {display:grid;grid-template-columns:1fr 1fr;align-items:end;gap:18px}
.model-controls label {color:#e6d8ed}
.model-controls input {margin:0;accent-color:#d8b4fa;padding:0}
.model-result {color:#fbdaa2;margin-bottom:0}
@media(max-width:550px){.model-controls{grid-template-columns:1fr;gap:8px}.lesson-hero h2{max-width:100%}.lesson-figure figcaption{align-items:flex-start}.lesson-hero{background-position:60% center}}
@media(prefers-reduced-motion:no-preference){
  .lesson-hero h2 {animation:lift-in .45s ease-out both}
  .part {transition:border-color .2s}
  #course .part:hover {border-color:#897498}
  .lesson-hero::before {animation:develop .7s ease-out}
  @keyframes lift-in{from{opacity:0;transform:translateY(8px)}}
  @keyframes develop{from{opacity:.45}}
}

#course:has(.lesson-hero) > h2:not(:first-child) {margin:32px 0 10px}
#course:has(.lesson-hero) .part > h3 {margin-top:0}
.model-controls input[type=range] {min-height:42px}
charge-model select {color-scheme:dark}
