@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap');
:root{--ink:#293d34;--muted:#8b988e;--green:#477956;--line:#e6e9df;--cream:#f8f9f4}*{box-sizing:border-box}body{margin:0;background:var(--cream);color:var(--ink);font:14px 'DM Sans','Noto Sans KR',sans-serif}button,input,select{font:inherit}button{cursor:pointer;color:inherit;border:0;background:none}button:hover{filter:brightness(.95)}button:focus-visible,input:focus-visible,canvas:focus-visible{outline:3px solid #e3ad56;outline-offset:2px}header{height:94px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 4%;gap:8%}.brand{text-decoration:none;color:var(--green);display:flex;gap:10px;align-items:center;font-size:35px}.brand>span{font-size:25px;letter-spacing:-1px;font-weight:800}.light{font-weight:400}.brand small{display:block;font-size:10px;letter-spacing:1px;margin-top:3px;color:#8d9a8a}nav{display:flex;gap:30px;height:100%;align-items:center}.nav{height:100%;position:relative;color:#8b948c;font-weight:600}.nav.active{color:var(--green)}.nav.active:after{content:'';position:absolute;height:3px;background:var(--green);bottom:0;left:0;right:0}nav b{font-size:10px;background:#edf2e9;border-radius:6px;padding:3px 5px}.online{margin-left:auto;font-size:11px;background:#f0f5ed;padding:9px 12px;border-radius:20px}.online i,.live{display:inline-block;width:6px;height:6px;background:#71a47b;border-radius:50%;margin-right:7px}main{max-width:1540px;margin:auto;padding:38px 4% 0}.intro{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px}.eyebrow{font-size:10px;letter-spacing:2px;color:#8d9b82;font-weight:700}h1{font-size:29px;letter-spacing:-1.3px;margin:10px 0}h1 span{color:#8fac6e}.intro p,.dex-head p{color:var(--muted);font-size:12px;margin-bottom:0}.pill{border:1px solid #dce3d6;background:white;padding:12px 18px;border-radius:25px;font-size:12px}.pill span{color:#8ca080;margin-left:9px}.layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:25px}.world-column{min-width:0}.world-top{display:flex;justify-content:space-between;margin-bottom:13px;font-size:12px;font-weight:600}.world-top small{color:#929d90;font-weight:400}.viewport{height:510px;border:7px solid white;border-radius:18px;position:relative;overflow:hidden;box-shadow:0 3px 18px #39472808;background:#dce9ba}canvas{width:100%;height:100%;display:block;touch-action:none}.map-label{position:absolute;left:20px;top:20px;color:#4d6c43;font-size:9px;letter-spacing:2px;pointer-events:none}.map-label small{display:block;font-size:16px;letter-spacing:0;font-weight:700;margin-top:5px}.map-control{position:absolute;right:15px;top:15px;background:#fffdf3e8;border-radius:10px;font-size:25px;width:38px;height:38px}.world-hint{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);white-space:nowrap;background:#fffff0db;border-radius:20px;padding:9px 15px;font-size:10px;color:#738268;pointer-events:none}.world-hint span{padding:0 8px;color:#acb39b}#toast{position:absolute;top:65px;left:50%;transform:translateX(-50%);background:#304a39eb;color:#fff;padding:12px 20px;border-radius:14px;display:none;max-width:90%;font-size:12px}.world-bottom{display:flex;align-items:center;justify-content:space-between;padding:17px 4px}.world-bottom>span{font-size:13px}.world-bottom small{display:block;margin:5px 0 0 24px;font-size:10px;color:var(--muted)}#resources{display:flex;gap:8px;font-size:11px}#resources span{background:#fff;border:1px solid var(--line);padding:8px;border-radius:9px}.section-heading{display:flex;gap:8px;align-items:center;justify-content:space-between}.section-heading h2{font-size:16px;margin:0}.section-heading h2 span{font-size:12px;color:#9aa58e;margin-left:5px}.section-heading h3{font-size:12px;margin-right:auto}.section-heading h3 span{font-size:8px;color:#8da17c;letter-spacing:1px;margin-left:8px}.section-heading>button{font-size:10px;border:1px solid var(--line);border-radius:8px;padding:7px;background:white}.muted{font-size:10px;color:var(--muted)}aside{background:#fff;border:1px solid var(--line);border-radius:16px;padding:21px;height:fit-content}.aside-desc{font-size:11px;color:var(--muted);margin:10px 0 18px}.modes{display:flex;background:#f4f6ef;padding:4px;border-radius:9px;margin-bottom:17px}.modes button{flex:1;font-size:11px;padding:8px 0;border-radius:6px;color:#839078}.modes .selected{background:white;color:var(--green);box-shadow:0 1px 4px #253c1710}.monster-card{border:1px solid var(--line);border-radius:12px;padding:13px;margin-bottom:11px}.monster-card.out{border-color:#abc797;background:#fcfef9}.monster-top{display:flex;align-items:center;gap:10px}.portrait{width:64px;height:64px;flex-shrink:0;background:#f1f5e8;border-radius:14px;display:grid;place-items:center;cursor:pointer}.portrait img{width:64px;height:64px}.monster-info{flex:1}.monster-info h3{font-size:13px;margin:0 0 4px}.monster-info small{font-size:9px;color:#99a18d}.badge{font-size:9px;border-radius:4px;padding:3px 6px;display:inline-block}.lv{font-size:10px;color:#909b84;float:right}.bars{margin-top:9px}.bar{height:4px;background:#ecf0e7;border-radius:5px;overflow:hidden;margin:5px 0}.bar i{height:100%;display:block;background:#91b77a;border-radius:5px}.bar.xp i{background:#e6c785}.bar-label{font-size:8px;color:#9ca68f;display:flex;justify-content:space-between}.monster-foot{display:flex;align-items:center;justify-content:space-between;margin-top:10px;font-size:9px;color:#9aa78e}.deploy{font-size:10px;color:#50754c;border:1px solid #d8e4cd;border-radius:6px;padding:5px 11px;background:#f3f8ee}.tip{display:flex;gap:10px;padding:15px 10px;background:#faf8ee;border-radius:10px;margin-top:18px}.tip>span{color:#c6a965}.tip b{font-size:10px}.tip p{font-size:10px;line-height:1.8;color:#a09d85;margin:5px 0 0}.pvp{display:block;font-size:10px;margin-top:18px;color:#839078}.pvp input{vertical-align:middle;accent-color:#648656}.pvp small{display:block;font-size:9px;margin:5px 0 0 23px;color:#a1a995}.activity{border-top:1px solid var(--line);padding-top:5px}#events{height:88px;overflow:auto;font-size:11px;color:#829079;line-height:2}#events .event{display:flex;gap:12px}#events .event:before{content:'✧';color:#a1b581}#chatForm{display:flex;border:1px solid var(--line);background:white;border-radius:10px;padding:4px;margin-top:12px}input,select{border:1px solid var(--line);background:white;border-radius:8px;padding:11px;color:var(--ink);outline:none}#chat{border:0;flex:1;min-width:0;font-size:11px}#chatForm button{font-size:11px;color:var(--green);padding:0 12px}footer{display:flex;justify-content:space-between;border-top:1px solid var(--line);margin-top:36px;padding:22px 0;font-size:10px;color:#a2aa98}footer span:first-child{color:#788b6e;font-weight:700}.hidden{display:none!important}.dex-head{display:flex;align-items:center;gap:15px;margin:15px 0 30px}.dex-head>div{margin-right:auto}.dex-head h2{font-size:22px}#dexGrid{display:grid;grid-template-columns:repeat(5,1fr);gap:15px}.dex-card{background:white;border:1px solid var(--line);border-radius:15px;text-align:left;padding:15px;transition:transform .2s}.dex-card:hover{transform:translateY(-4px)}.dex-card>img{display:block;width:120px;height:120px;margin:0 auto}.dex-card small{color:#9fa994;font-size:10px}.dex-card h3{margin:7px 0;font-size:15px}.dex-card p{font-size:10px;color:#8b9783}.guide-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:20px;margin:30px 0 100px}.guide-grid article{background:white;padding:25px;border:1px solid var(--line);border-radius:15px}.guide-grid article>span{font-size:32px;color:#bac8a8}.guide-grid p{font-size:13px;line-height:2;color:#839078}dialog{border:1px solid var(--line);border-radius:24px;padding:35px;width:min(440px,92vw);color:var(--ink);box-shadow:0 30px 100px #20332025}dialog::backdrop{background:#243e2955;backdrop-filter:blur(5px)}#joinForm{text-align:center}#joinForm h2{font-size:27px;margin:14px 0}#joinForm p{color:var(--muted);font-size:12px}#joinForm label{text-align:left;display:block;font-size:11px;margin-top:20px}#joinForm input{display:block;width:100%;margin-top:8px;background:#f8faf4}#joinForm small{font-size:10px;color:var(--muted);display:block;line-height:1.7}.login-flower{font-size:60px;color:#7fa76a}.primary{background:var(--green);color:white;width:100%;border-radius:10px;padding:14px;margin:25px 0 15px}.close{float:right}:is(#detailBody,#dexDetailBody){text-align:center}:is(#detailBody,#dexDetailBody)>img{width:180px;height:180px}:is(#detailBody,#dexDetailBody) p{font-size:12px;line-height:1.8;color:#87937e}.stat-row{display:flex;align-items:center;gap:10px;font-size:11px;margin:9px 0}.stat-row>span{width:60px;text-align:left}.stat-row>.bar{flex:1}.move-list{text-align:left;font-size:11px;line-height:2.1;color:#7c8971}@media(min-width:1500px){.viewport{height:590px}}@media(max-width:1000px){header{gap:5%;padding:0 3%}nav{gap:14px}.layout{grid-template-columns:minmax(0,1fr) 270px;gap:15px}aside{padding:15px}.world-bottom{display:block}#resources{margin-top:12px}.viewport{height:460px}#dexGrid{grid-template-columns:repeat(4,1fr)}}@media(max-width:720px){header{height:75px;flex-wrap:wrap;gap:10px}.brand>span{font-size:20px}.brand{font-size:27px}nav{margin-left:auto;gap:10px}.nav{font-size:11px}.nav b,.online{display:none}main{padding:25px 4% 0}h1{font-size:23px}.intro{gap:10px}.intro p{font-size:10px}.pill{font-size:10px;padding:10px}.pill span{display:none}.eyebrow{font-size:8px}.layout{display:block}.viewport{height:480px}.world-hint{font-size:8px;padding:8px;max-width:95%}aside{margin-top:25px}#party{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.monster-card{padding:9px;margin:0}.monster-top{gap:4px}.portrait,.portrait img{width:45px;height:45px}.monster-info h3{font-size:11px}.monster-foot{font-size:8px}.tip{margin-top:15px}.dex-head{flex-wrap:wrap}.dex-head>div{width:100%}#dexGrid{grid-template-columns:repeat(2,1fr)}.guide-grid{grid-template-columns:1fr 1fr}.world-top{font-size:10px}footer span:last-child{display:none}}
.detail-subtitle{font-weight:700;color:#607953!important;font-size:10px!important;text-align:left;margin-top:20px}.growth-chart{background:#f5f8ef;border-radius:10px;padding:10px}.growth-chart svg{display:block;width:100%;height:70px}.growth-chart small{font-size:9px;color:#8c9c7f}
@media(max-width:720px){header{height:112px;display:grid;grid-template-columns:1fr;padding:10px 4% 0;gap:0}.brand{width:fit-content}nav{margin:0;height:39px;justify-content:center;gap:28px}.nav{height:39px}.intro{align-items:center}.brand small{font-size:9px}}
#party{max-height:570px;overflow-y:auto;scrollbar-width:thin;padding-right:2px}@media(max-width:720px){#party{max-height:440px}}

.adventure{background:#fffdf5;border:1px solid #dce5d4;border-radius:18px;padding:20px;margin-top:18px}.adventure p{font-size:12px;line-height:1.9;color:#687f62}.quest-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;font-size:12px}.quest-grid b{float:right}.quest-grid .bar{margin-top:6px}.adventure button{padding:8px 12px;border:1px solid #d4dfc8;border-radius:9px;background:#f1f5e8;color:#456047;cursor:pointer}.adventure button:disabled{opacity:.5;cursor:default}.adventure .site-link{font-size:11px;padding:4px 6px;margin:3px}.region-list{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;margin-top:10px}.region-list button{font-size:11px;text-align:left}.adventure summary{cursor:pointer;font-size:12px;margin-top:16px}@media(max-width:600px){#atlas{height:auto}.quest-grid{grid-template-columns:1fr}.adventure{padding:14px}.map-label{max-width:50%}}

.play-controls{position:absolute;top:15px;right:15px;display:flex;gap:10px;align-items:center}.play-controls button{background:#fff9edee;border:1px solid #91ad86;border-radius:18px;padding:9px 14px;font-weight:700;color:#456047;box-shadow:0 2px 8px #35533518}#fps{font-size:10px;color:#456047;background:#ffffffc9;border-radius:10px;padding:4px 7px;font-variant-numeric:tabular-nums}#commands{width:min(580px,94vw);max-height:85dvh;overflow:auto;padding:25px;border-radius:24px;border:1px solid #c3d5b7;background:#fffdf5;color:#405641}#commands::backdrop{background:#203d3055}.command-heading{display:flex;align-items:center;justify-content:space-between}.command-heading h2{margin:0}.command-heading button{border:0;background:transparent;font-size:22px}#commands h3{margin:24px 0 10px}.item-actions{display:flex;gap:8px;flex-wrap:wrap}.item-actions button{flex:1;min-width:125px;padding:12px 7px;border-radius:13px;border:1px solid #cad9bd;background:#edf3df;color:#405641}.item-actions small{display:block;margin-top:5px;font-size:10px}.command-monster{display:flex;align-items:center;gap:10px;border-top:1px solid #e0e6d6;padding:14px 0}.command-monster img{width:62px;height:62px}.command-monster div{flex:1;min-width:0}.command-monster small{display:block;margin:4px 0;color:#7d8c76;font-size:11px}.command-monster button{background:#fae6e3;border:1px solid #e8c4be;padding:9px;border-radius:12px;color:#925d60}.command-monster select,#radius{padding:6px;border:1px solid #cad9bd;border-radius:8px;background:#fffdf5;color:#405641;max-width:100%}.command-help{font-size:12px;color:#7b8b73;line-height:1.7}.radius-label{display:flex;align-items:center;justify-content:space-between;font-size:13px}#worldCanvas{touch-action:none}@media(max-width:480px){#commands{padding:18px}.command-monster{gap:6px}.command-monster img{width:42px;height:42px}.command-monster button{font-size:11px;padding:8px 5px}.command-monster select{max-width:145px}.play-controls{top:10px;right:10px;gap:5px}.play-controls button{padding:7px 10px}}
.command-monster button:disabled{opacity:.55;cursor:default}#commands button:focus-visible,#menu:focus-visible{outline:3px solid #91ad86;outline-offset:3px}


.encounter-help{position:absolute;left:14px;bottom:52px;max-width:min(350px,90%);font-size:11px;pointer-events:none}.encounter-help p:empty{display:none}.encounter-help p{background:#fffdf3ed;border-radius:10px;padding:8px 10px;margin:0 0 6px}.encounter-help button,#menuDeploy{pointer-events:auto;background:#fff7d9;border:1px solid #d6bc72;border-radius:12px;padding:10px;margin:3px 3px 0 0;font-weight:600}.encounter-help button[hidden]{display:none}#commandFeedback{min-height:22px;color:#477956;font-size:12px;position:sticky;top:0;background:#fffdf5;padding:8px 0;z-index:1}button:disabled{opacity:.5;cursor:default}
#guideDialog{box-sizing:border-box;width:min(460px,92vw);border:1px solid #b9cfac;border-radius:24px;padding:30px;background:#fffdf5;color:#405641}#guideDialog::backdrop{background:#203d3055}#guideText{line-height:1.9;margin:20px 0}#guideTarget{white-space:normal;max-width:100%}@media(max-width:480px){.play-controls{right:12px;gap:4px}.play-controls button{font-size:11px;padding:7px}#fps{font-size:9px}}


#quickOrders{padding:14px;background:#f6f9ef;border-radius:16px;margin:12px 0}.quick-all,.quick-unit>div{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}.quick-unit{border-top:1px solid #dce5d4;padding:8px 0}.quick-unit small{display:block;color:#63765c}.quick-unit button[aria-pressed=true]{background:#cfe4bc}#quickOrders button{min-height:40px;padding:7px 12px}

.team-legend{display:flex;flex-wrap:wrap;gap:3px;background:#fffdf3e6;border-radius:10px;padding:6px 9px;font-size:10px;color:#3f5242;pointer-events:none;box-shadow:0 2px 8px #35533518}.team-legend span{display:flex;align-items:center;gap:6px}.team-legend i{width:12px;height:12px;border-radius:50%;box-shadow:0 0 0 2px #2f283855 inset;display:inline-block}

.music-controls{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:10px 14px;background:#f6f8ee;border-radius:12px;margin-top:10px}.music-controls label{display:flex;align-items:center;gap:8px;font-size:12px}.music-controls input{width:110px;accent-color:#689d64}

#captureSuccess{position:fixed;inset: max(24px,env(safe-area-inset-top)) 0 auto;margin:0 auto;width:min(330px,88vw);box-sizing:border-box;z-index:10000;border:2px solid #e4bf51;border-radius:24px;background:linear-gradient(145deg,#fffde8,#e4f8db);color:#36502d;box-shadow:0 10px 40px #183c3450;padding:16px;text-align:center;pointer-events:none}
#captureSuccess[hidden]{display:none}#captureSuccess strong{display:block;font-size:26px;color:#537b34}#captureSuccess img{display:block;width:76px;height:76px;object-fit:contain;margin:2px auto}#captureSuccess b{display:block;font-size:19px}#captureSuccess span{display:block;font-size:12px;margin-top:8px}.capture-sparkles{color:#bd8b16;font-size:24px;letter-spacing:9px}#captureSuccess.celebrate{animation:capture-arrive .55s ease-out}.celebrate .capture-sparkles{animation:capture-shine .8s ease-in-out 3 alternate}@keyframes capture-arrive{from{opacity:0;transform:translateY(-20px) scale(.85)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes capture-shine{to{transform:scale(1.12);opacity:.5}}@media(prefers-reduced-motion:reduce){#captureSuccess.celebrate,.celebrate .capture-sparkles{animation:none}}

#storageDialog{width:min(560px,94vw);max-height:85vh;overflow:auto}.storage-row{display:flex;align-items:center;gap:12px;margin:8px 0}.storage-row span{flex:1}.storage-row img{object-fit:contain}

.interaction-controls{display:flex;flex-wrap:wrap;gap:8px;padding:10px 12px}.interaction-controls button{max-width:100%;white-space:normal}#interactNearest{flex:1;min-width:180px}#dexProgress{font-weight:700;color:#456047}
/* 경제 · 성장 화면 */
.coin-hud{background:#fff7d6ee!important;border-color:#e2c26a!important;color:#7a5a12!important;white-space:nowrap}
#resources{flex-wrap:wrap;max-width:100%}
#resources .coin-chip{background:#fff7d6;border-color:#e2c26a;color:#7a5a12}
#resources .bag-chip{background:#edf3df;border:1px solid #cad9bd;padding:8px;border-radius:9px;font-size:11px;color:#405641}
.monster-foot{display:grid;grid-template-columns:minmax(0,1fr) 100px;gap:8px;align-items:center}
.monster-foot>span{grid-column:1/-1;overflow-wrap:anywhere;line-height:1.5}
.monster-foot>[data-evolution-reopen]{grid-column:1/-1;justify-self:start}
.monster-foot>.stats-btn{grid-column:1;justify-self:start;min-height:44px}
.monster-foot>.deploy{grid-column:2;width:100%;min-height:44px;white-space:nowrap}
.stats-btn{font-size:10px;border:1px solid #d4dfc8;border-radius:8px;padding:5px 7px;background:#f6f9ef;color:#456047}
.econ-dialog{width:min(640px,94vw);max-height:90vh;overflow:auto;overflow-x:hidden;padding:26px;box-sizing:border-box}
.econ-dialog.wide{width:min(900px,96vw)}
.econ-dialog h2{margin:0 0 8px}
.econ-dialog .close{position:absolute;top:14px;right:16px;font-size:20px}
.econ-coins{margin:0 0 12px;font-size:14px}.econ-coins small{color:var(--muted);font-size:11px}
.econ-tabs{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.econ-tabs button{border:1px solid #d4dfc8;border-radius:16px;padding:7px 12px;font-size:12px;background:#fff}
.econ-tabs button.selected{background:#477956;color:#fff;border-color:#477956}
.econ-list{display:flex;flex-direction:column;gap:8px}
.econ-row{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:14px;padding:10px;background:#fffdf7;min-width:0}
.econ-row.none{opacity:.55}
.econ-icon{flex:none;width:40px;height:40px;border-radius:12px;display:grid;place-items:center;font-size:22px;background:color-mix(in srgb,var(--c) 18%,#fff);border:2px solid var(--c)}
.econ-main{flex:1;min-width:0}
.econ-main b{display:block;font-size:13px}
.econ-main small{display:block;color:#6f7f6b;font-size:11px;margin-top:2px;overflow-wrap:anywhere}
.econ-useline{color:#5b7a4f!important}
.econ-count,.econ-price{font-weight:600;color:#7a5a12;font-size:12px;margin-left:4px}
.econ-row button,.econ-use button,.econ-target{border:1px solid #cad9bd;border-radius:10px;padding:8px 10px;background:#edf3df;color:#405641;font-size:12px}
.econ-row button:disabled,.econ-target:disabled{opacity:.5;cursor:default}
.econ-trade{display:flex;flex-direction:column;align-items:stretch;gap:5px;flex:none;width:96px}
.econ-trade .econ-qty{width:100%}
.econ-qty{width:64px;padding:6px;border:1px solid #cad9bd;border-radius:8px;font-size:13px;box-sizing:border-box}
.econ-inputs{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}
.econ-inputs span{font-size:10px;border-radius:7px;padding:2px 6px;background:#eef5e6}
.econ-inputs span.lack{background:#fbe6e3;color:#a2453c}
.econ-empty summary{cursor:pointer;font-size:12px;color:var(--muted);margin:6px 0}
.econ-empty .econ-row{margin-top:6px}
.econ-use{margin-top:12px;border:2px solid #b9d3a6;border-radius:16px;padding:12px;background:#f7fbf0}
.econ-use p{font-size:12px;margin:6px 0}
.econ-use-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.econ-qty-label{font-size:12px;display:flex;align-items:center;gap:6px}
.econ-targets{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr));gap:6px;margin-top:8px}
.econ-target{display:flex;align-items:center;gap:8px;text-align:left;min-width:0}
.econ-target img{width:40px;height:40px;object-fit:contain;flex:none}
.econ-target span{min-width:0}.econ-target b{display:block}
.econ-target small{display:block;font-size:10px;color:#6f7f6b;overflow-wrap:anywhere}
.econ-target .why{color:#477956}.econ-target:disabled .why{color:#a2453c}
.econ-feedback{min-height:18px;font-size:12px;color:#477956;margin:10px 0 0}
.econ-feedback.error{color:#b4433a}
.econ-help{font-size:11px;color:var(--muted)}
.stats-pickers{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:10px;margin-bottom:12px}
.stats-pickers label{font-size:12px;display:flex;flex-direction:column;gap:4px;min-width:0}
.stats-pickers select{padding:7px;border:1px solid #cad9bd;border-radius:8px;background:#fffdf5;max-width:100%;min-width:0}
.stats-compare{display:grid;grid-template-columns:1fr;gap:12px}
.stats-compare.pair{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
.stats-card{border:1px solid var(--line);border-radius:16px;padding:12px;background:#fffdf7;min-width:0}
.stats-head{display:flex;gap:10px;align-items:center;margin-bottom:8px}
.stats-head img{width:72px;height:72px;object-fit:contain;flex:none}
.stats-head h3{margin:0 0 4px;font-size:16px}
.stats-head small{font-size:10px;color:var(--muted)}
.stats-table{width:100%;border-collapse:collapse;margin-top:10px;font-size:12px;table-layout:fixed}
.stats-table th,.stats-table td{padding:5px 4px;border-bottom:1px solid #eef1e8;text-align:left;overflow-wrap:anywhere}
.stats-table thead th{font-size:10px;color:var(--muted);font-weight:600}
.stats-table td.real{font-weight:800;font-size:14px}
.stats-table td.split em{color:#2f8a4e;font-style:normal;font-weight:700}
.stats-table td.split small{display:block;font-size:9px;color:var(--muted)}
.diff.up{color:#2f8a4e;font-weight:700}.diff.down{color:#b4433a;font-weight:700}
.stats-line{font-size:11px;margin:8px 0 0;line-height:1.7}
.move-chip{display:inline-block;background:#eef5e6;border-radius:7px;padding:1px 6px;margin:1px;font-size:10px}
@media(max-width:480px){.econ-dialog{padding:16px}.econ-row{flex-wrap:wrap}.econ-trade{flex-direction:row;width:100%;justify-content:flex-end}.econ-trade .econ-qty{width:72px}.econ-icon{width:34px;height:34px;font-size:18px}.stats-head img{width:56px;height:56px}.coin-hud{padding:7px 8px!important}}

/* ───── 확장판 레이아웃: 게임 프레임(캔버스+독+프레임 안 메뉴) / 프레임 밖 지도·도움말 ───── */
:root{--dock-h:58px}
header{height:72px;gap:16px}.brand{font-size:30px}.brand>span{font-size:22px}#invite{margin-left:auto}.online{margin-left:0}
main{padding-top:18px}
.play-layout{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:20px;align-items:start}
.game-column{min-width:0}
.viewport{height:min(76vh,680px);min-height:520px;border:6px solid #fff;border-radius:18px;position:relative;overflow:hidden;background:#dce9ba}
.hud-top{position:absolute;left:10px;right:10px;top:10px;display:flex;justify-content:space-between;align-items:flex-start;gap:8px;pointer-events:none;z-index:5}
.hud-top>*{pointer-events:auto}
.hud-chip{background:#fffdf3e8;border-radius:12px;padding:7px 11px;font-size:12px;font-weight:700;color:#3f5a42;box-shadow:0 2px 8px #35533518;max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hud-right{display:flex;gap:6px;align-items:center}
.hud-right .coin-hud{border:1px solid #e2c26a;border-radius:14px;padding:6px 10px;font-weight:700}
.viewport .map-control{position:static;width:34px;height:34px;font-size:20px;background:#fffdf3e8;border-radius:10px;box-shadow:0 2px 8px #35533518}
#fps{font-size:9px;color:#456047;background:#ffffffc9;border-radius:10px;padding:4px 6px;font-variant-numeric:tabular-nums}
.hud-party{position:absolute;left:10px;top:48px;display:flex;flex-direction:column;gap:4px;z-index:4}
.hud-mon{display:flex;align-items:center;gap:6px;background:#fffdf3e0;border-radius:10px;padding:3px 8px 3px 3px;font-size:10px;text-align:left;box-shadow:0 1px 5px #35533514}
.hud-mon img{width:28px;height:28px;object-fit:contain}.hud-mon b{font-size:10px}
.hud-mon .bar{display:block;width:74px;height:4px;margin:3px 0 0}.hud-mon .bar.low i{background:#e0703d}
.battle-hud{position:absolute;top:48px;left:50%;transform:translateX(-50%);z-index:6;background:#fff5f2f2;border:2px solid #ef9a8a;border-radius:14px;padding:8px 12px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:center;max-width:min(560px,calc(100% - 200px));font-size:12px;color:#7a2a1d}
.battle-hud button{border:1px solid #e3a597;border-radius:10px;padding:5px 9px;background:#fff}.battle-hud small{color:#9a5a4c}
.battle-hud[hidden]{display:none}
.encounter-help{position:absolute;left:10px;bottom:calc(var(--dock-h) + 52px);max-width:min(330px,70%);font-size:11px;pointer-events:none;z-index:4}
.context-action{position:absolute;left:50%;bottom:calc(var(--dock-h) + 10px);transform:translateX(-50%);z-index:6;max-width:calc(100% - 20px);background:#fff3c9;border:2px solid #d6a73a;color:#5e4510;font-weight:800;font-size:13px;padding:10px 16px;border-radius:16px;box-shadow:0 4px 14px #4d3b0f30;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.context-action[data-kind=capture]{background:#ffe2d4;border-color:#e0703d;color:#7a2e10}
.context-action[data-kind=attack]{background:#ffece7;border-color:#e58b75}
.context-action[hidden]{display:none}
#toast{top:92px;z-index:40}
.dock{position:absolute;left:0;right:0;bottom:0;height:var(--dock-h);display:flex;align-items:center;gap:4px;padding:5px 8px;background:#fffdf3f2;border-top:1px solid #dfe6d4;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;z-index:20;-webkit-overflow-scrolling:touch}
.dock-group{display:flex;gap:2px;padding:0 6px;border-left:1px solid #e3e8da;flex:none}.dock-group:first-child{border-left:0;padding-left:0}
.dock button{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:52px;height:46px;border-radius:12px;font-size:17px;line-height:1;color:#405641}
.dock button span{font-size:10px;margin-top:4px;font-weight:700}
.dock button:hover,.dock button.active{background:#e7f0da}
.frame-panel{position:absolute;top:8px;right:8px;bottom:calc(var(--dock-h) + 8px);width:min(420px,calc(100% - 16px));overflow:auto;overscroll-behavior:contain;z-index:25;background:#fffdf7;border:1px solid #cddcc0;border-radius:18px;padding:0 16px 16px;box-shadow:0 10px 30px #20332030}
.frame-panel[hidden]{display:none}
.panel-head{position:sticky;top:0;background:#fffdf7;display:flex;justify-content:space-between;align-items:center;padding:12px 0 8px;z-index:2;border-bottom:1px solid #eef1e8;margin-bottom:10px}
.panel-head h2{font-size:16px;margin:0}.panel-head .close{float:none;font-size:20px;width:34px;height:34px}
.pane[hidden]{display:none}.pane-help{font-size:11px;color:var(--muted);line-height:1.7}.pane-help.error{color:#b4433a}
.frame-panel #party{max-height:none;display:block}
.frame-panel .adventure{margin:0;padding:12px;border-radius:14px}
.frame-panel .region-list{grid-template-columns:1fr}
.frame-panel #events{height:auto;max-height:46vh}
.frame-panel .dex-head{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px}.frame-panel .dex-head input,.frame-panel .dex-head select{padding:7px;min-width:0;flex:1}
.frame-panel #dexGrid{grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:8px}
.frame-panel .dex-card{padding:8px;border-radius:12px}.frame-panel .dex-card>img{width:64px;height:64px}.frame-panel .dex-card h3{font-size:12px;margin:4px 0}.frame-panel .dex-card small{font-size:9px}
.frame-panel .music-controls{flex-direction:column;align-items:stretch}
.travel-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px;margin-bottom:10px}
.travel-grid button{text-align:left;font-size:12px;border:1px solid #d4dfc8;border-radius:10px;padding:8px;background:#f6f9ef}
.frame-panel h3 small{font-weight:400;color:var(--muted);font-size:11px}
/* 프레임 안 대화창: 게임 화면 밖으로 넘치지 않고 안에서 스크롤 */
.viewport dialog.in-frame{position:absolute;inset:8px 8px calc(var(--dock-h) + 8px);margin:auto;width:min(640px,calc(100% - 16px));height:fit-content;max-height:calc(100% - var(--dock-h) - 16px);overflow:auto;overscroll-behavior:contain;z-index:30;padding:18px 20px;border-radius:18px;box-shadow:0 14px 40px #20332040;transform:none;box-sizing:border-box}
.viewport dialog.in-frame .close{position:sticky;top:0;float:right;z-index:3;width:34px;height:34px;border-radius:50%;background:#fffdf5;font-size:18px}
.viewport #commands{width:min(580px,calc(100% - 16px))}
/* #commands·#storageDialog의 ID 선택자 max-height(85dvh/85vh)·width(94vw)가 .in-frame 제한을 덮어써 프레임 밖으로 넘치던 문제 */
.viewport #commands,.viewport #storageDialog{max-height:calc(100% - var(--dock-h) - 16px)}
.viewport #storageDialog{width:min(560px,calc(100% - 16px))}
.viewport #guideDialog,.viewport #npcDialog{width:min(520px,calc(100% - 16px))}
#npcLine{line-height:1.8;color:#5c6d58;font-size:13px}
.npc-team{display:flex;gap:10px;flex-wrap:wrap}.npc-team figure{margin:0;text-align:center;font-size:11px}.npc-team img{width:64px;height:64px;object-fit:contain;display:block;margin:auto}
.npc-reward{background:#fff7d9;border-radius:10px;padding:8px 10px;font-size:12px}
.npc-offer{display:flex;flex-wrap:wrap;align-items:center;gap:8px;border:1px solid var(--line);border-radius:14px;padding:10px;margin:8px 0;background:#fffdf7}
.npc-offer>div{flex:1 1 220px;min-width:0;font-size:12px;line-height:1.8}.npc-offer small{display:block;color:#6f7f6b;font-size:11px}
.npc-offer span{display:inline-block;background:#eef5e6;border-radius:7px;padding:1px 6px;margin:1px}.npc-offer span.lack{background:#fbe6e3;color:#a2453c}
.npc-offer button{border:1px solid #cad9bd;border-radius:10px;padding:8px 12px;background:#edf3df}.npc-offer select{max-width:100%;padding:6px;border-radius:8px}
.npc-offer img.mini{width:30px;height:30px;vertical-align:middle;object-fit:contain}
.primary.slim{padding:10px;margin:8px 0 0}
.status-strip{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:10px 4px;font-size:12px}
/* 프레임 밖: 지도 · 목표 · 도움말 */
.side-panel{display:flex;flex-direction:column;gap:14px;background:none;border:0;padding:0}
.side-panel>section{background:#fff;border:1px solid var(--line);border-radius:16px;padding:14px}
.side-panel h2{font-size:15px;margin:0}
.map-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.map-zoom{display:flex;background:#f1f5ea;border-radius:10px;padding:3px}.map-zoom button{font-size:11px;padding:6px 9px;border-radius:8px}.map-zoom .selected{background:#fff;color:var(--green);font-weight:700;box-shadow:0 1px 4px #253c1714}
#atlas{width:100%;aspect-ratio:16/10;display:block;border-radius:12px;cursor:pointer;background:#e9efdf}
.map-info{font-size:11px;color:#56705a;margin:8px 0 4px;line-height:1.6}
.map-legend{display:flex;flex-wrap:wrap;gap:4px 10px;font-size:10px;color:#6c7b68;margin:0}.me-dot{color:#e55353}.ally-dot{color:#456eb2}
#objective{font-size:12px;line-height:1.8;color:#4f654c}.guide-card .section-heading>button{font-size:11px}
.help-list{padding-left:16px;font-size:12px;line-height:1.8;color:#5d6d58;margin:8px 0}.help-list b{color:#3f5a42}
.side-panel .team-legend{gap:6px 12px;background:#f7f9f1;border-radius:10px;padding:8px;font-size:11px;color:#3f5242;margin:8px 0}
.guide-steps summary{cursor:pointer;font-size:12px;font-weight:700;color:#477956}.guide-steps p,.guide-steps li{font-size:12px;line-height:1.8;color:#687f62}
@media(max-width:1000px){.play-layout{grid-template-columns:minmax(0,1fr) 300px}}
@media(max-width:820px){.play-layout{display:block}.side-panel{margin-top:14px}.viewport{height:72vh;min-height:500px}}
@media(max-width:720px){header{height:auto;display:flex;flex-wrap:wrap;padding:10px 4%;gap:8px}.brand small{display:none}main{padding:12px 3% 0}
 .viewport{border-width:4px;border-radius:14px;height:calc(100dvh - 150px);min-height:480px;max-height:760px}
 .hud-chip{font-size:11px;max-width:52%}.hud-party{top:46px}.hud-mon .bar{width:54px}.hud-mon b{display:none}
 .battle-hud{top:auto;bottom:calc(var(--dock-h) + 60px);max-width:calc(100% - 20px)}
 .context-action{font-size:12px;padding:10px 12px}
 .frame-panel{left:6px;right:6px;width:auto;top:6px;bottom:calc(var(--dock-h) + 6px);padding:0 12px 12px}
 .viewport dialog.in-frame{inset:6px 6px calc(var(--dock-h) + 6px);width:calc(100% - 12px);max-height:calc(100% - var(--dock-h) - 12px);padding:14px}
 .viewport #commands,.viewport #storageDialog{max-height:calc(100% - var(--dock-h) - 12px)}
 .viewport #storageDialog{width:calc(100% - 12px)}
 .dock button{min-width:48px}.encounter-help{bottom:calc(var(--dock-h) + 58px)}
}
.viewport.pane-open .context-action{left:calc((100% - min(420px,100% - 16px) - 8px)/2)}
.viewport.pane-open .encounter-help,.viewport.pane-open .battle-hud{display:none}
@media(max-width:720px){
 .dock{justify-content:space-between;gap:0;padding:4px}
 .dock-group{padding:0 1px;gap:0}
 .dock button{min-width:34px;flex:1;height:44px;font-size:15px;border-radius:10px;padding:0 2px}
 .dock button span{font-size:9px}
 .hud-party{flex-direction:row;left:8px;top:44px}.hud-mon{padding:2px 6px 2px 2px}.hud-mon img{width:24px;height:24px}
 .viewport.pane-open .context-action{display:none}
}

.dex-card.dex-owned{background:#e6f5df;border:2px solid #548548}.dex-card.dex-missing{background:#ededed;border:2px dashed #999}.dex-missing img{filter:grayscale(1);opacity:.45}.dex-owned small{font-weight:800;color:#285627}.dex-missing small{font-weight:800;color:#555}#captureBall{max-width:100%}

/* Notifications occupy document space so the playfield remains visible. */
#toast{position:static;transform:none;max-width:100%;margin:8px 0;padding:9px 12px;pointer-events:none}
#captureSuccess{position:relative;inset:auto;margin:8px 0;width:100%;padding:8px 12px;border-radius:12px;box-shadow:none;text-align:left;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#captureSuccess strong,#captureSuccess b{font-size:13px}#captureSuccess img{width:38px;height:38px;margin:0}#captureSuccess span{font-size:11px;margin:0}.capture-sparkles{display:none}
.evolution-choice{display:flex;align-items:center;gap:8px;flex-wrap:wrap;background:#f5f0ff;border:1px solid #c7b4e6;padding:12px;border-radius:12px;margin:8px 0}.evolution-choice span{flex:1;min-width:180px}.evolution-choice small{display:block;font-size:11px;margin-top:5px}.evolution-choice button{border:1px solid #a98cc9;border-radius:8px;padding:9px;background:white}
#evolutionShow{position:relative;display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;overflow:hidden;min-height:110px;border-radius:14px;background:radial-gradient(ellipse,#fffdeb,#e3dbfa);margin:8px 0;padding:12px}#evolutionShow[hidden]{display:none}#evolutionShow img{width:76px;height:76px;object-fit:contain}#evolutionShow b{font-size:13px}.evolution-orbit{position:absolute;inset:0;text-align:center;font-size:32px;color:#ba8bdf;pointer-events:none}.evolution-flash{font-size:28px;color:#ac7ddd}.evolving .evolution-before{animation:evolution-out 1.5s both}.evolving .evolution-after{animation:evolution-in 2s both}.evolving .evolution-orbit{animation:evolution-spark 1.2s 3}
@keyframes evolution-out{50%{filter:brightness(3) drop-shadow(0 0 14px white)}to{opacity:.3;transform:scale(.8)}}@keyframes evolution-in{from{opacity:0;transform:scale(.4);filter:brightness(4)}60%{opacity:1;filter:brightness(2) drop-shadow(0 0 14px #bd7cff)}to{transform:scale(1);filter:none}}@keyframes evolution-spark{50%{transform:rotate(10deg) scale(1.2);opacity:.3}}
@media(prefers-reduced-motion:reduce){.evolving *{animation:none!important}}

.battle-hud{position:static;transform:none;max-width:100%;margin:8px 0}

/* Keep controls, notifications and menus outside the live playfield. */
.game-column{position:relative;min-width:0}
.game-column>.dock{position:static;height:auto;min-height:54px;border-radius:0 0 12px 12px;max-width:100%}
.game-column>.encounter-help{position:static;max-width:100%;margin:4px 0;display:flex;align-items:center;gap:6px;min-width:0}
.encounter-help p{margin:0;padding:4px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;font-size:11px}
.encounter-help:has(p:empty):not(:has(button:not([hidden]))){display:none}
.encounter-help button{padding:5px 8px;margin:0;font-size:11px;flex-shrink:0}
#menuHost{min-width:0}#menuHost:empty{display:none}
#menuHost .frame-panel,#menuHost dialog.in-frame{position:relative;inset:auto;transform:none;width:100%;max-width:100%;height:auto;max-height:36dvh;overflow:auto;margin:6px 0;padding:12px;border-radius:12px;box-shadow:none}
#menuHost dialog:not([open]),#menuHost [hidden],#captureSuccess[hidden],#evolutionShow[hidden],#battleHud[hidden]{display:none!important}
#menuHost dialog::backdrop{display:none}
#toast{height:32px;max-height:32px;line-height:20px;padding:6px 10px;margin:4px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:8px}
#commandFeedback{max-height:44px;overflow:auto;font-size:11px}
#captureSuccess{max-height:64px;overflow:hidden;margin:4px 0;pointer-events:none}
#captureSuccess img{width:28px;height:28px}
.viewport.pane-open .context-action{display:block;left:50%}
.viewport{--dock-h:0px}
@media(max-width:720px){.game-column>.dock{justify-content:space-between;padding:3px 0}.game-column>.dock .dock-group{padding:0}.game-column>.dock button{min-width:30px}#menuHost .frame-panel,#menuHost dialog.in-frame{max-height:30dvh}.viewport{min-height:320px;height:calc(100dvh - 220px)}}

/* Game-frame containment: menus scroll internally and never move the page. */
.viewport{--dock-h:58px;isolation:isolate}
#menuHost{position:absolute;inset:6px 6px calc(var(--dock-h) + 42px);z-index:30;pointer-events:none;min-height:0}
#menuHost .frame-panel,#menuHost dialog.in-frame{position:absolute;inset:0 0 0 auto;width:min(460px,100%);max-width:100%;height:100%;max-height:100%;margin:0;padding:12px;overflow:auto;overscroll-behavior:contain;pointer-events:auto;background:#fffdf7;box-shadow:0 6px 24px #20332030}
#menuHost dialog.in-frame{width:min(640px,100%);height:fit-content;max-height:100%;inset:0 0 auto auto}
#menuHost #commands,#menuHost #storageDialog{max-height:100%;width:min(640px,100%)}
#menuHost .close,#closeCommands{position:sticky;top:0;z-index:3;background:#fffdf7}
#menuHost input,#menuHost select{max-width:100%;min-width:0}
#menuHost .econ-row{flex-wrap:wrap}
#menuHost .econ-main{min-width:0;overflow-wrap:anywhere}
#menuHost .side-panel{margin:0;max-width:100%}
#menuHost .side-panel>section{padding:8px}
#menuHost #atlas{width:100%;height:auto;touch-action:manipulation}
.viewport .dock{height:58px;max-width:100%;gap:0;padding:3px;z-index:35}
.viewport .dock-group{padding:0 3px}
.viewport .dock button{min-width:36px;height:46px}
.viewport>.status-strip{display:none}
.viewport>.encounter-help{display:none}
.viewport #toast{position:absolute;inset:auto 8px 62px;transform:none;max-width:calc(100% - 16px);width:fit-content;height:28px;max-height:28px;padding:4px 8px;margin:0;font-size:11px;z-index:40;pointer-events:none}
.viewport #captureSuccess{position:absolute;inset:auto 8px 94px;max-width:calc(100% - 16px);width:fit-content;max-height:54px;margin:0;z-index:8}
.viewport #captureSuccess span{display:none}
.viewport #evolutionChoices{position:absolute;right:8px;bottom:96px;max-height:35%;width:min(360px,calc(100% - 16px));overflow:auto;z-index:9}
.viewport .evolution-choice{padding:8px;margin:0;font-size:11px}
.viewport #evolutionShow{position:absolute;inset:55px 8px auto;max-height:40%;min-height:80px;margin:0;z-index:9;pointer-events:none}
.viewport #battleHud{position:absolute;top:48px;right:8px;left:auto;transform:none;max-width:55%;max-height:20%;overflow:auto;font-size:10px;margin:0;padding:5px;z-index:7}
.viewport .context-action{bottom:64px;max-width:calc(100% - 16px);font-size:11px;padding:7px 10px}
.viewport.pane-open .context-action{display:none}
@media(max-width:720px){.viewport{height:calc(100dvh - 130px);min-height:300px;max-height:780px}.viewport .dock{justify-content:space-between}.viewport .dock button{min-width:29px;font-size:15px}.viewport .dock button span{font-size:8px}.viewport .dock-group{padding:0;border:0}#menuHost .frame-panel,#menuHost dialog.in-frame{width:100%;max-height:100%}.viewport #battleHud{max-width:48%}}
.play-layout{grid-template-columns:minmax(0,1fr)}
#menuHost #atlas{height:180px}

.viewport #cycleBall{width:auto;max-width:115px;padding:0 7px;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}
.hud-top .hud-chip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:480px){.hud-right{gap:3px}.hud-right #fps{display:none}.viewport #cycleBall{max-width:105px;font-size:10px}.hud-top{gap:4px}}

/* Nearby signs never capture input or open a menu. */
#signReading{position:absolute;left:8px;right:8px;bottom:94px;z-index:12;width:fit-content;max-width:calc(100% - 16px);padding:4px 8px;border-radius:6px;background:#fff4d9ed;color:#5b4a1d;font-size:11px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
#signReading[hidden],.viewport:has(#menuHost dialog[open]) #signReading,.viewport.pane-open #signReading{display:none}

/* Notifications scroll completely on one line, then dismiss automatically. */
.viewport #toast{height:28px;max-height:28px;padding:4px 8px;white-space:nowrap;overflow:hidden;text-overflow:clip;pointer-events:none;line-height:20px}
#toast .message-content{display:block;width:max-content;max-width:none;white-space:nowrap;line-height:20px;will-change:transform}
#signReading{white-space:pre-wrap;overflow-wrap:anywhere;max-height:25%;overflow:auto;text-overflow:clip;pointer-events:auto;overscroll-behavior:contain}
.viewport .context-action{white-space:normal;overflow-wrap:anywhere;text-overflow:clip;max-height:20%;overflow:auto}
#commandFeedback,#npcFeedback,#guideText{white-space:pre-wrap;overflow-wrap:anywhere}

/* Bag selection and use remain reachable while snapshots update the contents. */
#bagDialog button{min-height:44px;min-width:44px;touch-action:manipulation}
#bagDialog button:focus-visible{outline:3px solid #b26b13;outline-offset:-3px}
.econ-dialog button[aria-disabled="true"]{opacity:.6;cursor:wait}
#bagDialog .bag-step{font-weight:700;color:var(--green);font-size:13px}
#bagDialog .econ-use-head{flex-wrap:wrap}
#bagFeedback{position:sticky;bottom:0;background:#fffdf7;padding:8px 0;margin-bottom:0;overflow-wrap:anywhere}
#bagFeedback:empty{padding:0;min-height:0}

/* Keep menu entry/exit targets easy to see and reach with keyboard or touch. */
#menuHost .close,#closeCommands{min-width:44px;min-height:44px}
#menuHost :is(button,input,select):focus-visible{outline:3px solid #b26b13;outline-offset:-3px}

/* Trade quantities stay readable and touchable while live inventory updates. */
.econ-trade .econ-qty,.econ-trade button{min-height:44px}
.econ-qty[aria-invalid="true"]{border-color:#b43f36;outline:2px solid #b43f3640}

.econ-qty-hint{font-size:11px;color:#596c4e;align-self:center}

#shopExchange{min-width:44px;min-height:44px}

#shopFeedback,#workshopFeedback{position:sticky;top:0;z-index:2;background:#fffdf6;padding:8px 52px 8px 4px;margin:6px 0}

#shopFeedback:empty,#workshopFeedback:empty{padding:0}

/* Dex list and detail share one frame panel; navigation stays within its scroll. */
#dexDetailView[hidden],#dexListView[hidden]{display:none}
#menuHost .dex-detail-nav{width:100%;display:flex;flex-wrap:wrap;gap:6px;background:#fffdf7;padding:6px 0;border-bottom:1px solid var(--line)}
.dex-detail-nav button{min-width:44px;min-height:44px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#f0f6e9;touch-action:manipulation}
.dex-detail-nav button[aria-disabled="true"]{opacity:.45;cursor:default}
#dexPosition{flex-basis:100%;margin:0;font-size:11px;color:#456047;overflow-wrap:anywhere}
#dexDetailBody>img{max-width:100%}

#menuHost .dex-detail-nav[hidden]{display:none}
#dockPanel.dex-reading .panel-head{flex-wrap:wrap;z-index:3}
#dockPanel.dex-reading .panel-head::before{content:"";position:absolute;left:0;right:0;top:-12px;height:12px;background:#fffdf7}

/* Keep dex filtering and recovery usable with touch and long search terms. */
#dexListView .dex-head{align-items:center}
#dexListView .dex-head>input,#dexListView .dex-head>select{min-height:44px}
#dexListView .dex-head>input{flex:1 1 130px}
#dexListView .dex-head>select{flex:1 1 110px}
#dexListView .dex-owned-filter{display:flex;align-items:center;gap:6px;min-height:44px;padding:0 8px;cursor:pointer}
#dexListView .dex-owned-filter input{flex:none;width:18px;height:18px;margin:0}
.dex-results-bar{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-bottom:8px}
#dexResults{flex:1 1 140px;min-width:0;margin:0;font-size:12px;overflow-wrap:anywhere}
#dexReset{min-height:44px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#f0f6e9;touch-action:manipulation}
#dexEmpty{padding:16px;background:#f0f4e9;border-radius:12px;font-size:13px;line-height:1.8}
#dexReset[hidden],#dexEmpty[hidden]{display:none}

/* Stable data-center controls remain reachable as snapshots arrive. */
#storageDialog .storage-row{gap:8px;min-width:0;padding:8px 0;border-bottom:1px solid #dce5d4}
#storageDialog .storage-row span{min-width:0;overflow-wrap:anywhere;font-size:13px}
#storageDialog .storage-row img{width:44px;height:44px;flex:none}
#storageDialog .storage-row button,#storageBox{min-width:44px;min-height:44px;flex:none}
#storageDialog .storage-row button{padding:8px;border:1px solid #cad9bd;border-radius:10px;background:#edf3df;color:#405641}
#storageDialog [aria-disabled=true]{opacity:.55;cursor:default}
#storageBoxHelp,#storageLimits{font-size:12px;line-height:1.6;overflow-wrap:anywhere}
#storageLimits:empty{display:none}

#storageDialog{scroll-padding-top:72px}
#storageDialog .storage-heading{position:sticky;top:-12px;margin:-12px -12px 12px;padding:8px 12px;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:8px;background:#fffdf7;min-height:52px}
#storageDialog .storage-heading h2{font-size:18px;margin:0}
#menuHost #storageDialog #closeStorage{position:static;float:none;flex:none}

#storageDialog .storage-row button{touch-action:manipulation}

/* Keep comparison choices reachable while reading long stat cards. */
#statsDialog{padding-top:0}
#statsDialog .stats-controls{position:sticky;top:0;z-index:2;background:var(--panel,#fffdf5);padding:18px 0 10px;border-bottom:1px solid var(--line);margin-bottom:12px}
#statsDialog h2{padding-right:50px}
#statsDialog .close{top:8px;right:0;min-width:44px;min-height:44px}
#statsDialog .stats-pickers{margin-bottom:8px}
#statsDialog select,#statsSwap{min-height:44px;min-width:44px;touch-action:manipulation}
#statsSwap[aria-disabled="true"]{cursor:default}
#statsStatus{font-size:12px;color:var(--muted);margin:6px 0 0;overflow-wrap:anywhere}

/* Keep chat retry feedback and touch targets inside the news pane. */
#chatForm input,#chatForm button{min-height:44px}
#chatForm button{min-width:72px;touch-action:manipulation}
#chatFeedback{font-size:12px;line-height:1.5;min-height:18px;margin:8px 0;overflow-wrap:anywhere}

/* Reserve update controls so incoming news never moves the reading viewport. */
.news-update{height:48px;flex-shrink:0;display:flex;align-items:center;justify-content:flex-end}
#latestNews{min-height:44px;min-width:44px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#edf4e8;touch-action:manipulation}
.news-status{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.frame-panel #events{overflow:auto;overscroll-behavior:contain;overflow-anchor:none;overflow-wrap:anywhere;touch-action:pan-y}
#events:focus-visible{outline:3px solid #e3ad56;outline-offset:-3px}

#menuHost #dockPanel.news-reading{display:flex;flex-direction:column;overflow:hidden}
#menuHost #dockPanel.news-reading .panel-head,#menuHost #dockPanel.news-reading .section-heading,#menuHost #dockPanel.news-reading #chatForm,#menuHost #dockPanel.news-reading #chatFeedback{flex-shrink:0}
#menuHost #dockPanel.news-reading .panel-head .close{min-width:44px;min-height:44px}
#menuHost #dockPanel.news-reading [data-pane-body="news"]{display:flex;flex-direction:column;flex:1;min-height:0}
#menuHost #dockPanel.news-reading #events{flex:1;min-height:0;height:0;max-height:none}

#salonDialog,#boutiqueDialog{width:min(480px,calc(100vw - 32px));max-height:85dvh;overflow:auto;box-sizing:border-box} .salon-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0}.salon-choices button{padding:4px;display:flex;flex-direction:column;align-items:center;border:2px solid transparent}.salon-choices button[aria-pressed="true"]{border-color:#9b6194;background:#faeaf6}.salon-choices canvas{width:90px;max-width:100%;height:auto}.salon-choices span{font-size:12px}#salonApply,#salonGo{margin:6px 0;width:100%}

#boutiqueMonster{max-width:100%;padding:8px}#boutiqueGo{width:100%;margin-top:8px}

/* Short field actions stay readable and tappable above the menu. */
.viewport>.encounter-help{display:block;position:absolute;inset:auto 8px 64px auto;width:auto;max-width:48%;margin:0;pointer-events:none;z-index:8}
.viewport>.encounter-help #playAdvice,.viewport>.encounter-help #seekWild,.viewport>.encounter-help #quickDeploy{display:none}
.viewport #quickCapture{pointer-events:auto;min-height:44px;padding:8px 12px;border:2px solid #df875c;border-radius:14px;background:#ffe4d5;color:#753b21;font-size:12px;font-weight:700}
.viewport #quickCapture[hidden]{display:none}
.viewport:has(#quickCapture:not([hidden])) .context-action{left:8px;transform:none;max-width:48%}
.viewport.pane-open>.encounter-help,.viewport:has(#menuHost dialog[open])>.encounter-help{display:none}
.viewport .context-action{min-height:44px;font-size:12px}
@media(max-width:720px){#signReading{max-height:44px;font-size:11px;line-height:18px}.viewport #battleHud small{display:none}}

.field-actions{margin:12px 0;padding:16px;border:1px solid #dce5d4;border-radius:16px;background:#fffdf5;color:#456047}.field-actions h3{margin:0;font-size:14px}.field-actions .section-heading>span{font-size:12px}.field-action-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0}.field-action-grid article{padding:12px;border:1px solid #e1e8d9;border-radius:12px;background:#fff}.field-actions p{font-size:12px;line-height:1.7;margin:7px 0}.field-actions b{font-size:13px}.field-buttons{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}.field-actions button{min-height:38px;padding:7px 10px;border:1px solid #c8d8bd;border-radius:8px;background:#edf4e5;color:#354f32;cursor:pointer;font:inherit;font-size:12px}.field-actions button:disabled{opacity:.5;cursor:default}.field-buttons span{font-size:11px;line-height:1.6}.field-exploration{border-top:1px solid #dce5d4;padding-top:12px}@media(max-width:600px){.field-action-grid{grid-template-columns:1fr}.field-actions{padding:12px}.field-actions button{min-height:44px}}

.dex-pose-preview{display:block;width:280px;max-width:100%;height:auto;margin:auto}.dex-pose-controls{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}.dex-pose-controls [aria-pressed="true"]{background:#d5e7bd;outline:2px solid #779d62}

.dex-pose-controls button{min-height:40px;min-width:44px;padding:8px 12px;border:1px solid #ccd9c0;border-radius:10px;background:#f4f7ee;color:#304b36;cursor:pointer}

/* 포획 여부는 색상과 문구를 함께 표시한다. */
.viewport #quickCapture{white-space:pre-line;line-height:1.5}
.viewport #quickCapture[data-caught="true"]{background:#e4f8ed;border-color:#28734f;color:#175537}
.viewport #quickCapture[data-caught="false"]{background:#fff3d1;border-color:#95621b;color:#754409}


/* Short touch screens need a height-based layout when rotated. */
@media (orientation:landscape) and (max-height:600px) and (max-width:1000px),
       (orientation:landscape) and (max-height:600px) and (pointer:coarse){
 body{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
 header{height:44px;min-height:44px;padding:0 12px;gap:10px;flex-wrap:nowrap}
 .brand{font-size:22px;gap:6px}.brand>span{font-size:18px}.brand small{display:none}
 header #invite{padding:6px 10px;font-size:11px}.online{padding:6px 8px;font-size:10px}
 main{padding:0;max-width:none}
 .viewport{height:calc(100vh - 44px - env(safe-area-inset-bottom));height:calc(100dvh - 44px - env(safe-area-inset-bottom));min-height:0;max-height:none;border-width:2px;border-radius:8px}
 .hud-top{top:5px;left:6px;right:6px}.hud-chip{font-size:11px;padding:6px 8px}
 .hud-party{top:42px;left:6px;flex-direction:row;gap:3px}
 .hud-mon{padding:2px 5px 2px 2px}.hud-mon img{width:24px;height:24px}.hud-mon b{display:none}.hud-mon .bar{width:44px}
 .viewport .dock{justify-content:space-evenly}.viewport .dock-group{padding:0 2px;border:0}
 .viewport .dock button{min-width:40px;min-height:44px;font-size:16px}.viewport .dock button span{font-size:9px}
 #menuHost{inset:4px 4px calc(var(--dock-h) + 4px)}
 #menuHost .frame-panel,#menuHost dialog.in-frame{width:min(640px,100%);max-height:100%;padding:8px 12px}
 #menuHost .panel-head{padding:4px 0;margin-bottom:6px}
 #menuHost .panel-head .close,#closeCommands{min-width:44px;min-height:44px}
 .viewport #battleHud{top:42px;max-width:48%;max-height:25%}.viewport #battleHud small{display:none}
 .viewport .context-action{max-height:28%}
 #login{max-height:calc(100dvh - 16px);overflow:auto;padding:16px}
}

#mobileMove{display:none;position:absolute;left:max(10px,env(safe-area-inset-left));bottom:118px;z-index:9;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,44px);gap:3px;touch-action:none;user-select:none}
#mobileMove button{padding:0;min-width:44px;min-height:44px;border:2px solid #fff9;border-radius:13px;background:#fffdebdc;color:#345c46;font-size:21px;touch-action:none;-webkit-user-select:none}
#mobileMove button[data-move=arrowup]{grid-column:2}#mobileMove button[data-move=arrowleft]{grid-row:2}#mobileMove button[data-move=arrowdown]{grid-row:2;grid-column:2}#mobileMove button[data-move=arrowright]{grid-row:2;grid-column:3}
#mobileMove button.held{background:#b4d49b}
@media(pointer:coarse),(max-width:700px){#mobileMove{display:grid}.viewport .context-action{left:auto;right:8px;transform:none;max-width:48%}}
.viewport.pane-open #mobileMove,.viewport:has(#menuHost dialog[open]) #mobileMove{display:none}
@media(max-height:500px) and (orientation:landscape){#mobileMove{bottom:66px;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,44px)}}

/* Landscape keeps the field full-screen and groups menus along the right edge. */
@media (orientation:landscape) and (max-height:600px) and (max-width:1000px),
       (orientation:landscape) and (max-height:600px) and (pointer:coarse){
 body{padding:0;overflow:hidden}
 body>header{display:none}
 main{padding:0;margin:0;width:100%;max-width:none}
 .play-layout{display:block;margin:0}
 .viewport{position:fixed;inset:0;width:100%;height:100dvh;min-height:0;max-height:none;border:0;border-radius:0;--dock-h:0px}
 .viewport .dock{left:auto;right:env(safe-area-inset-right,0px);top:0;bottom:0;width:58px;height:100%;padding:4px;display:flex;flex-direction:column;justify-content:flex-start;overflow-y:auto;overflow-x:hidden;border:0;border-left:1px solid #dfe6d4}
 .viewport .dock-group{flex-direction:column;gap:2px;padding:0;border:0}
 .viewport .dock button{width:48px;min-height:44px;height:44px;flex:none}
 .hud-top{left:max(8px,env(safe-area-inset-left));right:66px;top:max(5px,env(safe-area-inset-top))}
 .hud-top #fps{display:none}
 .hud-party{top:44px;max-width:calc(100% - 220px);flex-wrap:wrap;pointer-events:none}
 #mobileMove{left:max(10px,env(safe-area-inset-left));bottom:max(10px,env(safe-area-inset-bottom))}
 .viewport .encounter-help{left:auto;right:66px;bottom:64px;max-width:42%}
 .viewport #playAdvice{display:none}
 .viewport .context-action{left:auto;right:66px;bottom:12px;max-width:45%;transform:none}
 .viewport #battleHud{top:76px;right:66px;left:auto;bottom:auto;max-width:35%;max-height:25%;overflow:auto}
 #menuHost{inset:6px 64px 6px max(6px,env(safe-area-inset-left))}
 #menuHost .frame-panel,#menuHost dialog.in-frame{inset:0;margin:auto;max-height:100%;width:min(640px,100%)}
 .viewport.pane-open .context-action{display:none}
}

/* Fullscreen remains available on browsers without the Fullscreen API. */
body.game-fullscreen{overflow:hidden;padding:0}
body.game-fullscreen>header{display:none}
body.game-fullscreen #gameFrame{position:fixed;inset:0;width:100%;height:100dvh;min-height:0;max-height:none;border:0;border-radius:0;z-index:30}
body.game-fullscreen main{margin:0;padding:0;max-width:none}
#fullscreen{min-width:36px;min-height:36px}
#login [hidden]{display:none!important}
#login .naver-login{display:block;background:#03c75a;color:white;text-align:center;text-decoration:none;border-radius:12px;padding:12px;margin:12px 0;font-weight:700}
#login .register-choice{display:flex;align-items:center;gap:8px;font-size:13px}
#login .register-choice input{width:auto}
#login #accountStatus{overflow-wrap:anywhere}
#login #logoutAccount,#login #cancelAccount{margin-top:8px;min-height:40px}
#login{max-height:calc(100dvh - 20px);overflow:auto}

/* Material inventory: ivory badges with resource-colored icon wells. */
#resources{gap:6px;align-items:center}
#resources .resource-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 9px 4px 4px;border:1px solid #dddccd;border-radius:12px;background:linear-gradient(145deg,#fffef9,#f3f2e9);color:#354a3e;box-shadow:0 2px 4px #30443608,inset 0 1px #fff;white-space:nowrap}
#resources .resource-chip i{display:grid;place-items:center;width:27px;height:27px;border-radius:9px;background:color-mix(in srgb,var(--resource-color) 15%,#fffdf6);color:var(--resource-color);font-size:17px;font-style:normal}
#resources .resource-chip em{font-size:10px;font-style:normal;color:#738074}
#resources .resource-chip b{font-size:12px;font-variant-numeric:tabular-nums;letter-spacing:-.2px}
#resources .coin-chip{border-color:#e5d6ac;background:linear-gradient(145deg,#fffbed,#f6eed8)}
#resources .bag-chip{align-self:stretch;border-radius:12px;border-color:#cbd4bf;background:#e8eedf;font-weight:600;padding:7px 11px}
@media(max-width:720px){#resources{gap:4px}#resources .resource-chip{gap:4px;padding:3px 6px 3px 3px;border-radius:10px}#resources .resource-chip i{width:23px;height:23px;font-size:15px}#resources .resource-chip em{font-size:9px}#resources .resource-chip b{font-size:11px}}

#resources .resource-chip i svg{display:block;width:25px;height:25px;flex-shrink:0}
@media(max-width:720px){#resources .resource-chip i svg{width:22px;height:22px}}

/* Realistic resource cutouts retain detail in inventory and crafting rows. */
.econ-icon svg{display:block;width:34px;height:34px;flex-shrink:0}
.econ-inputs svg{display:inline-block;width:22px;height:22px;vertical-align:middle}

.quest-materials{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}.quest-material{display:inline-flex;align-items:center;gap:6px;padding:7px 9px;border:1px solid #e4d4bf;border-radius:10px;background:#fff8ef;font-size:12px;color:#79552f}.quest-material.ready{background:#f0f7ed;border-color:#c9dfc1;color:#365c36}.quest-material b,.quest-material small{display:block;font-size:11px;line-height:1.6}.quest-material svg{flex-shrink:0}

/* Update history stays scrollable within the existing desktop/mobile game menu. */
.update-list{padding-left:1.5rem;overflow-wrap:anywhere}.update-list li{padding:.65rem 0;border-bottom:1px solid #dbe5da}.update-list p{margin:0 0 .3rem}.update-list small,#updatesDialog>small{opacity:.7}

/* Expedition field journal: warm paper, stitched leather edges and brass controls. */
:root{--ink:#354237;--muted:#6f796a;--line:#cfc5ae;--cream:#ece8dc}
body{background:radial-gradient(ellipse at 25% 0,#faf5e7,transparent 65%),#e9e6da}
header{background:linear-gradient(#faf7ee,#eae4d5);border-bottom-color:#baad91;box-shadow:0 2px 8px #463a2420}
aside,.adventure,dialog,#commands,#guideDialog{background:linear-gradient(115deg,#fffaf0,#eee7d5);border:1px solid #b9ac8f;box-shadow:inset 0 1px 0 #fffdf7,0 8px 24px #42362126}
.viewport{border-color:#80755b;box-shadow:0 2px 0 #d7cfb8,inset 0 0 0 1px #463f30,0 8px 24px #3d362c30}
.monster-card,.econ-row,.growth-chart,#quickOrders{background:linear-gradient(125deg,#fffdf5,#eae5d6);border-color:#cec2a9;box-shadow:inset 0 1px 0 #ffffffb0,0 2px 4px #54452c0c}
.play-controls button,.interaction-controls button,.pill,.adventure button,.item-actions button,.econ-row button,.section-heading>button{background:linear-gradient(#fbf4df,#dfd3b6);border:1px solid #a99a78;box-shadow:inset 0 1px 0 #fffef4,0 2px 3px #463b2926;color:#384d3a}
button:active:not(:disabled){box-shadow:inset 0 2px 4px #463b2933;transform:translateY(1px)}
.econ-tabs button.selected,.deploy{background:linear-gradient(#668364,#3e6047);color:#fff9e7;border-color:#35523c;box-shadow:inset 0 1px 0 #ffffff40,0 2px 3px #30432b30}
.bar{background:#c9c5b5;box-shadow:inset 0 1px 3px #433c2933}.bar>i,.bar>span{box-shadow:inset 0 1px 0 #ffffff65}
.map-label,.world-hint,.team-legend{color:#3b4c39;background:linear-gradient(#fff9e9ed,#e9dfc7ed);border:1px solid #bbad8d;box-shadow:0 2px 6px #423b2526}
.map-label{padding:8px 10px;border-radius:8px}
dialog::backdrop{background:#19271e80;backdrop-filter:blur(3px)}
input,select{border-color:#b5a98b;background-color:#fffaf0;color:#354237}
