.quest-hud-button{position:absolute;right:9px;top:8px;z-index:22;display:grid;place-items:center;width:44px;height:50px;padding:0;border:0;background:none;box-shadow:none;touch-action:manipulation}
.quest-hud-button img{width:33px;height:42px;image-rendering:pixelated;pointer-events:none}
.quest-hud-button:active{transform:translateY(2px)}
.quest-hud-button[hidden]{display:none}
.quest-overlay,.quest-treasure-overlay{position:absolute;inset:0;z-index:90;display:grid;place-items:center;padding:42px 14px 16px;background:#0009;box-sizing:border-box;touch-action:manipulation;color:#54301b;font-family:inherit;overscroll-behavior:contain}
.quest-overlay[hidden],.quest-treasure-overlay[hidden],.quest-overlay [hidden],.quest-treasure-overlay [hidden]{display:none!important}
.quest-sheet,.quest-treasure-sheet{position:relative;box-sizing:border-box;width:100%;height:100%;max-height:390px;min-height:0;border:14px solid transparent;border-image:url('/research-assets/quest-paper.png') 6 fill stretch;background:#ffd783;image-rendering:pixelated;box-shadow:3px 5px #23120555}
.quest-journal-heading{position:absolute;left:50%;top:-47px;transform:translateX(-50%);margin:0;width:max-content;max-width:70%;padding:3px 18px;border:5px solid transparent;border-image:url('/research-ui/window.png') 11 fill stretch;background:#ffe9b4;font-size:clamp(16px,4.3vw,21px);line-height:1.25;color:#633718;text-align:center;white-space:nowrap}
.quest-close{position:absolute;z-index:2;top:-29px;right:-22px;width:44px;height:44px;border:0;padding:0;background:transparent url('/research-assets/quest-close.png') center/30px 30px no-repeat;box-shadow:none;image-rendering:pixelated;color:transparent}
.quest-back{position:absolute;z-index:2;left:-21px;top:-29px;width:44px;height:44px;border:0;padding:0;background:transparent url('/research-assets/quest-back.png') center/36px 33px no-repeat;box-shadow:none;image-rendering:pixelated;color:transparent}
.quest-close:active,.quest-back:active{transform:translateY(1px)}
.quest-close:disabled{opacity:.5}
.quest-list{height:100%;overflow:auto;display:flex;flex-direction:column;gap:8px;padding:6px 1px;box-sizing:border-box;scrollbar-color:#b67930 #ffd783}
.quest-row{position:relative;flex:0 0 auto;display:flex;align-items:center;width:100%;min-height:66px;gap:13px;padding:12px 10px;border:8px solid transparent;border-image:url('/research-assets/quest-row.png') 5 fill stretch;background:#ffe2a1;box-shadow:none;text-align:left;color:#58321e;font:inherit;font-size:clamp(13px,3.5vw,17px);font-weight:700;line-height:1.45;image-rendering:pixelated}
.quest-row:hover,.quest-row:focus-visible{background:#ffeebf;filter:brightness(1.04)}
.quest-row[aria-current=true]{background:#ffedb9}
.quest-row-mark{flex:none;width:46px;height:18px;object-fit:contain;image-rendering:pixelated}
.quest-row-mark[src$="quest-mark.png"]{height:24px;object-fit:contain}
.quest-row-title{flex:1;min-width:0;overflow-wrap:anywhere}
.quest-empty{margin:auto;color:#8a5e32;font-size:15px}
.quest-detail{height:100%;overflow-y:auto;padding:2px 9px 12px;box-sizing:border-box;scrollbar-color:#b67930 #ffd783}
.quest-detail h3{margin:7px 0 18px;font-size:clamp(17px,4.5vw,22px);line-height:1.5;text-align:center;color:#663512}
.quest-description{margin:0 0 22px;line-height:1.8;font-size:clamp(14px,3.8vw,18px);white-space:pre-line;overflow-wrap:anywhere}
.quest-objective{display:flex;align-items:flex-start;gap:11px;margin:10px 0;color:#385b1c}
.quest-objective>span{flex:0 0 15px;width:15px;height:12px;margin-top:6px;background:url('/research-assets/quest-objective.png') center/15px 12px no-repeat;image-rendering:pixelated;transform:rotate(90deg)}
.quest-objective p{margin:0;line-height:1.7;font-size:clamp(14px,3.8vw,17px)}
.quest-objective[data-state=complete]{color:#416b22}
.quest-finished{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;margin:24px 0 5px;color:#653c20;font-size:15px}
.quest-finished>img{width:46px;height:18px;object-fit:contain;image-rendering:pixelated}
.quest-finished>.quest-reward-small{width:32px;height:32px}
.quest-treasure-overlay{padding:40px 26px 24px;z-index:95;background:#000b}
.quest-treasure-sheet{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;height:auto;max-height:100%;padding:12px 10px 16px;overflow:visible}
.quest-treasure-sheet h2{margin:0;color:#633718;font-size:clamp(17px,4.6vw,22px);font-weight:700}
.quest-chest-stage{position:relative;width:128px;height:124px;display:grid;place-items:center;flex:0 0 auto}
.quest-chest-sprite{--chest-frame:0;display:block;width:96px;height:96px;background:url('/research-assets/quest-chest.png') 0 0/384px 96px no-repeat;background-position-x:calc(var(--chest-frame)* -96px);image-rendering:pixelated}
[data-phase=opening] .quest-chest-sprite{animation:quest-chest-arrive .5s ease-out both}
.quest-chest-sprite[hidden],.quest-treasure-gift[hidden]{display:none}
.quest-treasure-gift{width:80px;height:80px;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 2px 0 #7e441b88)}
.quest-treasure-name{margin:0;text-align:center;color:#633214;font-size:clamp(17px,4.6vw,22px);font-weight:700;line-height:1.4;min-height:1.4em}
.quest-treasure-message{margin:0;min-height:1.5em;max-width:100%;font-size:clamp(12px,3.5vw,15px);line-height:1.6;text-align:center;overflow-wrap:anywhere;color:#7a512d}
.quest-claim{min-width:116px;min-height:42px;margin:0;font-size:15px}
.quest-claim:disabled{opacity:.65;cursor:default}
.quest-treasure-message:empty{display:none}
@media(max-width:480px){.quest-treasure-sheet{gap:5px;padding:6px 7px 10px}.quest-chest-stage{height:104px}.quest-treasure-sheet h2,.quest-treasure-name,.quest-claim{flex-shrink:0}}
@keyframes quest-chest-arrive{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:370px){.quest-overlay{padding:37px 11px 12px}.quest-sheet{border-width:11px}.quest-journal-heading{top:-42px}.quest-row{gap:8px;padding:8px 5px;min-height:58px}.quest-row-mark{width:40px;height:16px}.quest-detail{padding:2px 5px 8px}.quest-detail h3{margin-bottom:12px}.quest-description{margin-bottom:12px}.quest-treasure-overlay{padding:22px 14px 14px}.quest-treasure-sheet{gap:4px;padding:6px}.quest-chest-stage{height:92px}.quest-chest-sprite{width:72px;height:72px;background-size:288px 72px;background-position-x:calc(var(--chest-frame)* -72px)}.quest-treasure-gift{width:64px;height:64px}.quest-claim{min-height:38px}.quest-treasure-name{font-size:17px}}
@media(prefers-reduced-motion:reduce){.quest-chest-sprite,.quest-treasure-gift{animation:none!important}}
