*{box-sizing:border-box}body{margin:0;background:#151825;color:#fff2ce;font-family:system-ui,sans-serif}main{min-height:100svh;display:flex;flex-direction:column}header,footer{padding:14px max(18px,calc((100vw - 960px)/2));background:#18202b}header{display:flex;gap:18px;align-items:center;border-bottom:3px solid #374153}header strong{font:900 22px/1 monospace;letter-spacing:-1.5px;color:#ffca70}header strong span{font-size:12px;vertical-align:top}header b,small{font: bold 13px monospace;letter-spacing:1px}header small{margin-left:auto;color:#c9c4af}.stage{flex:1;position:relative;display:grid;place-items:center;background:#282638;overflow:hidden}canvas{width:min(100%,calc(69svh * 1.6667));image-rendering:pixelated;touch-action:none}.location{position:absolute;left:16px;top:12px;background:#18202bee;padding:6px 10px;font-size:14px;pointer-events:none}.location i{display:inline-block;background:#eeb86d;width:6px;height:6px}.status,.line{display:flex;gap:8px;align-items:center}.status{margin-bottom:10px;min-height:30px;font-size:14px}.status span{margin-left:auto;color:#c6c4ba}input,button{border:0;border-radius:0;padding:11px 13px;font:inherit}input{background:#293342;color:#fff;min-width:0;flex:1}button{background:#ffca70;color:#24202c;font-weight:bold;cursor:pointer}button:disabled{opacity:.5}#entry{position:absolute;inset:0;display:grid;align-items:end;justify-items:center;pointer-events:none;padding:16px}#entry[hidden]{display:none}#join{pointer-events:auto;width:min(100%,350px);background:#1a202ded;border:2px solid #e4ac72;box-shadow:4px 4px #111621;padding:17px}h1{font-size:27px;margin:4px 0 9px}label{font-size:14px;display:block;margin-bottom:8px}#join small{color:#ffca70}#recent{min-height:22px;margin-top:5px;font-size:14px;color:#d6d4c9}@media(max-width:600px){header small{display:none}.stage{display:flex;flex-direction:column;justify-content:center}canvas{width:100%}#entry{position:relative;width:100%;padding:10px}.status{flex-wrap:wrap}header,footer{padding:12px 14px}}
[hidden]{display:none!important}nav{display:flex;gap:6px}nav button{flex:1;background:#33404a;color:#ffe7b9}nav button[aria-pressed=true]{background:#ffca70;color:#272731}canvas{display:block}#wallet{color:#ffcf77}#chat,#inventory{margin-top:10px}#items{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}#items button{font-size:14px}.location{z-index:1}#closePanel{margin-left:auto;padding:5px 12px}footer{padding-bottom:max(14px,env(safe-area-inset-bottom))}#join{box-shadow:4px 4px #181b27}#recent{min-height:2.4em}#saved a{color:#ffce87}@media(max-width:600px){.stage{background:linear-gradient(#b38591 48%,#656773 52%)}canvas{width:min(100%,58svh)}#entry{position:absolute;inset:auto 0 0}.location{top:8px}main{min-height:100svh}header{padding:14px}footer{padding-top:10px}}

#items .garment{width:48px;height:48px;padding:6px;background:#343c48;border:2px solid transparent}
#items .garment[aria-pressed=true]{border-color:#ffca70}
.garment canvas{width:32px;height:32px}
#fitting{display:flex;align-items:center;gap:12px;margin:8px 0}
#look{width:90px;height:78px;background:#343c48}
#equip{display:block;margin-top:5px}
#supplies{margin:4px 0 8px}

#badgeChoices .badge-name{color:#ff8588;background:#30303a;font-size:14px}#badgeChoices .badge-name:disabled{opacity:.8}

/* Keep the map geometry independent of inventory, outfits and status updates. */
main{height:100svh;min-height:0}
.stage{min-height:0;container-type:size}
#map{width:min(100cqw,166.666cqh);max-height:100%;height:auto}
#hud{position:absolute;inset:0;pointer-events:none;z-index:3}
.readout{position:absolute;top:12px;right:14px;display:grid;justify-items:end;gap:2px;background:#18202bf2;padding:6px 9px;font-size:14px}
#controls{pointer-events:auto;position:absolute;bottom:8px;left:50%;transform:translateX(-50%);display:flex;width:min(96%,400px);gap:6px}
#controls button{min-height:44px;white-space:nowrap;padding:8px}
#controls #action{background:#ffca70;color:#24202c;flex:1.4}
#controls button[aria-expanded=true]{outline:2px solid #ffca70;outline-offset:-2px}
#popupLayer{position:absolute;inset:0 0 60px;display:grid;place-items:center;padding:8px;z-index:4;background:#171c273b}
#inventory{width:min(100%,380px);max-height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;margin:0;padding:12px;background:#1a202dfc;border:2px solid #d9ab76;box-shadow:3px 3px #141924}
#inventory .status{position:sticky;top:-12px;background:#1a202d;z-index:1}
footer{position:relative;flex:none}
#talk{min-height:44px}
#recent{min-height:0;height:2.6em;overflow:auto;overflow-wrap:anywhere}
@media(max-width:600px){#map{width:min(100cqw,97.916cqh)}.location{top:8px;left:6px}.readout{top:8px;right:6px}}
#mapView{width:min(100cqw,166.666cqh);position:relative;overflow:hidden}
#mapView #map{width:100%;height:auto}
#names{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.player-tag{position:absolute;display:flex;align-items:baseline;gap:.28em;transform:translate(-50%,-100%);white-space:nowrap;line-height:1.15;background:#292332df;color:#fff6dc;border-radius:3px;padding:2px 4px;font:bold clamp(11px,1.4vw,15px)/1.15 system-ui,sans-serif}
.player-tag em{font-size:.83em;color:#ff9899;font-style:normal}
#entry{z-index:4;max-height:100%;overflow-y:auto;align-items:center}#join{max-height:100%;overflow:auto;pointer-events:auto}
.maker{display:flex;align-items:center;gap:12px;margin:10px 0}.maker canvas,#look{width:80px;height:80px;background:#414552;flex:none}
.traits{display:grid;grid-template-columns:1fr 1fr;gap:5px;flex:1}.traits label{margin:0;color:#dfd7c5;font-size:12px}.traits select{display:block;width:100%;padding:4px;border:1px solid #777166;background:#303543;color:#fff2d1;font-size:16px}
#editLook{margin:8px 0}#editLook summary{cursor:pointer;padding:8px}#saveLook{margin-top:6px}
@media(max-width:600px){#mapView{width:min(100cqw,97.916cqh)}#entry{inset:0}.maker canvas{width:64px;height:64px}}

#badgeChoices button[aria-pressed=true]:disabled{opacity:1;background:#ffdb83;color:#211d27;box-shadow:inset 0 0 0 3px #fff2c8;font-weight:800}

.map-area{position:absolute;inset:0 0 124px;container-type:size;display:grid;place-items:center}
#feed{position:absolute;bottom:56px;left:50%;transform:translateX(-50%);width:min(96%,640px);height:62px;overflow:auto;overscroll-behavior:contain;pointer-events:auto;background:#161d29e8;color:#fff5dc;padding:5px 9px;border-left:2px solid #aa9876;font:14px/1.45 system-ui,sans-serif;overflow-wrap:anywhere}
#feed:empty::before{content:'근처 대화';color:#b6b9bf}
#feed strong{margin-right:.55em;color:#ffcf87}#feed .discovery{color:#ffdb88}
.speech{position:absolute;left:50%;bottom:calc(100% + 4px);transform:translateX(-50%);width:max-content;max-width:min(224px,80cqw);white-space:pre-wrap;overflow-wrap:anywhere;padding:5px 8px;border:1px solid #483e37;border-radius:7px;background:#fff8e9;color:#292433;font:500 14px/1.35 system-ui,sans-serif;text-align:start}
@media(max-height:530px){.map-area{bottom:91px}#feed{height:35px;bottom:53px}#recent:empty{height:0}}

/* A single console below the playfield. Both columns remain reachable on a phone. */
main{height:100dvh;background:#231f23}
.stage{background:#302c30}
.map-area{inset:0}
#popupLayer{inset:0}
#hud{position:static;flex:0 0 auto;pointer-events:auto;background:#29252a;border-top:2px solid #a58b66;padding:8px max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
.console{margin:auto;max-width:960px;display:grid;grid-template-columns:minmax(0,1.8fr) minmax(0,1fr);background:#373236;border:1px solid #706458;box-shadow:inset 0 1px #8c7d68;color:#f4e8d5}
.console>section{min-width:0;padding:10px 12px}
.conversation{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:6px;border-right:1px solid #65594d}
.console-heading{display:flex;align-items:center;justify-content:space-between;gap:4px;line-height:1.2}
.console h2{margin:0;font-size:14px;font-weight:700;color:#ffe5b7}.console #near,.console #wallet{font-size:12px;color:#d7c6aa}
#feed{position:static;transform:none;width:auto;height:clamp(48px,8vh,78px);padding:5px 8px;background:#272429;border:1px solid #4d4445;font-size:14px;scrollbar-width:thin}
#feed:empty::before{content:none}
#chat{display:flex;gap:4px;margin:0}#chat input{width:0;border:1px solid #6d6257;background:#29272b;color:#fff4df;font-size:16px;padding:7px 9px}
.console button{font-size:14px;font-weight:700;min-height:42px;padding:6px 10px;color:#f5e8d1;background:#50494a;border:1px solid #807263;box-shadow:inset 0 1px #948477}
#chat button{color:#292428;background:#d9bd8f;border-color:#ddc9a5}
.commands{display:flex;flex-direction:column;gap:5px}
#controls{position:static;transform:none;width:100%;display:grid;grid-template-columns:1fr 1fr;gap:4px}
#controls #action{grid-column:span 2;background:#efc77e;border-color:#f4d4a0;color:#332925}
#controls button{min-width:0;min-height:36px;padding:4px}
#recent{font-size:12px;line-height:1.25;height:2.5em;margin:0;overflow:auto;color:#e0cead}
@media(min-width:700px){#controls{grid-template-columns:1fr 1fr 1.5fr}#controls #action{grid-column:auto}.commands{gap:8px}#controls button{min-height:44px}}
@media(max-width:600px){.console{grid-template-columns:minmax(0,1.45fr) minmax(112px,1fr)}.console>section{padding:7px}.console #near{font-size:11px}#controls button{min-height:40px}.console-heading{flex-wrap:wrap}#chat button{padding:4px 7px}.conversation{gap:4px}#feed{height:auto;min-height:0;max-height:100px}.console h2{font-size:13px}}
@media(max-height:520px){#hud{padding-top:3px;padding-bottom:max(3px,env(safe-area-inset-bottom))}.console>section{padding:5px 8px}.commands{gap:3px}#controls{grid-template-columns:1fr 1fr 1.4fr}#controls #action{grid-column:auto}#feed{height:32px}.console button,#controls button{min-height:32px}#recent{height:1.25em}}

.map-routes{font-size:13px;margin-top:8px}.map-routes summary{cursor:pointer}.map-routes #routes{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}.map-routes button{font:inherit;padding:7px}
