:root{color-scheme:light;--green:var(--village-spruce);--forest:var(--village-deep-spruce);--paper:var(--village-snow);--line:var(--village-edge);--gold:var(--village-gold);--red:var(--village-cranberry);font-family:"Avenir Next",Avenir,"Trebuchet MS",Arial,sans-serif;color:var(--forest);background:var(--forest)}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
button,a{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer}
button:disabled{cursor:default}
button:focus-visible,a:focus-visible,.viewport:focus-visible{outline:3px solid #ffd66b;outline-offset:2px}
i{display:inline-flex;width:18px;height:18px;flex-shrink:0}
i svg,button svg{display:block;width:100%;height:100%}
h1,h2,p{margin:0}
h1,h2{font-family:Georgia,"Times New Roman",serif}
header{flex:none;padding-top:env(safe-area-inset-top);background:var(--village-midnight);color:#fff7df;border-bottom:1px solid #9a8752}
.nav{width:100%;height:44px;margin:0;padding:3px max(8px,env(safe-area-inset-right)) 3px max(8px,env(safe-area-inset-left));display:flex;align-items:center;justify-content:space-between;gap:8px}
.brand{display:flex;align-items:center;gap:7px;min-width:0;color:inherit;text-decoration:none;font:700 20px/1 Georgia,serif;letter-spacing:-.7px;white-space:nowrap}
.brand img{width:25px;height:29px;flex:none}
.tools{display:flex;align-items:center;gap:5px;flex:none}
.tools button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:34px;padding:0 12px;border:1px solid #7c947d;border-radius:20px;background:#ffffff0d;color:#fff7df;font-size:14px;font-weight:650}
.tools .circle{width:34px;padding:0}
.tools button:hover{background:#ffffff20}
main{position:relative;flex:1;min-width:0;min-height:0;width:100%;margin:0}
.game{display:grid;grid-template-rows:minmax(0,1fr) auto;gap:0;width:100%;height:100%;min-width:0;min-height:0}
.board-space{width:100%;height:100%;min-width:0;min-height:0;padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
.frame{position:relative;width:100%;height:100%;padding:0;border:0;border-radius:0;background:var(--village-deep-night);overflow:hidden}
.viewport{display:grid;place-items:center;width:100%;height:100%;overflow:hidden;touch-action:manipulation;cursor:default}
#hunt-countdown {
 position:absolute;inset:0;z-index:5;display:grid;place-items:center;
 background:#122f25a6;backdrop-filter:blur(3px);
}
.countdown-dial {
 display:grid;place-content:center;justify-items:center;gap:4px;
 width:min(190px,42vmin);aspect-ratio:1;border:3px double #ddc48b;border-radius:50%;
 background:var(--village-twilight);color:#fff4d8;box-shadow:0 6px 26px #0f251f66;
}
.countdown-dial span {font-size:clamp(12px,2.4vmin,16px);font-weight:650}
.countdown-dial strong {font:700 clamp(46px,13vmin,84px)/1 Georgia,serif;color:var(--village-gold);font-variant-numeric:tabular-nums}
.room{position:relative;line-height:0;isolation:isolate;user-select:none;flex:none;background:var(--village-deep-night)}
#photo{display:block;width:100%;height:100%;max-width:none;pointer-events:none;user-select:none}
#objects{position:absolute;inset:0}
.object,.fixed-item{position:absolute;transform:translate(-50%,-50%);display:grid;place-items:center;width:12%;height:10%;min-width:24px;min-height:24px;padding:0;border:0;border-radius:35%;background:transparent;z-index:1;line-height:1}
.object img{max-width:90%;width:auto;height:var(--size);max-height:100%;object-fit:contain;transform:rotate(var(--tilt));filter:brightness(.86) saturate(.91) drop-shadow(1px 2px 1px #2317058a);pointer-events:none;user-select:none}
.room.landscape .object{width:5.3%;height:12%}
.room.landscape .fixed-item{width:5%;height:11%}
#objects button:disabled{opacity:1;pointer-events:none}
#objects .object:enabled{z-index:2}
:is(#objects,.cup-board) .collected{z-index:4;animation:foundFade var(--found-feedback-ms,2000ms) linear both}
:is(#objects,.cup-board) button.collected:disabled{pointer-events:auto}
:is(#objects,.cup-board) .collected::before{content:"";position:absolute;left:50%;top:50%;width:var(--found-circle-size);height:var(--found-circle-size);transform:translate(-50%,-50%);border:3px solid var(--gold);border-radius:50%;background:#ffdc6b24;box-shadow:0 0 0 1px #496b30,0 0 18px 4px #ffda717a}
:is(#objects,.cup-board) .collected img{position:relative;z-index:1;filter:brightness(1.05) saturate(1.08) drop-shadow(0 0 4px #ffe2a0)}
.collected::after{content:"✓";position:absolute;z-index:2;right:-7px;top:-7px;display:grid;place-items:center;width:22px;height:22px;border:2px solid #fff4bf;border-radius:50%;background:var(--village-spruce);color:#fff8df;font-size:16px;font-weight:800;line-height:1;box-shadow:0 2px 5px #0005}
.hinting{outline:3px solid var(--gold);box-shadow:0 0 16px 7px #f7d35d;animation:glow .7s ease infinite alternate}
.game-head{display:flex;align-items:center;gap:8px;min-height:37px;padding:0 max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left))}
.intro{min-width:0}
.stage{display:inline-flex;align-items:center;gap:5px;font-size:12px;letter-spacing:.8px;font-weight:800;line-height:1.2;text-transform:uppercase}
.intro>.stage{min-height:31px;padding:7px 9px;border:1px solid #efe4bc88;border-radius:18px;background:#173d30e8;color:#fff2c9;backdrop-filter:blur(5px);white-space:nowrap}
.stage i{width:13px;height:13px}
.stats{display:flex;align-items:center;gap:9px;min-height:31px;margin-left:auto;padding:5px 9px;border:1px solid #f2e7c7a8;border-radius:18px;background:var(--village-snow);color:var(--forest)}
.stat{display:flex;align-items:center}
.time{display:flex;align-items:center;gap:5px;font:700 19px/1 Georgia,serif;font-variant-numeric:tabular-nums}
.time i{width:15px;height:15px;color:#806a36}
.time.urgent{color:var(--red)}
.divider{width:1px;height:18px;background:var(--line)}
#hearts{display:flex;align-items:center;gap:2px}
#hearts svg{width:16px;height:16px;color:#ac4840;filter:drop-shadow(0 1px 0 #782c2025)}
#hearts .empty svg{color:#d6d1c2}
.hud-pause{display:grid;place-items:center;flex:none;width:31px;height:31px;padding:0;border:1px solid #7c947d;border-radius:50%;background:#ffffff0d;color:#fff4d9}
.hud-pause i{width:15px;height:15px}
.hud-pause:hover{background:#ffffff20}
.stud{display:none}
.list-wrap{display:grid;grid-template-areas:"head music" "targets music";grid-template-columns:minmax(0,1fr) minmax(230px,310px);grid-template-rows:auto auto;gap:4px 10px;min-width:0;width:100%;padding:5px max(8px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));border-top:1px solid #bcae83;background:var(--paper)}
.list-head{grid-area:head;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:28px}
.list-title{display:flex;align-items:center;gap:7px;min-width:0}
.list-title h2{font-size:19px;letter-spacing:-.6px;line-height:1}
.tag-icon{display:inline-flex}
.tag-icon i{width:18px;height:18px}
#count{flex:none;padding:3px 8px;border-radius:15px;background:var(--village-mint);color:#466044;font-size:12px;font-weight:800;white-space:nowrap}
.tray-tools{display:flex;align-items:center;gap:5px}
#hint{display:flex;align-items:center;gap:5px;padding:4px 9px;border:1px solid #d6c69a;border-radius:20px;background:#faf0d5;color:#775d27;font-size:14px;line-height:1;font-weight:650;min-height:28px}
#hint i{width:16px;height:16px}
#hint b{margin-left:2px;padding-left:7px;border-left:1px solid #d5c8a9}
#hint:hover:enabled{background:#ede5cc}
#hint:disabled{opacity:.52}
#targets{grid-area:targets;display:grid;grid-template-columns:repeat(var(--columns,4),minmax(0,1fr));gap:5px;min-width:0;min-height:48px}
.card{display:flex;align-items:center;justify-content:center;gap:8px;min-width:0;min-height:48px;padding:3px 6px;border:1px solid #ddd4b9;border-radius:7px;background:var(--village-mist);color:var(--village-ink);font-size:14px;font-weight:650;line-height:1.1;text-align:center;overflow-wrap:anywhere}
.card img{width:32px;height:32px;flex:none;object-fit:contain;filter:drop-shadow(0 2px 1px #42310f28)}
:is(.card,.cup-target).done{position:relative;border-color:#94b38a;background:var(--village-mint);color:#496841;animation:foundFade var(--found-feedback-ms,2000ms) linear both}
:is(.card,.cup-target).done>span{text-decoration:line-through;text-decoration-thickness:2px}
:is(.card,.cup-target).done::after{content:"✓";position:absolute;right:4px;top:3px;color:#2f623e;font-size:13px;font-weight:800;line-height:1}
.music-controls{grid-area:music;display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:5px;min-width:0}
.music-choice{position:relative;display:flex;align-items:center;gap:6px;min-width:0;height:34px;padding:0 10px;border:1px solid #c9d4c3;border-radius:20px;background:#e9eee2;color:var(--green);font-size:14px;font-weight:650;white-space:nowrap}
.music-choice select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px}
.music-choice:focus-within{outline:2px solid var(--green)}
#now-playing{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#dj-shuffle{display:flex;align-items:center;justify-content:center;gap:6px;min-width:120px;height:34px;padding:0 10px;border:1px solid #244c38;border-radius:20px;background:var(--green);color:#fffcef;font-size:14px;font-weight:650;white-space:nowrap}
#dj-shuffle svg{width:17px;height:17px;flex:none}
#dj-shuffle:hover:enabled{background:#183c2b}
#dj-shuffle:disabled{opacity:.65;cursor:wait}
.hitmark{position:absolute;z-index:5;transform:translate(-50%,-50%);padding:5px 8px;border:1px solid #ac9251;border-radius:50%;background:#fff8df;color:var(--green);line-height:1;pointer-events:none;animation:pop .8s ease-out forwards}
.miss{position:absolute;z-index:4;color:white;background:var(--village-cranberry);padding:4px 7px;border-radius:12px;font:bold 15px/1.1 system-ui;transform:translate(-50%,-50%);pointer-events:none;animation:miss .85s ease-in forwards}
#overlay{position:fixed;inset:0;z-index:20;display:grid;place-items:center;padding:18px;background:#19332788;backdrop-filter:blur(4px)}
#overlay[hidden],#hunt-extra-action[hidden]{display:none}
.modal{width:min(390px,100%);max-height:100%;overflow:auto;padding:25px 24px;border:5px double #bca76b;border-radius:16px;background:var(--paper);text-align:center;box-shadow:0 16px 50px #17352155}
.modal>img{display:block;width:65px;height:65px;margin:0 auto 15px;object-fit:contain}
.modal h2{margin:8px 0 12px;font-size:34px;letter-spacing:-1.2px}
.modal p{color:var(--village-muted);font-size:16px;line-height:1.52}
.primary{margin-top:18px;padding:12px 24px;border:0;border-radius:30px;background:var(--green);color:#fffcef;font-weight:700}
.primary:hover{background:#183c2b}
.secondary{display:block;margin:10px auto 0;padding:8px 14px;border:0;border-radius:20px;background:transparent;color:var(--green);text-decoration:underline}
.summary-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:17px 0}
.summary-stat{padding:14px 6px;border:1px solid #d5c9a7;border-radius:10px;background:var(--village-mist)}
.summary-stat strong{display:block;font:700 29px/1.2 Georgia,serif;font-variant-numeric:tabular-nums}
.summary-stat span{display:block;margin-top:5px;font-size:13px;color:var(--village-muted)}
.summary-next{font-size:14px!important}
#overlay[data-phase="enter"]{animation:summaryIn 280ms ease-out both}
#overlay[data-phase="exit"]{animation:summaryOut 320ms ease-in both}
main.stage-covered{opacity:0}
main.stage-reveal{animation:summaryIn 420ms ease-out both}
@keyframes summaryIn{from{opacity:0}to{opacity:1}}
@keyframes summaryOut{from{opacity:1}to{opacity:0}}
.sr-only,.stat-label,#announce{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@keyframes pop{to{opacity:0;transform:translate(-50%,-180%)}}
@keyframes glow{to{box-shadow:0 0 3px 1px #ffedac}}
@keyframes miss{to{opacity:0;scale:1.55}}
@keyframes foundFade{0%,20%{opacity:1}100%{opacity:0}}
@media(max-width:720px){
 .brand{font-size:19px;gap:5px}.brand img{width:23px;height:27px}
 .list-wrap{grid-template-areas:"head" "targets" "music";grid-template-columns:minmax(0,1fr);gap:4px}
 .list-title h2{font-size:18px}
 #targets{gap:4px;min-height:60px}
 .card{min-height:60px;flex-direction:column;gap:2px;padding:3px 2px;font-size:14px;line-height:1.05}
 .card img{width:25px;height:25px}
 .card[data-card="cookie"]{font-size:13px}
 .music-controls{flex-direction:row;align-items:center;gap:6px}
 .music-choice{flex:1}
 #dj-shuffle{min-width:116px}
 .game-head{gap:4px}.stats{gap:6px;padding-inline:8px}
}
@media(max-width:355px){
 .nav{gap:4px;padding-inline:5px}.brand{font-size:16px}.brand img{width:21px}
 .tools{gap:4px}.tools button{padding-inline:9px;font-size:13px}.tools .circle{width:32px;padding:0}
 .intro>.stage{padding-inline:7px;font-size:11px}.stats{gap:5px;padding-inline:6px}.time{font-size:17px}#hearts svg{width:13px}
 .list-title h2{font-size:17px}.list-title{gap:5px}.tag-icon{display:none}
 .card{font-size:13px}#dj-shuffle{min-width:110px;padding-inline:8px}
}
@media(max-height:480px){
 .nav{height:36px}.brand{font-size:17px}.brand img{height:24px}.tools button{min-height:30px}.tools .circle{width:30px}
 .list-wrap{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}
 .list-head{min-height:24px}.list-title h2{font-size:17px}#hint{min-height:24px}
 #targets,.card{min-height:38px}.card img{width:28px;height:28px}
 .music-choice,#dj-shuffle{height:29px}.modal{padding:10px}.modal>img{height:26px;margin-bottom:5px}.modal h2{margin:3px;font-size:28px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition:none!important;scroll-behavior:auto!important}}
@media(prefers-reduced-motion:reduce){:is(#objects,.cup-board) .collected,:is(.card,.cup-target).done{animation:none!important;opacity:1}}
.duplicate-flash{position:absolute;z-index:9;transform:translate(-50%,-50%);display:flex;align-items:flex-end;justify-content:center;width:var(--duplicate-size);height:var(--duplicate-size);border:4px solid #ee3f43;border-radius:50%;background:#db283630;box-shadow:0 0 0 2px #fff3d4,0 0 18px 5px #d8224477;color:var(--village-snow);font-size:17px;font-weight:800;text-shadow:0 1px 3px #690817;line-height:1.5;pointer-events:none;animation:duplicateFade 2s ease-out both}
@keyframes duplicateFade{0%,55%{opacity:1}100%{opacity:0}}
@media(prefers-reduced-motion:reduce){.duplicate-flash{animation:none!important}}
/* Keep the whole scene large on a phone held sideways. */
@media(min-width:600px) and (max-height:480px){
 header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
 .nav{width:auto;min-width:0;height:36px}
 .game-head{min-height:36px;padding:0 max(8px,env(safe-area-inset-right)) 0 0;gap:6px}
 #team-penalty{grid-column:1/-1}
 .list-wrap{grid-template-areas:"head targets music";grid-template-columns:144px minmax(0,1fr) 190px;grid-template-rows:auto;gap:8px}
 .list-head{gap:4px}.list-title{gap:0}.tag-icon{display:none}
 .list-title h2,#dj-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 #targets{gap:4px}.card{flex-direction:row;gap:4px;padding:2px 3px;min-height:38px;font-size:14px}.card img{width:25px;height:25px}
 .music-controls{flex-direction:row;gap:5px}.music-choice{flex:1;min-width:0;padding:0 8px}
 #dj-shuffle{width:32px;min-width:32px;flex:none;padding:6px}
}
@media(min-width:600px) and (max-width:819px) and (max-height:480px){.brand span{display:none}}

@media(max-width:355px){.brand span{display:none}}
.scene-picker{position:relative;cursor:pointer}
.scene-picker select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px}
.scene-picker:focus-within{outline:2px solid var(--village-gold);outline-offset:2px}
.scene-picker select:disabled{cursor:default}

.scene-picker::after{content:'▾';font-size:10px;margin-left:4px;pointer-events:none}

#chapters{color:var(--forest);background:var(--paper);width:min(440px,calc(100% - 24px));max-height:90dvh;overflow:auto;border:1px solid #bcae83;border-radius:16px;padding:20px;box-shadow:0 12px 50px #19332755}
#chapters::backdrop{background:#19332788;backdrop-filter:blur(4px)}
.chapter-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.chapter-heading h2{font-size:29px}
#close-chapters{border:1px solid #b9c9b2;border-radius:50%;width:36px;height:36px;background:transparent;font-size:23px}
#chapters label{display:block;font-size:14px;font-weight:600}
#scene{width:100%;margin:4px 0 12px;padding:8px;border-radius:8px;border:1px solid #b9c9b2;background:#fffdf6;color:inherit;font:inherit}
#chapters h3{margin:4px 0;font:700 21px Georgia,serif}
#chapters p{font-size:14px;margin:3px 0 10px}
#stage-map{list-style:none;padding:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
#stage-map li{padding:7px 1px;text-align:center;border:1px solid #cbc6b4;border-radius:7px;background:var(--village-mist);color:#57584c}
#stage-map strong,#stage-map small{display:block}#stage-map small{font-size:11px}
#stage-map [data-status="Current"]{border:2px solid #346341;background:var(--village-gold-paper);color:#264e34}
#stage-map [data-status="Done"]{background:var(--village-mint);color:#264e34}
.chapter-play,#chapter-friend{border-radius:24px;padding:9px 16px;font-weight:700}
.chapter-play{color:var(--village-snow);background:var(--green);border:1px solid var(--green)}
.chapter-finale{margin-top:16px;padding-top:12px;border-top:1px solid var(--line)}
#chapter-friend{color:var(--forest);background:transparent;border:1px solid #879a81}

@media(max-width:600px){body[data-area="hunt"] .brand span{overflow:hidden;text-overflow:ellipsis}}

/* Snowbell Village home sign, shared by game headers and return actions. */
[data-village-return]::before{
 content:"";display:block;width:34px;height:34px;flex:none;margin:auto;
 background:url("art/town/village-home.svg") center/contain no-repeat;pointer-events:none
}
body :is(button,a)[data-village-return]{
 display:inline-grid;place-items:center;vertical-align:middle;box-sizing:border-box;
 width:44px;min-width:44px;height:44px;min-height:44px;padding:0;
 border:0;border-radius:12px;background:transparent;box-shadow:none
}
body :is(button,a)[data-village-return]:hover::before{filter:brightness(1.12)}
body :is(button,a)[data-village-return]:focus-visible{outline:2px solid #d5ab5c;outline-offset:1px}
@media(max-height:500px){
 #games-home[data-village-return]{min-height:32px;height:32px}
 #games-home[data-village-return]::before{width:30px;height:30px}
}
