/* ==========================================================================
   The Activity world (Builder L): the land, the friends, the HUD, the arrival,
   the map and the touch buttons. The game room and the "All games" sheet are
   styled in world-room.css (Builder R).
   Land units: every layer is scaled by JS; --sw (outline), --sw2 and --shd
   (hard shadow offset) are set in layer units so they stay 3px / 2px / 5px on screen.
   ========================================================================== */

html.w-land, html.w-land body { height: 100%; overflow: hidden; overscroll-behavior: none; scrollbar-gutter: auto; }
html.w-land body { background: #bfe6f3; }
.wbody { --bar-space: calc(var(--nav-top) + var(--nav-h) + 10px); }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink); font: 700 15px/1 var(--font-display); }
.skip-link:focus { top: 10px; }
html.menu-open .skip-link, body.menu-open .skip-link { visibility: hidden; }
html.w-land .bar__pill::before { opacity: 1; }  /* on phones the bar keeps its paper face over the sky */
.wnoscript { position: relative; z-index: 2; max-width: 640px; margin: 140px auto 0; padding: 0 var(--gutter); font-size: var(--body-max); }

/* ---------- the stage ---------- */
.wstage {
  position: fixed; inset: 0; z-index: 1;
  overflow: hidden; overflow: clip;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: #cdeef7;
  contain: strict;
  cursor: pointer;
  --sw: 3px; --sw2: 2px; --shd: 5px;
}
.wstage[hidden] { display: none; }
.wsky { position: absolute; inset: 0; pointer-events: none; }
.wsky__l { position: absolute; inset: 0; }
.wsky__m { background: linear-gradient(180deg, #7cc8e8 0%, #a5dcef 38%, #d8f1f4 66%, #fff4dc 100%); }
.wsky__g { background: linear-gradient(180deg, #86c4e6 0%, #bfe0e6 30%, #ffe2a8 64%, #ffd08a 100%); opacity: 0; }
.wsky__d { background: linear-gradient(180deg, #9d9be6 0%, #c99be0 30%, #ffa8c4 62%, #ffd2a8 100%); opacity: 0; }
.wsky__stars { position: absolute; inset: 0 0 40% 0; opacity: 0; }
.wsky__stars svg { position: absolute; fill: #fffbe0; }
.wsun { position: absolute; left: 0; top: 0; width: 240px; height: 240px; margin: -120px 0 0 -120px; pointer-events: auto; cursor: pointer; }
.wsun__svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wsun__rays { transform-box: view-box; transform-origin: 50% 50%; animation: w-spin 60s linear infinite; }
.wsun__dusk { opacity: 0; }
.wsky__cloud { position: absolute; top: 0; left: 0; width: 200px; opacity: .92; }

.wworld { position: absolute; inset: 0; transform-origin: 50% 50%; }
.wl { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; pointer-events: none; }
.wp { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.wc { position: absolute; bottom: 0; width: 2000px; height: 0; }
.wc.is-off { display: none; }
.wi { position: absolute; }
.wi > svg.pc, .wi > .pc { position: absolute; left: 0; bottom: 0; display: block; overflow: visible; }
.pc { filter: drop-shadow(var(--shd) var(--shd) 0 rgba(16, 36, 74, .2)); }
.pc.ground, .pc.meadow, .pc.hillfar, .pc.rainbow { filter: none; }
.wl--far .pc { filter: drop-shadow(var(--shd) var(--shd) 0 rgba(16, 36, 74, .07)); }
.wl--mid .pc { filter: drop-shadow(var(--shd) var(--shd) 0 rgba(16, 36, 74, .12)); }
.o { stroke: #10244a; stroke-width: var(--sw); stroke-linejoin: round; stroke-linecap: round; }
.o2 { stroke: rgba(16, 36, 74, .3); stroke-width: var(--sw2); stroke-linejoin: round; }
.ol > * { fill: #10244a; stroke: #10244a; stroke-width: calc(var(--sw) * 2); stroke-linejoin: round; }
.wl--far .ol > * { stroke-width: calc(var(--sw2) * 2); fill: rgba(16, 36, 74, .3); stroke: rgba(16, 36, 74, .3); }
.wl--mid .ol > * { stroke-width: calc(var(--sw2) * 2); }
.wl--mid .o, .wl--far .o { stroke-width: var(--sw2); }

/* tints over the far scenery for the journey (opacity only) */
.wtint { position: fixed; inset: 0; pointer-events: none; }
.wtint span { position: absolute; inset: 0; opacity: 0; }
.wtint__gold { background: linear-gradient(180deg, rgba(255, 196, 92, .0) 20%, rgba(255, 186, 92, .22) 100%); }
.wtint__dusk { background: linear-gradient(180deg, rgba(150, 110, 210, .18) 10%, rgba(255, 110, 160, .22) 100%); }

.wfx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wscreen { position: absolute; inset: 0; pointer-events: none; }
.wfade { position: absolute; inset: 0; background: var(--cream); opacity: 0; pointer-events: none; }
.wspeed { position: absolute; inset: 0; opacity: 0; pointer-events: none; overflow: hidden; }
.wspeed i { position: absolute; left: -10%; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .85); animation: w-streak .32s linear infinite; }
@keyframes w-streak { from { transform: translateX(120vw); } to { transform: translateX(-40vw); } }

/* ---------- ambient life (slow) ---------- */
@keyframes w-spin { to { transform: rotate(360deg); } }
@keyframes w-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes w-sway-s { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
@keyframes w-wob { 0%, 100% { transform: rotate(-.8deg); } 50% { transform: rotate(.8deg); } }
@keyframes w-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes w-drift { 0%, 100% { transform: translateX(-14px); } 50% { transform: translateX(14px); } }
@keyframes w-smoke { 0% { transform: translate(0, 10px) scale(.6); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(10px, -40px) scale(1.3); opacity: 0; } }
@keyframes w-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes w-blink { 0%, 86%, 100% { opacity: 0; } 90%, 96% { opacity: .9; } }
@keyframes w-turn { 0%, 40% { transform: scaleX(1); } 50%, 90% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
@keyframes w-twinkle { 0%, 100% { transform: scale(.5); opacity: .2; } 50% { transform: scale(1.1); opacity: 1; } }
@keyframes w-spinstar { 0%, 100% { transform: translateY(0) rotate(-9deg) scale(1); } 50% { transform: translateY(-9px) rotate(9deg) scale(1.1); } }
@keyframes w-waves { from { transform: translateX(0); } to { transform: translateX(-60px); } }

.wpl__sails { animation: w-spin 16s linear infinite; }
.wpl__sails.is-fast { animation-duration: 1.6s; }
.wpl__smoke circle { transform-box: fill-box; transform-origin: center; animation: w-smoke 3.4s ease-out infinite; }
.wpl__smoke circle:nth-child(2) { animation-delay: -1.1s; }
.wpl__smoke circle:nth-child(3) { animation-delay: -2.2s; }
.wpl__pennant, .wpl__ribbon { transform-box: fill-box; transform-origin: 0 50%; animation: w-sway 3.2s ease-in-out infinite; }
.wpl__ribbon { transform-origin: 50% 0; animation-name: w-sway-s; }
.wpl__card { transform-box: fill-box; transform-origin: 50% 0; animation: w-sway 3.6s ease-in-out infinite; }
.wpl__vane { transform-box: fill-box; transform-origin: 50% 50%; animation: w-turn 7s ease-in-out infinite; }
.wpl__blink { animation: w-blink 5s ease-in-out infinite; opacity: 0; }
.wpl__blinkdot { animation: w-glow 1.6s ease-in-out infinite; }
.wpl__lamp { animation: w-glow 2.6s ease-in-out infinite; }
.wpl__twinkle { transform-box: fill-box; transform-origin: center; animation: w-twinkle 2.8s ease-in-out infinite; }
.bf { transform-box: fill-box; transform-origin: 50% 0; animation: w-sway-s 2.8s ease-in-out infinite; }
.sway-kite > svg { transform-origin: 50% 100%; animation: w-sway-s 4.6s ease-in-out infinite; }
.drift > svg { animation: w-drift 9s ease-in-out infinite; }
.bob > svg { animation: w-bob 3.4s ease-in-out infinite; }
.swing > svg { transform-origin: 50% 0; animation: w-sway-s 3.8s ease-in-out infinite; }
.wwaves { animation: w-waves 2.4s linear infinite; }
.tree-wrap > svg { transform-origin: 50% 100%; animation: w-wob 6s ease-in-out infinite; }
.tree-wrap:nth-child(2n) > svg { animation-duration: 7.4s; animation-delay: -2s; }
.wstar > svg { transform-origin: 50% 50%; animation: w-spinstar 2.6s ease-in-out infinite; }
.wstar:nth-child(3n) > svg { animation-delay: -.9s; }
.wstar:nth-child(3n+1) > svg { animation-delay: -1.7s; }
.wstar.is-got { visibility: hidden; }
.wballoon > svg { animation: w-bob 3s ease-in-out infinite; }
.wballoon.is-popped { visibility: hidden; }
.ln__glow { animation: w-glow 2.4s ease-in-out infinite; }

/* things that answer: hit areas */
.wthing { pointer-events: auto; cursor: pointer; }
.wflower .fl__petals { transform-box: view-box; transform-origin: 30px 26px; transform: scale(.45); transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.wflower.is-open .fl__petals { transform: scale(1); }
.near-flower .fl__petals { transform: none; }
.wprop { position: absolute; inset: 0; width: 100%; height: 100%; display: block; filter: drop-shadow(var(--shd) var(--shd) 0 rgba(16, 36, 74, .18)); }
.wprop-wrap { pointer-events: auto; }
.arch-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 calc(var(--sw) * 1.4) 0 #fff) drop-shadow(0 calc(var(--sw) * -1.4) 0 #fff) drop-shadow(calc(var(--sw) * 1.4) 0 0 #fff) drop-shadow(calc(var(--sw) * -1.4) 0 0 #fff) drop-shadow(var(--shd) var(--shd) 0 rgba(16, 36, 74, .2)); }

/* ---------- the places ---------- */
.wplace { position: absolute; left: 0; bottom: 0; pointer-events: auto; cursor: pointer; }
.wplace__pop { position: absolute; inset: 0; transform-origin: 50% 100%; }
.wplace .wpl__art { position: absolute; left: 0; bottom: 0; }
.wplace__glow { position: absolute; left: 50%; bottom: -10px; width: 420px; height: 300px; margin-left: -210px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 214, 102, .75), rgba(255, 214, 102, 0)); opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.wplace.is-near .wplace__glow { opacity: 1; }
.wplace__sign { position: absolute; width: 132px; transform-origin: 50% 0; animation: w-sway-s 3.6s ease-in-out infinite; pointer-events: none; }
.wplace__ropes { display: block; margin: 0 auto; width: 70px; border-left: var(--sw) solid var(--ink); border-right: var(--sw) solid var(--ink); }
.wplace__sign--post .wplace__ropes { width: 0; border-right: 0; border-left-width: calc(var(--sw) * 3.4); border-color: #7c4a24; }
.wplace__board { display: block; width: 132px; height: 132px; border-radius: 50%; background: var(--paper); border: var(--sw) solid var(--ink); box-shadow: 0 0 0 calc(var(--sw) * 3) var(--acc) inset, var(--shd) var(--shd) 0 rgba(16, 36, 74, .2); overflow: hidden; }
.wplace__board img { display: block; width: 116px; height: 116px; margin: 8px; object-fit: contain; }
.wplace__title {
  position: absolute; left: 50%; transform: translateX(-50%) rotate(-2deg);
  padding: 10px 28px 4px; border-radius: 20px;
  background: var(--paper); color: var(--ink);
  border: var(--sw) solid var(--ink);
  box-shadow: 0 calc(var(--sw) * 1.8) 0 var(--ink), inset 0 -12px 0 var(--acc-l);
  font: 800 46px/1.05 var(--font-display); white-space: nowrap; pointer-events: none;
}
.wplace__title { transition: opacity .2s ease; }
.wplace.is-near .wplace__title { opacity: 0; }
.wplace__flag { position: absolute; width: 60px; height: 90px; margin-left: -9px; transform-origin: 9px 100%; transform: scale(0); opacity: 0; transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease; pointer-events: none; }
.wplace__flag svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wplace__flag path.o { transform-box: fill-box; transform-origin: 0 50%; animation: w-sway 2.4s ease-in-out infinite; }
.wplace.is-visited .wplace__flag { transform: scale(1); opacity: 1; }
.wdoor {
  position: absolute; left: 180px; bottom: 0; width: 160px; height: 262px; padding: 0; display: block;
  border: var(--sw) solid var(--ink); border-radius: 80px 80px 12px 12px;
  background: #2a1d3a; overflow: hidden; perspective: 600px;
}
.wdoorbtn { position: absolute; bottom: 6px; width: 160px; height: 262px; padding: 0; border: 0; border-radius: 80px 80px 12px 12px; background: transparent; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.wdoorbtn:focus-visible { outline: calc(var(--sw) * 2.4) solid var(--gold); outline-offset: calc(var(--sw) * 2); }
.wdoor__in { position: absolute; inset: 0; background: radial-gradient(circle at 50% 70%, #fff3c4 0%, #ffcf6b 45%, #f6a313 100%); }
.wdoor__panel {
  position: absolute; inset: 0; transform-origin: 0 50%;
  background: repeating-linear-gradient(90deg, var(--acc-d) 0 30px, color-mix(in srgb, var(--acc-d) 80%, #000) 30px 34px);
  border-right: var(--sw) solid var(--ink);
}
.wdoor__knob { position: absolute; right: 22px; top: 54%; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); border: var(--sw) solid var(--ink); }
.wplace.is-near .wdoor { box-shadow: 0 0 0 calc(var(--sw) * 2.2) var(--gold-light), 0 0 40px 10px rgba(255, 207, 107, .8); }
.wplace.is-near .wdoor__panel { animation: w-knock 1.6s ease-in-out infinite; }
@keyframes w-knock { 0%, 70%, 100% { transform: rotateY(0); } 80% { transform: rotateY(-14deg); } 90% { transform: rotateY(-4deg); } }

/* the Make something signpost */
.wmake-wrap { pointer-events: auto; }
.wmake { position: absolute; inset: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.wmake__post { position: absolute; left: 50%; bottom: 0; width: 22px; height: 360px; margin-left: -11px; border-radius: 8px; background: #a0612f; border: var(--sw) solid var(--ink); }
.wmake__board { position: absolute; left: 0; right: 0; top: 30px; padding: 16px 10px 12px; border-radius: 18px; background: var(--pink); color: #fff; border: var(--sw) solid var(--ink); box-shadow: 0 calc(var(--sw) * 1.8) 0 var(--ink); font: 800 40px/1 var(--font-display); text-align: center; transform: rotate(-3deg); transform-origin: 50% 100%; }
.wmake:focus-visible .wmake__board { outline: calc(var(--sw) * 2) solid var(--gold); outline-offset: calc(var(--sw) * 2); }

/* ---------- the friends ---------- */
.wp--actors { z-index: 2; }
.wsp { position: absolute; left: 0; bottom: 0; width: 0; height: 0; pointer-events: none; }
.wsp.is-off { display: none; }
.wsp__body { position: absolute; left: 0; bottom: 0; width: 0; height: 0; transform-origin: 0 0; }
.wsp__flip { position: absolute; left: 0; bottom: 0; width: 0; height: 0; }
.wsp__img { position: absolute; background-repeat: no-repeat; }
.wsp__shadow { position: absolute; left: -75px; bottom: -14px; width: 150px; height: 30px; border-radius: 50%; background: rgba(16, 36, 74, .24); transform-origin: 50% 50%; }
.wsp__paper { display: none; position: absolute; left: -55px; bottom: 0; width: 110px; height: 200px; border-radius: 55px 55px 22px 22px; background: var(--paper); border: var(--sw) solid var(--ink); box-shadow: var(--shd) var(--shd) 0 rgba(16, 36, 74, .2); }
.whost { pointer-events: auto; cursor: pointer; }
.whost .wsp__hit { position: absolute; left: -70px; bottom: 0; width: 140px; height: 220px; pointer-events: auto; }
.whost.is-loading .wsp__body { opacity: 0; }
.whost .wsp__body { transition: opacity .3s ease; }

/* ---------- screen overlays: heading, hint, bubble, tap marker ---------- */
.wheading { position: absolute; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; opacity: 0; }
.wheading__card { display: inline-block; padding: 14px 36px 6px; border-radius: 28px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 7px 0 var(--ink); font: 800 clamp(40px, 6.4vw, 92px)/1 var(--font-display); color: var(--ink); transform: rotate(-2deg); }
.wheading__card em { font-style: normal; color: var(--pink); }
.whint { position: absolute; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 28px; align-items: flex-end; pointer-events: none; opacity: 0; }
.whint__grp { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.whint__keys { display: flex; gap: 6px; }
.whint__key { display: grid; place-items: center; min-width: 48px; height: 48px; padding: 0 10px; border-radius: 12px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font: 800 22px/1 var(--font-display); color: var(--ink); animation: w-press 1.4s ease-in-out infinite; }
.whint__key:nth-child(2) { animation-delay: .7s; }
.whint__key--wide { min-width: 96px; font: 800 15px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; }
@keyframes w-press { 0%, 60%, 100% { transform: translateY(0); box-shadow: 0 4px 0 var(--ink); } 70%, 80% { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); } }
.whint__word { padding: 5px 12px 3px; border-radius: 999px; background: var(--ink); color: var(--cream); font: 800 15px/1 var(--font-label); letter-spacing: .1em; text-transform: uppercase; }
.whint--touch { bottom: calc(116px + env(safe-area-inset-bottom)); justify-content: space-between; padding: 0 calc(16px + env(safe-area-inset-left)) 0 calc(16px + env(safe-area-inset-left)); }
.whint--touch .whint__grp:first-child { width: 158px; }
.whint--touch .whint__grp:last-child { width: 88px; margin-right: env(safe-area-inset-right); }
.whint__arrow { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; animation: w-bob 1.1s ease-in-out infinite; }

/* Hidden, the bubble is out of the Tab order and the reading order too (visibility waits for the fade-out). */
.wbubble { position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: visibility 0s linear .16s; }
.wbubble.is-on { pointer-events: auto; visibility: visible; transition-delay: 0s; }
.wbubble__in { position: absolute; left: 0; top: 0; width: max-content; transform: translate(-50%, -100%); }  /* max-content: the box has no width of its own, and a long title (Brick Math) used to spill out */
.wbubble__card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; transform-origin: 50% 100%; padding: 14px 20px 16px; border-radius: 24px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink); }
.wbubble__card::after { content: ""; position: absolute; left: 50%; bottom: -14px; width: 24px; height: 24px; margin-left: -12px; background: var(--paper); border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); border-radius: 0 0 6px 0; }
.wbubble__title { font: 800 26px/1 var(--font-display); color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.wbubble__title img { width: 40px; height: 40px; }
.wbubble__play { min-width: 150px; height: 58px; font-size: 22px; }
.wbubble__play svg { width: 22px; height: 22px; fill: var(--ink); }
.wtap { position: absolute; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--ink); opacity: 0; pointer-events: none; }

/* the friend chooser */
/* While the child is choosing, the friends standing in the land step out of the picture, so no friend is seen twice. */
html.w-choosing .whost, html.w-choosing .wplayer { opacity: 0 !important; }
.wchoose { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: calc(var(--bar-space) + 10px) 16px calc(20px + env(safe-area-inset-bottom)); pointer-events: auto; background: radial-gradient(ellipse at 50% 60%, rgba(255, 247, 232, .85), rgba(255, 247, 232, .35) 70%); }
.wchoose__title { padding: 12px 30px 6px; border-radius: 24px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink); font: 800 clamp(30px, 5vw, 64px)/1 var(--font-display); color: var(--ink); transform: rotate(-1.5deg); text-align: center; }
.wchoose__row { display: flex; gap: clamp(4px, 2vw, 26px); align-items: flex-end; justify-content: center; flex-wrap: nowrap; }
.wchoose__f { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: clamp(64px, 16vw, 190px); padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wchoose__pic { position: relative; width: 100%; aspect-ratio: 3 / 4; }
.wchoose__pic .wsp { left: 50%; bottom: 8%; }
.wchoose__name { padding: 6px 12px 4px; border-radius: 10px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font: 800 clamp(14px, 1.6vw, 20px)/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.wchoose__f:hover .wchoose__name, .wchoose__f:focus-visible .wchoose__name { background: var(--gold); }
.wchoose__f:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 12px; }
.wchoose:focus { outline: none; }
@media (max-width: 600px) {
  .wbubble__card { padding: 10px 16px 12px; gap: 8px; border-radius: 20px; }
  .wbubble__title { font-size: 22px; }
  .wbubble__title img { width: 32px; height: 32px; }
  .wbubble__play { height: 50px; min-width: 130px; font-size: 20px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .wchoose__row { flex-wrap: wrap; row-gap: 14px; max-width: 380px; }
  .wchoose__f { width: 29vw; max-width: 120px; }
}

/* ---------- HUD ---------- */
.whud {
  position: fixed; z-index: 20; left: 0; right: 0; top: calc(var(--nav-top) + var(--nav-h) + 10px);
  width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none;
}
.whud[hidden] { display: none; }
.whud__left { order: 0; } .whud__right { order: 1; }
.whud__left, .whud__right { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.whud__face { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: var(--gold-light); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); flex: none; }
button.whud__face { padding: 0; cursor: pointer; }
.whud__face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.whud__stars { display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 16px 0 10px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.whud__stars svg { width: 28px; height: 28px; fill: var(--gold); stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.whud__stars b { font: 800 24px/1 var(--font-display); color: var(--ink); min-width: 1ch; font-variant-numeric: tabular-nums; padding-top: 3px; }
.whud__btn { display: inline-flex; align-items: center; gap: 7px; height: 48px; padding: 0 16px; border-radius: 999px; background: var(--paper); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font: 800 16px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: translate .12s ease; -webkit-tap-highlight-color: transparent; }
.whud__btn:hover { translate: 0 -2px; }
.whud__btn:active { translate: 0 3px; box-shadow: 0 1px 0 var(--ink); }
.whud__btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.whud__btn span { padding-top: 2px; }
.whud__btn--map { order: 1; }
.whud__btn--all { order: 2; background: var(--gold); }
.whud__btn--sound { order: 3; width: 48px; padding: 0; justify-content: center; }
.whud__btn--sound .i-off { display: none; }
.whud__btn--sound.is-muted .i-on { display: none; }
.whud__btn--sound.is-muted .i-off { display: block; }
.whud__btn[aria-expanded="true"] { background: var(--ink); color: var(--cream); }
.whud__btn[aria-expanded="true"] svg { stroke: var(--cream); }
.whud__flystar { position: fixed; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px; z-index: 25; pointer-events: none; fill: var(--gold); stroke: var(--ink); stroke-width: 1.6; }
@media (max-width: 760px) {
  .whud__face { width: 44px; height: 44px; }
  .whud__stars { height: 44px; padding: 0 12px 0 8px; }
  .whud__stars b { font-size: 21px; }
  .whud__btn { height: 44px; padding: 0 11px; gap: 5px; font-size: 14px; }
  .whud__btn--sound { width: 44px; padding: 0; }
  .whud__btn svg { width: 20px; height: 20px; }
}
@media (max-width: 380px) { .whud__btn--map span { display: none; } .whud__btn--map { width: 44px; padding: 0; justify-content: center; } }
/* short landscape phones: the HUD moves to the bottom middle, between the move buttons */
@media (max-height: 500px) and (orientation: landscape) {
  .whud { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; right: auto; width: auto; margin: 0; transform: translateX(-50%); gap: 10px; }
  .whud__btn, .whud__stars { height: 44px; }
  .whud__face { width: 44px; height: 44px; }
  .wchoose { padding-top: calc(var(--bar-space)); gap: 8px; }
  .wchoose__f { width: clamp(64px, 12vw, 120px); }
  .whint--touch { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .wbubble__card { padding: 8px 14px 10px; gap: 6px; }
  .wbubble__title { font-size: 20px; }
  .wbubble__title img { width: 30px; height: 30px; }
  .wbubble__play { height: 46px; min-width: 120px; font-size: 18px; }
}

/* ---------- map ---------- */
.wmap {
  position: fixed; z-index: 30; left: 0; right: 0; top: calc(var(--nav-top) + var(--nav-h) + 70px);
  width: min(100% - 2 * var(--gutter), 980px); margin-inline: auto;
  padding: 16px 16px 14px; border-radius: 26px; background: var(--paper);
  border: 3px solid var(--ink); box-shadow: 0 7px 0 var(--ink);
}
.wmap[hidden] { display: none; }
.wmap__track { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding-top: 30px; }
.wmap__line { position: absolute; left: 4%; right: 4%; top: 64px; height: 0; border-top: 5px dashed #e3c48f; }
.wmap__stop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.wmap__tile { display: grid; place-items: center; width: min(76px, 100%); aspect-ratio: 1; border-radius: 18px; background: var(--acc); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: translate .12s ease; }
.wmap__tile img { width: 86%; height: 86%; object-fit: contain; }
.wmap__stop:hover .wmap__tile { translate: 0 -3px; }
.wmap__name { font: 800 15px/1.05 var(--font-display); text-align: center; }
.wmap__stop.is-visited .wmap__tile::after { content: ""; position: absolute; top: -6px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); border: 2.5px solid var(--ink); }
.wmap__stop:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 14px; }
.wmap__me { position: absolute; top: -2px; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; overflow: hidden; border: 2.5px solid var(--ink); background: var(--gold-light); box-shadow: 0 3px 0 var(--ink); transition: left .3s ease; }
.wmap__me img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
  .wmap { padding: 12px 8px 10px; border-radius: 20px; top: calc(var(--nav-top) + var(--nav-h) + 62px); }
  .wmap__track { gap: 3px; padding-top: 26px; }
  .wmap__line { top: 50px; }
  .wmap__tile { border-radius: 12px; border-width: 2px; box-shadow: 0 3px 0 var(--ink); }
  .wmap__name { font-size: 11px; }
  .wmap__me { width: 32px; height: 32px; margin-left: -16px; }
}
/* Narrow phones: seven stops across, each at least 44px wide (a touch target) and none overlapping. The map takes
   more of the width and the stops touch; at 340px and below it becomes a strip from edge to edge. */
@media (max-width: 400px) {
  .wmap { width: calc(100% - 16px); padding-inline: 4px; }
  .wmap__track { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; }
}
/* The longest names (Scramble, Grammar) are 47px wide at 11px: one size down, they keep apart in the narrower stops. */
@media (max-width: 380px) { .wmap__name { font-size: 10px; } }
@media (max-width: 340px) {
  .wmap { width: 100%; border-left: 0; border-right: 0; border-radius: 0; }
}
@media (max-height: 500px) and (orientation: landscape) { .wmap { top: calc(var(--nav-top) + var(--nav-h) + 8px); } }

/* ---------- touch buttons ---------- */
.wtouch { position: fixed; z-index: 22; inset: auto 0 0 0; height: 0; pointer-events: none; }
.wtouch[hidden] { display: none; }
.wtouch__run { position: fixed; left: calc(16px + env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; gap: 14px; pointer-events: auto; }
.wtouch__btn { display: grid; place-items: center; width: 72px; height: 72px; padding: 0; border-radius: 50%; background: rgba(255, 253, 247, .94); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.wtouch__btn svg { width: 38px; height: 38px; fill: none; stroke: var(--ink); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.wtouch__btn.is-down { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); background: var(--gold-light); }
.wtouch__btn--jump { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); width: 88px; height: 88px; background: var(--gold); pointer-events: auto; }
.wtouch__btn--jump svg { width: 46px; height: 46px; }
@media (max-height: 500px) and (orientation: landscape) {
  .wtouch__btn { width: 64px; height: 64px; }
  .wtouch__btn--jump { width: 78px; height: 78px; }
  .wtouch__run { gap: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .wtouch__btn--jump { bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ---------- still mode (?still) and calm ---------- */
html.w-still .wstage *, html.w-still .wstage *::before, html.w-still .wstage *::after { animation-play-state: paused !important; }
html.w-choosing .whud, html.w-choosing .wtouch, html.w-choosing .wmap { visibility: hidden; }
html:not(.w-land) :is(.wstage, .whud, .wtouch, .wmap) { display: none; }

/* No button in the top row ever drops under a 44px touch target, however narrow the phone. */
.whud .whud__btn { min-width: 44px; }
.whud .whud__btn--sound, .whud .whud__btn--map { flex: none; }
