.word-search-dialog{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:#fff6df;color:#372b20}
.word-search-dialog::backdrop{background:rgba(24,45,29,.76)}
.ws-screen{position:relative;isolation:isolate;box-sizing:border-box;display:grid;place-items:center;width:100%;height:100%;overflow:auto;padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));background:linear-gradient(180deg,rgba(255,247,220,.3),rgba(32,74,41,.24)),var(--ws-scene) center/cover no-repeat}
.ws-window{position:relative;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;gap:clamp(6px,1.3vh,13px);width:min(100%,1200px);height:100%;max-height:100%;min-height:0;overflow:hidden;padding:clamp(8px,1.6vh,15px);border:4px solid rgba(255,255,255,.96);border-radius:clamp(18px,3vw,30px);background:rgba(255,251,235,.94);box-shadow:0 12px 34px rgba(37,53,28,.3);touch-action:pan-y}
.ws-header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:none;padding:3px 8px 3px 12px;border-radius:17px;background:#fff9e9;box-shadow:0 2px 0 #eddfbf}
.ws-header small{display:block;color:#47734a;font-size:clamp(9px,1.25vh,12px);font-weight:950;letter-spacing:.12em}.ws-header h1{margin:2px 0;color:#3b2b1d;font-size:clamp(20px,2.7vh,30px);line-height:1.05}
.ws-close{flex:none;width:44px;height:44px;border:2px solid #eddaa9;border-radius:50%;background:#fff;color:#493829;font:800 29px/1 system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.ws-intro{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:clamp(5px,.9vh,10px);padding:clamp(4px,1vh,10px);text-align:center}
.ws-intro-art{display:grid;place-items:center;width:clamp(44px,8vh,78px);height:clamp(44px,8vh,78px);border:3px solid white;border-radius:50%;background:#dcedbd;box-shadow:0 3px 0 #b7ce8e;font-size:clamp(30px,5vh,50px)}
.ws-intro h2{margin:0;color:#315d3b;font-size:clamp(23px,3vh,32px)}.ws-intro p{max-width:38ch;margin:0;color:#564735;font-size:clamp(15px,1.9vh,19px);font-weight:700;line-height:1.24}.ws-intro h3{margin:3px 0 0;color:#5a482f;font-size:clamp(14px,1.8vh,19px)}
.ws-topics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:clamp(4px,1vw,9px);width:min(100%,690px)}
.ws-topic{display:flex;min-height:clamp(64px,9vh,86px);flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:5px 3px;border:2px solid #e7d8b6;border-radius:15px;background:#fffdf5;color:#44372a;font:800 clamp(11px,1.5vh,15px)/1.1 system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.ws-topic>span{font-size:clamp(24px,4vh,36px);line-height:1}.ws-topic.selected,.ws-count.selected{border-color:#407d49;background:#e7f3d9;box-shadow:inset 0 0 0 1px #407d49}.ws-counts{display:flex;justify-content:center;gap:7px}.ws-count{min-width:78px;min-height:39px;padding:5px 12px;border:2px solid #e7d8b6;border-radius:14px;background:#fffdf5;color:#44372a;font:800 15px/1.1 system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.ws-start{min-height:50px;min-width:190px;padding:9px 24px;border:3px solid #fff;border-radius:18px;background:#247446;color:#fff;font:900 clamp(19px,2.2vh,22px)/1.1 system-ui,sans-serif;box-shadow:0 4px 0 #174c2f;cursor:pointer;touch-action:manipulation}.ws-start:active,.ws-again:active{transform:translateY(2px);box-shadow:0 2px 0 #174c2f}
.ws-live{display:flex;align-items:center;justify-content:center;flex:none;min-height:35px;padding:4px 10px;border-radius:13px;background:#f1f5df;color:#425f3a;font-size:clamp(13px,1.65vh,17px);font-weight:800;line-height:1.15;text-align:center}
.ws-status{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:1px 7px;color:#43603a;font-size:clamp(14px,1.8vh,19px);font-weight:900}.ws-timer{padding:4px 12px;border:2px solid #e5d6b1;border-radius:13px;background:#fffdf3;font-variant-numeric:tabular-nums}
.ws-board-wrap{display:flex;flex:1;min-height:0;flex-direction:column;align-items:center;justify-content:center;gap:clamp(5px,.9vh,10px)}
.ws-grid{box-sizing:border-box;display:grid;grid-template-columns:repeat(var(--ws-cols,9),var(--ws-cell,32px));gap:var(--ws-gap,3px);width:var(--ws-board,auto);max-width:100%;padding:7px;border:3px solid #fdfcf1;border-radius:18px;background:#dcedbd;box-shadow:0 4px 0 #b9d29a;touch-action:none;user-select:none;-webkit-user-select:none}
.ws-cell{box-sizing:border-box;display:grid;place-items:center;width:var(--ws-cell,32px);height:var(--ws-cell,32px);min-width:0;padding:0;border:1px solid #ded4b4;border-radius:clamp(4px,1vw,9px);background:#fffdf3;color:#392e23;font:900 clamp(14px,calc(var(--ws-cell,32px)*.52),32px)/1 system-ui,sans-serif;cursor:pointer;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}
.ws-cell.is-selecting{z-index:1;border:2px solid #a66c1f;background:#ffd660;color:#3e301e;box-shadow:0 0 0 2px #fff9d0;transform:scale(1.04)}
.ws-cell.is-found{border:2px solid var(--found-line);background:var(--found-bg);color:#283228;box-shadow:inset 0 -3px 0 color-mix(in srgb,var(--found-line) 23%,transparent)}
.ws-word-list{display:flex;flex-wrap:wrap;justify-content:center;gap:5px;max-width:100%}
.ws-word{min-width:52px;min-height:34px;padding:3px 11px;border:2px solid #c7b58b;border-radius:999px;background:#fffdf5;color:#514638;font:900 clamp(14px,1.75vh,18px)/1 system-ui,sans-serif;letter-spacing:.09em;cursor:pointer;touch-action:manipulation}
.ws-word.is-found{border-color:var(--found-line);background:var(--found-bg);color:#283228;text-decoration:line-through;text-decoration-thickness:2px}
.ws-find-picture{display:flex;align-items:center;justify-content:center;gap:7px;min-height:29px;font-size:clamp(17px,2vh,21px);font-weight:900}.ws-find-picture img{width:29px;height:29px;object-fit:contain}.ws-object-emoji{font-size:28px;line-height:1}
.ws-found-pop{position:absolute;z-index:4;top:51%;left:50%;display:flex;min-width:clamp(140px,26vw,230px);min-height:clamp(135px,25vh,210px);flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:clamp(12px,2vh,20px);border:5px solid #fff;border-radius:28px;background:#fff9e8;color:#386d42;font-size:clamp(21px,3vh,31px);font-weight:950;box-shadow:0 8px 24px #253a2680;transform:translate(-50%,-50%);animation:ws-pop .32s cubic-bezier(.2,1.55,.5,1) both;pointer-events:none}.ws-found-pop img,.ws-found-pop .ws-object-emoji{width:clamp(70px,12vh,110px);height:clamp(70px,12vh,110px);object-fit:contain;font-size:clamp(58px,10vh,92px);line-height:1}
@keyframes ws-pop{from{opacity:0;transform:translate(-50%,-40%) scale(.55)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
.ws-controls{display:flex;justify-content:center;gap:8px}.ws-help,.ws-thanks{min-height:38px;padding:5px 13px;border:2px solid #e6d6b2;border-radius:14px;background:#fffdf5;color:#514434;font:800 clamp(13px,1.6vh,16px)/1.1 system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.ws-star-layer{position:absolute;z-index:5;inset:0;overflow:hidden;pointer-events:none}.ws-star-layer span{position:absolute;left:var(--star-x);top:45%;color:#ffc737;font-size:clamp(28px,5vh,54px);text-shadow:0 2px #af7515,0 0 12px #fff;animation:ws-star-fly 1.15s cubic-bezier(.16,.77,.27,1) both;animation-delay:var(--star-delay)}
@keyframes ws-star-fly{0%{opacity:0;transform:translate(-50%,25px) scale(.4) rotate(-28deg)}25%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + 10px),-110px) scale(1.2) rotate(28deg)}}
.ws-result{justify-content:center}.ws-win{display:flex;flex:1;min-height:0;flex-direction:column;align-items:center;justify-content:center;gap:clamp(7px,1.3vh,14px);padding:10px 6px;text-align:center}.ws-win-stars{color:#ffc332;font-size:clamp(30px,7vh,66px);letter-spacing:.04em;text-shadow:0 3px #b5791e;animation:ws-win-pop .65s cubic-bezier(.2,1.6,.45,1) both}.ws-win h2{margin:0;color:#2f7545;font-size:clamp(28px,4vh,43px)}.ws-win p{margin:0;color:#574631;font-size:clamp(18px,2.5vh,26px);line-height:1.25}.ws-win .ws-earned{color:#a36a13;font-weight:950}.ws-win-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-top:6px}.ws-again{min-height:53px;padding:9px 23px;border:3px solid white;border-radius:18px;background:#247446;color:#fff;font:900 19px system-ui,sans-serif;box-shadow:0 4px 0 #174c2f;cursor:pointer;animation:ws-button-pulse 1s ease-in-out infinite alternate;touch-action:manipulation}.ws-thanks{min-height:53px;padding-inline:19px;border-radius:18px;background:#fffdf3;font-size:17px}
@keyframes ws-button-pulse{from{transform:scale(1);box-shadow:0 4px 0 #174c2f,0 0 0 0 #73ae6160}to{transform:scale(1.055);box-shadow:0 4px 0 #174c2f,0 0 0 7px #73ae6100}}
@keyframes ws-win-pop{from{opacity:0;transform:scale(.25) rotate(-18deg)}to{opacity:1;transform:scale(1) rotate(0)}}
@media (orientation:landscape) and (min-width:620px){.ws-window{padding:8px 14px;gap:7px}.ws-header{padding-block:2px}.ws-board-wrap{display:grid;grid-template-columns:minmax(0,1fr) minmax(120px,.5fr);grid-template-rows:auto 1fr auto;column-gap:12px;align-content:center}.ws-status{grid-column:1/-1}.ws-grid{grid-column:1;grid-row:2/4}.ws-word-list{grid-column:2;grid-row:2;align-content:center;align-items:center}.ws-live{grid-column:2;grid-row:3}.ws-controls{flex:none}.ws-topic{min-height:55px}.ws-topic>span{font-size:25px}}
@media (max-height:520px){.ws-screen{place-items:center}.ws-window{gap:4px;padding:5px 8px}.ws-header h1{font-size:20px}.ws-header small{font-size:9px}.ws-close{width:36px;height:36px;font-size:24px}.ws-board-wrap{gap:4px}.ws-word{min-height:29px}.ws-live{min-height:28px}.ws-help{min-height:32px}}
@media (max-width:360px){.ws-window{padding:7px;gap:5px}.ws-topics{gap:3px}.ws-topic{min-height:60px;font-size:10px}.ws-count{min-width:70px}.ws-grid{padding:5px;gap:var(--ws-gap,2px)}}
@media (prefers-reduced-motion:reduce){.ws-star-layer span,.ws-win-stars,.ws-again{animation:none!important}.ws-again{transform:none}}

/* Preschool boards stay compact and keep each letter easy to touch. */
.ws-grid{padding:6px}
.ws-cell{font-size:clamp(18px,calc(var(--ws-cell,32px)*.58),32px)}
.ws-word{min-width:64px;min-height:42px;font-size:clamp(17px,2vh,21px)}
.ws-count{min-width:84px;min-height:46px;font-size:16px}
