:root{color-scheme:dark;--gold:#f4d18b;--cream:#f8eed7;--bg:#111f29;--panel:#20353c;--line:#52635e;font-family:system-ui,-apple-system,sans-serif}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:radial-gradient(ellipse at 50% 0,#29434a,#101c29 65%);color:var(--cream);overscroll-behavior:none}body{min-height:100dvh}button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}button:focus-visible{outline:3px solid #fff;outline-offset:3px}button[hidden],[hidden]{display:none!important}#app{min-height:100dvh;display:grid;place-items:center;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}.screen{width:min(100%,960px);position:relative}.menu,.ending{min-height:min(100dvh,760px);display:grid;place-items:center;overflow:hidden;border:1px solid #5b6a65;border-radius:18px;background:#172837;isolation:isolate}.menu>canvas,.ending>canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;image-rendering:pixelated;z-index:-2}.menu:before,.ending:before{content:'';position:absolute;inset:0;background:linear-gradient(90deg,#111e2be8,#111e2b90 55%,#111e2b35),linear-gradient(0deg,#101c29c4,transparent 45%);z-index:-1}.menu-content,.end-content{text-align:center;padding:32px 20px;width:min(100%,460px);text-shadow:0 2px 12px #101720}.eyebrow{font-size:10px;font-weight:800;letter-spacing:2px;color:var(--gold)}h1,h2,p{margin:0}h1{font-family:Georgia,serif;font-size:clamp(38px,8vw,76px);line-height:1.03;margin:18px 0;color:#fff3d5;letter-spacing:-2px}h1 em{font-style:normal;color:var(--gold)}.menu-content p,.end-content p{font-size:16px;line-height:1.65;color:#f8e5c8}.menu-buttons{display:grid;gap:10px;margin:28px auto 20px;max-width:290px}.primary,.secondary{border:1px solid #a58a5a;border-radius:9px;min-height:46px;padding:11px 20px;font-weight:750;box-shadow:0 4px 0 #0e1924}.primary{color:#202b27;background:linear-gradient(#ffe3a6,#e8b85f)}.secondary{background:#263e40e8;color:var(--cream)}.primary:active,.secondary:active{transform:translateY(2px);box-shadow:none}.menu small{color:#f2d9b5}.hud{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#1a3037;border:1px solid #52635e;border-radius:12px 12px 0 0}.hud h2{font-family:Georgia,serif;font-size:clamp(15px,3.5vw,23px);margin-top:3px}.hud .eyebrow{font-size:9px}.hud-actions{display:flex;gap:5px}.hud-actions button{width:36px;height:36px;border:1px solid #63716c;background:#293f45;border-radius:8px;font-weight:bold;font-size:18px}#gems{display:flex;gap:5px;align-items:center}.gem{width:12px;height:17px;background:var(--gem);clip-path:polygon(50% 0,100% 35%,82% 75%,50% 100%,18% 75%,0 35%);opacity:.22}.gem.on{opacity:1;filter:brightness(1.25)}.game-layout{display:grid;gap:0}.viewport{position:relative;width:100%;background:#111f2b;overflow:hidden;border-inline:1px solid #52635e}#world{display:block;width:100%;height:auto;aspect-ratio:8/5;image-rendering:pixelated;touch-action:none}#prompt,#toast{position:absolute;left:50%;transform:translateX(-50%);border:1px solid #d7b978;border-radius:8px;background:#182d36e8;color:#ffe2a6;padding:7px 12px;font-size:12px;text-align:center;pointer-events:none;max-width:90%}#prompt{bottom:8px}#toast{top:8px;width:max-content}.task{min-height:43px;display:flex;justify-content:space-between;gap:10px;align-items:center;font-size:12px;padding:8px 12px;color:#e9ddbd;background:#20363d;border:1px solid #52635e}#counter{font-weight:bold;color:var(--gold);white-space:nowrap}.controls{display:flex;justify-content:space-between;align-items:center;padding:12px 20px;user-select:none;touch-action:none;border:1px solid #52635e;border-top:0;border-radius:0 0 12px 12px;background:#162a34}.dpad{display:grid;grid-template-columns:repeat(3,46px);grid-template-rows:repeat(2,46px);gap:4px}.dpad button,.action{touch-action:none;background:linear-gradient(#38535a,#213943);border:1px solid #74827c;border-radius:10px;box-shadow:0 3px 0 #0a171e;font-size:22px}.dpad button.active,.dpad button:active,.action:active{background:#a48750;color:#172c33;transform:translateY(2px)}[data-dir=up]{grid-column:2;grid-row:1}[data-dir=left]{grid-column:1;grid-row:2}[data-dir=down]{grid-column:2;grid-row:2}[data-dir=right]{grid-column:3;grid-row:2}.action{width:76px;height:76px;border-radius:50%;color:#ffe7a9;border:2px solid #d3b66e;font-size:30px;display:grid;place-content:center;gap:2px}.action small{font-size:10px;font-weight:800;letter-spacing:1px}.control-hint{font-size:12px;color:#b4c2c0;text-align:center;line-height:1.6}.control-hint span{font-size:10px;color:#91a3a5}.overlay{position:fixed;inset:0;z-index:10;background:#0b1525bf;display:grid;place-items:center;padding:14px;backdrop-filter:blur(3px)}.dialog{width:min(100%,490px);max-height:92dvh;overflow:auto;background:linear-gradient(150deg,#284149,#182933);border:2px solid #bb9e64;box-shadow:0 12px 45px #0009,inset 0 0 0 4px #1b3038;border-radius:14px;padding:24px}.dialog h2{font-family:Georgia,serif;font-size:28px;color:#ffe0a0;margin:8px 0 12px}.dialog p{font-size:15px;line-height:1.65;margin:0 0 12px;white-space:pre-line}.dialog .primary{width:100%;margin-top:12px}#choices{display:grid;gap:8px}#choices button{min-height:44px;text-align:left;background:#324b50;border:1px solid #7c8d80;border-radius:7px;padding:10px 12px;font-size:14px}.portrait{float:right;width:66px;height:66px;background:#112c35;border:1px solid #c5aa70;border-radius:7px;margin-left:10px}.portrait canvas{width:100%;height:100%;image-rendering:pixelated}.end-content .primary,.end-content .secondary{display:block;margin:14px auto;width:min(100%,280px)}@media(max-width:600px){.screen{border-radius:0}.menu,.ending{min-height:100dvh;border:0}.hud{border-radius:0}.controls{border-radius:0;padding:14px 15px}.control-hint{display:none}#app:has(#game:not([hidden])){align-items:center}.dialog{padding:19px}.dialog h2{font-size:24px}}@media(orientation:landscape) and (max-height:600px){#game{width:100%;max-width:1000px}.hud{padding:4px 10px}.hud h2{font-size:17px}.hud-actions button{height:30px}.game-layout{grid-template-columns:1fr 170px;grid-template-rows:minmax(0,1fr) auto;align-items:stretch}.viewport{grid-column:1;display:grid;place-items:center;height:calc(100dvh - 92px)}#world{width:auto;height:100%;max-width:100%;object-fit:contain}.task{grid-column:1;min-height:35px;padding:5px 9px}.controls{grid-column:2;grid-row:1 / span 2;flex-direction:column;justify-content:center;gap:16px;border-top:1px solid #52635e;padding:5px}.menu,.ending{min-height:100dvh}.menu-content,.end-content{padding:10px}.menu-content h1,.end-content h1{font-size:42px;margin:6px 0}.menu-buttons{margin:12px auto;gap:6px}.menu-content p{font-size:13px}.dialog{padding:14px}.dialog p{font-size:14px;line-height:1.4}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}
