:root{
  color-scheme:dark;
  --navy:#081126;--navy2:#101b39;--ink:#111a32;--gold:#d8a93a;--gold2:#f0c75e;
  --cream:#f4e5b9;--muted:#8790a9;--green:#3d7253;--danger:#a84f48;
  font-family:"DejaVu Sans Mono","Liberation Mono",monospace;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:#030815;color:var(--cream)}
body{display:grid;place-items:center;padding:8px;overflow-x:hidden}
button{font:inherit;color:inherit;background:#101a35;border:2px solid #8a6c28;cursor:pointer}
button:hover,button:focus-visible{border-color:var(--gold2);background:#172446;outline:none}
button:active{transform:translateY(1px)}
.game-shell{position:relative;width:min(960px,100%);border:3px solid #5f4a1c;background:var(--navy);box-shadow:0 20px 60px #000;image-rendering:auto}
.game-header{height:52px;display:flex;align-items:center;justify-content:space-between;padding:4px 10px;border-bottom:2px solid #755b20;background:linear-gradient(180deg,#0c1730,#081126)}
.brand{display:flex;align-items:center;gap:8px}.brand img{width:42px;height:42px;object-fit:contain}.brand h1{font-size:16px;line-height:1;margin:0;color:var(--gold2)}.brand p{font-size:9px;margin:5px 0 0;color:#7f899f}
.header-actions{display:flex;gap:6px}.header-actions button{width:39px;height:39px;font-size:16px;padding:0}
.scene-wrap{position:relative;width:100%;aspect-ratio:640/304;background:#17293b;overflow:hidden}
#gameCanvas{display:block;width:100%;height:100%;image-rendering:auto;touch-action:none}
.mission-panel{position:absolute;left:10px;top:9px;min-width:220px;max-width:55%;padding:8px 10px;border:2px solid #7d6225;background:rgba(8,17,38,.9);box-shadow:3px 3px 0 rgba(0,0,0,.35);font-size:11px}.mission-panel strong{display:block;color:#b98e2e;font-size:8px;margin-bottom:4px}.mission-panel.flash{animation:missionFlash .65s steps(2)}
@keyframes missionFlash{50%{border-color:#f4d16a;background:#172b4e}}
.hover-label{position:absolute;display:none;transform:translate(-50%,-115%);padding:3px 6px;background:#111729;border:1px solid #9e7b2e;color:#f5dda0;font-size:10px;pointer-events:none;white-space:nowrap}.hover-label.visible{display:block}
.action-sentence{position:absolute;left:50%;bottom:5px;transform:translateX(-50%);max-width:90%;padding:3px 7px;background:rgba(12,19,37,.9);border:1px solid #9b7830;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:none}.action-sentence.visible{display:block}
.look-preview{position:absolute;left:14px;right:14px;bottom:28px;z-index:8;display:flex;gap:8px;align-items:flex-start;padding:7px 10px;background:rgba(12,22,43,.94);border:2px solid #b88a31;color:#fff;font-size:11px;line-height:1.35;opacity:0;transform:translateY(5px);transition:opacity .12s,transform .12s;pointer-events:none}.look-preview strong{color:#f2be47;white-space:nowrap}.look-preview span{min-width:0}.look-preview.visible{opacity:1;transform:none}
.toast{position:absolute;right:12px;top:12px;padding:7px 10px;background:#132544;border:2px solid #c49334;color:#ffe4a2;font-size:10px;opacity:0;transform:translateY(-6px);transition:.2s;pointer-events:none}.toast.visible{opacity:1;transform:none}
.start-overlay{position:absolute;inset:0;display:grid;place-items:center;background:rgba(2,7,17,.79);backdrop-filter:blur(2px);z-index:20}.start-overlay.hidden{display:none}.start-card{width:min(460px,90%);padding:22px;border:3px solid #a27b29;background:#0d1831;box-shadow:8px 8px 0 #030610;text-align:center}.phase-chip{display:inline-block;padding:3px 8px;background:#315e46;color:#f1e3b8;border:1px solid #85a778;font-size:10px}.start-card h2{color:var(--gold2);font-size:21px;margin:12px 0}.start-card p{font-size:12px;line-height:1.55;color:#d7d7d0}.start-actions{display:flex;justify-content:center;gap:10px;margin:18px 0}.start-actions button{padding:10px 18px}.start-card small{color:#7f899f;font-size:9px}.save-status{min-height:18px;color:#9fb99e!important}
.dialogue-panel{display:flex;gap:14px;min-height:148px;padding:12px 15px;border-top:3px solid #d3a238;border-bottom:2px solid #70551d;background:#101b39;position:relative;z-index:15}.dialogue-portrait{width:96px;min-width:96px;height:118px;border:2px solid #c69731;background:#152342;overflow:hidden;display:grid;place-items:end center}.dialogue-portrait img{width:74px;height:auto;image-rendering:auto}.dialogue-copy{flex:1}.dialogue-copy strong{display:block;color:#f2be47;margin-bottom:10px}.dialogue-copy p{min-height:48px;margin:0 0 12px;font-size:14px;line-height:1.45;color:#fff}.dialogue-copy button{padding:8px 12px}
.command-area{display:grid;grid-template-columns:minmax(0,1fr) minmax(250px,.72fr);min-height:77px;border-top:2px solid #70551d}.verbs{display:grid;grid-template-columns:repeat(5,1fr)}.verbs button{border-width:0 1px 0 0;border-color:#66501d;display:grid;place-items:center;align-content:center;gap:4px;background:#0b142b;color:#9b8352;font-size:14px}.verbs button span{font-size:10px}.verbs button.active{background:#202a44;color:#e7bd56;box-shadow:inset 0 0 0 3px #a97f27}
.inventory{display:flex;align-items:stretch;border-left:2px solid #70551d;background:#071024;overflow-x:auto}.inventory-item{width:72px;min-width:72px;border-width:0 1px 0 0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:#a28d5f;background:#0a1429}.inventory-item.selected{box-shadow:inset 0 0 0 3px #d8ab42;color:#f3cd6e;background:#1b2742}.inventory-item span:last-child{font-size:9px}.item-icon{display:grid;place-items:center;width:34px;height:27px;border:1px solid #8a6a25;background:#182642;color:#f4cb62}.notebook-icon{font-size:20px}.flyer-icon{border-radius:50%;font-weight:bold;color:#d95454;background:#ece0b9}.cancel-item{margin-left:auto;min-width:78px;border-width:0 0 0 1px;color:#d6b76c;font-size:10px}
.status-bar{height:25px;display:flex;justify-content:space-around;align-items:center;border-top:1px solid #5c481b;color:#717b92;font-size:9px}.status-bar strong{color:#bfa15f}
.mobile-pad{display:none;position:absolute;right:8px;bottom:108px;grid-template-columns:repeat(3,42px);grid-template-rows:repeat(2,42px);gap:2px;z-index:12;opacity:.82}.mobile-pad button{border:1px solid #9b772b;background:#101a35}.mobile-pad [data-dir=up]{grid-column:2}.mobile-pad [data-dir=left]{grid-row:2;grid-column:1}.mobile-pad [data-dir=down]{grid-row:2;grid-column:2}.mobile-pad [data-dir=right]{grid-row:2;grid-column:3}
.modal{width:min(680px,92vw);max-height:88vh;padding:0;border:3px solid #b0852c;background:#0c1730;color:#f0e3bd;box-shadow:10px 10px 0 #030610}.modal::backdrop{background:rgba(0,0,0,.8)}.modal form{display:flex;flex-direction:column;max-height:84vh}.modal header{display:flex;align-items:center;justify-content:space-between;padding:12px 15px;border-bottom:2px solid #765a20}.modal h2{font-size:18px;color:#f2c65e;margin:0}.modal header button{width:32px;height:32px}.modal footer{padding:11px 15px;border-top:1px solid #5d491d;text-align:right}.modal footer button{padding:8px 14px}.small-modal{width:min(440px,92vw)}.notebook-pages{padding:18px;overflow:auto;background:#e8d8ad;color:#30291d;min-height:290px;background-image:repeating-linear-gradient(0deg,transparent 0 25px,rgba(80,75,58,.18) 26px)}.notebook-entry{margin:0 0 18px;padding-left:12px;border-left:4px solid #765a31}.notebook-entry h3{font-size:14px;margin:0 0 6px}.notebook-entry p{font-size:12px;line-height:1.5;margin:0}.item-view{padding:20px;text-align:center}.item-art{width:100px;height:80px;margin:0 auto 15px;display:grid;place-items:center;border:2px solid #7a5d24;background:#152440;font-size:38px}.item-view p{font-size:12px;line-height:1.55}.menu-list{display:grid;gap:10px;padding:18px}.menu-list button{padding:10px}.help{padding:0 18px;color:#8e99af;font-size:10px;line-height:1.5}.phase-modal p{padding:0 20px;font-size:13px;line-height:1.55}.phase-summary{margin:12px 20px;padding:12px;border:1px solid #6d5724;background:#13203c;font-size:11px;line-height:1.7}
@media(max-width:720px){body{padding:0;align-items:start}.game-shell{border-width:0;width:100%;min-height:100svh}.game-header{height:48px}.brand img{width:38px;height:38px}.brand h1{font-size:13px}.brand p{font-size:8px}.header-actions button{width:34px;height:34px}.mission-panel{font-size:9px;min-width:180px}.command-area{grid-template-columns:1fr;min-height:132px}.inventory{border-left:0;border-top:2px solid #70551d;min-height:58px}.verbs{min-height:65px}.mobile-pad{display:grid}.dialogue-panel{min-height:132px;padding:9px}.dialogue-portrait{width:78px;min-width:78px;height:105px}.dialogue-portrait img{width:64px}.dialogue-copy p{font-size:12px}.look-preview{left:8px;right:8px;bottom:26px;font-size:9px;padding:6px 8px}.status-bar{font-size:8px}}
@media(max-width:430px){.header-actions button:nth-child(2){display:none}.brand p{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mission-panel{top:5px;left:5px;max-width:70%;padding:6px}.verbs button{font-size:12px}.verbs button span{font-size:8px}.mobile-pad{bottom:110px;transform:scale(.9);transform-origin:bottom right}}
.dialogue-choices{display:grid;gap:7px;margin:8px 0 10px}
.dialogue-choices button{padding:8px 10px;text-align:left;line-height:1.35;background:#172541;border-color:#856727;font-size:11px}
.dialogue-choices button:hover,.dialogue-choices button:focus-visible{background:#26375a;border-color:#f0c75e}
@media(max-width:720px){.dialogue-choices{gap:5px}.dialogue-choices button{padding:7px;font-size:10px}}
.scene-wrap::after{content:"";position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 36px rgba(2,7,15,.28)}
.seeds-icon{color:#f1cc60;background:#3b2c1e;font-size:18px;letter-spacing:1px}.feather-icon{color:#4fd0a2;background:#123e55;font-size:25px}.inventory-item[hidden]{display:none}
.cane-icon{color:#d1ae72;background:#3c2b20;font-size:26px}

.ending-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.ending-link{display:inline-flex;align-items:center;padding:8px 12px;border:2px solid #8a6c28;background:#101a35;color:#f0e3bd;text-decoration:none;font-size:11px}.ending-link:hover,.ending-link:focus{border-color:#f0c75e;background:#172446}.phase-chip{letter-spacing:.04em}

/* Ecrã inteiro: dimensionar a interface completa segundo largura E altura.
   Antes, o próprio gameShell era expandido até 100vw; a cena crescia pela
   largura e empurrava diálogo/comandos para fora da área visível. */
html:fullscreen{background:#030815}
body.game-fullscreen{
  width:100vw;
  height:100vh;
  min-height:100vh;
  padding:0;
  overflow:hidden;
  display:grid;
  place-items:center;
}
body.game-fullscreen .game-shell{
  width:960px;
  max-width:none;
  min-height:0;
  transform:scale(var(--fullscreen-scale,1));
  transform-origin:center center;
}



/* Fase 8k4 MAX — clareza narrativa e riqueza ambiental */
.clue-panel{position:absolute;right:10px;top:58px;z-index:7;display:grid;grid-template-columns:1fr;gap:3px;min-width:142px;padding:7px 9px;border:2px solid rgba(180,139,48,.85);background:rgba(7,16,33,.88);box-shadow:3px 3px 0 rgba(0,0,0,.28);font-size:9px;line-height:1.25;pointer-events:none}
.clue-panel[hidden]{display:none}.clue-panel strong{color:#f0bd4e;font-size:8px;letter-spacing:.08em;margin-bottom:2px}.clue-panel span{color:#b6bfd1;transition:color .15s,transform .15s}.clue-panel span.done{color:#91d7a7;transform:translateX(2px)}.clue-panel span.done::first-letter{color:#7ee59f}
.scene-transition{position:absolute;inset:0;z-index:19;display:grid;place-items:center;background:#050a15;color:#f0c45d;font-size:12px;letter-spacing:.08em;opacity:0;pointer-events:none;transition:opacity .22s steps(5)}.scene-transition.visible{opacity:1}.scene-transition span{padding:8px 12px;border-top:1px solid #8e6b27;border-bottom:1px solid #8e6b27;background:rgba(10,20,40,.9)}
@media(max-width:720px){.clue-panel{right:5px;top:48px;min-width:118px;padding:5px 7px;font-size:8px}.clue-panel strong{font-size:7px}}

/* REMASTER2: illustrated lake scene must render smoothly, not as forced pixel art. */
.scene-wrap{background:#18354a}
