/* Candidate 1.1: one clipped image-coordinate scene; controls remain viewport-sized. */
html:has(.o-portal){overflow-x:clip}
.o-portal{max-width:100%;overflow-x:clip;--world-glow:#e4d1a6}
.o-portal .backdrop{overflow:hidden;overflow:clip;contain:paint;touch-action:manipulation}
#scene-camera{position:absolute;top:0;left:0;width:1536px;height:1024px;transform-origin:0 0;pointer-events:none}
.in-world #scene-camera{transition:transform 950ms cubic-bezier(.22,1,.36,1);will-change:transform}
.o-portal .backdrop #background,.o-portal.picture-only .backdrop #background{display:block;width:1536px;height:1024px;max-width:none;object-fit:fill;transform:none;filter:none;user-select:none;-webkit-user-drag:none}
#scene-hotspots,.o-portal #effects{position:absolute;inset:0;pointer-events:none}
.o-portal #effects{overflow:hidden;overflow:clip}
#scene-hotspots{display:none}
.in-world #scene-hotspots{display:block}
.in-world .backdrop{pointer-events:auto}
.backdrop-shade{pointer-events:none}
.o-portal.in-world{height:100svh;min-height:100svh;display:grid;grid-template-rows:76px minmax(0,1fr) 52px}
.in-world>.topbar{grid-row:1;width:100%;min-height:0;padding-bottom:0}
.in-world>#main{grid-row:2;min-height:0;pointer-events:none}
.in-world>.footer{grid-row:3;width:100%;min-height:0;padding-top:0;padding-bottom:max(6px,env(safe-area-inset-bottom))}
.in-world .world{height:100%;min-height:0;max-width:1800px;margin:auto;padding:0 clamp(14px,3vw,42px) 4px;gap:4px}
.in-world .world .playfield{min-height:0;pointer-events:none}
.world button,.world a{pointer-events:auto}
.world-top{min-height:44px;flex-shrink:0}
.world-top .quiet-button,.world-controls>.quiet-button{padding:10px 14px;background:#0b242b80;border:1px solid #e2e7d340;border-radius:24px;text-shadow:none}
.world-bottom{flex-shrink:0;gap:18px;padding-top:0}
.world-controls{flex-shrink:0;gap:8px}
.world h2{font-size:clamp(21px,2.3vw,30px);text-wrap:balance;overflow-wrap:anywhere}
.world-controls>.primary-button{white-space:normal}
#viewpoints{display:flex;justify-content:center;gap:8px;flex-shrink:0;margin-top:6px;pointer-events:none}
#viewpoints button{pointer-events:auto;min-height:44px;max-width:30%;padding:7px 14px;border-radius:24px;border:1px solid #e9ebdd40;background:#09222a85;font-size:11px;line-height:1.4;color:#eff1df;overflow-wrap:anywhere}
#viewpoints button[aria-pressed=true]{border-color:#eee6bc;background:#1b3a41da}
.scene-secret,.o-gate{position:absolute;display:grid;place-items:center;transform:translate(-50%,-50%) scale(var(--inverse-scale,1));transform-origin:center;pointer-events:auto;background:transparent;padding:0;border:0;border-radius:50%;width:56px;height:56px;touch-action:manipulation}
.scene-secret>span{width:7px;height:7px;border-radius:50%;background:var(--world-glow);box-shadow:0 0 12px 4px var(--world-glow);animation:firefly 4s ease-in-out infinite;opacity:.85}
.scene-secret.revealed>span{width:6px;height:6px;background:#e9fff7;box-shadow:0 0 5px 2px var(--world-glow);animation:none;opacity:.7}
.scene-secret:focus-visible,.o-gate:focus-visible{outline:2px solid #fff0bd;outline-offset:3px;background:#143439aa}
.scene-secret::after,.o-gate::after{content:attr(data-label);position:absolute;left:50%;top:100%;transform:translateX(-50%);font:11px/1.4 Arial,sans-serif;padding:7px 10px;background:#102c33f0;color:#f5f0df;border-radius:9px;width:max-content;max-width:190px;opacity:0;pointer-events:none;text-align:center}
.scene-secret:focus-visible::after,.o-gate:focus-visible::after{opacity:1}
@media(hover:hover){.scene-secret:hover::after,.o-gate:hover::after{opacity:1}.o-gate:hover>svg{transform:translateY(-3px) scale(1.07)}}
.o-gate{width:64px;height:74px;filter:drop-shadow(0 3px 6px #001d35aa)}
.o-gate>svg{width:60px;height:70px;stroke:none;transition:transform .3s}
.gate-body{fill:#b8cdb9}.gate-hair{fill:#e8d4a0}
.o-gate::before{content:'';position:absolute;inset:22% 12% 0;border-radius:50%;box-shadow:0 0 25px 7px #e6fff133;animation:gate-pulse 5s ease-in-out infinite;z-index:-1}
.scene-effect{position:absolute;color:var(--world-glow);width:42px;height:60px;pointer-events:none;animation:world-rise 5s ease-out both;filter:drop-shadow(0 0 6px currentColor)}
.scene-effect svg{width:100%;height:100%}
.effect-mote,.effect-dust,.effect-sand{width:5px;height:5px;background:currentColor;border-radius:50%}
.effect-dust{border-radius:1px;width:6px;height:6px}
.effect-sand{width:3px;height:3px;animation-name:sand-fall}
.effect-bubble{width:22px;height:22px;border:1px solid currentColor;border-radius:50%;background:radial-gradient(circle at 30% 25%,#eaffff77,transparent 45%)}
.effect-ripple{width:30px;height:14px;border:1px solid currentColor;border-radius:50%;animation:ripple 2.7s ease-out both}
.effect-lightseed{width:68px;height:30px;animation-name:seed-flight}
.effect-plant{width:48px;height:100px;transform-origin:50% 100%;animation-name:grow}
.effect-crystal{animation-name:crystal-ring}.effect-moon{width:65px;height:48px;animation-name:seed-flight}
.effect-frost{animation-name:frost-turn}.effect-gear{width:50px;height:50px;animation-name:frost-turn}
.picture-only #scene-hotspots,.picture-only #effects{display:none}
.picture-only .backdrop{pointer-events:none}
.o-portal.picture-only .backdrop-shade{display:none}
.portal-opening .home{overflow:hidden;overflow:clip;contain:paint}
.o-portal.teleporting::after{content:'';position:fixed;inset:0;z-index:20;pointer-events:none;background:radial-gradient(ellipse at center,transparent 4%,#bce7da66 15%,#102731e6 65%);animation:teleport .65s ease-in-out both}
.teleporting .backdrop{opacity:.3;transition:opacity .3s}
.o-portal .backdrop{transition:opacity .35s}
.calm #scene-camera{transition:none!important}.calm .scene-effect{animation:none!important;opacity:.75}
.calm .effect-plant{transform:none}.calm .o-gate::before{animation:none;opacity:.5}
.light-world{--ink:#102c3e;--gold:#1c4260;--muted:#173e57}
.light-world .topbar,.light-world .footer,.light-world .world h2{color:#14374c;text-shadow:0 1px 5px #fff,0 0 15px #fff9}
.light-world .top-actions button{background:#fcfcf4c9;border-color:#183b6a66;color:#183b53}
.light-world .world-controls>.primary-button,.light-world .quiet-button,.light-world #viewpoints button{background:#fbfcf0d9;border-color:#234a6955;color:#153a51;text-shadow:none}
.light-world #viewpoints button[aria-pressed=true]{background:#143c53e6;color:#fff6df;border-color:#17364a}
.light-world .backdrop-shade{background:none}
.light-world .scene-secret>span{box-shadow:0 0 0 3px #fff9,0 0 15px 3px var(--world-glow)}
.o-portal dialog{position:fixed;z-index:40;max-height:calc(100dvh - 36px);overscroll-behavior:contain}
.o-portal dialog::backdrop{backdrop-filter:none;background:#061519b3}
#map-dialog{max-width:760px}
#world-map{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#world-map button{display:flex;align-items:center;gap:10px;background:#193b42;border:1px solid #c8d9c340;border-radius:12px;padding:8px;text-align:left;min-height:80px;min-width:0;font-size:12px;line-height:1.5}
#world-map button[aria-current=true]{border-color:#e7d4a4}
#world-map img{width:82px;height:65px;object-fit:cover;border-radius:7px;flex-shrink:0}
#world-map span{min-width:0;overflow-wrap:anywhere}
#discovery-list{display:grid;gap:8px}
#discovery-list button{background:#1e4147;border:1px solid #e0e4ce40;border-radius:10px;text-align:left;padding:12px 15px;min-height:48px;line-height:1.5;font-size:12px}
.o-portal #world-title:focus{outline:none}
@keyframes gate-pulse{50%{opacity:.25;transform:scale(.85)}}
@keyframes world-rise{0%{opacity:0;transform:translate(-50%,0) scale(.5)}15%{opacity:.9}100%{opacity:0;transform:translate(var(--drift),-170px) scale(1.1)}}
@keyframes seed-flight{0%{opacity:0;transform:translate(-50%,0) rotate(-10deg)}15%{opacity:.9}100%{opacity:0;transform:translate(230px,-130px) rotate(-25deg)}}
@keyframes crystal-ring{0%{opacity:0;transform:translate(-50%,-50%) scale(.2)}20%{opacity:1}100%{opacity:0;transform:translate(-50%,-50%) scale(2)}}
@keyframes frost-turn{0%{opacity:0;transform:scale(.3) rotate(0)}20%{opacity:1}100%{opacity:0;transform:scale(1.5) rotate(180deg)}}
@keyframes sand-fall{0%{opacity:0;transform:translate(0,90px)}20%{opacity:1}100%{opacity:0;transform:translate(var(--drift),-120px)}}
@keyframes teleport{0%,100%{opacity:0}45%,55%{opacity:1}}
@media(max-width:700px){
  .o-portal.in-world{grid-template-rows:70px minmax(0,1fr) 48px}
  .in-world>.topbar{padding-top:max(10px,env(safe-area-inset-top));padding-inline:max(14px,env(safe-area-inset-left))}
  .world-bottom{flex-direction:column;align-items:stretch;gap:8px}
  .world h2{font-size:22px;max-width:90%}
  .world-controls{justify-content:space-between}.world-controls>.primary-button{flex:1}
  #viewpoints{gap:6px;justify-content:stretch;margin-top:4px}
  #viewpoints button{flex:1;max-width:none;min-width:0;padding:7px 8px;font-size:10px;border-radius:15px}
  .world-top .quiet-button{font-size:10px;padding:8px 12px}
  .in-world .footer{padding-inline:16px;gap:10px}.footer button{font-size:9px}
  #world-map{grid-template-columns:1fr}
  #world-map img{width:100px;height:68px}
  .whisper,.whisper.visible{bottom:8px;width:min(500px,96%)}
  .whisper span{font-size:16px;line-height:1.4;background:#0b2538cc}
}
@media(max-height:500px) and (orientation:landscape){
  .o-portal.in-world{grid-template-rows:56px minmax(0,1fr) 42px}
  .in-world .topbar{padding-top:4px}.world-top{min-height:36px}
  .world-bottom{flex-direction:row;align-items:center}.world h2{font-size:19px}
  #viewpoints{position:absolute;top:0;left:20%;right:20%;margin:0}
  #viewpoints button{min-height:36px;font-size:9px;padding:4px 10px}
  .world-controls>.primary-button,.world-controls>.quiet-button{min-height:40px;padding-block:7px}
}
