Skip to content

A skill that turn any brand into a scrollable 3D world landing page

JavaScript

scroll-world: mobile support, camera grammar, and multi-model rendering

cyw5237764cb44d
diff --git a/plugins/scroll-world/skills/scroll-world/SKILL.md b/plugins/scroll-world/skills/scroll-world/SKILL.md
index 2de0e3a..0b41d9c 100644
--- a/plugins/scroll-world/skills/scroll-world/SKILL.md
+++ b/plugins/scroll-world/skills/scroll-world/SKILL.md
@@ -52,6 +52,9 @@ not the framework.
scripts. Higgsfield generations take **3–8 min each** — always run them detached
(background) and poll, never a foreground blocking call. Reference-by-job-UUID is
rejected by media flags — pass **local file paths** to `--image/--start-image/--end-image`.
+ Video models differ in accepted params (e.g. Kling has no `--resolution`) and in whether
+ they support start/end-image conditioning at all — before batching, confirm the chosen
+ model's schema with `higgsfield model get <job_type>` and see the Step 4 model table.
---
@@ -85,6 +88,26 @@ default. Cover:
the hero product. Each section needs: a short subject description (what's IN the
diorama), an eyebrow, a headline, one line of body, and 0–3 tag pills. The last
section is usually the hero product + the CTA.
+5. **Mobile version (beta) — ALWAYS ask this; never silently generate both.** Use
+ `AskUserQuestion`: *"Want a mobile-optimized version too? Mobile support is in
+ **beta** — the scroll-scrub mechanic is desktop-native; on phones you get lighter
+ encodes and engine hardening, but portrait crops the 16:9 frame and low-end devices
+ may still stutter."* Options: "Desktop only" / "Desktop + mobile (beta)". The beta
+ disclaimer must be stated to the user, not just implied. What the answer gates:
+ - **Yes** → produce the `-m.mp4` mobile encodes (Step 6) and wire
+ `clipMobile`/`connectorsMobile` (Step 7); run the full mobile QA (Step 8). If any
+ scene's focal subject sits off-centre, offer the 9:16 hero-variant escape hatch
+ (extra Higgsfield credits — say so).
+ - **No** → skip the mobile encodes and wiring entirely. The engine's phone hardening
+ (seek-coalescing, iOS priming, safe-area CSS) is always on regardless — that's not
+ a "mobile version," it's just the page not breaking when a phone visits — so a
+ desktop-only build still degrades gracefully.
+
+Video model is **not** an interview question — default `seedance_2_0` silently. If the user
+names a preference, honor it **only if it can frame-lock seams** (Step 4 roster:
+`seedance_2_0`, `kling3_0`, `seedance_2_0_mini`). This skill only ships seamless output, so
+a model that can't frame-lock is declined with a one-line why, not substituted in — use a
+roster model instead.
Keep the scroll mechanic fixed (continuous fly-through) — that's the point of the skill.
See `references/prompts.md` for the intake checklist and copy structure.
@@ -96,7 +119,8 @@ See `references/prompts.md` for the intake checklist and copy structure.
One image per section, **all sharing the same style preamble** for cohesion. Default
model **`gpt_image_2`** (crisp, great at isometric illustration; returns a solid/white
background which is perfect for floating diorama "islands"). Use `nano_banana_2` only if
-the brief is character/cartoon-heavy.
+the brief is character/cartoon-heavy (note: `nano_banana_2` is a CLI alias — it resolves
+to `nano_banana_pro`; it won't appear under that name in `higgsfield model list`).
Prompt shape (full templates in `references/prompts.md`):
@@ -136,13 +160,49 @@ These stills double as **video posters and lazy-load fallbacks**, so keep them.
How the camera moves *between* scenes is the single biggest quality lever. Two shapes;
pick by aesthetic.
+### Video model — pick ONE for the whole chain
+
+**This skill only ships seamless output**, so the only usable models are ones that can
+frame-lock a seam: every chained clip must accept `--start-image`, and connectors also
+need `--end-image`. That capability — not preference — is the selection rule. Check any
+model with `higgsfield model get <job_type>` and **skip anything whose media inputs are
+reference-only** (no start/end image): it can only *condition* a generation, not
+*continue* a shot, so it physically can't hold a seam. Schemas below were confirmed
+against the CLI:
+
+| Model | start/end image | Notes |
+|---|---|---|
+| `seedance_2_0` (default) | ✓ / ✓ | Full chain (legs + connectors). `--mode std --resolution 1080p`. Its NSFW filter is the touchy one (see Gotchas). |
+| `kling3_0` | ✓ / ✓ | Full chain — tested: `--mode std --sound off --duration 5` with start+end images accepted, seams frame-lock cleanly. **No `--resolution` param** (don't pass one; `--mode std` returns **720p native** — encode what ffprobe reports, never upscale). Sound defaults **on** → `--sound off`. `--duration` default 5, try 10 for legs. Different content filter than Seedance — the sanctioned NSFW fallback. |
+| `seedance_2_0_mini` | ✓ / ✓ | Cheap draft tier that keeps frame-locking (720p). The previz tier: run the whole chain here first, then re-render final legs on the full model — still seamless, so it translates directly. |
+
+Those three are the roster — all do both architectures. (`kling3_0_turbo` also frame-locks
+via `--start-image`, but has no `--end-image`, so it's architecture-A-only and can't make
+connectors; it also takes a different flag set — no `--mode`, has `--resolution` — so it
+doesn't drop into the pipeline as-is. It's not in the default roster; only reach for it, and
+wire it by hand, if architecture A's sequential render time is a proven bottleneck and you've
+benchmarked it as actually faster.)
+
+Rules:
+- **One model for all chained clips.** Each renderer has its own motion/color/grain
+ character; mixing models mid-chain keeps *position* continuity (frames still hand off)
+ but the render-character shift reads as a subtle pop. The one sanctioned exception is
+ the NSFW fallback for a single stubborn clip (Gotchas) — a slight character shift on
+ one 5s connector beats a missing connector.
+- Default to `seedance_2_0`; honor a user's stated preference **only if the model
+ qualifies** (frame-locking). If it doesn't, say so and use a supported model — never
+ ship a non-seamless build to satisfy a model request.
+- The pipeline scripts take the model as `$VMODEL` with per-model flags already cased
+ out (`references/pipeline.md`).
+
### A) Continuous forward take — RECOMMENDED for grounded / realistic / walkthrough
One camera that only ever glides **forward**, first scene through last, as a single take.
Generate the legs **sequentially**: leg 0 from scene-0's still (glide forward into it);
then each leg's `--start-image` = the **previous leg's ACTUAL last frame** (extract with
-ffmpeg), prompt *"continue gliding smoothly FORWARD into [scene i], never pulling back"*,
-and **no `--end-image`** — an end-image of a wide establishing shot forces the camera to
-pull back, which is the #1 cause of stutter. Extract each leg's last frame to feed the
+ffmpeg), prompt *"continue gliding smoothly FORWARD into [scene i], never pulling back"*
+(or an expressive mid-leg move under the motion-handoff contract — see **Camera grammar**
+below), and **no `--end-image`** — an end-image of a wide establishing shot forces the
+camera to pull back, which is the #1 cause of stutter. Extract each leg's last frame to feed the
next. Result: every seam is frame-identical **and** the camera never reverses. There are
**no connectors** (skip Step 5) — the legs ARE the journey. Wire each leg as a section
clip with `connectors: []` and a small `crossfade` (~0.08). Even without an `--end-image`
@@ -157,8 +217,54 @@ next scene (Step 5). The pull-out **reverses camera direction at every seam** (f
to the map, fly to the next island"; in a grounded first-person walkthrough it reads as a
jarring **rewind/stutter**. Use B only for the map-like aesthetic. When in doubt, use A.
+### Camera grammar — the move should fit the concept (A is NOT "forward only")
+
+"Forward only" is the *seam* rule, not the *leg* rule. The physics of the chain:
+
+- **Position continuity** at a seam comes from the frame handoff (next leg starts from the
+ previous leg's actual last frame).
+- **Velocity continuity** at a seam means the camera must never *reverse across a seam* —
+ that's the rewind stutter.
+- **Inside a single leg the camera is free.** One leg is one continuous render — there is
+ no seam to break mid-leg, so orbits, crane-ups, lateral tracking, even a push-in that
+ eases back out are all safe *within* the clip. Reversals are only fatal *across* seams.
+
+So give each leg an expressive move chosen from the scene's own logic, under a **motion
+handoff contract**: every leg **ends by settling into a slow, steady forward drift** toward
+the next destination (final ~1 s), and every leg **begins by continuing that same drift**.
+Keep both clauses in the prompts verbatim (templates in `references/prompts.md`).
+
+Pick the grammar from the concept:
+
+| Concept / tone | Mid-leg move |
+|---|---|
+| Product / luxury retail | slow half-orbit around the hero object, then continue past it |
+| Real estate / hospitality | steadicam glide through doorways; gentle crane-up in atria |
+| Industrial / process / logistics | low lateral track alongside the line, foreground parallax |
+| Travel / outdoors / campus | drone-style rise-and-reveal, then a descending swoop |
+| Food / craft / detail-driven | push in close to the craft moment, ease back, carry on |
+| Playful miniature (arch. B) | dives + aerial hops — the connector IS the grammar |
+
+Honest costs: expressive mid-leg moves raise re-roll odds — the model can end a fancy move
+in a state that isn't a clean forward drift. Mitigations: keep the final-second settle
+clause verbatim; **eyeball each leg's last frame before chaining the next** (it should look
+like a frame from a gentle forward glide — if not, re-roll before wasting the next leg);
+budget ~1 extra re-roll per expressive leg. A plain forward glide stays the zero-risk
+default — use it for legs where the scene itself is the show.
+
+Two related pacing knobs live in the engine (Step 7): per-section `scroll` (more scroll
+distance = longer dwell in that scene) and `linger` (the camera settles mid-scene exactly
+while the copy peaks, then picks up speed toward the seam). Prefer expressive motion in the
+*clip* and restraint in the *scrub mapping* — they compound.
+
+And remember scroll is a scrubber: visitors can scroll **up**, so every move also plays in
+reverse. That's free and expected — no extra work — but it's another reason seam velocity
+must be consistent in both directions (a seam that reads fine forward reads as a stutter
+backward too if velocity flips).
+
**For B**, one camera flight per scene: starts high/outside, descends into the interior,
-structure opens. Model **`seedance_2_0`** (image-to-video), `--start-image = the scene still`.
+structure opens. Model: the chain model you picked above (default **`seedance_2_0`**),
+`--start-image = the scene still`.
- Use the **solid-background still** (not the knocked-out transparent one) as the
start image, so the video has a full frame.
@@ -166,8 +272,10 @@ structure opens. Model **`seedance_2_0`** (image-to-video), `--start-image = the
at the whole <scene> from outside … descend and fly inside toward <focal point> … the
roof/walls gently open to reveal the interior. <style>, smooth graceful slow motion.
No text." (Template in `references/prompts.md`.)
-- Params: `--mode std --resolution 1080p --aspect_ratio 16:9 --duration 8`. Do **not**
- pass `--generate-audio` (it errors on seedance; audio is wasted anyway — you'll mute).
+- Params (seedance): `--mode std --resolution 1080p --aspect_ratio 16:9 --duration 8`.
+ For Kling: drop `--resolution` (no such param), add `--sound off`, `--duration 10`.
+ Do **not** pass `--generate-audio` (it errors on seedance; audio is wasted anyway —
+ you'll mute).
- Run concurrently, detached, then download each `.result_url`. Re-roll individual
failures. Keep the raw 1080p sources — you need their frames next.
@@ -205,13 +313,16 @@ ffmpeg -sseof -0.15 -i dive_i.mp4 -frames:v 1 -q:v 2 dive_i_last.png # inte
ffmpeg -ss 0 -i dive_{i+1}.mp4 -frames:v 1 -q:v 2 dive_next_first.png # establishing of i+1
```
-Generate the connector (`--duration 5` is plenty):
+Generate the connector (`--duration 5` is plenty). Connectors need `--end-image`, so the
+model must accept it — any roster model does (`seedance_2_0`, `seedance_2_0_mini`,
+`kling3_0`):
```bash
-higgsfield generate create seedance_2_0 \
+higgsfield generate create "$VMODEL" \
--prompt "$(cat connector_i.txt)" \
--start-image dive_i_last.png --end-image dive_next_first.png \
- --mode std --resolution 1080p --aspect_ratio 16:9 --duration 5 --wait --json
+ $VOPTS --aspect_ratio 16:9 --duration 5 --wait --json
+# seedance: VOPTS="--mode std --resolution 1080p"; kling3_0: VOPTS="--mode std --sound off"
```
Connector prompt: "Single continuous camera move, no cuts. Pull up and back out of
@@ -251,6 +362,16 @@ ffmpeg -i src.mp4 -an -vf "unsharp=5:5:0.8:5:5:0.0" \
Encode all 2N-1 clips (dives + connectors) with the same settings for uniform quality.
+**Mobile encodes (beta — only if the user opted in at Step 1.5).** Phone video decoders seek
+far slower than a laptop's, and seek cost scales with GOP length, so the 1080p `-g 8` master
+that scrubs smoothly on desktop can stutter on a phone. Produce a lighter `-m.mp4` sibling for
+every clip — **720p, `-g 4`** (more keyframes = cheaper seeks), crf 23 — and wire them as
+`clipMobile` / `connectorsMobile` (Step 7). The engine serves them automatically on phones and
+falls back to the desktop clip when absent. The exact `encm()` script is in
+`references/pipeline.md` §6. If the user chose desktop-only, skip this — the engine still
+hardens phone scrubbing regardless (seek-coalescing, iOS priming), so the page degrades
+gracefully rather than breaking.
+
---
## Step 7 — Assemble the page
@@ -264,22 +385,39 @@ mountScrollWorld(document.getElementById('world'), {
brand: { name: 'Pearl & Co.' },
diveScroll: 1.3, connScroll: 0.9, // viewport-heights of scroll per clip
sections: [
- { id:'farm', label:'The Farms', still:'assets/farm.webp', clip:'assets/vid/farm.mp4',
+ { id:'farm', label:'The Farms', still:'assets/farm.webp',
+ clip:'assets/vid/farm.mp4', clipMobile:'assets/vid/farm-m.mp4', // mobile beta only
+ scroll: 1.6, linger: 0.45, // optional pacing: longer dwell + camera settles mid-scene
accent:'#8FB98A', eyebrow:'From leaf to last sip', title:'It starts in the hills.',
body:'…', tags:['Single-origin','Hand-picked'] },
// …one per section; last may carry a `cta`
],
- connectors: ['assets/vid/conn1.mp4','assets/vid/conn2.mp4', /* … length = sections-1 */],
+ connectors: ['assets/vid/conn1.mp4','assets/vid/conn2.mp4', /* … length = sections-1 */],
+ connectorsMobile: ['assets/vid/conn1-m.mp4','assets/vid/conn2-m.mp4' /* … same length; mobile beta only */],
});
```
The engine handles: the ordered dive/connector chain, scroll→currentTime with rAF
smoothing, blob loading, lazy prefetch of nearby clips, frame-matched crossfades, pinned
per-section copy (first section greets on landing, last holds its CTA), a route rail,
-`prefers-reduced-motion`, and mobile. Theme it with CSS variables (`--accent`,
+`prefers-reduced-motion`, and mobile. **Pacing per section:** `scroll` overrides
+`diveScroll` for that scene (more scroll = longer dwell) and `linger` (0–1, keep ≤ 0.6)
+remaps time so the camera settles mid-scene — exactly while the copy peaks — then speeds
+up toward the seam; seam frames are untouched (f(0)=0, f(1)=1). Give the hero and finale
+scenes a higher `scroll` + some `linger`; keep transit scenes brisk. Theme it with CSS variables (`--accent`,
`--sw-bg`, `--sw-ink`, …) — the visual identity comes from the generated clips, so the
chrome stays quiet. See the header of `scrub-engine.js` for the full config + CSS vars.
+**On phones the engine adapts automatically** (coarse pointer or ≤860px): it serves
+`clipMobile` / `connectorsMobile` when present, **coalesces seeks** (never queues a new
+`currentTime` while the decoder is still seeking — this is what stops a fast flick from
+freezing the clip), **keeps the still as a poster until the clip paints its first frame**
+and **primes each video on first touch** (fixes iOS's blank-until-played video), drops the
+drifting particles, ignores URL-bar-only resizes (no scroll jump), and uses safe-area
+insets so copy clears the notch/home indicator. All of this hardening is on by default —
+no config needed. The `clipMobile`/`connectorsMobile` encodes are the opt-in **mobile
+beta** part (Step 1.5): only wire them when the user asked for the mobile version.
+
For non-JS backends (Python/Rails/etc.): serve the assets and drop the engine `<script>`
into the rendered HTML; nothing about it is framework-specific.
@@ -296,7 +434,23 @@ is the thing most likely to be wrong:
the crossfade band is too short.
- Check the console for errors, confirm `video.seekable.end(0) > 0` (blob working), and
that `currentTime` tracks scroll across each clip's band.
-- Check mobile (full-bleed `cover`) and reduced-motion (should fall back to the stills).
+- **Mobile — full checklist only if the user opted into the mobile beta (Step 1.5).**
+ For a desktop-only build, just sanity-check a phone viewport once: page loads, still
+ posters show, nothing overlaps — the engine's hardening covers graceful degradation.
+ For the beta (do this on a real phone or an emulated one, portrait + landscape):
+ - Emulate a phone viewport **with CPU throttled 4–6×** and scroll fast — the clip should
+ track without freezing (the seek-coalescing + `-m.mp4` encodes are what make this hold).
+ - Confirm the first scene shows immediately (its still is the poster) and the video takes
+ over the instant you scroll — no blank/black scene (the iOS priming fix). Test iOS Safari
+ specifically; it's the one that goes blank if this regresses.
+ - Verify the `-m.mp4` variant is actually served on mobile (Network panel), and the
+ heavy 1080p master on desktop.
+ - Slowly scroll so the URL bar collapses — the page must **not jump** (height-only resizes
+ are ignored on touch). Rotate the device — layout should recompose cleanly.
+ - Portrait crops a 16:9 clip to its centre; confirm the focal subject still reads. If a
+ hero scene's subject sits off-centre and gets cut, recompose it (prompts.md) or generate
+ a 9:16 variant for that scene.
+- Check reduced-motion (should fall back to the stills, no video, no particles).
---
@@ -323,16 +477,45 @@ is the thing most likely to be wrong:
trigger words like "bed", "pool", "waterfall", "wine", "swim". It's partly the prompt
wording and partly the reference frames. Fixes, in order: (1) re-roll — it's often
non-deterministic and passes on the 2nd–3rd try; (2) strip trigger words and add
- "empty, unoccupied, no people, no figures, architectural, tasteful"; (3) if a connector
- still won't pass, set that connector slot to `null` — the engine crossfades that seam
- directly (optional connectors), so the page still completes. Budget extra credits/time
- for these re-rolls on interiors/real-estate content.
+ "empty, unoccupied, no people, no figures, architectural, tasteful"; (3) regenerate
+ just that clip on **`kling3_0`** with the same start/end frames — a different
+ provider's filter often passes what Seedance blocks. Expect a slight render-character
+ shift on that one clip (each model has its own grain/motion feel); for a 5s connector
+ behind a crossfade that usually beats option (4): set the connector slot to `null` —
+ the engine crossfades that seam directly (optional connectors), so the page still
+ completes. Budget extra credits/time for these re-rolls on interiors/real-estate content.
- **Dark / custom theme** → the engine wraps its default tokens in `@layer sw`, so a
page-level `:root` / `.sw-root { --sw-bg; --sw-ink; --sw-accent; --sw-font-* }` block
wins cleanly (no specificity hacks). `--sw-ink` is your primary **text/heading** colour;
the **accent** fills the primary button and active nav. For a dark theme, set `--sw-bg`
dark and `--sw-ink` light — the copy scrim and title shadow follow `--sw-bg` automatically.
+- **Phone scrub stutters / freezes on a fast flick** → the 1080p master is too heavy for a
+ phone decoder and seeks pile up. Ship the `-m.mp4` mobile encodes (720p, `-g 4`) and wire
+ `clipMobile`/`connectorsMobile` (Step 6/7). The engine already coalesces seeks; the lighter
+ encode is the other half. Still choppy on a low-end device? Tighten GOP (`-g 2` / all-intra).
+- **Blank / black scene on iOS (desktop was fine)** → an iOS Safari quirk: a muted video that
+ was never played won't paint a seeked frame. The engine fixes this by keeping the still as a
+ poster until the clip paints and priming each video on first touch — so **don't** hide the
+ still on `loadedmetadata` or strip the `playsinline`/`muted` attributes if you adapt the
+ engine into a framework.
+- **Page jumps while scrolling on mobile** → something is re-running layout on the URL-bar
+ show/hide `resize`. The engine ignores height-only resizes on touch; if you ported it, gate
+ your resize handler on a width change (keep the `orientationchange` path for rotation).
+- **Copy hidden behind the URL bar / notch on mobile** → use the engine's safe-area-aware
+ bottom offset (`env(safe-area-inset-bottom)` + `dvh`); make sure the page's
+ `<meta viewport>` includes `viewport-fit=cover` (the template does).
+- **Portrait crops the scene** → a 16:9 clip on a tall phone shows only its centre. Keep each
+ scene's focal subject centred with a little headroom (prompts.md), or generate a 9:16 hero
+ for the scenes that matter most. The engine centre-crops (`object-fit:cover`); it can't
+ un-crop a widescreen composition.
- **`--generate-audio` errors on seedance** → omit it; mute in HTML and `-an` on encode.
+- **Kling rejects your flags** → `kling3_0` has **no `--resolution` param** (don't pass
+ one; encode at whatever native res ffprobe reports) and **sound defaults on** — pass
+ `--sound off`. Duration default is 5; legs/dives want 10.
+- **Seam pop only where you "saved credits"** → you swapped models mid-chain, or used a
+ start-image-only model where a connector needs an `--end-image`. One model for the whole
+ chain; the only cheap tier is `seedance_2_0_mini`, which keeps frame-locking so it stays
+ seamless. (Any model with reference-only inputs can't hold a seam at all — Step 4.)
- **White-box scenes** → `gpt_image_2` returns a solid bg; either match the page bg to it
or knock it out (Step 3).
- **bash 3.2** on macOS → no associative arrays in scripts.
@@ -342,8 +525,9 @@ is the thing most likely to be wrong:
- `references/prompts.md` — the intake checklist, style-preamble pattern, and every
prompt template (scene still, dive, connector) with fill-in slots.
- `references/pipeline.md` — copy-paste batch scripts for the whole run (generate →
- extract frames → connectors → encode), bash-3.2-safe.
+ extract frames → connectors → encode → mobile encode), bash-3.2-safe.
- `references/scrub-engine.js` — the portable, config-driven scrub engine (builds DOM +
- injects CSS; blob-seek, lazy load, seam crossfade, copy, route rail, reduced-motion).
+ injects CSS; blob-seek, lazy load, seam crossfade, copy, route rail, reduced-motion, and
+ phone hardening: mobile encodes, seek-coalescing, iOS priming, safe-area, no-jump resize).
- `references/index-template.html` — a minimal standalone page that mounts the engine.
- `references/knockout.py` — border-connected background knockout for floating scenes.
diff --git a/plugins/scroll-world/skills/scroll-world/references/index-template.html b/plugins/scroll-world/skills/scroll-world/references/index-template.html
index 9f2d1c0..b60300a 100644
--- a/plugins/scroll-world/skills/scroll-world/references/index-template.html
+++ b/plugins/scroll-world/skills/scroll-world/references/index-template.html
@@ -32,8 +32,11 @@
// First section is the hero (its copy greets on landing); last carries the CTA.
{
id: 'sceneA', label: 'Scene A',
- still: 'assets/sceneA.webp', clip: 'assets/vid/sceneA.mp4',
+ still: 'assets/sceneA.webp',
+ clip: 'assets/vid/sceneA.mp4',
+ clipMobile: 'assets/vid/sceneA-m.mp4', // mobile beta only: lighter 720p encode served on phones
accent: '#8FB98A',
+ // scroll: 1.6, linger: 0.45, // optional pacing: longer dwell; camera settles mid-scene
eyebrow: 'Value prop label',
title: 'The hero line.',
body: 'One plain-spoken sentence about this stage.',
@@ -42,7 +45,9 @@
// …middle scenes…
{
id: 'finale', label: 'The Product',
- still: 'assets/product.webp', clip: 'assets/vid/finale.mp4',
+ still: 'assets/product.webp',
+ clip: 'assets/vid/finale.mp4',
+ clipMobile: 'assets/vid/finale-m.mp4',
accent: '#9B7EBD',
eyebrow: 'And it all pours into',
title: 'One perfect thing.',
@@ -57,6 +62,11 @@
'assets/vid/conn1.mp4',
// 'assets/vid/conn2.mp4', …
],
+ // Mobile beta only: lighter connectors for phones — same length/order as `connectors`.
+ connectorsMobile: [
+ 'assets/vid/conn1-m.mp4',
+ // 'assets/vid/conn2-m.mp4', …
+ ],
});
</script>
</body>
diff --git a/plugins/scroll-world/skills/scroll-world/references/pipeline.md b/plugins/scroll-world/skills/scroll-world/references/pipeline.md
index 6f2652c..4e41e79 100644
--- a/plugins/scroll-world/skills/scroll-world/references/pipeline.md
+++ b/plugins/scroll-world/skills/scroll-world/references/pipeline.md
@@ -7,6 +7,17 @@ WORK=/tmp/scroll-world # scratch dir for prompts, sources, frames
ASSETS=./assets # where the site reads stills (webp) + clips (mp4)
mkdir -p "$WORK" "$ASSETS/vid"
NAMES="farm kitchen shop delivery plaza finale" # <-- your section ids, in order
+
+# Chain video model — ONE for every chained clip (SKILL Step 4 roster).
+# Must accept --start-image AND --end-image (verify: higgsfield model get <model>):
+# seedance_2_0 | kling3_0 | seedance_2_0_mini (draft tier). Reference-only models can't
+# hold a seam; models without --mode (e.g. kling3_0_turbo) need their own flag branch below.
+VMODEL=seedance_2_0
+case "$VMODEL" in # per-model flags + durations (bash 3.2 safe)
+ kling3_0) VOPTS="--mode std --sound off"; DIVE_DUR=10; CONN_DUR=5 ;; # no --resolution param on Kling
+ seedance_2_0_mini) VOPTS="--mode std --resolution 720p"; DIVE_DUR=8; CONN_DUR=5 ;; # cheap frame-locked previz
+ *) VOPTS="--mode std --resolution 1080p"; DIVE_DUR=8; CONN_DUR=5 ;; # seedance_2_0 default
+esac
```
Higgsfield generations take minutes — every `higgsfield ... --wait` call below is meant
@@ -42,10 +53,10 @@ add `--image "$WORK/still_<good>.png"` to lock style).
Prompt files at `$WORK/dive_<name>.txt`. Start image = the solid-bg still PNG.
```bash
-gen_dive() { # name
- higgsfield generate create seedance_2_0 --prompt "$(cat "$WORK/dive_$1.txt")" \
+gen_dive() { # name ($VOPTS is unquoted on purpose — word-split flags)
+ higgsfield generate create "$VMODEL" --prompt "$(cat "$WORK/dive_$1.txt")" \
--start-image "$WORK/still_$1.png" \
- --mode std --resolution 1080p --aspect_ratio 16:9 --duration 8 \
+ $VOPTS --aspect_ratio 16:9 --duration "$DIVE_DUR" \
--wait --wait-timeout 20m --json > "$WORK/dive_$1.json" 2> "$WORK/dive_$1.err"
url=$(jq -r '.[0].result_url // empty' "$WORK/dive_$1.json")
[ -n "$url" ] && curl -fsSL "$url" -o "$WORK/dive_$1.mp4" && echo "dive $1 ok" || echo "dive $1 FAIL"
@@ -75,10 +86,10 @@ done
Prompt files at `$WORK/conn_<i>.txt` (i = 1..N-1). Iterate adjacent pairs:
```bash
-gen_conn() { # i startPng endPng
- higgsfield generate create seedance_2_0 --prompt "$(cat "$WORK/conn_$1.txt")" \
+gen_conn() { # i startPng endPng (end-image required → seedance/kling3_0 only)
+ higgsfield generate create "$VMODEL" --prompt "$(cat "$WORK/conn_$1.txt")" \
--start-image "$2" --end-image "$3" \
- --mode std --resolution 1080p --aspect_ratio 16:9 --duration 5 \
+ $VOPTS --aspect_ratio 16:9 --duration "$CONN_DUR" \
--wait --wait-timeout 20m --json > "$WORK/conn_$1.json" 2> "$WORK/conn_$1.err"
url=$(jq -r '.[0].result_url // empty' "$WORK/conn_$1.json")
[ -n "$url" ] && curl -fsSL "$url" -o "$WORK/conn_$1.mp4" && echo "conn $1 ok" || echo "conn $1 FAIL"
@@ -92,7 +103,9 @@ done ; wait
## 5. Encode everything for scrubbing (Step 6)
-Native 1080p, crf 20, GOP 8, light sharpen, no audio, faststart. Same for dives + connectors.
+Native resolution (1080p from seedance std; kling3_0 std returned **720p** in testing —
+never upscale, encode what ffprobe reports), crf 20, GOP 8, light sharpen, no audio,
+faststart. Same for dives + connectors.
```bash
enc() { ffmpeg -v error -y -i "$1" -an -vf "unsharp=5:5:0.8:5:5:0.0" \
@@ -106,10 +119,51 @@ i=0; for f in "$WORK"/conn_*.mp4; do i=$((i+1)); enc "$f" "$ASSETS/vid/conn$i.mp
Now the engine config's `sections[k].clip = assets/vid/<name>.mp4` and
`connectors = [assets/vid/conn1.mp4, …]` (length N-1, in order).
+## 6. Mobile encodes (Step 6) — mobile beta, only if the user opted in
+
+**Skip this section unless the user chose the mobile (beta) version in the Step 1
+interview.** Scrubbing sets `currentTime` every frame, and a phone decoder's **seek cost scales with
+how many frames it must decode from the nearest keyframe** — so a 1080p `-g 8` master
+that scrubs fine on a laptop stutters on a phone. A **smaller frame + tighter GOP** fixes
+that (and halves the bytes on cellular). Produce a `-m.mp4` sibling for every clip:
+
+```bash
+# 720p, GOP 4 (twice the keyframes = ~half the seek-decode work), crf 23, same sharpen/faststart.
+encm() { ffmpeg -v error -y -i "$1" -an -vf "scale=-2:720,unsharp=5:5:0.6:5:5:0.0" \
+ -c:v libx264 -preset slow -crf 23 -pix_fmt yuv420p \
+ -g 4 -keyint_min 4 -sc_threshold 0 -movflags +faststart "$2"; echo "encm $2 $(du -h "$2"|cut -f1)"; }
+
+for n in $NAMES; do encm "$WORK/dive_$n.mp4" "$ASSETS/vid/$n-m.mp4"; done
+i=0; for f in "$WORK"/conn_*.mp4; do i=$((i+1)); encm "$f" "$ASSETS/vid/conn$i-m.mp4"; done
+```
+
+Wire the variants in the engine config — the engine serves them automatically on phones,
+falling back to the desktop `clip` when a mobile one is absent:
+
+```js
+sections[k].clipMobile = 'assets/vid/<name>-m.mp4';
+connectorsMobile = ['assets/vid/conn1-m.mp4', …]; // length N-1, in order
+```
+
+If phone scrubbing still stutters, tighten the GOP further (`-g 2`, or `-g 1` for all-intra
+= instant seeks at the cost of larger files); if cellular weight is the bigger worry, raise
+`crf` (24–26) or drop to `scale=-2:600`. If the master is already 720p (e.g. kling3_0 std),
+the mobile encode still pays off — the tighter GOP is what makes phone seeks cheap. All-mobile encodes stay 16:9 — the engine
+centre-crops them; see the portrait note in SKILL Step 8 / prompts.md.
+
## Notes
- `.[0].result_url` is the field on the `--wait --json` job object. `.min_result_url` is
a lower-res preview if you ever want it.
+- **NSFW fallback across models**: if one clip keeps getting flagged on seedance after
+ re-rolls + prompt scrubbing, regenerate just that clip on `kling3_0` with the SAME
+ start/end frames: `VMODEL=kling3_0; VOPTS="--mode std --sound off"; gen_conn 3 …` —
+ then restore your chain model. See SKILL Gotchas for the trade-off.
+- **Previz on the cheap**: run the whole chain once with `VMODEL=seedance_2_0_mini`
+ (frame-locking intact, ~720p) to validate the journey and seams before spending
+ full-model credits — because it's still seamless, the previz translates directly to the
+ final render. Don't reach for reference-only models here: without `--start/--end-image`
+ they can't hold a seam, so their output can't be chained (Step 4 rule).
- If a whole batch stalls, check `higgsfield workspace list` for credits and
`$WORK/*.err` for the reason.
- Concurrency: launching ~5–6 gens at once is fine; much more can trigger transient
diff --git a/plugins/scroll-world/skills/scroll-world/references/prompts.md b/plugins/scroll-world/skills/scroll-world/references/prompts.md
index 2b059bf..7a5cd0c 100644
--- a/plugins/scroll-world/skills/scroll-world/references/prompts.md
+++ b/plugins/scroll-world/skills/scroll-world/references/prompts.md
@@ -13,6 +13,7 @@ Collect and write down:
- `TONE` — a word or two (cozy/premium, playful, industrial…).
- `STYLE` — the art direction (default below).
- `SECTIONS[]` — ordered list; for each: `id`, `label`, `subject` (what's in the diorama), `eyebrow`, `title`, `body` (≤ 1 sentence), `tags[]` (0–3). Last section = hero product + CTA.
+- `MOBILE` — yes/no. **Always asked** (SKILL Step 1.5), presented to the user as **beta**. Gates the `-m.mp4` encodes (pipeline §6) + `clipMobile`/`connectorsMobile` wiring + the full mobile QA.
## Style preamble (default: clay diorama)
@@ -46,8 +47,48 @@ Tips:
- For the final "hero product" section, drop the diorama-island framing and prompt a
single oversized product centerpiece floating on the same background with a few small
orbiting props.
+- **Compose for the centre.** The page renders every clip `object-fit:cover`, and a portrait
+ phone crops a 16:9 frame to roughly its centre half. Keep the focal subject horizontally
+ centred with a little headroom, and don't park anything essential at the far left/right
+ edges — it will be cut off on phones. This also keeps the dive's focal point (which the
+ camera flies toward) inside the mobile crop. For a scene that absolutely must show its full
+ width on mobile, generate a separate 9:16 variant for it.
- Aspect `3:2`, `--resolution 2k --quality high`.
+## Leg prompt — architecture A, continuous forward take (Step 4)
+
+`--start-image = previous leg's ACTUAL last frame` (leg 0: the first scene's still).
+**No `--end-image`.** The bolded clauses are the motion-handoff contract — keep them
+verbatim; the mid-leg move is where the expression goes.
+
+```
+Single continuous cinematic camera move, no cuts. **Continue the same slow, steady
+forward glide.** [MID-LEG MOVE — optional, from the library below.] The camera moves
+into [SCENE i] toward [FOCAL POINT]. **In the final second, settle back into a slow,
+steady forward glide toward [the doorway / opening / direction of the next scene].**
+[STYLE tail + PALETTE]. Smooth, graceful, slow motion, subtle parallax. No text, no captions.
+```
+
+### Mid-leg move library (pick by concept; omit for a plain glide)
+
+Reversals are safe *inside* a leg (it's one continuous render) — only a seam may never
+reverse. That's why "ease back out" is fine mid-leg.
+
+- **Half-orbit** (product, luxury): "sweeping in a slow half-orbit around [the hero
+ object], keeping it centered, then continuing past it"
+- **Crane-up reveal** (scale, atriums, campuses): "rising smoothly as the full scale of
+ [the space] reveals below"
+- **Low lateral track** (production lines, counters, shelves): "tracking low and level
+ alongside [the line], foreground objects sliding past in parallax"
+- **Push-in + ease back** (craft, detail): "pushing in close to [the craft moment] until
+ it nearly fills the frame, then easing gently back out"
+- **Rise-and-swoop** (travel, outdoors): "climbing in a gentle arc over [the terrain],
+ then swooping down toward [the next focal point]"
+
+After rendering each leg, **check its last frame** before generating the next: it should
+read as a frame from a calm forward glide (no motion blur sideways, no half-finished
+orbit). If it doesn't, re-roll this leg — a bad handoff frame poisons every leg after it.
+
## Dive-in clip prompt (Step 4)
`--start-image = the scene still` (solid-bg version).
@@ -65,7 +106,10 @@ subtle parallax. No text, no captions.
For scenes with no building to open (a field, a plaza, a road), replace the roof clause
with "the camera flies low across [the scene] toward [focal point]."
-`--mode std --resolution 1080p --aspect_ratio 16:9 --duration 8`. No audio flag.
+Params by chain model (SKILL Step 4 table): seedance —
+`--mode std --resolution 1080p --aspect_ratio 16:9 --duration 8`, no audio flag;
+kling3_0 — `--mode std --sound off --aspect_ratio 16:9 --duration 10` (no `--resolution`
+param). Same for architecture-A legs.
## Connector clip prompt (Step 5)
@@ -84,7 +128,9 @@ For the last connector into a hero-product finale: "…glides forward and the wo
dissolves toward a single giant [PRODUCT] floating in soft [BG] space, arriving in front
of it."
-`--mode std --resolution 1080p --aspect_ratio 16:9 --duration 5`.
+seedance: `--mode std --resolution 1080p --aspect_ratio 16:9 --duration 5`; kling3_0:
+`--mode std --sound off --aspect_ratio 16:9 --duration 5`. Connectors need `--end-image`
+→ use a roster model that accepts it (Step 4).
## Copy per section (for the engine config)
diff --git a/plugins/scroll-world/skills/scroll-world/references/scrub-engine.js b/plugins/scroll-world/skills/scroll-world/references/scrub-engine.js
index 9d89eb5..6f67324 100644
--- a/plugins/scroll-world/skills/scroll-world/references/scrub-engine.js
+++ b/plugins/scroll-world/skills/scroll-world/references/scrub-engine.js
@@ -15,13 +15,34 @@
nav: true, // show the top section nav
atmosphere: true, // subtle gradient + drifting particles behind the clips
sections: [
- { id, label, still, clip, accent,
+ { id, label, still, clip, clipMobile, accent,
+ scroll: 1.6, // optional per-section override of diveScroll — more scroll
+ // distance = a slower, longer dwell in this scene
+ linger: 0.5, // optional 0..1 — remaps time so the camera settles mid-scene
+ // (exactly where the copy peaks) and moves quicker at the
+ // edges. 0 = linear (default). Keep ≤ 0.6; 1 = full pause.
eyebrow, title, body, tags:[…],
cta:{ primary:{label,href}, secondary:{label,href} } }, // last section only
…
],
- connectors: [clipUrl, …], // length = sections.length - 1 (nulls allowed)
- });
+ connectors: [clipUrl, …], // length = sections.length - 1 (nulls allowed)
+ connectorsMobile: [clipUrl, …], // optional lighter connectors for phones (same length)
+
+ MOBILE (the clipMobile/connectorsMobile variants are the opt-in "mobile beta";
+ the rest of the phone handling below is always on)
+ The engine is phone-aware out of the box: on a coarse-pointer / ≤860px viewport it
+ - loads `clipMobile` / `connectorsMobile` when provided (encode these smaller +
+ tighter-GOP — seek cost on a phone decoder is dominated by frames-from-keyframe,
+ so a 720p, -g 4 file scrubs far smoother than the 1080p desktop master; see
+ pipeline.md). Falls back to the desktop `clip` if no mobile variant is given.
+ - coalesces seeks (never issues a new currentTime while the decoder is still
+ `seeking`) so fast flicks can't pile up and freeze the video.
+ - keeps the still as a live poster until the clip actually paints its first frame,
+ and primes each video (muted play→pause) on first touch — this is what stops iOS
+ from showing a blank scene before the first seek.
+ - drops the drifting particles and ignores URL-bar-only resizes (no scroll jump).
+ Nothing here is required — a config with only `clip`/`connectors` still works on
+ phones; the mobile variants just make it lighter and smoother.
THEME (CSS custom properties; set on the container or :root to override)
--sw-bg page background (match your scene bg for seamless posters)
@@ -33,14 +54,22 @@
REQUIREMENTS ON YOUR ASSETS
- clips encoded native-res, crf~20, -g 8, +faststart, no audio (see pipeline.md)
- connectors' endpoints are the neighbouring dives' ACTUAL frames (see SKILL Step 5)
+ - (optional) mobile variants at ~720p, -g 4 for smoother phone scrubbing
The engine loads each clip as a Blob (always seekable) and scrubs currentTime; it does
NOT depend on HTTP byte-range support.
========================================================================== */
function mountScrollWorld(container, config) {
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+ // Phone detection. `coarse` is captured once (input type doesn't change mid-session);
+ // the ≤860px query is read live via isMobile() so a desktop resize/DevTools toggle
+ // switches sources and seek behaviour without a reload.
+ const coarse = window.matchMedia('(hover: none) and (pointer: coarse)').matches;
+ const smallMQ = window.matchMedia('(max-width: 860px)');
+ const isMobile = () => coarse || smallMQ.matches;
const SECTIONS = config.sections || [];
const CONNECTORS = config.connectors || [];
+ const CONNECTORS_M = config.connectorsMobile || [];
const DIVE_W = config.diveScroll || 1.3;
const CONN_W = config.connScroll || 0.9;
const CROSSFADE = (config.crossfade != null) ? config.crossfade : 0.12; // seam dissolve width (vh)
@@ -53,14 +82,15 @@ function mountScrollWorld(container, config) {
// ---- build the interleaved segment chain: dive0, conn0, dive1, … diveN-1 ----
const SEGMENTS = [];
SECTIONS.forEach((s, i) => {
- const dive = { kind: 'dive', si: i, clip: s.clip, still: s.still, accent: s.accent, w: DIVE_W };
+ const dive = { kind: 'dive', si: i, clip: s.clip, clipM: s.clipMobile, still: s.still, accent: s.accent,
+ w: s.scroll || DIVE_W, linger: s.linger || 0 };
SEGMENTS.push(dive);
s._seg = dive;
// A connector is optional: if connectors[i] is falsy, the two dives simply
// crossfade directly (no fly-over). Lets a page complete even when a
// connector can't be generated (e.g. a content-filter false-positive).
if (i < N - 1 && CONNECTORS[i]) {
- SEGMENTS.push({ kind: 'conn', si: i, clip: CONNECTORS[i],
+ SEGMENTS.push({ kind: 'conn', si: i, clip: CONNECTORS[i], clipM: CONNECTORS_M[i],
still: SECTIONS[i + 1].still, accent: SECTIONS[i + 1].accent, w: CONN_W });
}
});
@@ -136,10 +166,16 @@ function mountScrollWorld(container, config) {
// ---- math ----
const clamp = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x));
const smooth = x => { x = clamp(x); return x * x * (3 - 2 * x); };
+ // Per-section dwell: monotone remap of scroll→time so the camera settles mid-scene
+ // (where the copy peaks) and moves quicker near the seams. L=0 linear, L=1 full
+ // mid-scene pause. f(0)=0, f(1)=1 always, so seam frames are untouched.
+ const lingerEase = (x, L) => { L = clamp(L); const c = x - 0.5; return (1 - L) * x + L * (4 * c * c * c + 0.5); };
let vh = window.innerHeight, stageX = 0, totalW = 0, activeIndex = -1, ticking = false;
+ let laidOutW = window.innerWidth; // width the current layout was computed at (see onResize)
function layout() {
vh = window.innerHeight;
+ laidOutW = window.innerWidth;
stageX = window.innerWidth > 860 ? 4 : 0;
let off = 0;
SEGMENTS.forEach(s => { s.start = off * vh; off += s.w; s.end = off * vh; });
@@ -154,17 +190,25 @@ function mountScrollWorld(container, config) {
}
function loadClip(s) {
- if (s.loading || !s.clip) return;
+ // Under prefers-reduced-motion we never load the clips at all — the stills stay up
+ // and simply cross-dissolve as you scroll. No scrubbed video motion, no decode cost.
+ if (reduce || s.loading || !s.clip) return;
s.loading = true;
- fetch(s.clip).then(r => r.ok ? r.blob() : Promise.reject(new Error('404')))
+ // Serve the lighter mobile encode on phones when one was provided.
+ const url = (isMobile() && s.clipM) ? s.clipM : s.clip;
+ fetch(url).then(r => r.ok ? r.blob() : Promise.reject(new Error('404')))
.then(blob => {
const v = document.createElement('video');
v.className = 'sw-scene__video';
v.muted = true; v.playsInline = true; v.preload = 'auto';
v.setAttribute('muted', ''); v.setAttribute('playsinline', '');
v.src = URL.createObjectURL(blob);
- v.addEventListener('loadedmetadata', () => { s.ready = true; s.el.classList.add('has-clip'); read(); });
- v.addEventListener('loadeddata', () => { try { v.pause(); } catch (e) {} });
+ v.addEventListener('loadedmetadata', () => { s.ready = true; read(); });
+ // Reveal the video (hide the still poster) only once a real frame has
+ // painted — on iOS a seeked-but-never-played muted video stays blank, so
+ // hiding the still on metadata alone would flash an empty scene.
+ v.addEventListener('seeked', () => { s.el.classList.add('has-clip'); }, { once: true });
+ v.addEventListener('loadeddata', () => { try { v.pause(); } catch (e) {} if (userReady) primeVideo(v); });
s.el.appendChild(v); s.video = v; s.hasClip = true;
}).catch(() => { s.loading = false; });
}
@@ -179,7 +223,7 @@ function mountScrollWorld(container, config) {
const s = SEGMENTS[i];
if (y > s.start - 1.6 * vh && y < s.end + 1.6 * vh) loadClip(s);
const local = clamp((y - s.start) / (s.end - s.start), 0, 1);
- s.target = local;
+ s.target = s.linger ? lingerEase(local, s.linger) : local;
let outside = 0;
if (y < s.start) outside = s.start - y; else if (y > s.end) outside = y - s.end;
const op = smooth(1 - outside / fade);
@@ -221,21 +265,54 @@ function mountScrollWorld(container, config) {
}
function raf() {
+ const eps = isMobile() ? 0.02 : 0.008; // coarser seek step on phones = fewer decodes
for (let i = 0; i < NSEG; i++) {
const s = SEGMENTS[i];
if (!s.hasClip || !s.ready || !s.video) continue;
+ // Never queue a seek while the decoder is still resolving the last one.
+ // On phones a fast flick would otherwise pile up seeks and freeze the clip;
+ // cur keeps lerping, so we snap to the latest target the moment it's free.
+ if (s.video.seeking) continue;
if (!s.visible && Math.abs(s.cur - s.target) < 0.002) continue;
s.cur += (s.target - s.cur) * (reduce ? 1 : 0.18);
const dur = s.video.duration || 1;
const t = clamp(s.cur, 0, 0.999) * dur;
- if (Math.abs(s.video.currentTime - t) > 0.008) { try { s.video.currentTime = t; } catch (e) {} }
+ if (Math.abs(s.video.currentTime - t) > eps) { try { s.video.currentTime = t; } catch (e) {} }
}
requestAnimationFrame(raf);
}
- seedParticles(particles, reduce);
+ // iOS needs a user gesture before a muted video will decode/paint reliably. On the
+ // first touch we prime every loaded clip (muted play→pause) so the first seek is
+ // instant instead of showing a blank frame. `userReady` also makes freshly-loaded
+ // clips prime themselves (see loadClip).
+ let userReady = false;
+ function primeVideo(v) {
+ if (!isMobile() || !v) return;
+ try { const p = v.play(); if (p && p.then) p.then(() => { try { v.pause(); } catch (e) {} }).catch(() => {}); }
+ catch (e) {}
+ }
+ function onFirstGesture() {
+ if (userReady) return;
+ userReady = true;
+ SEGMENTS.forEach(s => primeVideo(s.video));
+ }
+ window.addEventListener('pointerdown', onFirstGesture, { once: true, passive: true });
+ window.addEventListener('touchstart', onFirstGesture, { once: true, passive: true });
+
+ // Particles are a per-frame cost we can't afford alongside video scrubbing on a phone.
+ seedParticles(particles, reduce || coarse);
window.addEventListener('scroll', () => { if (!ticking) { ticking = true; requestAnimationFrame(read); } }, { passive: true });
- window.addEventListener('resize', layout);
+ // Mobile browsers fire `resize` every time the URL bar slides in/out. Re-running
+ // layout() there rebuilds the track height and yanks the scroll position, so on
+ // touch we ignore height-only changes and only relayout when the width actually
+ // changes (rotation still comes through orientationchange). layout() records the
+ // width it laid out at.
+ function onResize() {
+ if (coarse && window.innerWidth === laidOutW) return;
+ layout();
+ }
+ window.addEventListener('resize', onResize);
window.addEventListener('orientationchange', layout);
window.addEventListener('load', layout);
layout();
@@ -330,9 +407,25 @@ function injectCSS() {
@media (max-width:860px){
.sw-nav{display:none;}
.sw-copylayer::before{width:100%;height:60%;top:auto;bottom:0;background:linear-gradient(0deg,var(--sw-bg) 8%,color-mix(in srgb,var(--sw-bg) 70%,transparent) 46%,transparent 100%);}
+ /* Anchor copy to the bottom, clear of the home indicator / collapsing URL bar.
+ dvh + env() are progressive: browsers that lack them keep the vh fallback line. */
.sw-copy{left:clamp(18px,5vw,64px);right:clamp(18px,5vw,64px);top:auto;bottom:clamp(64px,14vh,120px);transform:none;width:auto;max-width:560px;}
- .sw-copy__body{max-width:none;} .sw-scene__video,.sw-scene__still{object-position:center 46%;}
- .sw-route{gap:16px;right:8px;} .sw-route__label{display:none;}
+ .sw-copy{bottom:calc(clamp(56px,12dvh,110px) + env(safe-area-inset-bottom));}
+ .sw-copy__title{font-size:clamp(1.9rem,7.5vw,2.7rem);}
+ .sw-copy__body{max-width:none;font-size:clamp(.98rem,3.6vw,1.1rem);} .sw-scene__video,.sw-scene__still{object-position:center 46%;}
+ .sw-hint{bottom:calc(20px + env(safe-area-inset-bottom));}
+ .sw-route{gap:16px;right:6px;} .sw-route__label{display:none;}
+ }
+ /* Portrait phones crop a 16:9 clip hard; keep the framing centred so the focal
+ subject (which the camera dives toward) stays in view. */
+ @media (max-width:860px) and (orientation:portrait){
+ .sw-scene__video,.sw-scene__still{object-position:center 44%;}
+ }
+ /* Touch: give the route dots a finger-sized hit area without growing the visible dot. */
+ @media (hover:none) and (pointer:coarse){
+ .sw-route{padding:14px 6px;}
+ .sw-route__dot{width:28px;height:28px;}
+ .sw-btn{padding:15px 26px;}
}
@media (prefers-reduced-motion:reduce){ .sw-hint i::after{animation:none;} .sw-pt{display:none;} }
`;