*{box-sizing:border-box}body{margin:0;min-height:100svh;color:#493354;font-family:'Trebuchet MS',Arial,sans-serif;background:#d6dfba url('assets/garden.webp') center center/cover fixed}body:before{content:'';position:fixed;inset:0;background:linear-gradient(180deg,#fdf9ed92,#fdf9ed20 48%,#fbf5e48c);pointer-events:none;z-index:-1}button{font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}header{max-width:1120px;margin:auto;padding:18px 26px;display:flex;justify-content:space-between;align-items:center;gap:14px}.brand{font-size:11px;letter-spacing:1.8px;text-transform:uppercase;padding:12px 18px;background:#fff9ecda;border:1px solid #ffffffb0;border-radius:30px;box-shadow:0 3px 15px #43432610}#difficulty{font-size:12px;padding:10px 16px;border-radius:30px;background:#fff9ece8;border:1px solid #ddc898}main{max-width:1100px;margin:auto;padding:0 24px 20px;text-align:center}h1{font:normal clamp(28px,3.4vw,42px) Georgia,serif;margin:7px 0;color:#493157;text-shadow:0 1px 15px #fff9e9}main>p{font-size:15px;line-height:1.4;margin:5px 0 6px;color:#604a68;text-shadow:0 1px 8px #fff}.progress{font-size:11px;letter-spacing:2px;font-weight:bold;color:#62456c}#stars{height:37px;display:flex;gap:9px;align-items:center;justify-content:center;font-size:29px;margin:0 0 2px}#stars .earned{color:#efb72e;filter:drop-shadow(0 2px 1px #896014)}#stars .new-star{animation:star-pop .55s ease-out}.game{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:34px;align-items:center;max-width:900px;margin:0 auto}.game>*{min-width:0}.stage{position:relative;isolation:isolate}.stage:after{content:'';position:absolute;left:10%;right:10%;bottom:0;height:40%;z-index:-1;background:#fff7e45c;border-radius:50%;filter:blur(30px)}.stage>svg{width:100%;display:block;max-height:600px;overflow:hidden}.slot{cursor:pointer;outline:none;touch-action:manipulation}.slot:focus-visible .socket{stroke:#79528c;stroke-width:7}.shelf{background:linear-gradient(145deg,#fffbefee,#f9f2e1db);border:1px solid #fff5d9;border-radius:28px;padding:22px 18px 18px;box-shadow:0 12px 40px #303d2626;backdrop-filter:blur(8px)}.shelf h2{font:normal 24px Georgia;margin:0 0 6px;color:#60406b}.shelf>p{font-size:13px;color:#8a7389;margin:0}.boxes{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:16px 0 10px}.box{position:relative;border:0;border-radius:18px;background:transparent;padding:0;min-height:110px;aspect-ratio:1.15;transition:transform .18s,filter .18s;touch-action:manipulation}.box .chest{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none;filter:drop-shadow(0 5px 3px #54364c24)}.box .box-gem{position:absolute;left:33%;top:48%;width:34%;height:34%;pointer-events:none;filter:drop-shadow(0 3px 2px #2d173e66)}.box.selected{filter:drop-shadow(0 0 5px #edc75b);transform:translateY(-3px)}.box:active{transform:scale(.94)}.box:focus-visible{outline:3px solid #8a5aa2;outline-offset:2px}.hint{font-size:12px;color:#806b7f;line-height:1.5;margin:12px 0 0}.hint br{display:none}.actions{display:flex;justify-content:center;gap:12px;flex-wrap:wrap;margin-top:10px}button:not(.box){border:1px solid #e2cda6;border-radius:30px;padding:13px 24px;background:#fff7e9;color:#62466d;font-weight:bold;box-shadow:0 3px 8px #53344e12}button.primary{color:#fff9f1;background:linear-gradient(#9566a9,#75488b);border:1px solid #815096;box-shadow:0 4px 0 #543362,0 6px 15px #54336226}button:disabled{opacity:.55;cursor:default}button:focus-visible{outline:3px solid #b88c25;outline-offset:4px}#message{min-height:28px;font-size:17px;line-height:1.4;margin:8px 0 0;font-weight:bold;text-shadow:0 0 14px #fff,0 0 6px #fff}#summary{padding:36px 28px;background:linear-gradient(#fffcf4,#fff1d9);color:#49375b;border:2px solid #e5c873;border-radius:28px;width:min(90vw,540px);text-align:center;box-shadow:0 24px 100px #28133255;overflow:visible}#summary[open]{animation:palmares-in .45s ease-out}#summary::backdrop{background:#35213f99;backdrop-filter:blur(5px)}#summary h2{font:normal 34px Georgia;margin:0 0 12px}#summary p{line-height:1.5}.final-stars{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:20px 0;min-height:64px}.final-stars span{display:inline-block;color:#dfaa28;font-size:50px;text-shadow:0 3px 0 #ae791d;animation:star-pop .6s both;animation-delay:var(--delay)}.celebration{font-size:36px;color:#bb902e;margin-bottom:10px}@keyframes star-pop{0%{opacity:0;transform:translateY(20px) scale(.15) rotate(-25deg)}70%{opacity:1;transform:translateY(-5px) scale(1.2) rotate(8deg)}100%{opacity:1;transform:none}}@keyframes palmares-in{from{opacity:0;transform:translateY(25px) scale(.9)}to{opacity:1;transform:none}}@media(hover:hover){.box:hover{transform:translateY(-4px)}}
@media(max-width:720px){body{background-position:center top;background-attachment:scroll}header{padding:10px 12px;gap:8px}.brand{font-size:8px;letter-spacing:1px;padding:8px 10px;max-width:58%}#difficulty{font-size:10px;padding:8px 10px;max-width:42%}main{padding:0 12px 10px}h1{font-size:27px;margin:5px 0}main>p{font-size:12px;margin:4px 6px 0}#stars{height:30px;font-size:25px}.progress{font-size:10px}.game{grid-template-columns:1fr;gap:0;max-width:440px}.stage>svg{max-height:none;width:100%;height:auto}.shelf{padding:9px 8px 8px;border-radius:22px;margin-top:-4px}.shelf h2{font-size:17px}.shelf>p{display:none}.boxes{grid-template-columns:repeat(4,minmax(0,1fr));gap:2px;margin:4px 0 0}.box{min-height:0;aspect-ratio:1.05;border-radius:12px}.hint{font-size:10px;line-height:1.35;margin:2px 5px}.actions{position:sticky;bottom:0;z-index:2;background:#fff9e9df;backdrop-filter:blur(8px);border-radius:24px 24px 0 0;padding:8px 4px max(10px,env(safe-area-inset-bottom));margin:6px -3px 0;gap:8px}button:not(.box){font-size:12px;padding:11px 15px;min-height:44px}#message{font-size:14px;min-height:22px;margin:6px 0 0}#summary{padding:26px 18px;max-height:90dvh;overflow:auto}#summary h2{font-size:27px}.final-stars{gap:5px}.final-stars span{font-size:42px}}
@media(max-width:360px){h1{font-size:24px}.brand{font-size:7px}main{padding-left:8px;padding-right:8px}.hint{font-size:9px}button:not(.box){padding:10px 12px}}@media(max-height:500px) and (orientation:landscape){header{padding:6px 14px}.game{grid-template-columns:minmax(0,1fr) 250px;max-width:700px}.stage>svg{max-height:340px}.boxes{grid-template-columns:repeat(2,1fr)}.shelf h2{font-size:18px}.box{max-height:110px}.actions{position:static}}
@media(prefers-reduced-motion:reduce){#stars .new-star,#summary[open],.final-stars span{animation:none}.box{transition:none}}


.faces .face-happy,.faces .face-oops{opacity:0;transition:opacity 650ms cubic-bezier(.25,.1,.25,1)}.faces[data-expression="happy"] .face-happy,.faces[data-expression="oops"] .face-oops{opacity:1}.faces.reset .face-happy,.faces.reset .face-oops{transition:none}@media(prefers-reduced-motion:reduce){.faces .face-happy,.faces .face-oops{transition:none}}

/* Embedded WordPress page: use content height, avoiding viewport resize loops. */
html.embedded body{min-height:0}html.embedded .actions{position:static}

/* Keep the full dress behind the controls, clipped only at the decor edge. */
main{position:relative;isolation:isolate;overflow:hidden}.stage{z-index:0}.stage>svg{overflow:visible;-webkit-mask-image:none;mask-image:none}.shelf{position:relative;z-index:1}#message{position:relative;z-index:2}.actions{position:relative;z-index:2}@media(max-width:720px){.actions{position:sticky}}html.embedded .actions{position:relative}

/* Classroom layout: the necklace, portrait and choices take priority. */
header{max-width:1250px;padding:8px 18px}.brand{padding:7px 12px}main{max-width:1280px;padding:0 12px 12px}h1{font-size:30px;margin:2px 0}main>p{margin:3px 0;font-size:14px}#stars{height:30px;margin:0}.game{max-width:1200px;grid-template-columns:minmax(0,1fr) 230px;gap:12px}.stage>svg{height:760px;max-height:none;width:100%}.shelf{padding:16px 10px}.shelf h2{font-size:21px}.boxes{gap:4px}.box .box-gem{left:28%;top:43%;width:44%;height:44%}.box{min-height:105px}.hint{font-size:12px}body:before{background:#fff8ec65}.actions{margin-top:4px}#message{margin:3px 0}
@media(max-width:720px){header{padding:5px 9px}.brand{display:none}#difficulty{max-width:none;margin-left:auto;padding:5px 10px}main{padding:0 5px 8px}h1{font-size:23px}main>p{font-size:12px}.game{grid-template-columns:1fr;max-width:520px;gap:0}.stage>svg{height:auto;aspect-ratio:674/1080}.shelf{padding:6px;margin-top:-3px}.shelf h2{font-size:16px}.boxes{gap:3px;margin:2px 0}.box{min-height:0;aspect-ratio:1}.hint{font-size:10px}.actions{padding-top:6px}#stars{height:27px}}
@media(max-height:500px) and (orientation:landscape){.game{grid-template-columns:minmax(0,1fr) 210px}.stage>svg{height:480px;aspect-ratio:auto}.boxes{grid-template-columns:1fr 1fr}}

/* Constrain jewelry boxes to their grid cells, including narrow PC embeds. */
.shelf{min-width:0;max-width:100%;width:100%}.boxes{min-width:0;width:100%;grid-template-columns:repeat(2,minmax(0,1fr))}.box{min-width:0;width:100%;min-height:0;max-width:100%;aspect-ratio:1.05}.box .chest{max-width:100%}
@media(max-width:720px){.boxes{grid-template-columns:repeat(4,minmax(0,1fr))}.box{aspect-ratio:1}}
@media(max-height:500px) and (orientation:landscape){.boxes{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Larger jewelry tray on desktop, with a compact fallback for narrow embeds. */
@media(min-width:721px){.game{grid-template-columns:minmax(0,1fr) clamp(280px,29vw,360px);gap:18px}.shelf{padding:22px 16px;border-radius:28px}.shelf h2{font-size:26px}.shelf>p{font-size:15px}.boxes{gap:10px;margin:16px 0 12px}.box{aspect-ratio:1.05}.hint{font-size:13px;line-height:1.5}}
@media(min-width:721px) and (max-width:900px){.game{gap:10px}.shelf{padding:16px 12px}.shelf h2{font-size:23px}.boxes{gap:6px}}
