/* Schattenpad (games-schattenpad.js). Every rule is scoped under .sp-root, except the phone-landscape
   frame override below. Layouts: [data-layout] = tall | wide | compact (chosen from the root's own
   width and height). The board layer (.sp-board) is in board px (1086×1448) and has ONE transform. */

/* Phone held sideways: the app's tall frame would not fit, so while Schattenpad is open the frame takes
   the whole screen (compact layout). Only then; the rest of the app is untouched. */
@media (orientation:landscape) and (max-height:520px){
  /* inset !important: landscape.css centres a short frame with left/top 50% (the runners), which without
     its translate put Schattenpad's top-left corner in the middle of the screen and Start off it */
  html.sp-on .game-frame{position:fixed;inset:0!important;margin:0;width:100vw!important;height:100dvh!important;max-height:none;aspect-ratio:auto;transform:none!important;border-radius:0}
}

.sp-root{
  /* the Kwizillo games' display face (Luckiest Guy, base.css) for titles, buttons and labels; body text
     stays the app's rounded face. Luckiest Guy has no Cyrillic or Arabic letters: there a bold system face. */
  --sp-font:'Kwizillo Arcade',ui-rounded,"SF Pro Rounded","Arial Rounded MT Bold",system-ui,sans-serif;--sp-fw:400;--sp-ls:.03em;
  --sp-ink:#2a0d63;--sp-blue:#123c9c;--sp-deep:#0b1f62;--sp-gold:#ffd23f;--sp-text:#fff;
  --sp-safe-t:var(--sat,env(safe-area-inset-top,0px));--sp-safe-b:var(--sab,env(safe-area-inset-bottom,0px));
  position:absolute;inset:0;overflow:hidden;color:var(--sp-text);
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:"top" "stage" "panel";
  background:#2f9ee8;-webkit-user-select:none;user-select:none;touch-action:manipulation
}
html[lang="ru"] .sp-root,html[lang="ar"] .sp-root{--sp-font:ui-rounded,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;--sp-fw:900;--sp-ls:0}
.sp-root :is(.sp-btn,.sp-card h2,.sp-msg,.sp-player-copy b,.sp-big,.sp-prompt,.sp-start-sign,.sp-zoom,.sp-soon,.sp-keystop b,.sp-bonus-head b,.sp-chip,.sp-rotate-card b,.sp-memo-card,.sp-route b,.sp-brand,.sp-label,.sp-level-name,.sp-tile-name b,.sp-pill){font-family:var(--sp-font);font-weight:var(--sp-fw);letter-spacing:var(--sp-ls)}
.sp-root .sp-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0;pointer-events:none}
.sp-root .sp-loading{position:absolute;inset:0;display:grid;place-content:center;justify-items:center;gap:10px;z-index:2;font-size:18px;text-shadow:0 2px 6px rgba(0,0,40,.6)}
.sp-root>*:not(.sp-bg){position:relative;z-index:1}
.sp-root button{font:inherit;color:inherit;cursor:pointer}
.sp-root button:focus-visible{outline:4px solid #fff;outline-offset:3px;box-shadow:0 0 0 7px rgba(42,13,99,.55)}

/* ---- top bar ---- */
.sp-top{grid-area:top;display:flex;align-items:center;gap:8px;padding:calc(8px + var(--sp-safe-t)) 10px 6px}
.sp-icon-btn{flex:none;width:48px;height:48px;border-radius:50%;border:0;display:grid;place-items:center;
  background:radial-gradient(circle at 35% 30%,#7fc8ff,#1f6fe8 55%,#1340a8);box-shadow:inset 0 -3px 0 rgba(0,0,60,.35),0 4px 10px rgba(0,20,80,.35),0 0 0 3px #8fe3ff}
.sp-icon-btn svg{width:26px;height:26px;color:#fff}
.sp-logo{height:64px;width:auto;margin-inline:auto;filter:drop-shadow(0 4px 6px rgba(40,0,90,.4))}
.sp-player{flex:1;min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:8px;align-items:center;
  padding:5px 10px 6px 5px;border-radius:999px;background:linear-gradient(180deg,rgba(30,94,226,.92),rgba(14,46,150,.92));box-shadow:inset 0 2px 0 rgba(255,255,255,.35),0 0 0 3px rgba(143,227,255,.85),0 6px 14px rgba(0,20,80,.3)}
.sp-portrait{grid-row:1/3;width:46px;height:46px;border-radius:50%;box-shadow:0 0 0 3px var(--sp-gold),0 0 12px rgba(255,210,63,.7);background:#bfe3ff}
.sp-player-copy{min-width:0;line-height:1.05}
.sp-player-copy b{display:block;font-size:17px;color:var(--sp-gold);text-shadow:0 2px 0 var(--sp-ink)}
.sp-player-copy small{display:block;font-size:12px;font-weight:800;opacity:.92;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-keys{grid-row:1/3;grid-column:3;display:flex;align-items:center;gap:1px}
.sp-keys img{width:24px;height:24px;object-fit:contain;filter:grayscale(1) brightness(.55) opacity(.6)}
.sp-keys img.got{filter:drop-shadow(0 0 4px rgba(255,220,90,.9))}
.sp-keys b{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.sp-keys.bump{animation:sp-bump .6s ease}
@keyframes sp-bump{40%{transform:scale(1.3)}}
.sp-progress{grid-column:2;height:7px;border-radius:9px;background:rgba(0,10,60,.45);overflow:hidden}
.sp-progress i{display:block;height:100%;width:0;background:linear-gradient(90deg,#ffe36b,#ffb21f);border-radius:9px;transition:width .4s}

/* ---- the board ---- */
.sp-stage{grid-area:stage;position:relative;overflow:hidden;min-height:0}
.sp-board{position:absolute;left:0;top:0;transform-origin:0 0;will-change:transform}
.sp-board-img{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;filter:drop-shadow(0 30px 30px rgba(0,40,90,.35))}
.sp-stone{position:absolute;width:0;height:0}
.sp-stone .sp-ring{position:absolute;width:150px;left:-75px;top:-34px;opacity:0;transition:opacity .25s;pointer-events:none}
.sp-stone.key .sp-ring{width:250px;left:-125px;top:-55px}
.sp-stone.here .sp-ring,.sp-stone.ahead .sp-ring{opacity:1}
.sp-stone.ahead .sp-ring{animation:sp-pulse 1s ease-in-out infinite alternate}
@keyframes sp-pulse{to{opacity:.45;transform:scale(1.06)}}
.sp-stone .sp-icon{position:absolute;width:50px;height:50px;object-fit:contain;left:-25px;top:-38px;filter:drop-shadow(0 4px 2px rgba(80,50,0,.35));pointer-events:none}
.sp-stone.key .sp-icon{width:92px;height:92px;left:-46px;top:-78px;filter:drop-shadow(0 0 14px rgba(255,215,80,.95)) drop-shadow(0 5px 3px rgba(80,50,0,.4));animation:sp-float 2.4s ease-in-out infinite}
.sp-stone .sp-tick{position:absolute;width:70px;left:-35px;top:-60px;opacity:0;transition:opacity .4s}
.sp-stone.key.solved .sp-icon{opacity:0;animation:none}
.sp-stone.key.solved .sp-tick{opacity:1}
@keyframes sp-float{50%{transform:translateY(-8px)}}
.sp-start-sign{position:absolute;left:-150px;top:-30px;padding:6px 14px;border-radius:10px;background:linear-gradient(#b7773d,#7b4518);color:#fff3d6;font-size:30px;letter-spacing:.04em;box-shadow:0 5px 0 #4f2a0c,0 10px 14px rgba(0,0,0,.3);transform:rotate(-8deg)}
.sp-chest{position:absolute;height:168px;transform:translate(-50%,-98.3%);pointer-events:none;filter:drop-shadow(0 6px 6px rgba(60,30,0,.4))}
.sp-chest.open{opacity:0;transition:opacity .9s}
.sp-chest.open.shown{opacity:1}
.sp-chest.shine{filter:drop-shadow(0 0 18px rgba(255,220,90,1)) drop-shadow(0 6px 6px rgba(60,30,0,.4))}
.sp-parrot{position:absolute;height:120px;transform:translate(-50%,-100%);pointer-events:none;z-index:2000}
.sp-hero{position:absolute;width:0;height:0;z-index:500;pointer-events:none}
.sp-hero-img{position:absolute;display:block;width:230px;height:230px;left:-115px;top:-201px;transform-origin:50% 87.5%;background:no-repeat 0 0/100% 100%}
.sp-hero-shadow{position:absolute;width:120px;height:40px;left:-60px;top:-18px;opacity:.55}
.sp-picks{position:absolute;inset:0;pointer-events:none;z-index:3000}
.sp-pick{position:absolute;width:150px;height:110px;margin:-55px 0 0 -75px;border:0;background:none;padding:0;pointer-events:auto;animation:sp-pulse .8s ease-in-out infinite alternate}
.sp-pick img:first-child{width:150px}
.sp-pick-arrow{position:absolute;width:64px;left:43px;top:-70px;filter:drop-shadow(0 4px 3px rgba(0,0,60,.4))}
.sp-debug{position:absolute;left:0;top:0;z-index:4000;pointer-events:none;font:bold 22px/1 sans-serif}
.sp-debug line{stroke:#ff2d55;stroke-width:4}
.sp-debug line.fly{stroke:#ffcc00;stroke-dasharray:12 8}
.sp-debug line.bridge{stroke:#00e5ff}
.sp-debug circle{fill:#ff2d55;stroke:#fff;stroke-width:2}
.sp-debug text{fill:#fff;stroke:#000;stroke-width:4px;paint-order:stroke}
.sp-zoom{position:absolute;right:10px;bottom:8px;min-height:44px;padding:0 16px;border-radius:999px;border:0;background:rgba(12,40,130,.85);box-shadow:0 0 0 2px #8fe3ff;font-weight:900;font-size:14px}

/* ---- panel: message, die, roll ---- */
.sp-panel{grid-area:panel;display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:4px 14px calc(10px + var(--sp-safe-b))}
.sp-msg{margin:0;min-height:22px;text-align:center;font-size:17px;font-weight:900;text-shadow:0 2px 4px rgba(0,20,80,.7)}
.sp-act{display:flex;align-items:center;gap:14px;justify-content:center}
.sp-btn{position:relative;min-height:56px;min-width:44px;padding:0 26px;border:0;background:none;display:inline-grid;place-items:center;
  border-image:url("assets/games/schattenpad/ui/button_gold.webp") 0 90 fill / 0 28px stretch;font-weight:900;font-size:19px;color:var(--sp-ink)!important;filter:drop-shadow(0 5px 6px rgba(40,10,80,.35))}
.sp-btn.blue{border-image-source:url("assets/games/schattenpad/ui/button_blue.webp");color:#fff!important;text-shadow:0 2px 0 rgba(0,0,60,.5)}
.sp-btn.small{min-height:48px;font-size:16px;padding:0 20px}
.sp-btn span{position:relative;top:-1px;white-space:nowrap}
.sp-btn:active:not(:disabled){transform:translateY(2px) scale(.98)}
.sp-btn:disabled{filter:grayscale(.75) brightness(.85);opacity:.75;cursor:default}
/* "Roll the die": the one obvious action. The gold art bigger, a die face, the display face; it breathes
   gently while it is your turn, and turns to flat grey stone (no glow, no pulse) while the die rolls and
   the child walks, so "not now" is clear without reading. */
.sp-roll{flex:1;max-width:360px;min-height:68px;padding:0 22px 0 18px;border-image-width:0 34px;font-size:clamp(18px,5.4vw,24px);display:inline-flex;align-items:center;justify-content:center;gap:10px;
  filter:drop-shadow(0 6px 0 rgba(122,59,0,.55)) drop-shadow(0 10px 14px rgba(40,10,80,.35))}
.sp-btn.sp-roll span{top:0}
.sp-roll .sp-roll-txt{white-space:normal;line-height:1.02;text-align:center;text-wrap:balance;text-shadow:0 2px 0 rgba(255,250,210,.7)}
.sp-roll-ico{flex:none;width:34px;height:34px;display:block;transform:rotate(-10deg)}
.sp-roll-ico svg{width:100%;height:100%;display:block}
/* the pulse is a halo round the button (the button itself stays put, so a tap never misses) */
.sp-roll::after{content:"";position:absolute;inset:4px 10px;border-radius:999px;pointer-events:none;opacity:0}
.sp-roll.ready::after{box-shadow:0 0 0 4px rgba(255,236,140,.9),0 0 26px 6px rgba(255,200,40,.75);animation:sp-breathe 1.5s ease-in-out infinite}
.sp-roll.ready .sp-roll-ico{animation:sp-wiggle 1.5s ease-in-out infinite}
@keyframes sp-breathe{0%,100%{opacity:.15;transform:scale(.97)}50%{opacity:1;transform:scale(1.04)}}
@keyframes sp-wiggle{0%,60%,100%{transform:rotate(-10deg)}70%{transform:rotate(12deg)}80%{transform:rotate(-16deg)}90%{transform:rotate(6deg)}}
.sp-roll:disabled{filter:grayscale(1) brightness(.92) contrast(.85);opacity:1;color:#4a4a5c!important;transform:none;animation:none}
.sp-roll:disabled .sp-roll-txt{text-shadow:none;opacity:.8}
.sp-roll:disabled .sp-roll-ico{opacity:.55;animation:none}

/* the die: a real cube in CSS 3D */
.sp-die-wrap{--d:64px;position:relative;width:var(--d);height:var(--d);flex:none;perspective:420px;display:block;padding:0;border:0;background:none;border-radius:16px}
.sp-die-wrap:disabled{cursor:default}
.sp-die-wrap.ready::after{content:"";position:absolute;inset:-8px;border-radius:22px;box-shadow:0 0 0 3px rgba(255,214,79,.85),0 0 18px rgba(255,214,79,.7);animation:sp-glow 1.5s ease-in-out infinite;pointer-events:none}
@keyframes sp-glow{50%{opacity:.35}}
.sp-die,.sp-cube{display:block}
.sp-die{width:100%;height:100%;transform-style:preserve-3d;transform:rotateX(-16deg) rotateY(20deg)}   /* a slight resting tilt: it reads as a cube, the result face still in front */
.sp-cube{position:relative;width:100%;height:100%;transform-style:preserve-3d;transform:rotateX(0) rotateY(0)}
.sp-face{position:absolute;inset:0;background-size:cover;border-radius:12%;backface-visibility:hidden;box-shadow:inset 0 0 0 1px rgba(150,90,0,.5)}
.sp-face.f1{transform:translateZ(calc(var(--d)/2))}
.sp-face.f6{transform:rotateY(180deg) translateZ(calc(var(--d)/2))}
.sp-face.f2{transform:rotateY(90deg) translateZ(calc(var(--d)/2))}
.sp-face.f5{transform:rotateY(-90deg) translateZ(calc(var(--d)/2))}
.sp-face.f3{transform:rotateX(90deg) translateZ(calc(var(--d)/2))}
.sp-face.f4{transform:rotateX(-90deg) translateZ(calc(var(--d)/2))}
.sp-die-shadow{position:absolute;left:8%;right:8%;bottom:-12px;height:12px;border-radius:50%;background:rgba(0,20,60,.35);filter:blur(3px)}
.sp-die-wrap.rolling .sp-die{animation:sp-hop 1.2s cubic-bezier(.3,.6,.3,1)}
.sp-die-wrap.rolling .sp-die-shadow{animation:sp-shadow 1.2s cubic-bezier(.3,.6,.3,1)}
.sp-die-wrap.landed .sp-die{animation:sp-land .35s ease}
.sp-die-wrap.fade .sp-die{animation:sp-fade .25s ease}
@keyframes sp-hop{0%{translate:0 0;scale:.92}25%{translate:0 -42px;scale:1}55%{translate:0 -10px}75%{translate:0 -16px}100%{translate:0 0}}
@keyframes sp-shadow{25%{transform:scale(.6);opacity:.5}55%{transform:scale(.9)}100%{transform:scale(1)}}
@keyframes sp-land{40%{scale:1.14}}
@keyframes sp-fade{from{opacity:.2}}

/* ---- the modal layer ---- */
.sp-layer{position:absolute!important;inset:0;z-index:20!important;display:grid;place-items:safe center;padding:calc(10px + var(--sp-safe-t)) 12px calc(12px + var(--sp-safe-b));background:rgba(4,18,70,.38);overflow:auto}
.sp-layer[hidden]{display:none}
.sp-layer.low{align-items:end;background:rgba(4,18,70,.12)}
.sp-layer.sheet{background:rgba(4,30,90,.45);backdrop-filter:blur(2px)}
.sp-card{width:min(100%,460px);padding:22px 22px 20px;text-align:center;border:26px solid transparent;border-image:var(--panel) 72 fill / 26px stretch;filter:drop-shadow(0 12px 18px rgba(0,10,60,.45))}
.sp-card.wide{width:min(100%,560px)}
.sp-card h2{margin:0 0 10px;font-size:24px;color:var(--sp-gold);text-shadow:0 3px 0 var(--sp-ink),0 0 10px rgba(0,0,0,.25)}
.sp-sub{margin:4px 0 10px;font-weight:800;opacity:.95}
.sp-big{margin:6px 0 8px;font-size:23px;font-weight:900;text-shadow:0 2px 0 var(--sp-ink)}
.sp-tip{margin:0 0 12px;font-size:17px;font-weight:700;line-height:1.3}
.sp-routes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.sp-route{min-height:44px;border:0;border-radius:20px;padding:12px 8px;display:flex;flex-direction:column;align-items:center;gap:6px;
  background:linear-gradient(180deg,#ffe57a,#ffbf1f);color:var(--sp-ink)!important;box-shadow:inset 0 -5px 0 rgba(150,70,0,.35),0 0 0 3px #7a3ed8,0 8px 12px rgba(0,0,60,.3);font-size:18px}
.sp-ready{display:flex;flex-direction:column;align-items:center;gap:6px;margin-bottom:12px}
.sp-ready>img{width:84px;height:84px;border-radius:50%;box-shadow:0 0 0 4px var(--sp-gold)}
.sp-ready p{margin:0;font-size:19px;font-weight:900;line-height:1.25}
.sp-ready-keys img{width:40px;height:40px;object-fit:contain}
.sp-route-art{display:block;width:100%;aspect-ratio:4/3;border-radius:14px;background-repeat:no-repeat;background-color:#2f9ee8;box-shadow:inset 0 0 0 3px rgba(255,255,255,.7)}
.sp-route b{font-size:clamp(14px,4.2vw,18px);line-height:1.15;overflow-wrap:break-word;hyphens:auto;max-width:100%}

/* challenges */
.sp-layer.challenge{background:rgba(4,18,70,.5)}
/* the top bar's Back (and sound) stay usable above a challenge or a card: a child can always leave (QA 2026-10-12); the island menus have their own Back and cover the bar */
.sp-root>.sp-top{z-index:25;pointer-events:none}
.sp-root>.sp-top>button{pointer-events:auto}
.sp-root:has(>.sp-layer.menu:not([hidden]))>.sp-top{z-index:1}
.sp-keystop,.sp-bonus-head{display:flex;align-items:center;gap:10px;text-align:start;margin:-4px 0 8px;padding:6px 12px;border-radius:16px;background:rgba(255,210,63,.18);box-shadow:inset 0 0 0 2px rgba(255,210,63,.6)}
.sp-keystop img,.sp-bonus-head img{width:40px;height:40px;object-fit:contain;flex:none}
.sp-keystop b{display:block;color:var(--sp-gold);font-size:18px}
.sp-keystop small{display:block;font-size:13px;font-weight:700;line-height:1.25}
.sp-prompt{margin:4px 0 10px;font-size:22px;font-weight:900}
.sp-subject{display:grid;place-items:center;margin-bottom:10px}
.sp-subject img{height:clamp(90px,18vh,150px);filter:drop-shadow(0 6px 4px rgba(0,0,40,.4))}
.sp-opts{display:grid;gap:10px}
.sp-opts.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.sp-opts.four{grid-template-columns:repeat(2,minmax(0,1fr))}
.sp-opt{min-height:88px;border:0;border-radius:18px;padding:10px;display:grid;place-items:center;background:linear-gradient(180deg,#fff7d6,#ffe08a);box-shadow:inset 0 -4px 0 rgba(160,90,0,.3),0 0 0 3px #7a3ed8,0 6px 10px rgba(0,0,60,.3)}
.sp-opt img{max-width:100%;height:clamp(64px,13vh,110px);object-fit:contain}
.sp-opt img.sp-shadow{filter:brightness(0) opacity(.82)}
.sp-opt.removed{opacity:.22;filter:grayscale(1);cursor:default}
.sp-opt.shake{animation:sp-shake .4s}
@keyframes sp-shake{25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}
.sp-memo-show,.sp-memo-hidden{display:flex;justify-content:center;gap:12px;margin:4px 0 14px}
.sp-memo-show img{width:28%;max-width:120px;aspect-ratio:1;object-fit:contain;padding:8px;border-radius:16px;background:rgba(255,255,255,.18)}
.sp-memo-card{width:22%;max-width:84px;aspect-ratio:1;display:grid;place-items:center;border-radius:16px;background:linear-gradient(#5a8cff,#2a4fc2);font-size:30px;font-weight:900;box-shadow:inset 0 0 0 3px rgba(255,255,255,.5)}
.sp-hint{display:flex;align-items:center;gap:8px;justify-content:center;margin:10px 0 0;font-weight:800;font-size:16px;line-height:1.25}
.sp-hint img{width:28px}
.sp-skip{margin-top:12px}

/* events, finish, result */
.sp-burst{position:relative;height:110px;display:grid;place-items:center}
.sp-burst img{grid-area:1/1;max-height:96px;max-width:140px;object-fit:contain;filter:drop-shadow(0 4px 4px rgba(0,0,40,.35));animation:sp-pop .45s cubic-bezier(.3,1.6,.5,1)}
.sp-burst .sp-burst-glow{max-height:150px;max-width:150px;opacity:.75;animation:sp-spin 4s linear infinite}
.sp-burst .sp-burst-sparkle{max-height:70px;transform:translate(46px,-30px)}
@keyframes sp-pop{from{transform:scale(.3);opacity:0}}
@keyframes sp-spin{to{transform:rotate(360deg)}}
.sp-chest-show{position:relative;height:180px;display:grid;place-items:center;margin-bottom:12px}
.sp-chest-show img{grid-area:1/1;height:160px}
/* the island's chest: closed, then open full of gold — two drawn states on one canvas (same base), a short
   cross-fade with a small bounce; not a lid animation */
.sp-chest-show .sp-chest-state{position:relative;z-index:1;height:170px;max-width:100%;object-fit:contain;transition:opacity .35s ease}
.sp-chest-show .sp-chest-state.open{opacity:0}
.sp-chest-show.opening .sp-chest-state.closed{opacity:0}
.sp-chest-show.opening .sp-chest-state.open{opacity:1;animation:sp-chest-bump .45s cubic-bezier(.3,1.5,.5,1)}
@keyframes sp-chest-bump{from{transform:scale(.94)}}
@media (prefers-reduced-motion:reduce){.sp-chest-show .sp-chest-state{transition:none}.sp-chest-show.opening .sp-chest-state.open{animation:none}}
.sp-chest-show .glow{opacity:0;height:200px;transition:opacity .9s}
.sp-chest-show.opening .glow{opacity:.8;animation:sp-spin 5s linear infinite}
.sp-result{position:relative;height:190px;display:grid;place-items:end center;margin-top:-4px}
.sp-result img{grid-area:1/1}
.sp-result-chest{height:150px}
.sp-result-compass{height:84px;transform:translateY(-92px);animation:sp-pop .6s cubic-bezier(.3,1.6,.5,1) .2s both;filter:drop-shadow(0 0 14px rgba(255,220,90,.9))}
.sp-confetti{height:150px;opacity:.85;animation:sp-pop .5s ease both}
.sp-chips{display:flex;justify-content:center;gap:8px;margin:0 0 12px;min-height:8px}
.sp-chip{display:inline-flex;align-items:center;gap:4px;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.18);font-weight:900;font-size:17px}
.sp-chip svg{width:18px;height:18px}
.sp-result-btns{display:flex;flex-wrap:wrap;justify-content:center;gap:10px}

/* tablet held upright: rotate hint (the game waits; nothing is lost) */
.sp-rotate{position:absolute!important;inset:0;z-index:40!important;display:grid;place-items:center;background:rgba(6,24,80,.82);backdrop-filter:blur(4px)}
.sp-rotate[hidden]{display:none}
.sp-rotate-card{display:flex;flex-direction:column;align-items:center;gap:14px;max-width:300px;text-align:center;font-size:22px;line-height:1.3}
.sp-rotate-ico{font-size:72px;line-height:1;animation:sp-turn 2.4s ease-in-out infinite}
@keyframes sp-turn{40%,60%{transform:rotate(90deg)}}

/* ---- the menus before the game: like the runners' welcome menu ---- */
.sp-layer.menu{background:#06283a;padding:calc(10px + var(--sp-safe-t)) 10px calc(10px + var(--sp-safe-b));place-items:stretch center;overflow:hidden}
.sp-menu-bg{position:absolute;inset:-30px;width:calc(100% + 60px);height:calc(100% + 60px);object-fit:cover;filter:blur(12px) saturate(1.15);z-index:0;pointer-events:none}
.sp-layer.menu::before{content:"";position:absolute;inset:0;z-index:0;background:linear-gradient(180deg,#03182666,#031826cc 30%,#031826ee);pointer-events:none}
.sp-menu{position:relative;z-index:1;display:flex;flex-direction:column;gap:4px;width:min(640px,100%);height:100%;min-height:0;max-height:900px;align-self:center;padding:12px 14px 10px;border-radius:24px;overflow:hidden;
  background:radial-gradient(closest-side,#06283ad0 0,#06283aa6 55%,#06283a00 100%);border:0;box-shadow:none}   /* no box: the panel fades into the blurred island (Stefan 2026-10-12) */
.sp-menu-x{position:absolute;top:10px;left:10px;width:44px;height:44px;border-radius:50%;border:0;display:grid;place-items:center;background:#ffffff14;box-shadow:inset 0 0 0 1px #ffffff33}
.sp-menu-x svg{width:22px;height:22px;color:#fff}
[dir="rtl"] .sp-menu-x svg{transform:scaleX(-1)}
.sp-brand{margin:6px 0 2px;padding:0 48px;line-height:1.02;text-align:center;font-size:clamp(32px,9vw,46px);flex:none;text-wrap:balance;
  background:linear-gradient(180deg,#fff9a8,#ffc328 55%,#ff8f1a);-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;filter:drop-shadow(0 4px 0 #7a3b00) drop-shadow(0 8px 14px #0006)}
.sp-label{margin:8px 0 6px;display:flex;align-items:center;justify-content:center;gap:10px;color:#ffe27a;font-size:clamp(15px,4.2vw,19px);text-align:center;flex:none}
.sp-label::before,.sp-label::after{content:"";flex:1;max-width:70px;height:2px;border-radius:2px;background:linear-gradient(270deg,#ffe27a88,#ffe27a00)}
.sp-label::after{background:linear-gradient(90deg,#ffe27a88,#ffe27a00)}
.sp-label span{text-shadow:0 2px 0 rgba(0,0,0,.3)}
.sp-menu-opts{display:flex;justify-content:center;gap:10px;margin-top:auto;padding-top:10px;flex:none}
.sp-pill{min-width:min(150px,100%);height:44px;padding:0 18px;border-radius:999px;background:#ffffff10;border:1px solid #ffffff22;color:#d3e6e5!important;font-size:15px}
.sp-pill:active,.sp-tile:active,.sp-level:active:not(.soon){transform:translateY(2px) scale(.97)}
.sp-check{position:absolute;top:8px;right:8px;width:28px;height:28px;border-radius:50%;background:linear-gradient(#ffdf6d,#ffb925);display:none;place-items:center;box-shadow:0 3px 0 #b77114,0 4px 10px #0006;z-index:2}
.sp-check svg{width:16px;height:16px}
.sp-check path{stroke:#513800}
[aria-pressed="true"]>.sp-check{display:grid}
.sp-soon{position:absolute;top:8px;left:50%;transform:translateX(-50%);z-index:2;padding:4px 12px;border-radius:999px;background:rgba(3,24,38,.82);border:1px solid #ffe27a66;color:#ffe27a;font-size:12px;white-space:nowrap}
/* islands: picture cards, the playable one with a gold border */
.sp-levels{flex:0 1 auto;min-height:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-content:center;margin-block:auto}
.sp-level{position:relative;isolation:isolate;min-height:0;aspect-ratio:1;width:100%;border:2px solid #ffffff33;border-radius:16px;padding:0;overflow:hidden;background:#0b2b3d;transition:transform .12s ease}
.sp-level img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-1}
.sp-level::after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(180deg,#05283d00 50%,#05283dd9)}
.sp-level-name{position:absolute;left:4px;right:4px;bottom:7px;font-size:clamp(13px,3.8vw,19px);line-height:1.05;text-shadow:0 2px 4px #000c;hyphens:auto}
.sp-level.soon img{filter:saturate(.45) brightness(.72)}
.sp-level[aria-pressed="true"]{border:3px solid #ffcf43;box-shadow:0 0 0 3px #ffc93644,0 0 18px #ffc93666}
/* play modes and children: tall cards filled with the island; the child stands in it */
.sp-modes,.sp-chars{flex:1 1 auto;min-height:0;max-height:560px;display:flex;gap:12px;align-self:stretch;margin-block:auto}
.sp-tile{position:relative;isolation:isolate;container-type:size;flex:1;min-width:0;min-height:150px;padding:0;border:2px solid #ffffff44;border-radius:20px;overflow:hidden;background:#0b2b3d center/cover no-repeat;box-shadow:0 8px 18px #0006;transition:transform .12s ease;
  --feet:71;--fh:min(calc((var(--feet) - 15) * 1.26cqh),170cqw)}
.sp-tile::before{content:"";position:absolute;inset:0;z-index:1;background:linear-gradient(180deg,#00000000 60%,#00000066 100%);pointer-events:none}
/* the island board, scaled with the child, its start stone right under the child's feet */
.sp-scene{position:absolute;z-index:0;left:50%;top:calc(var(--feet) * 1%);width:calc(var(--fh) * 2);max-width:none;height:auto;transform:translate(calc(var(--sx) * -100%),calc(var(--sy) * -100%));pointer-events:none}
/* the child stands on that line: the cell is square (512 × 512, feet on 87.5 %), never stretched; a soft shadow under the feet */
.sp-figs{position:absolute;inset:0;z-index:2;pointer-events:none}
.sp-figs::before{content:"";position:absolute;left:50%;top:calc(var(--feet) * 1%);width:calc(var(--fh) * .5);height:calc(var(--fh) * .08);transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(closest-side,#0a1f0c80,#0a1f0c00)}
.sp-figs.duo{--fh:min(calc((var(--feet) - 15) * 1.26cqh),125cqw)}
.sp-figs.duo::before{width:calc(var(--fh) * .95)}
.sp-fig{position:absolute;left:50%;top:calc(var(--feet) * 1%);height:var(--fh);width:auto;aspect-ratio:1;transform:translate(-50%,-87.5%);background:var(--walk) no-repeat 0 0/calc(var(--walk-n,4) * 100%) 100%;filter:drop-shadow(0 4px 5px #0006)}
[aria-pressed="true"] .sp-fig{background-image:var(--cheer);background-size:300% 100%;background-position:50% 0}
.sp-mode .sp-fig{background-image:var(--walk)!important;background-size:calc(var(--walk-n,4) * 100%) 100%!important;background-position:0 0!important}
.sp-figs.duo .sp-fig{left:32%}
.sp-figs.duo .sp-fig+.sp-fig{left:68%}   /* both face right: off on the adventure together */
.sp-tile .sp-soon,.sp-tile .sp-check{z-index:4}
.sp-tile-name{position:absolute;z-index:3;left:8px;right:8px;bottom:8px;padding:6px 4px;border-radius:999px;background:#ffffff1c;color:#fff;line-height:1.1;text-shadow:0 2px 3px #0008;display:flex;flex-direction:column;align-items:center}
.sp-tile-name b{font-size:clamp(16px,4.6vw,20px)}
.sp-tile-name small{font-size:12px;font-weight:800;opacity:.92}
.sp-tile[aria-pressed="true"]{border:3px solid #ffcf43;box-shadow:0 0 0 3px #ffc93644,0 0 22px #ffc93677}
.sp-tile[aria-pressed="true"] .sp-tile-name{background:linear-gradient(#ffdf6d,#ffb925);color:#513800;text-shadow:none}
.sp-tile.soon{filter:saturate(.5) brightness(.8)}
.sp-tile.soon .sp-soon{filter:saturate(2)}
.sp-char{background-color:#2f9ee8}
/* an upright phone: cards no taller than a picture card, so the child and its island fill them */
.sp-root[data-layout="tall"] :is(.sp-modes,.sp-chars){max-height:min(560px,118vw)}
/* a wide screen: the cards side by side get room, the title one line */
.sp-root[data-layout="wide"] .sp-menu{width:min(760px,100%);max-height:720px}
.sp-root[data-layout="wide"] .sp-levels{grid-template-columns:repeat(3,minmax(0,180px));justify-content:center}
.sp-root[data-layout="wide"] .sp-tile-name b{font-size:22px}
.sp-root[data-layout="wide"] .sp-tile-name small{font-size:14px}
/* a phone on its side: smaller title, the islands in one row */
.sp-root[data-layout="compact"] .sp-menu{width:min(820px,100%);padding:6px 12px 6px}
.sp-root[data-layout="compact"] .sp-brand{font-size:26px;margin:2px 0 0}
.sp-root[data-layout="compact"] .sp-label{margin:2px 0 4px;font-size:15px}
.sp-root[data-layout="compact"] .sp-levels{grid-template-columns:repeat(6,minmax(0,1fr))}
.sp-root[data-layout="compact"] .sp-modes,.sp-root[data-layout="compact"] .sp-chars{max-width:560px;margin-inline:auto;width:100%}
.sp-root[data-layout="compact"] .sp-tile{min-height:0}
.sp-root[data-layout="compact"] .sp-menu-opts{padding-top:4px}
.sp-root[data-layout="compact"] .sp-pill{height:40px}

/* ---- wide: board centre, side panel ---- */
.sp-root[data-layout="wide"]{grid-template-columns:minmax(0,1fr) 330px;grid-template-rows:auto minmax(0,1fr);grid-template-areas:"top top" "stage panel"}
.sp-root[data-layout="wide"] .sp-top{padding:14px 18px 4px}
.sp-root[data-layout="wide"] .sp-panel{justify-content:center;gap:18px;padding:10px 22px 22px 6px}
.sp-root[data-layout="wide"] .sp-player{flex:none;border-radius:26px;padding:10px 14px;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto auto;row-gap:8px}
.sp-root[data-layout="wide"] .sp-portrait{width:70px;height:70px;grid-row:1/3}
.sp-root[data-layout="wide"] .sp-player-copy b{font-size:24px}
.sp-root[data-layout="wide"] .sp-player-copy small{font-size:15px}
.sp-root[data-layout="wide"] .sp-keys{grid-row:2;grid-column:2}
.sp-root[data-layout="wide"] .sp-keys img{width:34px;height:34px}
.sp-root[data-layout="wide"] .sp-progress{grid-row:3;grid-column:1/3;height:10px}
.sp-root[data-layout="wide"] .sp-act{flex-direction:column;gap:22px}
.sp-root[data-layout="wide"] .sp-die-wrap{--d:104px}
.sp-root[data-layout="wide"] .sp-roll{width:100%;max-width:none;min-height:78px;font-size:25px;border-image-width:0 40px}
.sp-root[data-layout="wide"] .sp-roll-ico{width:40px;height:40px}
.sp-root[data-layout="wide"] .sp-msg{font-size:20px;min-height:28px}
/* short cards (route choice, events, finish) sit over the side panel, so the whole board stays in view */
.sp-root[data-layout="wide"] .sp-layer.low{place-items:center end;padding-inline-end:14px;background:none}
.sp-root[data-layout="wide"] .sp-layer.low .sp-card{width:340px}
.sp-root[data-layout="compact"] .sp-layer.low{place-items:center end;padding-inline-end:8px;background:none}
.sp-root[data-layout="compact"] .sp-layer.low .sp-card{width:300px;padding:10px 12px}

/* ---- compact: phone sideways ---- */
.sp-root[data-layout="compact"]{grid-template-columns:minmax(0,1fr) 230px;grid-template-rows:auto minmax(0,1fr);grid-template-areas:"top top" "stage panel"}
.sp-root[data-layout="compact"] .sp-top{padding:max(6px,var(--sp-safe-t)) max(10px,env(safe-area-inset-right)) 2px max(10px,env(safe-area-inset-left))}
.sp-root[data-layout="compact"] .sp-icon-btn{width:44px;height:44px}
.sp-root[data-layout="compact"] .sp-portrait{width:36px;height:36px}
.sp-root[data-layout="compact"] .sp-player{max-width:420px;margin-inline:auto}
.sp-root[data-layout="compact"] .sp-panel{justify-content:center;padding:4px max(12px,env(safe-area-inset-right)) 8px 4px}
.sp-root[data-layout="compact"] .sp-act{flex-direction:column;gap:12px}
.sp-root[data-layout="compact"] .sp-die-wrap{--d:58px}
.sp-root[data-layout="compact"] .sp-roll{width:100%;min-height:60px;font-size:17px;padding:0 12px;gap:6px}
.sp-root[data-layout="compact"] .sp-roll-ico{width:28px;height:28px}
.sp-root[data-layout="compact"] .sp-card{max-height:none}
.sp-root[data-layout="compact"] .sp-subject img{height:70px}
.sp-root[data-layout="compact"] .sp-opt{min-height:64px}
.sp-root[data-layout="compact"] .sp-opt img{height:52px}
.sp-root[data-layout="compact"] .sp-card{padding:8px 14px 10px}
.sp-root[data-layout="compact"] .sp-card h2{font-size:20px;margin-bottom:4px}
.sp-root[data-layout="compact"] .sp-result{height:104px}
.sp-root[data-layout="compact"] .sp-result-chest{height:92px}
.sp-root[data-layout="compact"] .sp-result-compass{height:52px;transform:translateY(-56px)}
.sp-root[data-layout="compact"] .sp-confetti{height:96px}
.sp-root[data-layout="compact"] .sp-chips{margin-bottom:6px}
.sp-root[data-layout="compact"] .sp-burst{height:70px}
.sp-root[data-layout="compact"] .sp-burst img{max-height:62px}
.sp-root[data-layout="compact"] .sp-chest-show{height:110px}
.sp-root[data-layout="compact"] .sp-chest-show img{height:100px}
.sp-root[data-layout="compact"] .sp-chest-show .sp-chest-state{height:104px}

@media (prefers-reduced-motion:reduce){
  .sp-root *{animation:none!important;transition:none!important}
}

/* ---- iPad and other wide screens (Stefan, 2026-10-13) ----
   The game fills the whole window: scaled to its height and as wide as it is (m1-runtime.js --fit-h,
   --fill-w), so no blurred band with the frame's white line stands beside the world on an iPad of
   another shape than 1180 x 820, and the page cannot scroll the frame aside. */
html[data-shape="wide"] .game-frame:has(>.sp-root){position:fixed;left:50%;top:50%;margin:0;width:var(--fill-w,1180px);height:820px;transform:translate(-50%,-50%) scale(var(--fit-h,var(--fit,1)));border-radius:0;box-shadow:none}
html[data-shape="wide"] .game-frame:has(>.sp-root)::after{display:none}
html:has(.sp-root),html:has(.sp-root) body{overflow:hidden}
/* the start sign stands apart from its stone (games-schattenpad.js build), above every icon: no icon over text */
.sp-stones>.sp-start-sign{z-index:1999}
/* the islands: three to a row and much larger on a wide screen */
.sp-root[data-layout="wide"] .sp-menu:has(.sp-levels){width:min(1080px,100%);max-height:none}
/* the tiles take their size from the height that is left (two rows), square, so they never run into each
   other or into "Terug" when the status bar and safe areas take room (iPad app, Stefan 2026-10-14) */
.sp-root[data-layout="wide"] .sp-levels{flex:1 1 auto;min-height:0;grid-template-columns:repeat(3,auto);grid-template-rows:repeat(2,minmax(0,1fr));justify-content:center;gap:18px;width:100%;margin-block:6px}
.sp-root[data-layout="wide"] .sp-level{height:100%;width:auto;max-width:300px;aspect-ratio:1;justify-self:center}
.sp-root[data-layout="wide"] .sp-level{border-radius:22px}
.sp-root[data-layout="wide"] .sp-level-name{font-size:24px;bottom:12px}
/* the board under the panel, to the left, right and bottom edges of the screen (games-schattenpad.js camera
   frames it in the free part); below the top bar, so no icon of the board stands behind the title */
.sp-root[data-layout="wide"] .sp-stage{grid-area:2/1/3/3;z-index:0}
.sp-root[data-layout="wide"] .sp-panel{z-index:2}
/* the turn line on its own plate: no icon of the board behind its text */
.sp-root[data-layout="wide"] .sp-msg:not(:empty){padding:6px 14px;border-radius:999px;background:rgba(4,30,70,.62);backdrop-filter:blur(3px)}
.sp-root[data-layout="wide"] .sp-stage{-webkit-mask-image:linear-gradient(180deg,transparent 0,#000 46px);mask-image:linear-gradient(180deg,transparent 0,#000 46px)}
/* "Overzicht" / "Inzoomen" on a wide screen: bottom left, out from under the panel the board runs under */
.sp-root[data-layout="wide"] .sp-zoom{right:auto;left:16px;bottom:14px;z-index:3}

/* ---- Samen spelen (games-schattenpad.js duoSheet; Stefan, 2026-10-13) ---- */
.sp-mate{position:absolute;width:0;height:0;z-index:499;pointer-events:none}
.sp-mate-img{position:absolute;display:block;width:230px;height:230px;left:-115px;top:-201px;background:no-repeat 0 0/100% 100%}
.sp-duo{display:flex;flex-direction:column;align-items:center;gap:12px;margin-block:auto;width:min(440px,100%);align-self:center}
.sp-duo-via{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.sp-duo-via .sp-pill{display:inline-flex;align-items:center;gap:6px}
.sp-duo-via .sp-pill svg{width:18px;height:18px}
.sp-duo-via .sp-pill[aria-pressed="true"]{background:linear-gradient(#ffdf6d,#ffb925);color:#513800}
.sp-duo-pair{display:flex;align-items:center;gap:14px}
.sp-duo-pair span{display:grid;place-items:center;min-width:96px;padding:10px 14px;border-radius:18px;background:#ffffff1f;box-shadow:inset 0 0 0 2px #ffffff44;font-weight:900;font-size:18px}
.sp-duo-pair span.on{background:linear-gradient(#ffdf6d,#ffb925);color:#513800;box-shadow:none}
.sp-duo-pair span.wait{display:flex;gap:6px;justify-content:center}
.sp-duo-pair span.wait i{width:9px;height:9px;border-radius:50%;background:#fff;opacity:.4;animation:sp-dots 1s infinite}
.sp-duo-pair span.wait i:nth-child(2){animation-delay:.2s}.sp-duo-pair span.wait i:nth-child(3){animation-delay:.4s}
@keyframes sp-dots{50%{opacity:1}}
.sp-duo-pair>b{font-size:24px;color:#ffe27a}
.sp-duo-btns{display:flex;flex-direction:column;gap:10px;width:100%}
.sp-duo-label,.sp-duo-help,.sp-duo-wait,.sp-duo-note{margin:0;text-align:center;font-weight:800}
.sp-duo-note{color:#ffe27a}
.sp-duo-wait.ok{color:#9dffb8}
.sp-duo-code{display:flex;gap:8px;justify-content:center}
.sp-duo-code span{display:grid;place-items:center;width:52px;height:64px;border-radius:14px;background:#fff;color:#10205d;font-size:38px;font-weight:1000;box-shadow:0 4px 0 #0005}
.sp-duo-code.six span{width:44px;height:56px;font-size:32px}
.sp-duo-code.entry span{background:#ffffff22;color:#fff;box-shadow:inset 0 0 0 2px #ffffff55}
.sp-duo-code.entry span.on{background:#fff;color:#10205d}
.sp-duo-keys{display:grid;grid-template-columns:repeat(3,72px);gap:10px;justify-content:center}
.sp-duo-keys button{height:60px;border:0;border-radius:16px;background:#ffffff26;color:#fff;font:inherit;font-size:26px;font-weight:1000;box-shadow:inset 0 0 0 2px #ffffff44;cursor:pointer}
.sp-duo-keys button:active{transform:scale(.95)}
.sp-duo-wait,.sp-duo-wait.ok{font-size:17px}
.sp-tile.taken{filter:saturate(.35) brightness(.7)}
.sp-tile[disabled]:not([aria-pressed="true"]){cursor:default}
.sp-ready.duo{display:grid;grid-template-columns:auto auto;justify-content:center;column-gap:14px}
.sp-ready.duo>p,.sp-ready.duo>.sp-ready-keys{grid-column:1/-1;text-align:center}
/* the friend's turn: the card to watch, nothing to tap */
.sp-layer.theirs .sp-card button,.sp-layer.theirs .sp-card [role="button"]{pointer-events:none}
.sp-layer.theirs .sp-card{opacity:.92}
.sp-theirs-note{position:relative;z-index:2;margin:0 0 8px;padding:6px 16px;border-radius:999px;background:rgba(4,30,70,.8);color:#ffe27a;font-weight:900;text-align:center;justify-self:center}
.sp-layer.theirs{display:flex;flex-direction:column;align-items:center;justify-content:center}
