/* Compact lesson top on phones (apa-mlay.js adds html.mlay only under 760px). */
.mlay-bar{position:relative;display:block;height:64px;margin:0 0 14px;border-radius:14px;overflow:hidden;cursor:pointer;
  background:linear-gradient(180deg,#0f2a4a 0%,#1b4d7a 62%,#2a6f9e 100%);color:#fff;-webkit-tap-highlight-color:transparent}
.mlay-bar:focus-visible{outline:3px solid #ffd166;outline-offset:2px}
.mlay-bar::after{content:"▾";position:absolute;right:9px;bottom:5px;font-size:11px;opacity:.75;transition:transform .2s}
.mlay-bar.is-open::after{transform:rotate(180deg)}
.mlay-lbl{position:absolute;left:10px;top:7px;z-index:3;font:700 11px/1.2 system-ui,sans-serif;letter-spacing:.02em;white-space:nowrap;
  max-width:62%;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 2px rgba(0,0,0,.35)}
.mlay-meta{position:absolute;right:8px;top:6px;z-index:3;display:flex;gap:5px}
.mlay-pill{display:inline-flex;align-items:center;gap:4px;padding:2px 7px;border-radius:999px;background:rgba(255,255,255,.16);
  font:700 11px/1.5 system-ui,sans-serif;white-space:nowrap}
.mlay-puz{display:inline-block;animation:mlay-sway 2.6s ease-in-out infinite}
.mlay-more{margin:-6px 0 14px}
.mlay-more .lv-strip{margin:0 0 10px}

/* V1: the real map, cropped to the road; its own animations keep running. */
.mlay-bar--v1{background:none}
.mlay-bar--v1 .lv-strip{width:100%;height:64px;aspect-ratio:auto;margin:0;border-radius:14px;overflow:hidden}
.mlay-bar--v1 svg.lv-map{width:100%!important;height:64px!important;aspect-ratio:auto;display:block}
.mlay-bar--v1 .lv-puz{top:4px;right:6px;left:auto;bottom:auto;transform:scale(.82);transform-origin:top right}
.mlay-bar--v1 .lv-toast{display:none}

/* V2: the boat sails between islands. */
.mlay-sea{position:absolute;left:-40px;right:-40px;bottom:0;height:20px;z-index:1;
  background:radial-gradient(14px 7px at 14px 0,transparent 96%,#3d8fc4 100%) 0 0/28px 20px repeat-x;animation:mlay-sea 3s linear infinite}
.mlay-sea--b{bottom:-5px;opacity:.6;animation-duration:5s;animation-direction:reverse}
.mlay-isl{position:absolute;bottom:13px;width:26px;height:9px;z-index:0;border-radius:50% 50% 0 0;background:#e9c46a}
.mlay-isl::before{content:"";position:absolute;left:11px;bottom:7px;width:3px;height:12px;background:#7a5230;border-radius:2px}
.mlay-isl::after{content:"";position:absolute;left:4px;bottom:15px;width:18px;height:8px;border-radius:50%;background:#2a9d8f}
.mlay-isl.is-cur::after{background:#52b788;animation:mlay-sway 3s ease-in-out infinite;transform-origin:50% 100%}
.mlay-boat{position:absolute;bottom:10px;left:10%;width:34px;height:30px;z-index:2;animation:mlay-sail 14s ease-in-out infinite alternate}
.mlay-hull{position:absolute;left:0;bottom:0;width:34px;height:9px;background:#8d5a3b;border-radius:0 0 14px 14px;animation:mlay-rock 2s ease-in-out infinite}
.mlay-sail{position:absolute;left:17px;bottom:9px;width:0;height:0;border-bottom:19px solid #fff;border-right:13px solid transparent;
  box-shadow:-2px 0 0 #6b4226;
  animation:mlay-rock 2s ease-in-out infinite;transform-origin:0 100%}
.mlay-boat .mlw{left:4px;bottom:8px;transform:scale(.7);transform-origin:bottom left}
.mlay-star{position:absolute;width:3px;height:3px;border-radius:50%;background:#fff;animation:mlay-tw 2.4s ease-in-out infinite}

/* V3: a rope path that fills up, the walker on it, the fire and the puzzle on the right. */
.mlay-bar--v3{background:linear-gradient(180deg,#183a2c 0%,#24563f 100%)}
.mlay-rope{position:absolute;left:14px;right:38%;bottom:15px;height:6px;border-radius:6px;background:rgba(255,255,255,.18)}
.mlay-rope i{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,#ffd166,#f4a261);animation:mlay-fill 1.2s ease-out both}
.mlay-walk{position:absolute;bottom:20px;z-index:2}
.mlay-pill--f{background:rgba(255,140,40,.25)}
.mlay-fire{position:relative;display:inline-block;width:10px;height:13px}
.mlay-fire i,.mlay-fire b{position:absolute;left:0;bottom:0;width:10px;height:12px;border-radius:50% 50% 45% 45%/60% 60% 40% 40%;background:#9aa0a6}
.mlay-fire b{left:2px;width:6px;height:7px;background:#cfd4d8}
.is-lit .mlay-fire i{background:#ff7b00;animation:mlay-flick .5s ease-in-out infinite alternate}
.is-lit .mlay-fire b{background:#ffd166;animation:mlay-flick .35s ease-in-out infinite alternate-reverse}
.mlay-pill--f:not(.is-lit) .mlay-fire{animation:mlay-pulse 1.6s ease-in-out infinite}

/* The walker (V2 on the boat, V3 on the rope). */
.mlw{position:relative;display:block;width:14px;height:24px}
.mlay-walk .mlw{animation:mlay-bob .5s ease-in-out infinite}
.mlw-h{position:absolute;left:3px;top:2px;width:8px;height:8px;border-radius:50%;background:#f1c27d}
.mlw-hp{position:absolute;left:2px;top:0;width:10px;height:5px;border-radius:5px 5px 0 0;background:#e63946;z-index:1}
.mlw-b{position:absolute;left:4px;top:10px;width:6px;height:8px;border-radius:2px;background:#4361ee}
.mlw-l1,.mlw-l2{position:absolute;top:17px;width:2px;height:7px;background:#1d3557;transform-origin:top center}
.mlw-l1{left:5px}.mlw-l2{left:8px}
.mlay-walk .mlw-l1{animation:mlay-leg .5s ease-in-out infinite alternate}
.mlay-walk .mlw-l2{animation:mlay-leg .5s ease-in-out infinite alternate-reverse}

@keyframes mlay-sea{to{transform:translateX(28px)}}
@keyframes mlay-sail{from{left:8%}to{left:58%}}
@keyframes mlay-rock{0%,100%{transform:rotate(-3deg)}50%{transform:rotate(3deg)}}
@keyframes mlay-sway{0%,100%{transform:rotate(-6deg)}50%{transform:rotate(6deg)}}
@keyframes mlay-tw{0%,100%{opacity:.2}50%{opacity:1}}
@keyframes mlay-fill{from{width:0}}
@keyframes mlay-flick{from{transform:scaleY(.88)}to{transform:scaleY(1.08)}}
@keyframes mlay-pulse{0%,100%{opacity:.55}50%{opacity:1}}
@keyframes mlay-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-2px)}}
@keyframes mlay-leg{from{transform:rotate(-22deg)}to{transform:rotate(22deg)}}
@media (prefers-reduced-motion:reduce){.mlay-bar *,.mlay-bar *::before,.mlay-bar *::after{animation:none!important}}

/* Preview only (admins): what moved, with a label, and the variant switcher. */
.mlay-hl{outline:2px dashed #f4b400;outline-offset:3px;position:relative}
.mlay-hl::before{content:attr(data-mlay);position:absolute;left:0;top:-19px;z-index:5;padding:1px 6px;border-radius:5px;background:#f4b400;color:#222;
  font:700 10px/1.5 system-ui,sans-serif;white-space:nowrap;pointer-events:none}
.mlay-bar.mlay-hl{overflow:visible;margin-top:22px}
.mlay-bar.mlay-hl > .lv-strip,.mlay-bar--v2.mlay-hl,.mlay-bar--v3.mlay-hl{clip-path:inset(-24px 0 0 0 round 14px)}
.mlay-switch{position:fixed;left:50%;top:6px;transform:translateX(-50%);z-index:99999;display:flex;align-items:center;gap:4px;
  padding:5px 6px;border-radius:999px;background:#111;color:#fff;font:600 12px/1 system-ui,sans-serif;box-shadow:0 4px 18px rgba(0,0,0,.3)}
.mlay-switch b{padding:0 6px;font-size:11px;opacity:.7}
.mlay-switch a{padding:6px 9px;border-radius:999px;color:#fff;text-decoration:none;white-space:nowrap}
.mlay-switch a.on{background:#f4b400;color:#111}

/* Phones: no waypoint rope on the left of the sections (34px back for the text) and a denser exercise card. Inner scrollers
   (the terminal, the check output) hand the swipe to the page when they reach their end. */
@media (max-width: 760px) {
  .ap-lesson-section.lv-wp{padding-left:0}
  .ap-lesson-section.lv-wp::before,.ap-lesson-section.lv-wp::after{display:none}
  .ap-exercise-card{padding:12px 13px;margin-top:0}
  .ap-exercise-card .lv-mission{margin-bottom:6px;padding:3px 8px;font-size:9.5px}
  .ap-exercise-card .ap-exercise-title{margin-bottom:6px;font-size:17px}
  .ap-exercise-card > p{font-size:14px;line-height:1.45}
  .ap-exercise-card .ap-exercise-list{margin-top:6px;padding-left:16px}
  .ap-exercise-card .ap-exercise-list li{margin:2px 0;font-size:14px;line-height:1.4}
  .ap-exercise-card .ap-inline-code{padding:1px 5px;font-size:13px}
  .ap-exercise-card .ap-hint{margin-top:8px;padding:8px 10px;font-size:12.5px;line-height:1.45}
  .ap-exercise-card .ap-solution-toggle{margin-top:8px;padding:6px 12px;font-size:13px}
  .lx-screen,.ap-lab-output,.ap-editor-panel pre{overscroll-behavior:auto}
}

/* Halfway offer (apa-mlay.js midOffer): the walker on the road towards the paid lessons. */
.mlay-mid{margin:16px 0;border-radius:16px;overflow:hidden;border:1px solid rgba(114,234,223,.25);background:linear-gradient(180deg,#152131,#0f1724);color:#e6edf3}
.mlay-mid__scene{position:relative;height:84px;overflow:hidden;background:linear-gradient(180deg,#1b3a5c 0%,#2b5f7d 70%,#2f6b4f 70%,#28583f 100%)}
.mlay-mid__sun{position:absolute;right:18%;top:10px;width:22px;height:22px;border-radius:50%;background:#ffd166;box-shadow:0 0 18px #ffd166;animation:mlay-pulse 3s ease-in-out infinite}
.mlay-mid__road{position:absolute;left:0;right:0;bottom:12px;height:10px;background:#7a5b3a;border-top:2px solid #94704a}
.mlay-mid__road::after{content:"";position:absolute;left:0;right:-40px;top:3px;height:2px;background:repeating-linear-gradient(90deg,#e9d8a6 0 12px,transparent 12px 26px);animation:mlay-road .9s linear infinite}
.mlay-mid__flag{position:absolute;left:14%;bottom:22px;width:2px;height:34px;background:#ddd}
.mlay-mid__flag b{position:absolute;left:2px;top:0;padding:2px 6px;border-radius:0 6px 6px 0;background:#72eadf;color:#06202a;font:800 11px/1.3 system-ui,sans-serif;white-space:nowrap;animation:mlay-sway 2.4s ease-in-out infinite;transform-origin:0 50%}
.mlay-mid__man{position:absolute;left:44%;bottom:21px;transform:scale(1.45);transform-origin:bottom center}
.mlay-mid__man .mlw{animation:mlay-bob .5s ease-in-out infinite}
.mlay-mid__man .mlw-l1{animation:mlay-leg .5s ease-in-out infinite alternate}
.mlay-mid__man .mlw-l2{animation:mlay-leg .5s ease-in-out infinite alternate-reverse}
.mlay-mid__gate{position:absolute;right:8%;bottom:22px;width:46px;height:40px;border-radius:8px 8px 0 0;background:#3b2a1a;border:2px solid #f4b400;box-shadow:0 0 14px rgba(244,180,0,.45);animation:mlay-glow 2s ease-in-out infinite}
.mlay-mid__gate i{position:absolute;left:50%;top:-11px;width:12px;height:10px;margin-left:-6px;border:2px solid #f4b400;border-bottom:0;border-radius:6px 6px 0 0}
.mlay-mid__gate b{position:absolute;inset:0;display:grid;place-items:center;color:#ffd166;font:800 12px system-ui,sans-serif}
.mlay-mid__txt{padding:12px 14px 14px}
.mlay-mid__txt strong{display:block;font-size:15.5px;line-height:1.35}
.mlay-mid__txt p{margin:6px 0 10px;font-size:14px;line-height:1.45;color:#b9c5d3}
.mlay-mid__row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.mlay-mid__txt small{color:#8b98a8;font-size:12px}
@keyframes mlay-road{to{transform:translateX(-26px)}}
@keyframes mlay-glow{50%{box-shadow:0 0 24px rgba(244,180,0,.8)}}
@media (prefers-reduced-motion:reduce){.mlay-mid *,.mlay-mid *::after{animation:none!important}}
