/* Activity UI: warm paper, dark ink and a control row outside the play area. */
body dialog.activity-frame[open]{display:flex!important;flex-direction:column!important;padding:0!important;overflow:hidden!important;gap:0!important;align-items:stretch!important;justify-content:flex-start!important}
.activity-frame>.activity-surface{position:relative;flex:1 1 auto;min-height:0;min-width:0;overflow:auto;isolation:isolate;box-sizing:border-box;overscroll-behavior:contain}
body dialog .activity-source{display:none!important}
body dialog.activity-frame>.activity-toolbar{position:relative;flex:0 0 auto;display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:62px;padding:8px max(16px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));margin:0;border:0;border-top:1px solid #bea16b;background:linear-gradient(#fff6dc,#efdfb9);color:#49331d;z-index:40}
body .activity-toolbar button,body #activity-pause button{position:static!important;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;min-width:84px;width:auto!important;min-height:44px!important;height:auto!important;padding:9px 16px!important;margin:0!important;border:1px solid #b29461!important;border-radius:9px!important;background:#fff8e6!important;color:#49331d!important;box-shadow:0 2px 0 #b2946145!important;text-shadow:none!important;font:650 15px/1.2 system-ui,sans-serif!important;letter-spacing:normal!important;white-space:nowrap;box-sizing:border-box}
body .activity-toolbar button[data-activity-action=exit]{margin-right:auto!important}
body .activity-toolbar button:hover,body #activity-pause button:hover{background:#f9e5b4!important;border-color:#805b2c!important}
body .activity-toolbar button:focus-visible,body #activity-pause button:focus-visible{outline:3px solid #15777b;outline-offset:2px}
body .activity-toolbar button:disabled{opacity:.48;cursor:default;box-shadow:none!important}
body .activity-toolbar button[hidden]{display:none!important}
body dialog.activity-paper{inset:0!important;transform:none!important;margin:auto!important;width:min(1000px,calc(100vw - 24px));height:fit-content;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);border:5px double #b78a43!important;border-image:none!important;border-radius:18px!important;color:#49331d;background:radial-gradient(ellipse at 40% 10%,#fff9e5,#f1dfb2)!important;box-shadow:0 12px 60px #0006!important;text-shadow:none}
body dialog.activity-paper>.activity-surface{flex:0 1 auto;padding:24px 30px}
body dialog.activity-paper[open]{height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 24px)!important}
body dialog.activity-paper h2{font:600 clamp(26px,3vw,38px)/1.15 Georgia,serif;color:#49331d;text-shadow:none;margin:0 0 14px}
body dialog.activity-paper p{color:#665034;font:16px/1.5 system-ui,sans-serif}
body dialog.activity-paper .eyebrow{font:700 12px/1.4 system-ui,sans-serif;color:#805b26;letter-spacing:.14em}
body dialog.activity-paper button:not(.activity-source){text-shadow:none}
body :is(#mine-activity,#rune-riddles).activity-paper>.activity-surface{padding:0}
body #mine-activity .mine-top{padding-left:0}
body #mine-activity .mine-scene{min-height:0}
body #puzzle.activity-paper{width:min(800px,calc(100vw - 24px))}
body #puzzle.activity-paper #equation{margin:12px 0}
body #troll-dialog.activity-paper{width:min(880px,calc(100vw - 24px))}
/* A consistent invitation card, with the artwork kept in its original proportions. */
body dialog.activity-offer{width:min(960px,calc(100vw - 24px))}
body #orchard-offer .farm-welcome{display:flex;align-items:center;gap:24px;padding:0 0 20px;margin:0 0 20px;border-bottom:1px solid #bea16b80;text-align:left}
body dialog.activity-offer :is(img,canvas):not(button *){object-fit:contain;max-height:190px;max-width:24%;width:auto;height:auto;float:left;margin:0 22px 14px 0}
body #orchard-offer .signe-portrait{width:110px;height:190px;max-width:none;float:none;flex:0 0 110px;margin:0}
body dialog.activity-offer button:not(.activity-source){color:#49331d;background:linear-gradient(#fff4d5,#ecd5a5);border:1px solid #b29461;border-radius:10px;font-family:system-ui,sans-serif;text-shadow:none;box-shadow:inset 0 0 0 2px #fff7dc,0 3px 0 #aa804530}
body dialog.activity-offer button :is(strong,span,small){color:inherit;text-shadow:none}
body dialog.activity-offer .farm-choices{gap:14px}
body dialog.activity-offer .farm-choices button{padding:18px 12px}
body dialog.activity-offer .farm-choices img{float:none;max-width:100%;width:90px;height:90px;margin:0 auto 10px;display:block}
body dialog.activity-offer .farm-choices strong{font-size:19px}
/* Illustrated games retain their own scene, inside the reserved frame. */
body :is(#north-chapter-game,#north-journey-game,#troll-run-game)>.activity-surface{display:flex;flex-direction:column;overflow:hidden;flex:1 1 0}
body :is(#ruins-game,#tower-climb)>.activity-surface{flex:1 1 0;overflow:hidden}
body :is(#orchard-game,#feeding-game,#garden-game,#bakery-game)>.activity-surface>div{min-height:100%;box-sizing:border-box}
body :is(#apple-catch-game,#fishing-game)>.activity-surface{display:grid;place-items:center;overflow:hidden;container-type:size}
body :is(#crab-cave,#dragon-game,#dragon-bridge,#wildlife-game)>.activity-surface{flex:1 1 0;overflow:hidden;display:grid;place-items:center;container-type:size}
body .activity-surface>:is(.cave-scene,.dragon-scene,.bridge-scene,.wildlife-scene),body #apple-catch-game #catch-stage{width:min(100cqw,177.777cqh);height:auto;max-width:none;aspect-ratio:16/9;box-sizing:border-box}
body #fishing-game #fishing-stage{width:min(100cqw,222.222cqh);height:auto;max-width:none;aspect-ratio:20/9}
body #catch-stage .catch-top{grid-template-columns:1fr 1fr}
body #catch-stage .catch-target{justify-self:start}
body #catch-stage .catch-tools{display:none}
body :is(.nc-hud,.nj-hud,.tr-hud){gap:10px}
body #ruins-game .ru-heading{left:18px}
body :is(#north-chapter-game,#north-journey-game,#troll-run-game) :is(.nc-question,.nj-question,.tr-question){color:#49331d;background:linear-gradient(110deg,#fff6dc,#efdfb9);border-top:1px solid #bda26c;padding-right:max(18px,env(safe-area-inset-right))}
body #north-chapter-game[data-game=raft] .nc-question{background:linear-gradient(110deg,#fff6dc,#efdfb9);padding-bottom:12px}
body :is(.nc-problem,.nj-problem,.tr-problem) :is(p,strong),body :is(.nc-visual,.nj-visual) .tc-sequence{color:#49331d;text-shadow:none}
body :is(#north-chapter-game,#north-journey-game,#troll-run-game) :is(.nc-answers,.nj-answers,.tr-answers) button{border-radius:10px;background:linear-gradient(#fff4d5,#ecd5a5);border:1px solid #ad8b51;box-shadow:inset 0 0 0 2px #fff7dc,0 3px 0 #aa804540;color:#49331d;font-family:system-ui,sans-serif}
body :is(#north-chapter-game,#north-journey-game,#troll-run-game) :is(.nc-answers,.nj-answers,.tr-answers) button.right{background:#d0edbb}
body :is(#north-chapter-game,#north-journey-game,#troll-run-game) :is(.nc-answers,.nj-answers,.tr-answers) button.chosen:not(.right){background:#f1c7a6}
body #troll-run-game #tr-dots i{background:#9b6c27}
body #ruins-game .ru-bottom{padding-right:max(18px,env(safe-area-inset-right))}
body #bakery-game .bakery-layout{padding-right:20px}
body #feeding-game :is(.rabbit-dock,.feeding-dock){width:100%;margin-right:0}
body #garden-game .garden-header{grid-template-columns:minmax(0,820px)}
/* A pause is a pause, rather than a second menu of duplicate task controls. */
body #activity-pause,body :is(#troll-run-game,#ruins-game,#north-chapter-game,#north-journey-game) .activity-pause-card{box-sizing:border-box;position:fixed;inset:50% auto auto 50%;transform:translate(-50%,-50%);margin:0;width:min(460px,calc(100vw - 28px));height:auto;max-height:calc(100dvh - 28px);overflow:auto;padding:24px;border:5px double #b78a43;border-radius:18px;color:#49331d;background:radial-gradient(ellipse at 40% 10%,#fff9e5,#f1dfb2);text-align:center;text-shadow:none;z-index:50}
body #activity-pause:not([open]){display:none}
#activity-pause::backdrop{background:#061c238c}
body .activity-pause-card{box-shadow:0 0 0 100vmax #061c238c}
body :is(#activity-pause,.activity-pause-card) h2{font:600 30px/1.2 Georgia;color:#49331d;text-shadow:none;margin:8px 0 14px}
body :is(#activity-pause,.activity-pause-card) p{font:16px/1.5 system-ui;color:#665034;text-shadow:none}
body .activity-pause-card :is(nav,.ru-menu-choices){display:flex;justify-content:center}
body .activity-pause-card button:not([hidden]){color:#49331d;background:#fff4d5;border:1px solid #b29461;border-radius:9px;font:650 16px/1.3 system-ui;padding:12px 20px;text-shadow:none;box-shadow:none}
body .activity-pause-card button i{display:none}
body #tr-overlay.activity-pause-card :is(#tr-easier,#tr-leave){display:none}
@media(max-height:550px),(max-width:600px){
 body dialog.activity-paper[open]{max-height:calc(100dvh - 12px)!important}
 body dialog.activity-frame>.activity-toolbar{min-height:54px;padding:5px 10px;gap:6px}
 body .activity-toolbar button{font-size:14px!important;min-width:70px;padding:8px 11px!important}
 body dialog.activity-paper{max-height:calc(100dvh - 12px);max-width:calc(100vw - 12px);border-width:4px;border-radius:12px}
 body dialog.activity-paper>.activity-surface{padding:16px 20px}
 body dialog.activity-paper h2{font-size:26px;margin-bottom:10px}
 body dialog.activity-paper p{font-size:14px}
 body dialog.activity-offer :is(img,canvas):not(button *){max-height:125px}
 body #orchard-offer .signe-portrait{width:75px;height:125px;flex-basis:75px}
 body dialog.activity-offer .farm-choices button{padding:12px 8px}
 body dialog.activity-offer .farm-choices img{width:64px;height:64px}
 body dialog.activity-offer .farm-choices strong{font-size:16px}
 body #ruins-game .ru-heading{left:12px}
}
@media(max-width:390px){body .activity-toolbar button{min-width:0;padding:8px!important;font-size:13px!important}}
@media(max-height:550px){
 body #dragon-game .dragon-workbench{height:auto;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:3px 8px;bottom:8px}
 body #dragon-game .dragon-actions{grid-column:1/-1;justify-self:center;padding:2px 5px}
 body #dragon-game #dragon-feedback{grid-column:1/-1;min-height:0}
 body #dragon-game #dragon-feedback:empty{display:none}
 body #garden-game .garden-note{padding:7px 12px}
 body #garden-game .garden-note h2{font-size:20px;margin:2px 0}
 body #garden-game .garden-note p{font-size:13px;margin:2px 0}
 body #mine-activity[data-kind=light] .mine-scene{padding:6px 18px 4px 110px}
 body #mine-activity[data-kind=light] .mine-guide{left:14px;bottom:12px;width:78px}
 body #mine-activity[data-kind=light] .mine-guide img{max-height:150px}
 body #mine-activity[data-kind=light] .mine-top{line-height:14px;padding:0}
 body #mine-activity[data-kind=light] .mine-title-plaque{margin:2px 0}
 body #mine-activity[data-kind=light] #mine-title{font-size:23px;margin:2px 0}
 body #mine-activity[data-kind=light] .mine-instruction{display:none}
 body #mine-activity[data-kind=light] .mine-matching{padding:0}
 body #mine-activity[data-kind=light] .match-instruction{font-size:13px;margin:3px 0 7px}
 body #mine-activity[data-kind=light] :is(.match-expressions,.match-answers){gap:5px}
 body #mine-activity[data-kind=light] .match-card{min-height:44px;padding:4px 12px;font-size:21px}
 body #mine-activity[data-kind=light] .match-count{margin:4px 0;font-size:12px}
 body #mine-activity[data-kind=light] .mine-bottom{padding:0}
 body #mine-activity[data-kind=light] .mine-feedback:empty{display:none}
 body #mine-activity[data-kind=light] .mine-controls button{min-height:36px!important;padding:5px 10px!important;font-size:13px!important}
}
@media(max-height:550px) and (max-width:750px){body #mine-activity[data-kind=light] .mine-scene{padding-left:12px}}

/* Varde trial only: spoken invitation, then two compact controls in the HUD. */
body #varde-invitation[open]{position:fixed;inset:0;transform:none;margin:auto;width:min(740px,calc(100vw - 28px));height:fit-content;max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);padding:28px 30px;display:grid;grid-template-columns:170px minmax(0,1fr);align-items:center;gap:26px;overflow:auto;border:5px double #b78a43;border-radius:18px;background:var(--story-paper);color:#493419;text-align:left;box-shadow:0 14px 50px #0006}
#varde-invitation::backdrop{background:#051b21a6;backdrop-filter:blur(3px)}
body #varde-invitation .varde-portrait{width:170px;height:auto;aspect-ratio:6/7;object-fit:contain;align-self:center;border-radius:70px 70px 12px 12px}
body #varde-invitation .eyebrow{font:700 12px/1.4 system-ui,sans-serif;letter-spacing:.16em;color:#806034}
body #varde-invitation h2{font:600 38px/1.15 Georgia,serif;color:#493419;margin:6px 0 15px}
body #varde-invitation p{font:17px/1.5 system-ui,sans-serif;color:#594227;margin:0 0 18px}
body #varde-invitation .varde-progress{font-size:14px;margin-top:-6px}
body #varde-invitation .varde-choices{display:flex;flex-wrap:wrap;gap:10px}
body #varde-invitation button{min-height:46px;padding:10px 17px;border:1px solid #a88044;border-radius:9px;font:650 16px/1.3 system-ui,sans-serif;color:#493419;text-shadow:none;box-shadow:inset 0 0 0 2px #fff1cc,0 3px 0 #9c76334d;background:linear-gradient(#f9e4ac,#d7b36a)}
body #varde-invitation button.quiet{background:#fff1d0;box-shadow:none;font-weight:500}
body #varde-invitation button:focus-visible{outline:3px solid #187b80;outline-offset:3px}
body #north-chapter-game[data-game=archery]>.activity-toolbar{position:absolute;inset:8px 12px auto;z-index:4;width:auto;min-height:44px;padding:0!important;border:0;background:none;box-shadow:none;pointer-events:none}
body #north-chapter-game[data-game=archery]>.activity-toolbar button{pointer-events:auto;min-width:0;padding:9px 14px!important;background:#fff0ccf2!important;border-color:#b38d4d!important;box-shadow:0 2px 5px #0003!important;font-size:14px!important}
body #north-chapter-game[data-game=archery]>.activity-toolbar [data-activity-action=pause]{display:none!important}
body #north-chapter-game[data-game=archery] .nc-hud{padding:10px 150px;justify-content:center;text-align:center;min-height:65px;height:auto}
body #north-chapter-game[data-game=archery] .nc-hud h2{font-size:23px}
body #north-chapter-game[data-game=archery] .nc-hud p{font-size:13px}
body #north-chapter-game[data-game=archery][data-varde-view=info] :is(.activity-toolbar,.nc-hud){display:none!important}
@media(max-height:480px){
 body #varde-invitation[open]{width:min(660px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:18px 22px;grid-template-columns:125px minmax(0,1fr);gap:22px}
 body #varde-invitation .varde-portrait{width:125px}
 body #varde-invitation h2{font-size:30px;margin:4px 0 9px}
 body #varde-invitation p{font-size:15px;margin-bottom:12px}
 body #varde-invitation button{font-size:14px;padding:9px 12px}
 body #north-chapter-game[data-game=archery]>.activity-toolbar{inset:6px 8px auto}
 body #north-chapter-game[data-game=archery] .nc-hud{padding:8px 120px}
 body #north-chapter-game[data-game=archery] .nc-hud h2{font-size:18px}
}
@media(max-width:480px) and (min-height:481px){
 body #varde-invitation[open]{grid-template-columns:1fr;justify-items:center;gap:12px;padding:20px;text-align:center}
 body #varde-invitation .varde-portrait{width:120px}
 body #varde-invitation .varde-choices{justify-content:center}
}

body #north-chapter-game[data-game=archery] .nc-lives{display:none}

body #north-chapter-game[data-game=archery][data-varde-view=info] .nc-notice{display:none}
