/* Seek & Find. The scene is one SVG (viewBox 1000x625) inside a clipped board; zoom and pan move it with transform only. */
.sf-app{--sf-ink:#0f172a}
.sf-stage{padding:12px;display:flex;flex-direction:column;align-items:center;gap:6px}
.sf-stage .stage-head{width:100%}
.sf-play{--lw:clamp(150px,22%,230px);width:100%;display:flex;gap:10px;align-items:flex-start;justify-content:center}
.sf-board{position:relative;flex:0 1 auto;width:min(calc(100% - var(--lw) - 10px),calc((var(--gic-maxh,100vh) - 150px)*1.6));min-width:0;aspect-ratio:1000/625;overflow:hidden;border-radius:18px;background:#1e293b;touch-action:none;user-select:none;-webkit-user-select:none}
.sf-board::after{content:'';position:absolute;inset:0;z-index:9;box-sizing:border-box;border:clamp(3px,.6vw,6px) solid var(--hard);border-radius:inherit;pointer-events:none}
.sf-view{position:absolute;inset:0;overflow:hidden;border-radius:inherit}
.sf-view>svg,.sf-view>.sf-l{display:block;position:absolute;left:0;top:0;width:100%;height:100%;transform-origin:0 0}
.sf-view #scene{cursor:grab}
/* the moving parts: HTML boxes with a small svg inside; only transform and opacity ever animate */
.sf-m{position:absolute;pointer-events:none}
.sf-m svg{display:block;width:100%;height:100%;overflow:visible}
.sf-m.clip{overflow:hidden}.sf-m.clip svg{overflow:hidden}
.sf-m .dr{width:200%;height:100%;animation:sf-drift 120s linear infinite}
.sf-m.drift,.sf-m.st{animation:none}
.sf-m.sway{transform-origin:50% 0;animation:sf-sway 5s ease-in-out infinite alternate}
.sf-m.sway2{transform-origin:50% 0;animation:sf-sway 6.5s ease-in-out -2s infinite alternate-reverse}
.sf-m.swing{transform-origin:50% 0;animation:sf-swing 2s ease-in-out infinite alternate}
.sf-m.spin{animation:sf-spin 60s linear infinite}
.sf-m.twinkle{animation:sf-twinkle 3s ease-in-out infinite alternate}
.sf-m.glow{animation:sf-twinkle 5s ease-in-out infinite alternate}
.sf-m.flick{transform-origin:50% 100%;animation:sf-flick .9s ease-in-out infinite alternate}
.sf-m.rise{animation:sf-rise 6s ease-in infinite}
.sf-m.bob{animation:sf-bob 4s ease-in-out infinite alternate}
.sf-m.ripple{animation:sf-ripple 4s ease-out infinite}
.sf-m.swim{animation:sf-swim 9s ease-in-out infinite}
.sf-m.swim2{animation:sf-swim2 14s ease-in-out infinite}
@keyframes sf-drift{to{transform:translateX(-50%)}}
@keyframes sf-sway{from{transform:rotate(-2.4deg)}to{transform:rotate(2.4deg)}}
@keyframes sf-swing{from{transform:rotate(-7deg)}to{transform:rotate(7deg)}}
@keyframes sf-spin{to{transform:rotate(360deg)}}
@keyframes sf-twinkle{from{opacity:.45}to{opacity:1}}
@keyframes sf-flick{from{transform:scale(1,.94);opacity:.85}to{transform:scale(1.04,1.06);opacity:1}}
@keyframes sf-rise{0%{transform:translateY(25%);opacity:0}15%{opacity:1}100%{transform:translateY(-55%);opacity:0}}
@keyframes sf-bob{from{transform:translateY(-7%)}to{transform:translateY(7%)}}
@keyframes sf-ripple{0%{transform:scale(.7);opacity:.9}100%{transform:scale(1.25);opacity:0}}
@keyframes sf-swim{0%{transform:translateX(0) scaleX(1)}46%{transform:translateX(80%) scaleX(1)}50%{transform:translateX(80%) scaleX(-1)}96%{transform:translateX(0) scaleX(-1)}100%{transform:translateX(0) scaleX(1)}}
@keyframes sf-swim2{0%{transform:translateX(0) scaleX(1)}46%{transform:translateX(-60%) scaleX(1)}50%{transform:translateX(-60%) scaleX(-1)}96%{transform:translateX(0) scaleX(-1)}100%{transform:translateX(0) scaleX(1)}}
html[data-gfx=low] .sf-m,html[data-gfx=low] .sf-m .dr{animation:none}
@media (prefers-reduced-motion:reduce){.sf-m,.sf-m .dr{animation:none}}
.sf-view.panning .sf-l{will-change:transform}
.sf-view .osh{fill:#4d3857;opacity:.18;pointer-events:none}
body.sf-arranging .sf-view #scene{cursor:default}
.sf-view .o{cursor:pointer}
.sf-view .o .hit{fill:transparent}
.sf-view .o .ring{fill:none;stroke:#22c55e;stroke-width:5;opacity:0}
.sf-view .o.found .ring{opacity:1}
.sf-view .o.found{opacity:1!important}
body.sf-arranging .sf-view .o{cursor:move}
.sf-view .o.sel .ring{opacity:1;stroke:#38bdf8;stroke-dasharray:10 7}
.sf-view .hintc{fill:rgba(250,204,21,.18);stroke:#facc15;stroke-width:6;animation:sf-pulse 1s ease-in-out infinite;transform-box:fill-box;transform-origin:center;pointer-events:none}
@keyframes sf-pulse{from{transform:scale(.8);opacity:1}to{transform:scale(1.15);opacity:.45}}
html[data-gfx=low] .sf-view .hintc{animation:none}

.sf-zoom{position:absolute;right:10px;bottom:10px;z-index:4;display:flex;flex-direction:column;gap:6px}
.sf-zoom button{width:44px;height:44px;border-radius:50%;border:2px solid var(--hard);background:var(--panel);color:var(--text);font-size:1rem;cursor:pointer;display:grid;place-items:center;box-shadow:0 2px 0 rgba(0,0,0,.25)}
.sf-zoom button:disabled{opacity:.4;cursor:default}
.sf-fx{position:absolute;inset:0;z-index:5;pointer-events:none;overflow:hidden}
.sf-pop{position:absolute;font-weight:900;font-size:1.8rem;transform:translate(-50%,-50%);text-shadow:0 2px 0 rgba(0,0,0,.45)}
.sf-pop.good{color:#4ade80}.sf-pop.bad{color:#f87171}
.sf-edit{position:absolute;left:8px;right:8px;top:8px;z-index:4;background:rgba(15,23,42,.88);color:#fff;border-radius:10px;padding:6px 10px;font-weight:700;font-size:.9rem;text-align:center}
.sf-board .gs-over{z-index:8}

/* a narrow page (a phone held upright, not full screen): the Start card is taller than the small room, so the card's layer opens downward over the list instead of being squeezed and cut off inside the room */
@media (max-width:700px){
  html:not(.gic-fs):not(.gic-phone) .sf-board{overflow:visible}
  html:not(.gic-fs):not(.gic-phone) .sf-board .gs-over{inset:0 0 auto 0;height:min(27rem,calc(var(--gic-maxh,100vh) - 24px));z-index:20;border-radius:18px}
}

/* ---- the find list ---- */
.sf-list{list-style:none;margin:0;padding:8px;width:clamp(150px,22%,230px);flex:none;overflow-y:auto;border-radius:14px;border:3px solid var(--hard);background:var(--panel);display:grid;grid-template-columns:1fr;gap:6px;align-content:start;max-height:calc(var(--gic-maxh,100vh) - 150px);align-self:stretch}
.sf-list li{display:flex;align-items:center;gap:8px;min-height:44px;padding:4px 8px;border-radius:10px;background:var(--bg);border:2px solid var(--hard);font-weight:800;font-size:max(14px,1rem);line-height:1.15;overflow-wrap:anywhere}
.sf-list .pc{flex:none;width:36px;height:36px;display:grid;place-items:center;font-size:1.7rem}
.sf-list .pc img{max-width:100%;max-height:100%;object-fit:contain}
.sf-list .ck{flex:none;width:20px;height:20px;border-radius:50%;border:2px solid var(--hard);display:grid;place-items:center;font-size:.7rem;color:transparent}
.sf-list li.got{background:rgba(34,197,94,.18);border-color:#22c55e}
.sf-list li.got .ck{background:#22c55e;border-color:#22c55e;color:#fff}
.sf-list li.got .wd{text-decoration:line-through;opacity:.7}
.sf-list li.got .pc{opacity:.55}

.sf-pick{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin:6px 0}
.sf-pk{border:2px solid var(--hard);background:var(--panel2);color:var(--text);border-radius:999px;padding:6px 12px;min-height:36px;font-weight:800;cursor:pointer;font-size:max(14px,.9rem)}
.sf-pk.on{background:var(--sky);color:#fff;border-color:var(--sky)}
.msg{min-height:1.4em;margin:0;text-align:center;font-weight:700}

/* portrait and narrow: list goes under the scene as a wrapping row */
html[data-orient=portrait] .sf-play,html.gic-phone .sf-play{flex-direction:column}
html[data-orient=portrait] .sf-board,html.gic-phone .sf-board{flex:none;width:min(100%,calc((var(--gic-maxh,100vh) - 150px)*1.6))}
html[data-orient=portrait] .sf-list,html.gic-phone .sf-list{width:100%;max-height:none;grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}
@media (max-width:700px){.sf-play{flex-direction:column;align-items:center}.sf-board{flex:none;width:100%}.sf-list{width:100%;max-height:none;grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}}

/* ---- full screen (1.203.364) ----
   The room is as large as the window allows and EVERY word stays visible (no scrolling). A wide window puts the words in a column beside the room;
   a squarer or upright window (iPad, a 4:3 board, a phone held upright) puts them in a band under it. .sf-play is a size container; .sf-in does the arranging.
   game.js sets --n (words), --h2 (n / 2 rounded up) and --q4 (n / 4 rounded up) on the list. Font and picture sizes follow the list's own height. */
.sf-in{display:contents}
:is(html.gic-fs,html.gic-phone) .layout{grid-template-columns:minmax(0,1fr)}
:is(html.gic-fs,html.gic-phone) .sf-stage{border-radius:0;border:0;box-shadow:none;background:transparent;padding:4px 54px 4px 4px;flex:1 1 auto;min-height:0}
html.gic-phone body .sf-stage{padding:4px}
:is(html.gic-fs,html.gic-phone) .sf-play{flex:1 1 0;min-height:0;width:100%;container:sfplay/size;display:block}
:is(html.gic-fs,html.gic-phone) .sf-in{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:8px;width:100%;height:100%}
html:is(.gic-fs,.gic-phone){--sf-lw:clamp(150px,20cqw,300px)}
:is(html.gic-fs,html.gic-phone) .sf-board{flex:none;align-self:center;aspect-ratio:1000/625;max-width:none;max-height:none;width:auto;height:min(100cqh,calc((100cqw - var(--sf-lw) - 8px) / 1.6))}
:is(html.gic-fs,html.gic-phone) .sf-list{--rows:var(--n,12);flex:none;align-self:center;width:var(--sf-lw);height:min(100cqh,calc((100cqw - var(--sf-lw) - 8px) / 1.6));max-height:none;box-sizing:border-box;container-type:size;overflow-x:hidden;overflow-y:auto;padding:4px;gap:3px;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(var(--n,12),minmax(18px,1fr));align-content:stretch}
:is(html.gic-fs,html.gic-phone) .sf-list li{min-height:0;padding:0 clamp(6px,5cqw,12px);gap:clamp(4px,3cqw,10px);font-size:clamp(12px,calc(100cqh / var(--rows,12) * .5),26px);line-height:1.05;overflow:hidden}
:is(html.gic-fs,html.gic-phone) .sf-list .pc{width:clamp(18px,calc(100cqh / var(--rows,12) * .72),56px);height:clamp(18px,calc(100cqh / var(--rows,12) * .72),56px);font-size:clamp(14px,calc(100cqh / var(--rows,12) * .6),44px)}
:is(html.gic-fs,html.gic-phone) .sf-list .ck{width:clamp(12px,calc(100cqh / var(--rows,12) * .36),22px);height:clamp(12px,calc(100cqh / var(--rows,12) * .36),22px)}
:is(html.gic-fs,html.gic-phone) .msg{margin-top:2px}
/* a squarer or upright window: words in a band under the room (3 sizes of band by width) */
@container sfplay (max-aspect-ratio: 7/4){
  :is(html.gic-fs,html.gic-phone) .sf-in{flex-direction:column;justify-content:center;gap:8px}
  :is(html.gic-fs,html.gic-phone) .sf-board{height:auto;width:min(100cqw,calc((100cqh - var(--sf-lh) - 8px) * 1.6))}
  :is(html.gic-fs,html.gic-phone) .sf-in{--sf-rh:clamp(32px,5.4cqh,56px)}
  :is(html.gic-fs,html.gic-phone) .sf-list{width:100cqw;height:var(--sf-lh);grid-template-rows:none;grid-auto-rows:var(--sf-rh);align-content:start}
  :is(html.gic-fs,html.gic-phone) .sf-in{--sf-lh:calc(2 * var(--sf-rh) + 3px + 14px)}
  :is(html.gic-fs,html.gic-phone) .sf-list{--rows:2;grid-template-columns:repeat(var(--h2,6),minmax(0,1fr))}
}
@container sfplay (max-aspect-ratio: 7/4) and (max-width: 899px){
  :is(html.gic-fs,html.gic-phone) .sf-in{--sf-lh:calc(var(--q4,3) * var(--sf-rh) + (var(--q4,3) - 1) * 3px + 14px)}
  :is(html.gic-fs,html.gic-phone) .sf-list{--rows:var(--q4,3);grid-template-columns:repeat(4,minmax(0,1fr))}
}
@container sfplay (max-aspect-ratio: 7/4) and (max-width: 559px){
  :is(html.gic-fs,html.gic-phone) .sf-in{--sf-lh:calc(var(--h2,6) * var(--sf-rh) + (var(--h2,6) - 1) * 3px + 14px)}
  :is(html.gic-fs,html.gic-phone) .sf-list{--rows:var(--h2,6);grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* ---- editor ---- */
.sf-lvls{display:flex;flex-wrap:wrap;gap:6px}
.sf-lt{width:40px;height:40px;border-radius:10px;border:2px solid var(--hard);background:var(--panel2);color:var(--text);font-weight:900;cursor:pointer}
.sf-lt[aria-pressed=true]{background:var(--sky);color:#fff;border-color:var(--sky)}
.sf-scenes{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.sf-sc{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 6px;min-height:64px;border-radius:12px;border:2px solid var(--hard);color:#fff;cursor:pointer;font-size:.9rem;text-shadow:0 1px 2px rgba(0,0,0,.5)}
.sf-sc i{font-size:1.3rem}
.sf-sc[aria-pressed=true]{outline:3px solid var(--sky);outline-offset:2px}
.sf-sc-toy{background:linear-gradient(135deg,#fb923c,#a855f7)}
.sf-sc-garden{background:linear-gradient(135deg,#84cc16,#15803d)}
.sf-sc-reef{background:linear-gradient(135deg,#22d3ee,#1d4ed8)}
.sf-sc-kitchen{background:linear-gradient(135deg,#f28b82,#d4a24c)}
.sf-sc-study{background:linear-gradient(135deg,#8c2f39,#3f6b4a)}
.sf-sc-custom{background:linear-gradient(135deg,#64748b,#334155)}
.sf-emo{display:flex;flex-wrap:wrap;gap:4px}
.sf-eb{width:40px;height:40px;border-radius:10px;border:2px solid var(--hard);background:var(--panel2);font-size:1.4rem;cursor:pointer;padding:0}
.sf-eb:hover{filter:brightness(1.12)}
.fc-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.fc-none{color:var(--muted);text-align:center;padding:8px}
.fc-item{display:flex;align-items:center;gap:6px;background:var(--bg);border:2px solid var(--hard);border-radius:10px;padding:4px 6px}
.fc-item.sel{border-color:var(--sky)}
.fc-item input[type=text]{flex:1;min-width:0;border:0;background:transparent;padding:6px 4px;border-radius:6px;font-weight:700;font-size:.9rem}
.fc-item input[type=text]:focus{outline:2px solid var(--sky);border:0}
.fc-thumb{width:40px;height:40px;flex:none;border-radius:8px;border:2px solid var(--hard);background:var(--panel2);cursor:pointer;padding:0;overflow:hidden;display:grid;place-items:center;font-size:1.3rem;color:var(--muted)}
.fc-thumb img{width:100%;height:100%;object-fit:contain;display:block}
.mini{border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:.8rem;width:28px;height:28px;border-radius:50%;flex:none;display:grid;place-items:center}
.mini:hover:not(:disabled){background:var(--panel2);color:var(--text)}
.mini.del:hover{background:var(--rose);color:#fff}
.sf-view #sceneBg,.sf-view #mv,.sf-view #fr,.sf-view #hints{pointer-events:none}
@media (max-width:700px){.sf-zoom{flex-direction:row;right:6px;bottom:6px;gap:4px}.sf-zoom button{width:36px;height:36px;font-size:.85rem;opacity:.9}}
html.gic-phone .sf-zoom{flex-direction:row;right:6px;bottom:6px;gap:4px}html.gic-phone .sf-zoom button{width:36px;height:36px;font-size:.85rem;opacity:.9}
