@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Nunito:wght@500;600;700;800;900&display=swap');
:root{--ink:#15251e;--forest:#172b25;--moss:#9cc05f;--light:#e6f1d4;--gold:#f8cf74;--paper:#f6f5df;--line:#35543b}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:#10231b;color:#edf6e6;font-family:Nunito,system-ui,sans-serif}
button,input{font:inherit}
button{cursor:pointer;touch-action:manipulation}
button:focus-visible,input:focus-visible{outline:3px solid #f3d683;outline-offset:3px}
.hidden{display:none!important}
.app{max-width:1140px;margin:0 auto;padding:12px 14px 18px}
.masthead{min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:0 2px 12px}
.branding{display:flex;align-items:center;gap:12px}
.brand-sigil{font-size:37px;color:#e8d17d;filter:drop-shadow(0 2px 0 #455a32)}
.eyebrow{display:block;color:#d5dd9c;font:900 11px/1.4 Nunito,sans-serif;letter-spacing:2px}
.branding h1{font:800 clamp(24px,3.3vw,39px)/.95 'Barlow Condensed',Impact,sans-serif;letter-spacing:2px;margin:2px 0}
.header-actions,.choices,.end-actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap}
.header-actions button,.end-actions button:not(.primary){border:1px solid #789776;border-radius:9px;padding:9px 13px;background:#26443a;color:#f3f8e9;font-weight:900}
.header-actions button:hover,.end-actions button:not(.primary):hover{background:#365e4b}
.game-shell{position:relative;aspect-ratio:8/5;width:100%;overflow:hidden;border:5px solid #314d39;border-radius:19px;background:#638a47;box-shadow:0 18px 60px #0008,0 5px 0 #0f2018;isolation:isolate}
#gameCanvas{display:block;width:100%;height:100%;background:#6e984c;image-rendering:auto;touch-action:none}
.hud{position:absolute;top:12px;left:12px;right:12px;display:flex;justify-content:space-between;align-items:flex-start;gap:6px;z-index:7;pointer-events:none}
.hud-left,.hud-right{display:flex;align-items:center;gap:6px;flex-wrap:nowrap}
.hud-pill{font-size:13px;font-weight:900;white-space:nowrap;padding:7px 12px;border:1.5px solid #b0ca85;border-radius:9px;color:#f7f5d9;background:#172d26dd;box-shadow:0 3px 9px #0004}
.hearts{color:#ffbec0;border-color:#e3a2a9;letter-spacing:2px}
.game-tools{position:absolute;z-index:7;top:66px;right:12px;display:flex;gap:6px}
.game-tools button{border-radius:8px;border:1.5px solid #4c663d;padding:9px 12px;font-size:12px;color:#20352d;background:#e2edbe;font-weight:900;box-shadow:0 3px 0 #35513b}
.game-tools button:hover{background:#f6f7d6}
.overlay{position:absolute;inset:0;z-index:18;background:linear-gradient(135deg,#173e36ed,#10251ff2 55%,#142319ed);display:flex;align-items:center;justify-content:center;padding:22px;overflow:auto}
.intro{background:radial-gradient(ellipse at 80% 10%,#77955f90,transparent 35%),linear-gradient(135deg,#152f2af5,#10221ff7)}
.intro-card{width:min(620px,98%);max-height:100%;overflow:auto;background:#1e3933f4;padding:clamp(18px,2.7vw,28px);border:1px solid #8faa75;border-radius:17px;box-shadow:0 14px 36px #0007}
.intro-card h2{font:800 clamp(29px,4vw,52px)/1.03 'Barlow Condensed',Impact,sans-serif;letter-spacing:.3px;margin:6px 0 14px;color:#faf4d7}
.intro-card p{font-size:14px;line-height:1.6;color:#e0e8d1}
.instructions{display:flex;flex-wrap:wrap;gap:7px;margin:15px 0 18px}
.instructions span{display:inline-block;padding:5px 8px;border:1px solid #728c69;background:#314b3c;border-radius:7px;color:#f1edd3;font-size:11px;font-weight:800}
.field-label{display:block;font-weight:900;font-size:13px;margin:8px 0 5px;color:#f2e7bf}
#playerName{display:block;width:100%;max-width:400px;border:2px solid #83a16b;background:#f9f8ea;color:#1f3729;border-radius:9px;padding:10px 12px;font-size:15px;font-weight:800}
.inline-error{color:#ffbabb!important;margin:3px 0 8px!important;font-size:12px!important;font-weight:800}
.choices{margin-top:11px}
.choice{border:1px solid #799473;background:#25443a;color:#e8ebd7;padding:9px 13px;border-radius:9px;font-size:13px;font-weight:900}
.choice.selected{background:#d9e6b4;color:#243b30;border-color:#fff6c6}
.primary{border:0;background:#f5d27b;color:#19352a;border-radius:10px;padding:11px 17px;font-weight:900;box-shadow:0 3px 0 #8f6c3b}
.primary:hover{background:#ffe6a0}
.giant{width:100%;margin-top:17px;padding:13px 20px;text-align:center;display:flex;justify-content:space-between}
.small-note{opacity:.82;font-size:11px!important;margin:12px 0 0!important}
.speech{position:absolute;z-index:12;left:11%;right:11%;bottom:18px;background:#f4f4d9;border:3px solid #3f5a43;color:#19362a;border-radius:12px;padding:14px 17px;box-shadow:0 8px 25px #102a20aa}
.speaker{font-weight:900;font-size:15px;color:#2b6944}
.speech p{font-size:14px;font-weight:800;line-height:1.5;margin:6px 0 8px}
.speech-footer{display:flex;align-items:center;justify-content:space-between;gap:10px}
.speech-footer span{font-size:11px;color:#62725c}
.speech-footer button{border:0;background:#274c39;color:#fff;border-radius:7px;padding:7px 14px;font-weight:900}
.question{position:absolute;inset:0;z-index:15;display:flex;align-items:center;justify-content:center;padding:20px;background:#102f29d8}
.dialog-card{width:min(650px,100%);max-height:100%;overflow:auto;background:#eef3d9;border:3px solid #a3be83;border-radius:14px;color:#234330;padding:24px;box-shadow:0 15px 60px #0a1c14bb}
.dialog-card .eyebrow{color:#628345}
.dialog-card h2{font:800 clamp(24px,3.4vw,36px)/1.06 'Barlow Condensed',Impact,sans-serif;margin:8px 0}
.dialog-card>p{font-size:14px;font-weight:800}
.answer-options{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.answer-options button{border:2px solid #94ac7d;padding:11px;background:#fffdf0;color:#1c412e;border-radius:9px;font-weight:800;text-align:left}
.answer-options button:hover:not(:disabled){background:#e4f6c3}
.answer-options button.correct{border-color:#3d985b;background:#d4f1d4}
.answer-options button.wrong{border-color:#b86960;background:#ffe0d4}
.answer-options button:disabled{opacity:.75}
.feedback{background:#e0e9cf;color:#234a33;border-left:4px solid #75a368;padding:10px;font-weight:900}
.dialog-card .primary{margin-top:12px}
.toast{position:absolute;z-index:19;left:50%;top:21%;transform:translateX(-50%);max-width:90%;width:max-content;background:#183c33ed;border:2px solid #ead89b;color:#fff4d2;padding:11px 16px;border-radius:10px;font-size:15px;font-weight:900;text-align:center;box-shadow:0 8px 20px #10281aa9}
.panel{position:absolute;z-index:13;top:112px;right:10px;width:min(370px,90%);max-height:69%;overflow:auto;background:#edf1d8;border:3px solid #3d6747;border-radius:13px;color:#243c2d;padding:14px;box-shadow:0 7px 25px #0007}
.panel h2{font:800 25px 'Barlow Condensed',sans-serif;margin:0 0 9px}
.panel p{font-size:13px;line-height:1.55}
.panel ul{padding-left:19px;font-size:13px;line-height:1.7}
.panel-close{float:right;border:0;border-radius:6px;background:#314d37;color:#fff;padding:5px 9px}
.map-mini{display:block;width:100%;height:auto;background:#70934c;border:2px solid #5a7746;border-radius:6px;margin:12px auto}
.end-icons{font-size:35px;margin:9px 0}
.end-score{background:#355641;color:#fef4d4;border:1px solid #a5bd82;border-radius:10px;padding:13px;margin:12px 0 17px;font-size:15px;font-weight:900;line-height:1.9}
.end-actions{justify-content:center}
.touch-controls{position:absolute;inset:auto 12px 12px;z-index:9;display:none;justify-content:space-between;align-items:flex-end;pointer-events:none}
.touch-controls button{pointer-events:auto;color:#f1f7dc;background:#1d4439d9;border:2px solid #dae7bf;border-radius:11px;font-weight:900;touch-action:none;user-select:none;-webkit-user-select:none}
.dpad{display:grid;grid-template-columns:repeat(3,45px);grid-template-rows:repeat(3,45px);gap:3px}
.dpad button{font-size:20px}
.dpad .up{grid-column:2;grid-row:1}.dpad .left{grid-column:1;grid-row:2}.dpad .right{grid-column:3;grid-row:2}.dpad .down{grid-column:2;grid-row:3}
.touch-controls button:active{background:#477257}
.talk-button{min-width:85px;min-height:68px;font-size:15px}
.talk-button span{display:block;font-size:10px;margin-top:3px}
footer{font-size:11px;opacity:.7;text-align:center;padding:12px 0}
.game-shell:has(.intro:not(.hidden)) .touch-controls,.game-shell:has(.ending:not(.hidden)) .touch-controls,.game-shell:has(.question:not(.hidden)) .touch-controls{display:none!important}
html.focus body{overflow:hidden}html.focus .app{position:fixed;inset:0;max-width:none;padding:0;display:grid;place-items:center}html.focus .masthead,html.focus footer{display:none}html.focus .game-shell{width:min(100vw,calc(100dvh * 1.6));height:auto;max-height:100dvh;border:0;border-radius:0}
@media(pointer:coarse){.touch-controls{display:flex}}
@media(max-width:720px){
 .app{padding:0}.masthead{padding:8px 11px;min-height:51px}.brand-sigil{font-size:27px}
 .branding h1{font-size:23px}.branding .eyebrow{font-size:8px}.header-actions button{font-size:11px;padding:7px 8px}
 .game-shell{border:0;border-radius:0}
 .hud{top:5px;left:5px;right:5px}.hud-pill{font-size:10px;padding:5px 7px}.hud-right,.hud-left{gap:3px}
 .game-tools{top:40px;right:5px;gap:4px}.game-tools button{font-size:10px;padding:6px 7px}
 .intro-card{padding:15px}.intro-card h2{font-size:33px}.intro-card p{font-size:12px}.instructions span{font-size:10px}
 .speech{left:4%;right:4%;bottom:7px;padding:9px}.speech p{font-size:12px}.speech-footer span{font-size:9px}
 .panel{top:76px;max-height:62%}
 .touch-controls{bottom:6px;left:6px;right:6px}.dpad{grid-template-columns:repeat(3,39px);grid-template-rows:repeat(3,39px)}.talk-button{min-width:76px;min-height:61px}
 .answer-options{grid-template-columns:1fr}.dialog-card{padding:14px}
}
@media(max-height:520px) and (orientation:landscape){
 html,body{height:100dvh;overflow:hidden}.app{max-width:none;position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:0}.masthead,footer{display:none}
 .game-shell{width:min(calc(100vw - 190px),calc(100dvh * 1.6));height:auto;aspect-ratio:8/5;border-radius:0}
 html.focus .game-shell{width:min(calc(100vw - 190px),calc(100dvh * 1.6))}
 .touch-controls{position:fixed;left:9px;right:9px;bottom:7px;z-index:21}
 .intro-card{padding:8px 14px}.intro-card h2{font-size:26px;margin:3px 0}.intro-card p{font-size:11px;margin:5px 0}
 .instructions{margin:4px 0}.instructions span{padding:3px 5px}.choices{margin:5px 0}.choice{padding:5px 9px}
 .giant{margin-top:5px;padding:8px}
 .hud-pill{font-size:9px}.game-tools{top:33px}
}
@media(prefers-reduced-motion:reduce){*{animation:none!important;scroll-behavior:auto!important}}
/* Den originale figuren, seks 32×32-ruter per retning. */
.hero-preview{display:inline-block;width:40px;height:40px;flex:none;vertical-align:middle;background-image:url('assets/hero-blonde.webp');background-repeat:no-repeat;background-size:240px 160px;background-position:0 0;image-rendering:pixelated;margin-right:6px}
#avatarExplorer{display:inline-flex;align-items:center;gap:5px}
