:root{font-family:system-ui,"Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;color:#384239;background:#f7f3ed;--cell:80px}
*{box-sizing:border-box}body{margin:0;background:#f7f3ed}button{font:inherit;cursor:pointer;border:0;border-radius:12px;padding:11px 15px;font-weight:750;touch-action:manipulation}button:focus-visible{outline:3px solid #faad66;outline-offset:2px}button:disabled{opacity:.45;cursor:not-allowed}
#app{max-width:1280px;margin:auto;padding:12px clamp(12px,2.2vw,24px)}
header{display:flex;align-items:center;justify-content:flex-end;padding:8px 0 14px}#helpBtn{border:2px solid #b6caa9;background:white;border-radius:50%;width:44px;height:44px;padding:0;font-size:22px}
.title-screen{display:grid;grid-template-columns:1fr;gap:16px;background:linear-gradient(135deg,#fff 0%,#eff6e5 48%,#f8e4df 100%);border:1px solid #e3e9d9;border-radius:24px;padding:16px}.title-image{width:100%;height:auto;display:block;border-radius:22px;border:3px solid #fff;box-shadow:0 10px 24px #3332}.title-panel{display:flex;flex-direction:column;justify-content:center;max-width:960px;margin:0 auto}.title-panel h1{color:#547447;font-size:clamp(22px,2.4vw,34px);margin:.1em 0 .5em}.title-panel p{line-height:1.8;margin:.55em 0}
.mission-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-top:14px}.mission-card{background:white;border:2px solid #e2ead8;border-radius:18px;padding:14px;text-align:left;box-shadow:0 4px 14px #8882}.mission-card h3{margin:.2em 0;color:#607d50}.mission-card p{margin:.4em 0 .8em;font-size:13px;line-height:1.65}.mission-meta{display:flex;gap:10px;flex-wrap:wrap;font-size:12px;color:#7a8777}
.primary{background:#d66e63;color:white;box-shadow:0 4px 0 #ac554f}.secondary{background:#ecf3e5;color:#557749;box-shadow:0 3px 0 #c0d0b6}.tertiary{background:#fff;color:#7f8581;border:1px solid #d8dcd4}
.hud{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin-bottom:12px}.hud>div{border-radius:14px;background:white;box-shadow:0 2px 9px #7772;padding:10px;text-align:center}.hud small{display:block;color:#848b7f;font-size:11px}.hud b{font-size:clamp(18px,3vw,29px);color:#4c7250}.danger{color:#bd3b39!important}
.game-layout{display:grid;grid-template-columns:minmax(0,1.8fr) minmax(300px,.9fr);gap:12px}.store-wrap,.note,.comment{border-radius:18px;background:white;padding:13px}.store-top{display:flex;align-items:center;justify-content:space-between;gap:9px;margin-bottom:9px}.store-top span{font-size:12px;color:#697966}
.map-frame{position:relative;background:linear-gradient(#f6eddc,#e8dbc3);border:8px solid #d5c7ad;border-radius:18px;overflow:hidden;padding:10px}.viewport{position:relative;height:min(62vw,630px);min-height:420px;overflow:hidden;border-radius:12px;background:#f9f4ea;touch-action:none}.world{position:absolute;left:0;top:0;will-change:transform}
.tile-layer,.item-layer,.decor-layer,.npc-layer{position:absolute;left:0;top:0}.tile{position:absolute;width:var(--cell);height:var(--cell);border-radius:12px;border:1px solid #d8ceb9;display:flex;align-items:center;justify-content:center;text-align:center;line-height:1.2;font-size:13px;font-weight:800;color:#564c3f}.tile.floor{background:#fbf7ef}.tile.wall{background:#c8b18f;border-color:#b59f7e}.tile.entry{background:#dff0e6;border-color:#b3cdbd;color:#51745d}.tile.register{background:#e3ecf8;border-color:#9cb4cc;color:#486584}.tile.shelf{background:#dcc4a2;border-color:#b39367;color:#664f31}.tile.special{background:#efe7d6;border-style:dashed}.tile .sub{display:block;font-size:10px;font-weight:600;color:#7b6c57}
.item-marker,.decor,.npc{position:absolute;width:calc(var(--cell) - 14px);height:calc(var(--cell) - 14px);display:flex;align-items:center;justify-content:center;border-radius:14px;text-align:center;font-size:36px;pointer-events:none}.item-marker{left:7px;top:7px;background:#fff7;box-shadow:inset 0 0 0 2px #ffffffaa}.item-marker small{display:block;font-size:11px;color:#664f31;font-weight:800}.decor{left:7px;top:7px;background:#fff6;font-size:34px}.npc{left:8px;top:8px;background:#ffffffd8;border:2px solid #d9dccf;flex-direction:column;font-size:28px;z-index:3}.npc span{font-size:10px;font-weight:800;color:#6f7e69;line-height:1.1}.player{position:absolute;z-index:4;width:74px;height:auto;transform:translate(-50%,-88%);pointer-events:none;filter:drop-shadow(0 3px 5px #0004);transition:left .14s linear,top .14s linear}.hint-block{margin-top:10px}.hint{font-size:12px;color:#6e7a6c;margin:0 0 8px}.action-row{display:flex;flex-wrap:wrap;gap:8px}.mobile-pad{display:none;margin-top:10px;justify-content:center;align-items:center;flex-direction:column;gap:6px}.mobile-pad button{width:58px;height:44px;padding:0}.pad-mid{display:flex;gap:6px}
.comment{display:flex;align-items:center;gap:10px;margin-bottom:12px;background:#f1f7eb;min-height:116px}.comment img{width:96px;height:96px;object-fit:cover;background:white;border-radius:18px}#talk{font-size:13px;line-height:1.6;font-weight:700}.mission-desc{font-size:13px;line-height:1.8;margin:.7em 0;color:#5f695f}
.note{margin-bottom:12px}.note b{color:#547447}.note ul{padding:0;margin:11px 0 0;list-style:none}.note li{font-size:13px;border-top:1px solid #edf0e8;padding:8px 3px;display:flex;justify-content:space-between;gap:6px}.note li.done{color:#8c9b88;text-decoration:line-through}.note li button{padding:2px 7px;border:1px solid #dbd5ca;background:#fff;color:#b56c5e;font-size:11px}.tips li{display:list-item;margin-left:1em;border-top:0;padding:2px 0}
.overlay[hidden],section[hidden]{display:none!important}.overlay{position:fixed;inset:0;background:#263529aa;display:flex;align-items:center;justify-content:center;padding:14px;z-index:10}.dialog{position:relative;background:white;border-radius:22px;padding:25px 18px 19px;max-width:760px;width:100%;max-height:88dvh;overflow:auto;box-shadow:0 12px 60px #2225}.dialog h2{font-size:21px;color:#567c4d;margin:0 38px 15px 0}.close{position:absolute;right:14px;top:10px;background:#f2efed;font-size:24px;padding:2px 10px}.products{display:grid;gap:11px}.product{display:grid;grid-template-columns:1fr auto;align-items:center;gap:12px;border:1px solid #dce3d6;border-radius:13px;padding:12px}.prod-name{font-weight:800}.product small{display:block;color:#818a79;margin-top:5px;line-height:1.5}.product button{background:#e5f0dd;color:#4a734c}.product button.badfit{background:#fbe4df;color:#aa5d53}.product button.selected{background:#e6f3df;color:#4c734e}.muted{color:#7c8979;font-size:13px}
.pickup-figure{display:grid;place-items:center;background:linear-gradient(#fefbf7,#eef6e8);border-radius:20px;padding:16px;margin:10px 0 14px;border:1px solid #dde8d7}.pickup-stack{position:relative;width:230px;height:310px}.pickup-stack img{position:absolute;inset:auto 0 0 0;margin:auto;height:250px;width:auto;object-fit:contain}.pickup-item{position:absolute;left:50%;top:10px;transform:translateX(-50%);min-width:130px;max-width:180px;background:#fff;border:3px solid #d88a74;border-radius:14px;padding:8px 10px;text-align:center;box-shadow:0 8px 18px #0002}.pickup-item .emoji{font-size:34px;display:block}.pickup-note{text-align:center;font-weight:800;color:#c96762}
.result{text-align:center;background:white;border-radius:22px;padding:22px}.result img{width:170px;height:220px;object-fit:contain}.result h2{color:#c96762}.result #resultDetail{max-width:580px;margin:0 auto 24px;line-height:2}.statrow{display:flex;justify-content:space-between;border-bottom:1px solid #e8ebe7;padding:3px 12px}.near-miss{margin-top:12px;padding:9px 12px;background:#f7f4ee;border-radius:12px}footer{text-align:center;font-size:10px;color:#81877c;padding:21px 0}
@media(max-width:980px){.game-layout{grid-template-columns:1fr}.mobile-pad{display:flex}.action-row button{flex:1 1 42%}.viewport{height:68vw}}
@media(max-width:720px){.viewport{height:74vw;min-height:360px}.comment img{width:82px;height:82px}.hud{gap:5px}.hud>div{padding:7px 3px}.hud small{font-size:10px}.hud b{font-size:16px}.player{width:66px}}
@media(max-width:420px){button{padding:10px 12px;font-size:13px}.mission-grid{grid-template-columns:1fr}.pickup-stack{width:190px;height:290px}.pickup-stack img{height:230px}.pickup-item{min-width:110px}}

/* v0.9.0 item acquisition: translation and opacity only, no image rotation or filtering */
.pickup-stack{overflow:visible}.pickup-stack img{z-index:2}.pickup-held-item{position:absolute;z-index:3;top:3px;left:50%;transform:translateX(-50%);font-size:51px;line-height:1.1;transition:top .52s ease,opacity .52s ease;filter:none;pointer-events:none}.pickup-basket{position:absolute;z-index:1;bottom:0;right:-28px;font-size:65px}.putting-in .pickup-held-item{top:225px;opacity:0}.pickup-scene{overflow:hidden}.npc{transition:left .55s linear,top .55s linear}

.mission-card{padding:0;overflow:hidden;background:#fff;border:2px solid #dce8d0;position:relative}.mission-card img{display:block;width:100%;height:auto;border-radius:16px}.mission-card h3,.mission-card p,.mission-meta{display:none}.mission-card.blink-go{animation:btnblink .22s linear 0s 5 alternate}.menu-button.blink-go{animation:btnblink .18s linear 0s 4 alternate}.button-wait{pointer-events:none;filter:saturate(.85)}
@keyframes btnblink{from{opacity:1;transform:scale(1)}to{opacity:.25;transform:scale(.98)}}
.npc{background:transparent;border:none;overflow:visible}.npc img{display:block;width:64px;height:64px;object-fit:contain;filter:drop-shadow(0 2px 4px #0003)}.npc span{position:absolute;left:50%;bottom:-9px;transform:translateX(-50%);background:#ffffffd8;border:1px solid #d9dccf;border-radius:10px;padding:1px 6px;white-space:nowrap}.npc{transition:left .55s linear,top .55s linear}
.pause-overlay[hidden]{display:none!important}.pause-overlay{position:fixed;inset:0;background:rgba(0,0,0,.48);display:flex;align-items:center;justify-content:center;z-index:12}.pause-box{font-size:clamp(42px,8vw,110px);font-weight:900;letter-spacing:.08em;color:#fff;text-shadow:0 5px 16px rgba(0,0,0,.5);padding:20px 40px;border:4px solid rgba(255,255,255,.7);border-radius:28px;background:rgba(20,20,20,.18)}
.product.selected-choice{outline:4px solid #96c17d;background:#f7fff2}.product .pick-button{min-width:98px}.talk-dialog p{font-size:18px;line-height:1.8}.pickup-held-item{transform:translateX(-50%)}.putting-in .pickup-held-item{animation:tossIntoBasket .6s cubic-bezier(.2,.5,.2,1) forwards;opacity:1}@keyframes tossIntoBasket{0%{transform:translate(-50%,0) scale(1);top:10px;opacity:1}45%{transform:translate(-24px,72px) scale(.96);top:80px;opacity:1}100%{transform:translate(78px,212px) scale(.66);top:142px;opacity:0}}

.help-title-btn{align-self:center;margin:6px auto 12px;min-width:180px}.title-panel{align-items:center}.help-scene{width:100%;max-width:600px;border-radius:14px;margin-bottom:12px}.product-icon{width:58px;height:58px;object-fit:contain;border:1px solid #e8e1d2;border-radius:10px;flex-shrink:0;background:#fff}.memo-icon{width:44px;height:44px}.note li{justify-content:flex-start;align-items:center}.note li>span{flex:1}.product{grid-template-columns:58px minmax(0,1fr) auto}.talk-dialog{display:flex;gap:18px;align-items:center;min-height:190px}.npc-portrait{width:180px;height:165px;object-fit:contain;border-radius:16px;background:#fff9f1}.dialog-actions{text-align:center;margin-top:14px}.dialog-actions button{min-width:180px}@media(max-width:520px){.product{grid-template-columns:52px minmax(0,1fr);}.product button{grid-column:2}.npc-portrait{width:115px;height:118px}.talk-dialog{gap:10px}.talk-dialog p{font-size:15px}}


/* v0.11.2 refinements */
.note li.done,.note li.done *, .note li.done small{ text-decoration:none !important; }
.note li.purchased{background:linear-gradient(90deg,#f0faee,#fcfff9);border:1px solid #cde4c3;box-shadow:inset 0 0 0 1px #ebf6e8}.memo-copy{display:block;padding-right:112px}.done-stamp,.done-stamp-img{position:absolute;right:4px;top:2px}.done-stamp{display:none!important}.done-stamp-img{width:88px;height:auto;transform:rotate(-10deg);filter:drop-shadow(0 2px 4px rgba(192,43,43,.12))}
.pickup-stack{width:250px;height:320px}.pickup-stack img{height:252px}.pickup-held-item{left:122px;top:112px;width:60px;height:60px;padding:4px;border-width:2px;border-radius:14px;background:rgba(255,255,255,.96);box-shadow:0 6px 12px rgba(0,0,0,.10)}.pickup-held-item img{width:44px;height:44px}.pickup-basket{bottom:8px;right:-8px;font-size:62px}.putting-in .pickup-held-item{animation:tossIntoBasketArc2 .82s cubic-bezier(.26,.62,.18,.99) forwards;opacity:1}@keyframes tossIntoBasketArc2{0%{left:122px;top:112px;transform:scale(1);opacity:1}24%{left:146px;top:82px;transform:scale(1.02);opacity:1}55%{left:178px;top:108px;transform:scale(.92);opacity:1}100%{left:178px;top:176px;transform:scale(.72);opacity:0}}
.talk-dialog{gap:20px;align-items:center}.npc-portrait{width:208px;height:192px;object-fit:contain;object-position:center center;display:block;margin:0 auto;background:#fff9f1;padding:6px}.talk-dialog p{flex:1}.dialog-actions{text-align:center;margin-top:18px}.dialog-actions button{min-width:220px;display:inline-flex;justify-content:center}
@media(max-width:520px){.npc-portrait{width:132px;height:132px}.done-stamp-img{width:72px}.pickup-held-item{left:104px;top:104px;width:54px;height:54px}.pickup-held-item img{width:38px;height:38px}}


/* v0.11.3 portrait/sprite centering */
.talk-dialog{justify-content:flex-start;align-items:center}.npc-portrait{width:228px;height:205px;object-fit:contain;object-position:center center;display:block;margin:0 auto;flex:0 0 auto;background:#fff9f1;padding:2px 4px}.talk-dialog p{display:flex;align-items:center;min-height:170px}.npc img{object-position:center center}
@media(max-width:520px){.npc-portrait{width:144px;height:144px}}


/* v0.11.4 portrait strict centering */
.npc-portrait{width:240px;height:220px;object-fit:contain;object-position:center center;display:block;margin:0 auto;align-self:center}
@media(max-width:520px){.npc-portrait{width:160px;height:147px}}


/* v0.11.5 portrait enlargement */
.npc-portrait{width:252px;height:232px;object-fit:contain;object-position:center center;display:block;margin:0 auto;align-self:center}
@media(max-width:520px){.npc-portrait{width:168px;height:154px}}


/* v0.11.6 portrait size refinement */
.npc-portrait{width:264px;height:244px;object-fit:contain;object-position:center center;display:block;margin:0 auto;align-self:center}
@media(max-width:520px){.npc-portrait{width:176px;height:162px}}

/* v0.11.7 RPG dialogue redesign — overrides older portrait rules */
.overlay .dialog:has(.talk-dialog){max-width:790px;padding:28px 28px 24px;border:4px solid #b8d6a8;background:linear-gradient(155deg,#fffdf9 0%,#f6faee 100%);box-shadow:0 20px 65px #0004, inset 0 0 0 3px #ffffff}
.dialog:has(.talk-dialog) h2{margin:0 42px 14px 0;border-bottom:2px solid #d8e7cc;padding-bottom:12px;color:#577b4a;font-size:22px}
.talk-dialog{display:grid;grid-template-columns:minmax(0,245px) minmax(0,1fr);align-items:center;gap:26px;min-height:250px;margin:0;justify-content:center}
.talk-dialog .npc-portrait{display:block;width:245px;height:220px;object-fit:contain;object-position:center center;background:transparent;border:0;padding:0;margin:0 auto;flex:none}
.talk-dialog .talk-speech{display:flex;align-items:center;min-height:200px;margin:0;padding:22px 24px;background:#fff;border:2px solid #d9e7d0;border-radius:20px;box-shadow:0 5px 14px #6a8d5818;color:#3d493e;font-size:19px;line-height:1.85;font-weight:650}
.dialog:has(.talk-dialog) .dialog-actions{text-align:center;margin-top:14px;padding-top:8px}
.dialog:has(.talk-dialog) .dialog-actions button{min-width:230px;min-height:48px;font-weight:800}
@media(max-width:560px){.overlay .dialog:has(.talk-dialog){padding:20px 14px 18px}.talk-dialog{grid-template-columns:1fr;gap:6px}.talk-dialog .npc-portrait{width:210px;height:190px}.talk-dialog .talk-speech{min-height:96px;font-size:16px;padding:14px 16px}.dialog:has(.talk-dialog) h2{font-size:18px}}

/* v0.11.8: gameplay-only compact touch layout */
@media (pointer:coarse), (max-width:760px) {
 body:has(#game:not([hidden])) {overflow:hidden; overscroll-behavior:none}
 body:has(#game:not([hidden])) #app {padding:0;max-width:none;height:100dvh;overflow:hidden}
 body:has(#game:not([hidden])) header,body:has(#game:not([hidden])) footer{display:none}
 #game:not([hidden]){position:fixed;inset:0;z-index:2;display:flex;flex-direction:column;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);background:#f7f3ed;overflow:hidden}
 #game .hud{flex:0 0 43px;margin:0;gap:3px;padding:3px;grid-template-columns:repeat(4,minmax(0,1fr))}
 #game .hud>div{min-width:0;padding:3px 1px;border-radius:7px;box-shadow:none}
 #game .hud small{font-size:9px;line-height:1.2;white-space:nowrap}
 #game .hud b{font-size:clamp(12px,3.3vw,19px);line-height:1.25}
 #game .game-layout{display:grid;flex:1;min-height:0;min-width:0;gap:4px}
 #game .store-wrap{display:contents}
 #game .store-top,#game .hint,#game aside{display:none}
 #game .map-frame{min-width:0;min-height:0;padding:3px;border:3px solid #d5c7ad;border-radius:9px;overflow:hidden}
 #game .viewport{height:100%;min-height:0;width:100%;border-radius:5px}
 #game .hint-block{margin:0;min-width:0;min-height:0}
 #game .action-row{display:grid;gap:4px;height:100%;margin:0}
 #game .action-row button{min-width:0;min-height:0;width:100%;height:100%;padding:3px 1px;box-shadow:none;border-radius:9px;font-size:clamp(10px,2.5vw,15px);white-space:normal;line-height:1.1}
 #game .mobile-pad{display:grid!important;gap:3px;margin:0;min-width:0;min-height:0;align-items:stretch;justify-items:stretch;align-content:center}
 #game .mobile-pad>button,#game .pad-mid button{width:100%;height:100%;min-width:0;min-height:0;padding:0;border-radius:9px;background:#e4f0df;color:#395d3f;box-shadow:inset 0 -3px 0 #aac59e;font-size:clamp(18px,4.5vw,28px)}
 #game .pad-mid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;min-width:0;min-height:0;height:100%}
 #game .pad-mid button[data-move="left"]{grid-column:1}
 #game .pad-mid button[data-move="down"]{grid-column:2}
 #game .pad-mid button[data-move="right"]{grid-column:3}
 #game .mobile-pad>button{width:33.333%;justify-self:center}
 #game .player{width:68px}
}
@media (orientation:portrait) and ((pointer:coarse) or (max-width:760px)){
 #game .game-layout{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) clamp(118px,25dvh,182px)}
 #game .map-frame{grid-column:1/3;grid-row:1}
 #game .mobile-pad{grid-column:1;grid-row:2;grid-template-rows:repeat(2,minmax(0,1fr));padding:4px}
 #game .hint-block{grid-column:2;grid-row:2;padding:4px}
 #game .action-row{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}
}
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)){
 #game .hud{flex-basis:38px}
 #game .game-layout{grid-template-columns:clamp(116px,21vw,210px) minmax(0,1fr) clamp(104px,19vw,190px);grid-template-rows:minmax(0,1fr)}
 #game .mobile-pad{grid-column:1;grid-row:1;grid-template-rows:repeat(2,minmax(0,1fr));padding:3px}
 #game .map-frame{grid-column:2;grid-row:1}
 #game .hint-block{grid-column:3;grid-row:1;padding:3px}
 #game .action-row{grid-template-columns:1fr;grid-template-rows:repeat(4,minmax(0,1fr))}
 #game .player{width:68px}
}

/* v0.11.9: thumb-friendly Switch-style four-way D-pad */
@media (pointer:coarse), (max-width:760px) {
 #game .mobile-pad{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:clamp(7px,1.25vmin,14px);place-items:stretch;align-content:center;justify-content:center;padding:5px!important}
 #game .mobile-pad>button{width:100%!important;height:100%!important;min-width:0;min-height:0;max-width:none;max-height:none;border-radius:13px;font-size:clamp(22px,5vmin,36px);display:grid;place-items:center;touch-action:manipulation;user-select:none;-webkit-user-select:none}
 #game .mobile-pad>[data-move=up]{grid-column:2;grid-row:1}
 #game .mobile-pad>[data-move=left]{grid-column:1;grid-row:2}
 #game .mobile-pad>[data-move=down]{grid-column:2;grid-row:3}
 #game .mobile-pad>[data-move=right]{grid-column:3;grid-row:2}
}
@media (orientation:portrait) and ((pointer:coarse) or (max-width:760px)) {
 #game .game-layout{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) clamp(174px,30dvh,258px)}
 #game .mobile-pad{grid-column:1;grid-row:2}
 #game .hint-block{grid-column:2;grid-row:2}
}
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)) {
 #game .game-layout{grid-template-columns:clamp(180px,25vw,310px) minmax(0,1fr) clamp(115px,18vw,210px);grid-template-rows:minmax(0,1fr)}
 #game .mobile-pad{grid-column:1;grid-row:1;max-width:none;max-height:none}
 #game .map-frame{grid-column:2;grid-row:1}
 #game .hint-block{grid-column:3;grid-row:1}
 #game .mobile-pad>button{font-size:clamp(22px,5vh,35px)}
}
/* Landscape title: art + 4 selectable illustrations together within the viewport */
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)) {
 body:has(#intro:not([hidden])){overflow:hidden}
 body:has(#intro:not([hidden])) #app{height:100dvh;min-height:0;overflow:hidden;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);max-width:none}
 body:has(#intro:not([hidden])) header,body:has(#intro:not([hidden])) footer{display:none}
 #intro.title-screen{display:grid;grid-template-columns:minmax(0,1.12fr) minmax(0,1fr);gap:clamp(4px,1vw,12px);height:100%;min-height:0;overflow:hidden;padding:clamp(4px,1vmin,10px);align-items:center}
 #intro .title-visual{min-width:0;min-height:0;display:flex;align-items:center;justify-content:center}
 #intro .title-image{max-width:100%;max-height:calc(100dvh - 24px);width:auto;height:auto;object-fit:contain}
 #intro .title-panel{min-width:0;min-height:0;width:100%;height:100%;display:grid;grid-template-rows:auto minmax(0,1fr);gap:clamp(2px,1vh,8px);align-content:center;justify-items:stretch;margin:0}
 #intro .help-title-btn{margin:0 auto;min-width:0;padding:clamp(4px,1vh,9px) clamp(12px,2vw,24px);font-size:clamp(12px,2.5vh,17px)}
 #intro .mission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:clamp(3px,1vh,9px);margin:0;min-height:0;width:100%;align-content:stretch}
 #intro .mission-card{min-height:0;min-width:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:0}
 #intro .mission-card img{display:block;object-fit:contain;width:100%;height:100%}
}



/* v0.12.3: richer shelf rendering and compact landscape selection layout */
.tile.shelf{background:linear-gradient(180deg,#e8d4b4 0%,#d6b78f 100%);border-color:#b08b5d;overflow:hidden;justify-content:flex-start;align-items:stretch;padding:0}
.tile.shelf .shelf-unit{position:relative;display:flex;flex-direction:column;justify-content:flex-start;width:100%;height:100%;padding:6px 5px 4px;background:linear-gradient(180deg,rgba(255,248,236,.72) 0%,rgba(255,255,255,0) 24%)}
.tile.shelf .shelf-sign{align-self:flex-start;max-width:calc(100% - 6px);background:rgba(255,251,244,.95);border:1px solid #d1b089;border-radius:8px;padding:2px 6px;font-size:10px;font-weight:900;line-height:1.15;color:#63452a;box-shadow:0 1px 0 #fff inset;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tile.shelf .shelf-rack{position:absolute;left:6px;right:6px;height:7px;border-radius:4px;background:linear-gradient(180deg,#ad8256 0%,#8e6b45 100%);box-shadow:0 1px 0 rgba(255,255,255,.28) inset,0 -1px 0 rgba(82,56,25,.18) inset}
.tile.shelf .shelf-rack.r1{top:32px}.tile.shelf .shelf-rack.r2{top:54px}
.tile.shelf .shelf-preview{position:absolute;left:7px;right:7px;bottom:5px;display:flex;justify-content:center;align-items:flex-end;gap:5px;min-height:20px}
.tile.shelf .shelf-preview img{width:17px;height:17px;object-fit:contain;filter:drop-shadow(0 1px 1px rgba(0,0,0,.18))}
.tile.shelf .shelf-preview .zone-fallback{font-size:13px;line-height:1}
.item-marker{left:7px;top:30px;width:calc(var(--cell) - 14px);height:calc(var(--cell) - 34px);background:transparent;box-shadow:none;align-items:flex-end}
.item-marker>div{display:flex;flex-direction:column;align-items:center;gap:2px;padding:2px 4px 0;background:rgba(255,255,255,.78);border:1px solid rgba(213,191,161,.95);border-radius:10px;backdrop-filter:blur(1px)}
.item-marker .product-shelf-icon{width:28px;height:28px;object-fit:contain;display:block}
.item-marker small{display:block;font-size:10px;color:#664f31;font-weight:800;line-height:1.05}
.dialog.mode-shelf{max-width:920px}
.dialog.mode-shelf #modalBody>.muted{margin:.1em 0 .7em}
.dialog.mode-shelf .products{grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:10px;align-items:start}
.dialog.mode-shelf .products>div{background:#fbfcf8;border:1px solid #e0e7d8;border-radius:16px;padding:10px 11px;box-shadow:0 2px 10px rgba(106,141,88,.08)}
.dialog.mode-shelf .products h3{margin:.1em 0 .3em;color:#5e7747;font-size:18px}
.dialog.mode-shelf .products>div>.muted{font-size:12px;line-height:1.55;margin:.2em 0 .55em}
.dialog.mode-shelf .product{grid-template-columns:50px minmax(0,1fr) auto;gap:8px;padding:8px 9px}
.dialog.mode-shelf .product-icon{width:50px;height:50px}
.dialog.mode-shelf .prod-name{font-size:14px;line-height:1.35}.dialog.mode-shelf .product small{font-size:11px;line-height:1.45;margin-top:3px}
.dialog.mode-shelf .pick-button{min-width:82px;padding:9px 10px;font-size:13px;align-self:center}
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)) {
  #overlay .dialog.mode-shelf{box-sizing:border-box;width:min(980px,100%);max-width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 8px);padding:10px 14px 12px;border-radius:14px;overflow:auto}
  #overlay .dialog.mode-shelf h2{font-size:18px;line-height:1.2;margin:0 30px 4px 0}
  #overlay .dialog.mode-shelf #modalBody>.muted{font-size:12px;margin:0 0 6px}
  #overlay .dialog.mode-shelf .products{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:8px}
  #overlay .dialog.mode-shelf .products>div{padding:8px 9px}
  #overlay .dialog.mode-shelf .products h3{font-size:16px;margin:.05em 0 .2em}
  #overlay .dialog.mode-shelf .products>div>.muted{font-size:11px;line-height:1.4;margin:.15em 0 .45em}
  #overlay .dialog.mode-shelf .product{grid-template-columns:40px minmax(0,1fr) 76px;gap:7px;padding:6px 7px}
  #overlay .dialog.mode-shelf .product-icon{width:40px;height:40px}
  #overlay .dialog.mode-shelf .prod-name{font-size:12px;line-height:1.25}
  #overlay .dialog.mode-shelf .product small{font-size:10px;line-height:1.28;margin-top:2px}
  #overlay .dialog.mode-shelf .pick-button{min-width:0;width:100%;padding:7px 5px;font-size:12px;line-height:1.2}
  #overlay .dialog:has(.talk-dialog) .talk-dialog .talk-speech{min-height:128px;padding:10px 12px;font-size:clamp(12px,3vh,16px);line-height:1.55}
}

/* v0.12.1: mobile-game text selection and iOS long-press callout prevention */
#app, #overlay, #pauseOverlay {
  -webkit-user-select:none; user-select:none;
  -webkit-touch-callout:none;
}
#app img, #overlay img, #pauseOverlay img { -webkit-user-drag:none; user-drag:none; -webkit-touch-callout:none; }
#app button, #overlay button, #pauseOverlay button { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
#viewport, .viewport, .world, .tile-layer, .item-layer, .npc-layer { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
/* Preserve ordinary interaction with genuine text-editing controls if added later. */
#app input, #app textarea, #overlay input, #overlay textarea { -webkit-user-select:text; user-select:text; -webkit-touch-callout:default; }

/* v0.12.2 — landscape gameplay: slightly smaller tiles, with scaled art */
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)) {
  #game .player{width:58px}
  #game .tile{font-size:11px;border-radius:10px}
  #game .tile .sub{font-size:9px}
  #game .item-marker,#game .decor,#game .npc{width:calc(var(--cell) - 12px);height:calc(var(--cell) - 12px);font-size:26px}
  #game .item-marker small{font-size:9px}
  #game .npc img{max-width:100%;max-height:100%;object-fit:contain}
  #game .register-figure{max-height:42px;max-width:55px}
}
/* Fit all dialogue content into the available iPhone landscape viewport. */
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)) {
  #overlay{position:fixed;inset:0;padding:env(safe-area-inset-top) max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-left));align-items:center;justify-content:center}
  #overlay .dialog:has(.talk-dialog){box-sizing:border-box;width:min(800px,100%);max-width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 8px);overflow-y:auto;padding:10px 16px 9px;border-width:2px;border-radius:14px;display:flex;flex-direction:column;gap:3px}
  #overlay .dialog:has(.talk-dialog) h2{font-size:clamp(14px,3.6vh,19px);line-height:1.2;margin:0 30px 3px 0;padding:0 0 4px;flex-shrink:0}
  #overlay .dialog:has(.talk-dialog) .talk-dialog{min-height:0;margin:0;display:grid;grid-template-columns:minmax(0,clamp(94px,30vh,150px)) minmax(0,1fr);gap:12px;align-items:center;flex:1 1 auto}
  #overlay .dialog:has(.talk-dialog) .talk-dialog .npc-portrait{width:100%;height:clamp(98px,35dvh,156px);min-height:0;max-height:100%;object-fit:contain}
  #overlay .dialog:has(.talk-dialog) .talk-dialog .talk-speech{min-height:0;height:auto;padding:8px 12px;font-size:clamp(12px,3vh,16px);line-height:1.45;overflow-wrap:anywhere}
  #overlay .dialog:has(.talk-dialog) .dialog-actions{flex:0 0 auto;margin:0;padding:3px 0 0;text-align:center}
  #overlay .dialog:has(.talk-dialog) .dialog-actions button{min-height:34px;min-width:180px;padding:5px 14px;font-size:13px}
  #overlay .dialog:has(.talk-dialog) .close{top:5px;right:7px;padding:1px 8px;font-size:21px}
}


/* v0.12.4: shelf differentiation, pickup fit, talk polish */
.tile.shelf{color:#4e3c2d}
.tile.shelf .shelf-sign{position:relative;z-index:2}
.tile.shelf .shelf-preview{z-index:2}
.tile.shelf.zone-vegetable{background:linear-gradient(180deg,#c5a46c 0%,#9c7242 100%);border-color:#8b673f}
.tile.shelf.zone-vegetable .shelf-unit{background:linear-gradient(180deg,rgba(255,250,238,.36) 0%,rgba(255,255,255,0) 20%),repeating-linear-gradient(90deg,rgba(119,77,35,.16) 0 5px,rgba(119,77,35,0) 5px 16px)}
.tile.shelf.zone-vegetable .shelf-rack{display:none}
.tile.shelf.zone-vegetable .shelf-preview{bottom:8px;gap:6px}.tile.shelf.zone-vegetable .shelf-preview img{width:20px;height:20px}
.tile.shelf.zone-meat,.tile.shelf.zone-dairy,.tile.shelf.zone-frozen,.tile.shelf.zone-drink{border-color:#8fa2b6}
.tile.shelf.zone-meat{background:linear-gradient(180deg,#eff3f7 0%,#cad5e1 100%)}
.tile.shelf.zone-meat .shelf-sign{background:rgba(255,245,245,.96);border-color:#d8b4b4;color:#864848}
.tile.shelf.zone-meat .shelf-rack{background:linear-gradient(180deg,#bcc6d2 0%,#8e9baa 100%)}
.tile.shelf.zone-dairy{background:linear-gradient(180deg,#f6fbff 0%,#dde7ef 100%)}
.tile.shelf.zone-dairy .shelf-sign{background:rgba(249,253,255,.96);border-color:#b7cddd;color:#486584}
.tile.shelf.zone-dairy .shelf-rack{background:linear-gradient(180deg,#dfe8ef 0%,#a7bac7 100%)}
.tile.shelf.zone-frozen{background:linear-gradient(180deg,#d9eef8 0%,#b7d7e8 100%)}
.tile.shelf.zone-frozen .shelf-unit{background:linear-gradient(180deg,rgba(255,255,255,.46) 0%,rgba(255,255,255,.08) 34%,rgba(218,242,255,.1) 100%)}
.tile.shelf.zone-frozen .shelf-sign{background:rgba(241,251,255,.97);border-color:#9fc8db;color:#366982}
.tile.shelf.zone-frozen .shelf-rack{background:linear-gradient(180deg,#98b8c8 0%,#6e95a8 100%)}
.tile.shelf.zone-frozen::after{content:'';position:absolute;left:8px;right:8px;top:22px;bottom:8px;border:2px solid rgba(255,255,255,.55);border-radius:10px;pointer-events:none}
.tile.shelf.zone-bakery{background:linear-gradient(180deg,#ecd0a8 0%,#c8955b 100%);border-color:#9a6a3d}
.tile.shelf.zone-bakery .shelf-sign{background:rgba(255,248,238,.97);border-color:#e0bc91;color:#8b5a2b}
.tile.shelf.zone-bakery .shelf-rack{background:linear-gradient(180deg,#d09962 0%,#a56e3d 100%)}
.tile.shelf.zone-bakery .shelf-preview{gap:4px}.tile.shelf.zone-bakery .shelf-preview img{width:18px;height:18px;filter:drop-shadow(0 1px 0 rgba(255,255,255,.15))}
.tile.shelf.zone-delicatessen{background:linear-gradient(180deg,#f5d3b6 0%,#ddb08f 100%);border-color:#b88762}
.tile.shelf.zone-delicatessen .shelf-sign{background:rgba(255,250,245,.96);border-color:#d8b493;color:#84563b}
.tile.shelf.zone-delicatessen .shelf-rack{background:linear-gradient(180deg,#d7b296 0%,#a97c58 100%)}
.tile.shelf.zone-daily{background:linear-gradient(180deg,#e9efe8 0%,#cad8c8 100%);border-color:#9db09b}
.tile.shelf.zone-daily .shelf-sign{background:rgba(251,255,251,.96);border-color:#bfd0bc;color:#4f6a55}
.tile.shelf.zone-daily .shelf-rack{background:linear-gradient(180deg,#b7c7b5 0%,#8da08b 100%)}
.tile.shelf.zone-rice{background:linear-gradient(180deg,#efe1bc 0%,#d5bf8f 100%);border-color:#ae9863}
.tile.shelf.zone-rice .shelf-sign{background:rgba(255,252,243,.96);border-color:#cfbe90;color:#6e5a2d}
.tile.shelf.zone-rice .shelf-rack{background:linear-gradient(180deg,#cdb480 0%,#a28757 100%)}
.tile.shelf.zone-snacks{background:linear-gradient(180deg,#f8dfb5 0%,#f1be74 100%);border-color:#d29a55}
.tile.shelf.zone-snacks .shelf-sign{background:rgba(255,252,244,.97);border-color:#e6c275;color:#8a5e19}
.tile.shelf.zone-snacks .shelf-rack{background:linear-gradient(180deg,#ebb66d 0%,#cb8f44 100%)}
.tile.shelf.zone-drink{background:linear-gradient(180deg,#e0eef9 0%,#bfd4e7 100%)}
.tile.shelf.zone-drink .shelf-sign{background:rgba(245,250,255,.97);border-color:#bdd0df;color:#41657f}
.tile.shelf.zone-drink .shelf-rack{background:linear-gradient(180deg,#b7c7d7 0%,#879caf 100%)}
.tile.shelf.zone-drink .shelf-preview img{width:15px;height:19px}
.item-marker>div{box-shadow:0 2px 5px rgba(0,0,0,.08)}
.item-marker .product-shelf-icon{width:26px;height:26px}.item-marker small{font-size:9px}

.dialog.mode-pickup{max-width:920px}
.dialog.mode-pickup .pickup-layout{display:grid;grid-template-columns:minmax(260px,320px) minmax(0,1fr);gap:18px;align-items:center}
.dialog.mode-pickup .pickup-figure{margin:0;padding:12px}
.dialog.mode-pickup .pickup-stack{width:220px;height:274px}.dialog.mode-pickup .pickup-stack img{height:218px}
.dialog.mode-pickup .pickup-held-item{left:110px;top:100px;width:54px;height:54px}.dialog.mode-pickup .pickup-held-item img{width:40px;height:40px}
.dialog.mode-pickup .pickup-basket{bottom:6px;right:-2px;font-size:56px}.dialog.mode-pickup .pickup-note{margin:.4em 0 0;font-size:18px}
.dialog.mode-pickup .pickup-info{display:flex;flex-direction:column;gap:12px}
.dialog.mode-pickup .pickup-detail{background:#fbfcf8;border:1px solid #dce8d7;border-radius:18px;padding:14px 16px;box-shadow:0 3px 10px rgba(106,141,88,.08)}
.dialog.mode-pickup .pickup-product-line{display:flex;align-items:center;gap:12px;margin-bottom:8px}.dialog.mode-pickup .pickup-product-line strong{display:block;font-size:18px;color:#526e45}.dialog.mode-pickup .pickup-product-line small{display:block;color:#7b8678;margin-top:4px;line-height:1.45}
.dialog.mode-pickup .pickup-product-icon{width:58px;height:58px;object-fit:contain;border:1px solid #e9e1d4;border-radius:12px;background:#fff;padding:5px}
.dialog.mode-pickup .pickup-meta{margin:.25em 0 .35em;font-weight:800;color:#c46e5a}
.dialog.mode-pickup .pickup-detail .muted{font-size:13px;line-height:1.65;margin:0}
.dialog.mode-pickup .pickup-actions{display:flex;gap:10px;flex-wrap:wrap}.dialog.mode-pickup .pickup-actions button{min-width:180px}

.dialog.mode-talk .talk-dialog{align-items:stretch}
.dialog.mode-talk .npc-portrait-wrap{display:flex;flex-direction:column;align-items:center;gap:10px}
.dialog.mode-talk .talk-nameplate{display:inline-flex;align-items:center;justify-content:center;min-width:120px;padding:6px 18px;border-radius:999px;background:linear-gradient(180deg,#8ab571 0%,#5d864f 100%);color:#fff;font-weight:800;letter-spacing:.04em;box-shadow:0 4px 10px rgba(58,89,48,.22)}
.dialog.mode-talk .talk-bubble{position:relative;display:flex;align-items:center}
.dialog.mode-talk .talk-bubble::before{content:'';position:absolute;left:-14px;top:50%;transform:translateY(-50%);border-width:14px 16px 14px 0;border-style:solid;border-color:transparent #fff transparent transparent;filter:drop-shadow(-2px 0 0 #d9e7d0)}
.dialog.mode-talk .talk-speech{position:relative;background:linear-gradient(180deg,#fff 0%,#f8fbf1 100%)}
.dialog.mode-talk h2{position:relative}.dialog.mode-talk h2::after{content:'💬';margin-left:8px;font-size:20px}

@media (pointer:coarse), (max-width:760px) {
  .dialog.mode-shelf .products{gap:8px}.dialog.mode-shelf .products>div{padding:8px 9px}.dialog.mode-shelf .product{gap:7px}
  .dialog.mode-talk .talk-nameplate{min-width:110px;font-size:13px;padding:5px 14px}
}
@media (orientation:portrait) and ((pointer:coarse) or (max-width:760px)) {
  .dialog.mode-pickup .pickup-layout{grid-template-columns:1fr;gap:10px}.dialog.mode-pickup .pickup-actions{justify-content:center}.dialog.mode-pickup .pickup-actions button{min-width:150px;flex:1 1 44%}
}
@media (orientation:landscape) and ((pointer:coarse) or (max-height:610px)) {
  #overlay .dialog.mode-pickup{box-sizing:border-box;width:min(980px,100%);max-width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 8px);padding:10px 14px 12px;border-radius:14px;overflow:hidden}
  #overlay .dialog.mode-pickup h2{font-size:18px;line-height:1.2;margin:0 30px 6px 0}
  #overlay .dialog.mode-pickup #modalBody{height:auto}
  #overlay .dialog.mode-pickup .pickup-layout{grid-template-columns:minmax(180px,240px) minmax(0,1fr);gap:10px;align-items:center}
  #overlay .dialog.mode-pickup .pickup-figure{padding:8px}.dialog.mode-pickup .pickup-stack{width:168px;height:212px}.dialog.mode-pickup .pickup-stack img{height:166px}.dialog.mode-pickup .pickup-held-item{left:84px;top:77px;width:44px;height:44px;padding:2px}.dialog.mode-pickup .pickup-held-item img{width:32px;height:32px}.dialog.mode-pickup .pickup-basket{font-size:46px;right:-6px;bottom:4px}.dialog.mode-pickup .pickup-note{font-size:14px;margin:.35em 0 0}
  #overlay .dialog.mode-pickup .pickup-detail{padding:10px 12px;border-radius:14px}.dialog.mode-pickup .pickup-product-line{gap:8px;margin-bottom:5px}.dialog.mode-pickup .pickup-product-icon{width:44px;height:44px;padding:3px}.dialog.mode-pickup .pickup-product-line strong{font-size:15px}.dialog.mode-pickup .pickup-product-line small{font-size:11px;line-height:1.32;margin-top:2px}.dialog.mode-pickup .pickup-meta{font-size:13px;margin:.1em 0 .2em}.dialog.mode-pickup .pickup-detail .muted{font-size:11px;line-height:1.35}
  #overlay .dialog.mode-pickup .pickup-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.dialog.mode-pickup .pickup-actions button{min-width:0;width:100%;padding:8px 8px;font-size:12px;line-height:1.2}
  #overlay .dialog.mode-talk .talk-dialog{grid-template-columns:minmax(0,clamp(104px,30vh,160px)) minmax(0,1fr);gap:14px}.dialog.mode-talk .talk-nameplate{font-size:12px;min-width:90px;padding:4px 10px}.dialog.mode-talk .talk-bubble::before{left:-12px;border-width:10px 12px 10px 0}.dialog.mode-talk .talk-speech{min-height:124px;padding:12px 14px;font-size:13px;line-height:1.55}
}
