/* Tallskogen's shared parchment, carved frame and forest-green controls.
   Gameplay pieces (shells, plots, arrows, planks and charts) keep their own artwork. */
dialog{font-family:Manrope,'DM Sans',sans-serif}
:is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog)[open]{
 top:calc(var(--view-top,0px) + var(--view-height,100dvh)/2);bottom:auto;transform:translateY(-50%);margin:0 auto;
 max-height:calc(var(--view-height,100dvh) - 24px);overflow:auto;
 background:var(--farm-paper);color:var(--farm-ink);border:7px solid #4d3925;border-radius:14px;
 box-shadow:0 0 0 1px #d6b777,inset 0 0 0 2px #b78d4d,inset 0 0 0 5px #fff0c277,inset 0 0 45px #87602e44,0 24px 80px #0009;
 padding-block:26px;
}
:is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog) :is(h2,h3){color:#372818;font-family:Georgia,serif;font-weight:500;letter-spacing:0}
:is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog) :is(p,label,legend,.note,.field-label){color:#534329;font-weight:400;line-height:1.5}
:is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog) .eyebrow{color:#6c522d;font-weight:600;font-size:11px}
:is(#builder-dialog,#market-shop,#home-room-locked){width:min(760px,calc(100% - 32px));text-align:center;padding-inline:32px}
:is(#builder-dialog,#market-shop,#home-room-locked)>h2{font-size:34px;margin:0 40px 18px}
:is(#builder-dialog,#market-shop,#home-room-locked)>p{margin:16px 0}
:is(#builder-dialog,#market-shop,#home-room-locked)>.close{position:absolute;float:none;top:8px;right:8px;margin:0}
/* A single button family for actions; titles remain parchment plaques. */
:is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog,#orchard-game,#feeding-game,#garden-game,#apple-catch-game,#fishing-game,#crab-cave,#dragon-game,#dragon-bridge,#wildlife-game,#quest-book,#shop-dialog,#furnishing-dialog) :is(.primary,.quiet,.close,.game-button,.offer-actions button,.frida-choices button,.garden-actions button,.catch-tools button,.fishing-panel button,.fishing-toolbar button,.cave-scene footer button,.cave-scene header button,.dragon-actions button,.dragon-scene header button,.bridge-actions button,.bridge-scene header button,.wildlife-actions button,.wildlife-scene header button),
dialog :is(#catch-exit,#catch-home,#catch-claim,#garden-hint-close),
#opening-video button,#fullscreen-toggle{
 min-height:44px;padding:9px 16px;border:1px solid #b99a61;border-radius:7px;background:var(--farm-wood);color:#fff0cb;
 box-shadow:inset 0 0 0 3px #0d251e,inset 0 0 0 4px #baa16a55,0 3px 0 #10261f,0 5px 12px #0003;
 font:600 14px/1.25 Manrope,'DM Sans',sans-serif;letter-spacing:.01em;text-shadow:none;cursor:pointer;
}
body :is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog,#orchard-game,#feeding-game,#garden-game,#apple-catch-game,#fishing-game,#crab-cave,#dragon-game,#dragon-bridge,#wildlife-game,#quest-book,#shop-dialog,#furnishing-dialog) button.primary,dialog #dragon-run,dialog #bridge-go,#opening-video #opening-video-start{background:linear-gradient(#f6dfa5,#d2ae69);border-color:#ffe6ac;box-shadow:inset 0 0 0 3px #83633255,inset 0 0 0 4px #fff3cc77,0 3px 0 #715021,0 5px 12px #0003;color:#322719;font-weight:600}
body :is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog,#orchard-game,#feeding-game,#garden-game,#apple-catch-game,#fishing-game,#crab-cave,#dragon-game,#dragon-bridge,#wildlife-game,#quest-book,#shop-dialog,#furnishing-dialog) button.close{width:44px;height:44px;padding:0;font:25px Georgia,serif}
dialog button:focus-visible{outline:3px solid #b67b27;outline-offset:3px}
dialog button:disabled{cursor:default}
:is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog,#orchard-game,#feeding-game,#garden-game,#apple-catch-game,#fishing-game,#crab-cave,#dragon-game,#dragon-bridge,#wildlife-game,#quest-book,#shop-dialog,#furnishing-dialog) :is(.primary,.quiet,.close,.game-button):hover:not(:disabled){filter:brightness(1.1)}
dialog .answer-row{gap:10px}
#puzzle #equation{background:#fff8e2a6;border:1px solid #aa834955;box-shadow:inset 0 0 15px #a47d2822;color:#3b2e1b;border-radius:8px;font-family:Georgia,serif;font-weight:500}
#puzzle #answer,#troll-dialog .sequence-row :is(span,input){background:#fff8e2;color:#3b2e1b;border:1px solid #b59052;border-radius:8px}
#troll-dialog .sequence-row input{border:2px solid #42664c}
#puzzle :is(#feedback,#story,#quest-intro),#troll-dialog #troll-status{color:#4a3b24}
#puzzle #worksheet-toggle{color:#fff0cb}
#settings-dialog .settings-heading,.setup-actions{background:var(--farm-paper);color:var(--farm-ink);border-bottom:1px solid #a88755}
#profile-dialog .operations label{background:#fbefcf;border:1px solid #ab8b58}
/* Illustrated activities share the same heading and instruction surfaces. */
dialog :is(.story-paper,.fishing-panel,.orchard-instruction),
:is(.cave-scene,.dragon-scene,.bridge-scene,.wildlife-scene) header h2,.fishing-toolbar strong{
 background:var(--farm-paper);color:var(--farm-ink);border:3px solid #4d3925;border-radius:8px;
 box-shadow:0 0 0 1px #d6b777,inset 0 0 0 1px #b48c4e,inset 0 0 20px #885c2a33,0 7px 20px #0005;text-shadow:none;
}
dialog :is(.story-paper,.fishing-panel) :is(h2,h3){font-family:Georgia,serif;font-weight:500;color:#372818}
dialog :is(.story-paper,.fishing-panel) p{color:#43351f;font-family:Manrope,'DM Sans',sans-serif;font-weight:400}
:is(.cave-scene,.dragon-scene,.bridge-scene,.wildlife-scene) header h2,.fishing-toolbar strong{font-family:Georgia,serif;font-weight:500}
#orchard-game .orchard-instruction{font-weight:400;color:#43351f;padding:10px 16px}
dialog :is(.catch-tools,.dragon-actions,.bridge-actions,.wildlife-actions),.cave-scene footer{
 background:var(--farm-wood);border:1px solid #bca06a;border-radius:9px;box-shadow:inset 0 0 0 3px #132d24,0 5px 20px #0005;padding:7px 10px;
}
#fishing-game .fishing-panel{background:var(--farm-paper);color:#3b2e1b;border:4px solid #4d3925}
#fishing-game .fishing-panel :is(p,label,#fishing-equation){color:#3b2e1b;text-shadow:none}
#fishing-game .fishing-panel h2{font-weight:500}
#frida-offer .frida-portrait{filter:drop-shadow(0 4px 5px #5b3c2844)}
#north-guide .north-missing{background:#fff6dc88;color:#534329;border-color:#b49662}
/* Photographic fantasy props replace the old CSS book and vector globe. */
.journal-button .journal-cover,.journal-button .map-globe{display:block;width:58px;height:58px;max-width:100%;padding:0;border:0;border-radius:0;background:none;box-shadow:none;object-fit:contain;transform:none;filter:drop-shadow(0 3px 3px #0009)}
.journal-button{grid-template-rows:58px auto}
.journal-button:hover .journal-cover{transform:none;filter:drop-shadow(0 0 6px #e8cc7f)}
.has-reward .journal-cover{animation:fantasy-book-glow 2.4s ease-in-out infinite}
@keyframes fantasy-book-glow{50%{filter:drop-shadow(0 0 7px #ffe6a0)}}
/* The live fullscreen control is moved here so it is inside the modal. */
.opening-video-actions{display:flex;gap:8px;align-items:center}
#opening-video #display-tools.in-intro{display:flex;position:static;margin:0;width:44px;height:44px;clear:none;flex-shrink:0}
#opening-video #fullscreen-toggle{display:block;width:44px;height:44px;min-width:44px;padding:0;font-size:28px}
#opening-video #display-status{position:absolute;right:12px;bottom:80px;max-width:70%;font-size:12px;background:#15352df0;border-radius:6px}
#opening-video #display-status:empty{display:none}
@media(max-height:550px){
 :is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog)[open]{padding-block:12px;border-width:5px}
 :is(#builder-dialog,#market-shop,#home-room-locked)>h2{font-size:25px;margin-bottom:10px}
 :is(#builder-dialog,#market-shop,#home-room-locked)>p{margin:10px 0;font-size:13px}
 :is(#quest-offer,#puzzle,#troll-dialog,#frida-offer,#fisher-dialog,#dragon-offer,#wildlife-offer,#north-guide,#builder-dialog,#market-shop,#home-room-locked,#instructions,#ending,#settings-dialog,#profile-dialog,#orchard-game,#feeding-game,#garden-game,#apple-catch-game,#fishing-game,#crab-cave,#dragon-game,#dragon-bridge,#wildlife-game,#quest-book,#shop-dialog,#furnishing-dialog) :is(.primary,.quiet,.close,.game-button,.offer-actions button,.frida-choices button,.catch-tools button,.fishing-panel button,.fishing-toolbar button,.cave-scene footer button,.cave-scene header button,.dragon-actions button,.dragon-scene header button,.bridge-actions button,.bridge-scene header button,.wildlife-actions button,.wildlife-scene header button){padding:6px 9px;font-size:12px}
 dialog .close{padding:0;font-size:25px}
 dialog :is(.catch-tools,.dragon-actions,.bridge-actions,.wildlife-actions),.cave-scene footer{padding:4px 6px}
 .journal-button .journal-cover,.journal-button .map-globe{width:40px;height:40px}.journal-button{grid-template-rows:40px auto}
 #orchard-game .orchard-instruction{padding:5px 9px}
}
@media(max-width:430px){#opening-video button{font-size:11px;padding:7px}.opening-video-actions,.opening-video-playback{gap:5px}.opening-video-controls{padding-inline:7px;gap:5px}}
@media(prefers-reduced-motion:reduce){.has-reward .journal-cover{animation:none}}

#frida-offer .quiet,#puzzle #worksheet-toggle{color:#fff0cb}
#garden-game .garden-seed:disabled{opacity:.6;cursor:default}

/* Short landscape screens keep titles, task text and actions in separate rows. */
@media(max-height:550px){
 :is(.cave-scene,.dragon-scene,.bridge-scene,.wildlife-scene) header h2{font-size:16px;line-height:1.2;padding:4px 12px}
 .dragon-instruction{top:51px;padding:4px 10px}
 #bridge-request{top:48px;padding:3px 8px;font-size:12px;line-height:1.25}
 .dragon-workbench{right:calc(4% + 50px)}
 .dragon-actions{padding-right:6px}
 #wildlife-game .wildlife-scene{width:100vw;height:100dvh;aspect-ratio:auto}
 #wildlife-game .wildlife-board,#wildlife-game.level-two .wildlife-board,#wildlife-game.level-stats .wildlife-board{top:54px;bottom:66px;height:auto;left:9%;width:82%;padding:5px 12px}
 #wildlife-game .wildlife-board h3{font-size:15px;line-height:1.2;margin:0 0 3px}
 #wildlife-game #wildlife-rows{height:calc(100% - 22px);gap:3px}
 #wildlife-game .stats-caption{font-size:11px;line-height:1.2}
 #wildlife-game .stats-chart{padding-bottom:50px;margin-top:2px}
 #wildlife-game .stats-label{height:22px;font-size:10px}
 #wildlife-game .stats-controls button{min-height:28px;padding:0 12px}
 #wildlife-game .stats-answer{margin:1px 0 0;font-size:11px;gap:8px}
 #wildlife-game .stats-answer button{min-height:32px;font-size:12px;padding:5px 9px}
 #wildlife-game .stats-scale{font-size:9px}
 #wildlife-game .wildlife-scene footer{bottom:5px}
}
@media(max-height:330px){
 #puzzle.practice-puzzle{padding:8px 18px}
 #puzzle.practice-puzzle #story{display:none}
 #puzzle.practice-puzzle #feedback:empty{display:none}
 #puzzle.practice-puzzle h2{font-size:20px;margin:2px 36px 4px}
 #puzzle.practice-puzzle #equation{font-size:24px;margin:3px 0;padding:2px}
 #puzzle.practice-puzzle #worksheet{margin:2px 0}
 #puzzle.practice-puzzle .easy-question{margin:4px auto;min-height:44px}
 #north-guide[open]{padding-block:9px}
 #north-guide canvas{top:8px;height:56px;width:44px}
 #north-guide h2{font-size:24px;margin:3px 0 5px}
 #north-guide p{font-size:12px;line-height:1.3;margin:6px 0}
 #north-guide ul{font-size:12px;line-height:1.3;margin-bottom:6px}
 #wildlife-game .stats-scale span:nth-child(even){visibility:hidden}
}

/* Give the chart its own column: the answer form must not consume its height. */
@media(max-height:550px){
 #wildlife-game.level-stats #wildlife-rows{display:grid;grid-template-columns:minmax(0,1fr) 140px;grid-template-rows:auto minmax(0,1fr);gap:3px 10px}
 #wildlife-game .stats-caption{grid-column:1;grid-row:1}
 #wildlife-game .stats-chart{grid-column:1;grid-row:2;height:100%;margin:0 2% 0 6%;padding-bottom:50px}
 #wildlife-game .stats-answer{grid-column:2;grid-row:1 / -1;flex-direction:column;justify-content:center;margin:0;text-align:center}
 #wildlife-game .stats-answer input{max-width:100%}
}

/* Shared hover/focus feedback for the two illustrated navigation controls. */
.journal-button:is(:hover,:focus-visible) :is(.journal-cover,.map-globe){animation:none;filter:drop-shadow(0 0 6px #e8cc7f)}

/* Progress is information, with a small framed badge rather than a button. */
dialog :is(#cave-count,#dragon-progress,#bridge-count,#wildlife-progress,#fishing-progress),#apple-catch-game .catch-count{
 border:1px solid #c7a36b;border-radius:8px;background:var(--farm-wood);color:#fff0cb;
 box-shadow:inset 0 0 0 2px #132d24,inset 0 0 0 3px #baa16a55,0 3px 10px #0004;
 padding:7px 12px;text-align:center;font:600 clamp(12px,1.3vw,18px)/1.3 Manrope,'DM Sans',sans-serif;
 font-variant-numeric:tabular-nums;white-space:nowrap;
}

/* Glimt speaks from beside his starting stone; the grid stays visible. */
#dragon-game .dragon-speech{
 position:absolute;left:calc(var(--dragon-x) - 6%);top:max(80px,var(--dragon-y));transform:translate(-100%,-50%);
 width:min(12cqw,210px);margin:0;padding:10px 8px;border:2px solid #76532d;border-radius:16px;
 background:var(--farm-paper);box-shadow:inset 0 0 0 1px #d9b982,0 4px 12px #0005;color:#382b1b;
 z-index:3;pointer-events:none;text-align:center;
}
#dragon-game .dragon-speech p{margin:0;color:#382b1b;font:400 clamp(10px,1.3cqw,18px)/1.3 Manrope,'DM Sans',sans-serif}
#dragon-game .dragon-speech::before,#dragon-game .dragon-speech::after{content:'';position:absolute;top:50%;transform:translateY(-50%);width:0;height:0;border-style:solid}
#dragon-game .dragon-speech::before{right:-12px;border-width:10px 0 10px 12px;border-color:transparent transparent transparent #76532d}
#dragon-game .dragon-speech::after{right:-8px;border-width:8px 0 8px 10px;border-color:transparent transparent transparent #eddbb2}
#dragon-game .dragon-speech.on-right{left:calc(var(--dragon-x) + 6%);transform:translateY(-50%)}
#dragon-game .dragon-speech.on-right::before{left:-12px;right:auto;border-width:10px 12px 10px 0;border-color:transparent #76532d transparent transparent}
#dragon-game .dragon-speech.on-right::after{left:-8px;right:auto;border-width:8px 10px 8px 0;border-color:transparent #eddbb2 transparent transparent}
#dragon-game .dragon-actions{display:flex;width:max-content;max-width:100%;align-self:center;align-items:center;justify-content:center;gap:10px;grid-template-columns:none}
#dragon-game .dragon-actions>div{justify-content:center}
#dragon-game .dragon-actions>div:first-child:not(:has(button:not([hidden]))){display:none}
@media(max-height:550px){
 dialog :is(#cave-count,#dragon-progress,#bridge-count,#wildlife-progress,#fishing-progress),#apple-catch-game .catch-count{padding:5px 9px;font-size:12px}
 #dragon-game .dragon-speech{padding:6px 4px;border-radius:11px}
 #dragon-game .dragon-actions{gap:5px;padding:4px 6px}
 #dragon-game .dragon-actions>div{gap:4px}
 body #dragon-game .dragon-actions button{padding:6px 7px;font-size:11px;white-space:nowrap}
}

/* On very short landscape screens, put the palette beside the route tray. */
@media(max-height:330px){
 #dragon-game .dragon-workbench{height:auto;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:4px 8px}
 #dragon-game .dragon-tile{width:25px;height:25px}
 #dragon-game #dragon-program{min-height:36px}
 #dragon-game .dragon-actions{grid-column:1 / -1;justify-self:center}
 body #dragon-game .dragon-actions button{min-height:32px;padding:4px 6px}
 #dragon-game #dragon-feedback{grid-column:1 / -1;min-height:14px;line-height:1.2}
}

/* Settings stay within the warm parchment/brown palette, including native controls. */
#settings-dialog{color-scheme:light;scrollbar-color:#a27c49 #f1e2bf}
#settings-dialog .audio-settings{background:linear-gradient(140deg,#fff8e780,#e4cca478);border-color:#b49463;box-shadow:inset 0 0 0 1px #fff5dc88}
#settings-dialog .audio-settings legend{padding-inline:8px}
#settings-dialog #settings-level{background:#fff;color:#3b2919;border:1px solid #9a784d;box-shadow:inset 0 1px 3px #73512b22}
#settings-dialog #settings-level option{background:#fff;color:#3b2919}
body #settings-dialog button:is(.close,.secondary){
 min-height:44px;padding:10px 16px;background:linear-gradient(#f6e5bf,#d4b17a);color:#3b2919;border:1px solid #967143;border-radius:7px;
 box-shadow:inset 0 0 0 2px #fff2d380,inset 0 0 0 3px #a8804666,0 2px 0 #7b5831,0 4px 8px #75512833;
 font-weight:600;text-shadow:none;
}
body #settings-dialog button.close{padding:0}
body #settings-dialog button:is(.close,.secondary):hover{background:linear-gradient(#fff0d1,#dfbe89)}
#settings-dialog :is(button,input,select):focus-visible{outline:3px solid #94632f;outline-offset:3px}
#settings-dialog .audio-row input[type=range]{appearance:none;-webkit-appearance:none;background:transparent;border:0;border-radius:0;box-shadow:none;accent-color:#976b38;cursor:pointer}
#settings-dialog input[type=range]::-webkit-slider-runnable-track{height:8px;background:linear-gradient(#c8ab7c,#ead7b1);border:1px solid #9b7847;border-radius:10px;box-shadow:inset 0 1px 2px #72522c33}
#settings-dialog input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:24px;height:24px;margin-top:-9px;background:linear-gradient(#f6e3bb,#be965c);border:2px solid #7a552e;border-radius:50%;box-shadow:inset 0 0 0 2px #fff1cf99,0 2px 4px #73532b44}
#settings-dialog input[type=range]::-moz-range-track{height:6px;background:linear-gradient(#c8ab7c,#ead7b1);border:1px solid #9b7847;border-radius:10px}
#settings-dialog input[type=range]::-moz-range-progress{height:6px;background:#b18a50;border-radius:10px}
#settings-dialog input[type=range]::-moz-range-thumb{width:20px;height:20px;background:linear-gradient(#f6e3bb,#be965c);border:2px solid #7a552e;border-radius:50%;box-shadow:inset 0 0 0 2px #fff1cf99}
#settings-dialog .audio-mute input{appearance:none;-webkit-appearance:none;display:inline-grid;place-content:center;background:#fff3d6;border:1.5px solid #997144;border-radius:4px;box-shadow:inset 0 1px 2px #73532b22;cursor:pointer}
#settings-dialog .audio-mute input:checked{background:#8a6035;border-color:#6f4d2a}
#settings-dialog .audio-mute input::before{content:'';width:10px;height:6px;border-left:2px solid #fff3d6;border-bottom:2px solid #fff3d6;transform:translateY(-1px) rotate(-45deg);opacity:0}
#settings-dialog .audio-mute input:checked::before{opacity:1}
@media(forced-colors:active){
 #settings-dialog :is(input[type=checkbox],input[type=range]){appearance:auto;-webkit-appearance:auto;accent-color:auto}
 #settings-dialog .audio-mute input::before{display:none}
}

/* Short help paragraphs are easier to scan than a single centered wall of text. */
#instructions .help-copy{text-align:left;max-width:68ch;margin:0 auto 20px}
#instructions .help-copy p{margin:14px 0;line-height:1.55}
#instructions .help-copy strong{color:#49331b;font-weight:600}
