/* Smaller frames, readable live labels, and independent scrollable inspection. */
#panel-pause-note{position:absolute;z-index:145;left:50%;top:4px;transform:translateX(-50%);padding:4px 10px;background:#111b12ed;border:1px solid #697656;color:#d7ddbd;font:10px/1.5 SimSun;pointer-events:none;white-space:nowrap}
#player-status{left:8px;top:8px;width:173px;height:68px;padding:5px;gap:5px;border-image-width:4px}
#player-status .portrait{width:25px;height:44px}.player-data strong{font-size:10px;margin-bottom:2px}.player-data strong small{font-size:8px}.status-meter{height:12px;margin:2px 0}.status-meter span{font-size:9px;line-height:10px}.status-meter.experience{height:3px}.player-data>small{margin-top:2px}
#world-conditions{top:80px;left:8px;padding:3px 6px;font:9px/1.45 SimSun;border-image-width:4px}#world-conditions span{display:inline}#world-conditions span+span:before{content:' · '}
.floating-bar{padding:5px 6px;border-image-width:4px;width:226px;height:46px;box-sizing:border-box}.bar-slots{gap:2px}.bar-content>small{display:none}.bar-slots button{width:30px;height:32px;min-width:0;min-height:0}.bar-slots img{max-width:23px;max-height:23px}.bar-slots kbd{font-size:8px}.bar-slots button small{font-size:8px}.drag-handle{width:15px;min-width:15px;touch-action:none}
#skill-bar{top:8px;left:192px}#item-bar{bottom:8px;left:210px}#fixed-shortcuts{bottom:8px;right:8px;gap:2px}#fixed-shortcuts button{width:33px;height:37px;padding:2px;border-image-width:3px}#fixed-shortcuts button img{width:19px;height:19px}#fixed-shortcuts button span{font-size:8px;line-height:10px}
#minimap-button{right:8px;top:8px;width:100px;height:96px;border-image-width:4px}#minimap{width:90px;height:66px}#minimap-title{font-size:9px;height:12px}#minimap-coords{font-size:8px}.quest-track{top:112px;right:8px;max-width:140px;padding:5px;border-image-width:4px;font-size:10px}.quest-track>strong{font-size:10px}
#inventory,.touch-ui #inventory{box-sizing:border-box;left:50%;top:50%;right:auto;transform:translate(-50%,-50%);width:390px;height:360px;max-width:calc(100% - 20px);max-height:calc(100% - 40px);border-image-width:8px;padding:14px;z-index:55}
body:not(.touch-ui) #inventory{left:calc(50% + 150px)}
#inventory .inventory-caption,.touch-ui #inventory .inventory-caption{left:16px;top:15px;font-size:13px;max-width:calc(100% - 64px)}
#inventory #bag-grid,.touch-ui #inventory #bag-grid{position:absolute;left:16px;right:16px;top:48px;bottom:92px;width:auto;height:auto;max-height:none;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(5,minmax(0,1fr));gap:3px;overflow:auto}
#inventory .bag-slot,.touch-ui #inventory .bag-slot{width:100%;height:100%;min-height:28px;border-image-width:3px;overflow:hidden}#inventory .bag-slot .item-icon{width:28px;height:28px;max-height:28px;object-fit:contain}
#inventory #capacity,.touch-ui #inventory #capacity{top:auto;bottom:66px;left:16px;font-size:11px}#inventory #gold-bag,.touch-ui #inventory #gold-bag{top:auto;bottom:66px;right:16px;left:auto;font-size:11px}
#inventory #item-detail{display:none}#inventory #equip-destination,.touch-ui #inventory #equip-destination{left:16px;top:auto;bottom:16px;width:148px;height:32px;font:11px SimSun}
#inventory #equip-button,.touch-ui #inventory #equip-button{top:auto;left:auto;right:16px;bottom:16px;width:72px;height:34px;font-size:12px}#inventory #discard-button,.touch-ui #inventory #discard-button{left:auto;right:96px;top:auto;bottom:16px;width:54px;height:34px;font-size:11px}
#inventory #bag-close,.touch-ui #inventory #bag-close{right:8px;top:8px;left:auto;width:32px;height:32px}
#item-popup{box-sizing:border-box;position:absolute;z-index:140;width:300px;max-width:calc(100% - 16px);min-height:0;transform:none;padding:15px;overflow:auto;overscroll-behavior:contain;border-image-width:6px;font:11px/1.7 SimSun;touch-action:pan-y}
#item-popup .item-popup-close{position:sticky;float:right;top:0;width:30px;height:30px;margin:-4px -4px 0 0;z-index:2}#item-popup h2{font-size:14px;margin:0 20px 4px 0;padding:0}#item-popup .item-popup-icon{width:32px;height:32px;object-fit:contain;float:left;margin-right:8px}#item-popup .item-popup-description{white-space:pre-line;margin:8px 0;padding:8px 0;border-bottom:1px solid #504735}#item-popup .item-comparison{margin-top:10px}#item-popup h3{font-size:12px;font-weight:normal;color:#d6bf84;margin:4px 0}#item-popup table{width:100%;border-collapse:collapse;font:11px/1.8 Arial,SimSun}#item-popup th{text-align:left;color:#a89f88;font-weight:normal}#item-popup td{text-align:right;border-bottom:1px solid #363729}#item-popup td:first-child{text-align:left}.stat-gain{color:#9fdb9d}.stat-loss{color:#f5a18e}.stat-same{color:#8e907e}
#travel-window,.touch-ui #travel-window{box-sizing:border-box;left:50%;top:50%;transform:translate(-50%,-50%);width:720px;max-width:calc(100% - 20px);max-height:calc(100% - 40px);min-height:0;padding:18px;overflow:auto;z-index:60}#travel-window h2{font-size:16px;margin:0 32px 6px 0}#travel-description{font-size:11px;margin:4px 0}#world-atlas{display:block;width:100%;height:auto;max-height:48vh;touch-action:manipulation;cursor:crosshair;border:1px solid #766c4d}#atlas-message{font-size:11px;margin:6px 0;color:#d5c399}.atlas-tools{display:flex;align-items:center;gap:8px;margin:6px 0}.atlas-tools button{padding:3px 8px;font-size:11px}#atlas-scale{flex:1;text-align:center;color:#b9c29f;font-size:11px}#atlas-landmarks,#travel-list{display:flex;flex-wrap:wrap;gap:4px}#atlas-landmarks button,#travel-list button{width:auto;min-height:25px;padding:4px 7px;margin:0;font-size:10px}#travel-list{margin:6px 0}#travel-window>small{font-size:10px;color:#a8a18b}
#merchant,.touch-ui #merchant{width:430px;max-width:calc(100% - 20px);max-height:calc(100% - 40px);overflow:auto;padding:20px;box-sizing:border-box;z-index:65}#merchant h2{font-size:17px;margin:0 32px 8px 0}#merchant-intro{font-size:11px;line-height:1.6}#merchant .equipment-shop{max-height:220px}#merchant .equipment-shop>div{gap:6px;border-bottom:1px solid #383b2c;min-height:38px}#merchant .equipment-shop button{font-size:11px;padding:5px}#merchant .item-icon{width:26px;height:26px;object-fit:contain}#merchant-balance{color:#e2cb8f;font-size:12px}#merchant-feedback{color:#f0b092;min-height:1.6em;font-size:12px}#merchant-tabs{display:flex;gap:8px;margin:8px 0}#merchant-tabs button{padding:6px 12px}#merchant-tabs [aria-pressed=true]{color:#ffe49b}#sell-list{display:grid;gap:4px;max-height:240px;overflow:auto}#sell-list button{text-align:left;display:flex;align-items:center;gap:8px;min-height:38px;padding:6px;font-size:11px}
#trade-confirm{position:sticky;bottom:0;background:#141911;border:1px solid #887449;padding:10px;margin-top:8px;z-index:4;font-size:12px}#trade-confirm p{margin:2px 0 8px}#trade-confirm button{padding:7px 12px;margin-right:8px}#trade-confirm button:disabled{opacity:.5}#trade-confirm-note{display:block;color:#f6b298;font-size:11px;margin:4px 0}
#side-quest-journal{border-top:1px solid #6d6145;margin-top:18px;padding-top:10px}#side-quest-journal h3{font-size:14px;color:#dbc48f}#side-quest-journal>p{font:11px/1.7 SimSun;color:#aca48b}.side-quest{padding:10px 0;border-bottom:1px solid #4d4937}.side-quest summary{cursor:pointer;font-size:12px;color:#dfce9c}.side-quest p{font:12px/1.7 SimSun;color:#beb69e}.side-quest small{font-size:11px;color:#ccbb8b}.side-quest-actions{display:flex;gap:6px;margin-top:8px}.side-quest-actions button{padding:6px 10px;font-size:11px}#item-popup pre{white-space:pre-wrap;font:inherit;overflow-wrap:anywhere}
.touch-ui #player-status{width:160px;height:67px;left:6px;top:6px;padding:5px;gap:4px}.touch-ui #player-status .portrait{width:23px;height:42px}.touch-ui #world-conditions{top:77px;left:6px;max-width:190px;font-size:9px;padding:2px 5px}.touch-ui #minimap-button{top:6px;right:6px;width:84px;height:83px}.touch-ui #minimap{width:74px;height:51px}.touch-ui .quest-track{top:102px;left:6px;max-width:160px;font-size:9px}.touch-ui #mobile-nav{top:98px;right:6px;gap:2px;grid-template-columns:repeat(2,44px)}.touch-ui #mobile-nav button{border-image-width:3px}.touch-ui #mobile-pause{top:6px;right:96px;left:auto;border-image-width:3px}
.touch-ui #mobile-item-bar{border-image-width:4px;padding:3px;gap:2px}.touch-ui #mobile-item-bar button{padding:4px;width:44px;height:44px}.touch-ui #mobile-item-bar img{width:27px;height:27px}.touch-ui #mobile-actions{width:150px;height:150px;right:8px;bottom:12px}.touch-ui #mobile-actions #mobile-attack{width:64px;height:64px}.touch-ui #mobile-slaying{left:76px;bottom:76px}.touch-ui #mobile-heal{left:29px;bottom:57px}.touch-ui #touch-joystick{width:96px;height:96px;left:8px;bottom:16px}
.mobile-layout-handle{display:none}.touch-ui .mobile-layout-handle{display:block;position:absolute!important;left:-15px!important;top:-14px!important;bottom:auto!important;right:auto!important;min-width:28px!important;min-height:28px!important;width:28px!important;height:28px!important;border-radius:4px!important;padding:0!important;touch-action:none!important;font:16px Arial!important;opacity:.85;z-index:3;background:#1b2018ed!important;border:1px solid #8c7d55!important}
.touch-ui #touch-joystick>.mobile-layout-handle{left:0!important;top:-28px!important}
.touch-ui #item-popup{padding:13px;width:310px;font-size:12px}.touch-ui #item-popup .item-popup-close{min-width:44px;min-height:44px}.touch-ui #inventory{width:390px;height:390px}.touch-ui #inventory #bag-grid{grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:40px;gap:3px}.touch-ui #inventory #equip-button,.touch-ui #inventory #discard-button{height:44px;bottom:10px}.touch-ui #inventory #equip-destination{height:40px;bottom:12px;width:140px}.touch-ui #inventory #bag-close{width:44px;height:44px}.touch-ui #inventory #capacity,.touch-ui #inventory #gold-bag{bottom:66px}.touch-ui #travel-window{padding:14px}.touch-ui #travel-window>.close-simple{position:absolute;top:8px;right:8px;margin:0;width:44px;height:44px}.touch-ui #atlas-landmarks button,.touch-ui #travel-list button{min-height:36px}.touch-ui #atlas-scale{font-size:10px}
@media(orientation:landscape){.touch-ui #mobile-nav{top:6px;right:96px;left:auto;grid-template-columns:repeat(6,44px)}.touch-ui #mobile-pause{top:54px;right:96px;left:auto}.touch-ui .quest-track{left:auto;right:6px;top:96px;max-width:150px}.touch-ui #inventory{height:calc(100% - 38px);width:430px}.touch-ui #inventory #bag-grid{grid-template-columns:repeat(8,minmax(0,1fr));grid-auto-rows:36px}.touch-ui #world-atlas{max-height:40vh}}
@media(max-width:350px){.touch-ui #inventory #equip-destination{width:112px}.touch-ui #inventory #equip-button{width:60px}.touch-ui #inventory #discard-button{right:82px;width:45px}.touch-ui #player-status{width:150px}.touch-ui #item-popup{width:calc(100% - 16px)}}
@media(prefers-reduced-motion:no-preference){.bag-slot .item-icon{transition:transform .12s}.bag-slot:hover .item-icon{transform:translateY(-2px)}#trade-confirm{animation:trade-appear .12s ease-out}@keyframes trade-appear{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}}
/* Stable controls: updating numbers never replaces a pressed button or draft input. */
#character-window.stats-view{left:50%;top:50%;width:360px;height:460px;max-height:calc(100% - 32px);transform:translate(-50%,-50%);box-sizing:border-box}
#character-window.stats-view h2{left:60px;width:240px}#character-window.stats-view #equipment{left:12px;right:12px;top:75px;bottom:12px;width:auto;height:auto;overflow-y:auto;display:block;overscroll-behavior:contain;touch-action:pan-y;padding:0 4px}
#character-window #equipment[hidden]{display:none!important}#character-window #equipment>div{height:auto;padding:0;border:0;line-height:1.5}
.stat-summary{display:flex;justify-content:space-between;gap:8px;font:12px/1.6 SimSun;padding:5px 0!important;color:#e3cf9c}.stat-summary strong{font-size:11px;font-weight:normal}.stat-hint{font:10px/1.6 SimSun;color:#a9a18c;margin:4px 0 8px}
#character-window #equipment .stat-allocation-row{display:grid;grid-template-columns:40px 1fr 30px 45px;gap:5px;align-items:center;min-height:35px;border-bottom:1px solid #4b4736;padding:3px 0;font:11px/1.4 SimSun}.stat-value{font-variant-numeric:tabular-nums;color:#d8ccab;white-space:nowrap}.stat-name{color:#c5b68e}.stat-allocation-row button{padding:0;width:28px;height:28px;color:#f2d69d;font-size:17px}.stat-allocation-row input{box-sizing:border-box;min-width:0;width:45px;height:28px;border:1px solid #6d6148;color:#e9ddbd;background:#11170f;text-align:center;font:12px Arial;padding:2px;appearance:textfield}
#equipment .stat-actions{display:flex;gap:5px;flex-wrap:wrap;margin-top:10px;padding:4px 0!important}#equipment .stat-actions button,#stat-reset-confirm button{padding:6px 9px;min-height:30px;font:11px SimSun}#stat-reset-price{font:10px/1.6 SimSun;color:#d5bd84;margin:6px 0}#stat-feedback{font:11px/1.6 SimSun;color:#f0c48f;min-height:1.6em;margin:6px 0}#stat-reset-confirm{background:#11180f;border:1px solid #887347!important;padding:8px!important;margin:8px 0;font:11px/1.7 SimSun}#stat-reset-confirm p{margin:0 0 8px}#stat-reset-confirm button+button{margin-left:8px}#equipment button:disabled{opacity:.45;cursor:default}
#atlas-encounters{font:11px/1.6 SimSun;color:#d9bc83;margin:5px 0}
.touch-ui #character-window.stats-view{width:min(360px,calc(100% - 24px));height:min(470px,calc(100% - 24px));max-height:calc(100% - 24px);transform:translate(-50%,-50%)}.touch-ui #character-window.stats-view #equipment{top:85px}.touch-ui #character-window #equipment .stat-allocation-row{min-height:42px;grid-template-columns:40px 1fr 44px 48px}.touch-ui .stat-allocation-row button{width:44px;height:40px}.touch-ui .stat-allocation-row input{width:48px;height:40px;font-size:14px}.touch-ui #equipment .stat-actions button,.touch-ui #stat-reset-confirm button{min-height:40px}
