/* Keep xdat art at native resolution; adapt hit areas and scroll native windows instead of zooming the desktop. */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { overscroll-behavior: none; }
.screen { inset: auto; left: var(--app-left, 0px); top: var(--app-top, 0px); width: var(--app-width, 100vw); height: var(--app-height, 100dvh); }
button, a, [role='button'], input, select, textarea { touch-action: manipulation; }
button, [role='button'] { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.ui-scroll, .lobby-screen { overscroll-behavior: contain; }
.mobile-dock, .mobile-panel, .mobile-window-head, .mobile-hud-open { display: none; }
.mobile-native-surface { display: contents; }
.ui-root { --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px); --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); }
.ui-native-drag-head { z-index: 50; touch-action: none; cursor: grab; }
.ui-native-drag-head:active { cursor: grabbing; }
.ui-overflow-window { overflow: auto; overscroll-behavior: contain; }
.ui-overflow-window > .ui-frame-head, .ui-overflow-window > .mobile-native-surface > .ui-frame-head { position: sticky; top: 0; }
.ui-window[data-name='ShortcutWnd'] > .mobile-native-surface > .ui-Window { pointer-events: auto; }
.mobile-panel { position: absolute; z-index: 3001; left: max(6px, env(safe-area-inset-left)); right: max(6px, env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom)); max-height: calc(100% - 140px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; padding: 12px; border: 1px solid #86795b; background: #171914 url('../assets/ui/tex/l2ui_ch3/scrollbar/scrollbarback.png') right top / 12px 8px repeat-y; color: #eee8cf; font: 14px/1.5 Tahoma, Arial, sans-serif; pointer-events: auto; box-shadow: 0 8px 24px #0009; }
.mobile-panel h2 { margin: 0 0 12px; font: bold 16px/1.4 Tahoma, Arial, sans-serif; overflow-wrap: anywhere; }
.mobile-panel button, .mobile-dock button, .mobile-window-head button { flex-shrink: 0; min-width: 44px; min-height: 44px; border: 1px solid #746d52; border-radius: 0; padding: 6px 10px; background: #20231c url('../assets/lobby/ui/btn1_normal.png') center / 100% 100% no-repeat; color: #f1e6c9; font: 13px/1.25 Tahoma, Arial, sans-serif; cursor: pointer; }
.mobile-panel button { display: inline-block; max-width: 100%; margin: 4px; overflow-wrap: anywhere; }
.mobile-panel button:active, .mobile-dock button:active, .mobile-window-head button:active { filter: brightness(1.3); }
.mobile-panel :focus-visible, .mobile-dock :focus-visible, .mobile-window-head :focus-visible { outline: 2px solid #e5c68b; outline-offset: -3px; }
.mobile-panel:not([hidden]) { display: block; }
.mobile-panel .ui-tip-desc { color: #d2cbbc; }
.mobile-panel [aria-pressed='true'], .mobile-dock [aria-pressed='true'] { border-color: #e5c68b; background-color: #625438; color: #fff; }
.mobile-shortcut-icon { position: relative; display: block; width: 32px; height: 32px; background-size: 32px 32px; background-repeat: no-repeat; }
.mobile-shortcut-number { position: absolute; left: 2px; top: 0; font: 10px Tahoma, sans-serif; color: #fff; text-shadow: 1px 1px #000; pointer-events: none; }
.is-compact-ui .mobile-dock { display: grid; gap: 4px; position: absolute; z-index: 3000; bottom: env(safe-area-inset-bottom, 0px); left: max(4px, env(safe-area-inset-left)); right: max(4px, env(safe-area-inset-right)); padding: 4px; background: #141610ed; border: 1px solid #746d52; pointer-events: auto; }
.mobile-shortcuts, .mobile-tools { display: flex; gap: 8px; min-width: 0; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.mobile-shortcuts button { position: relative; display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 5px; background-image: url('../assets/ui/tex/l2ui_ch3/inventorywnd/inventory_outline.png'); }
.is-compact-ui .mobile-collapsed { display: none !important; }
.is-compact-ui .mobile-scroll-window { overflow: auto; overscroll-behavior: contain; background: #171914; border: 1px solid #746d52; box-shadow: 0 6px 20px #0007; touch-action: pan-x pan-y; pointer-events: auto; }
.is-compact-ui .mobile-scroll-window .mobile-native-surface { display: block; position: absolute; left: 0; top: 44px; pointer-events: auto; }
.is-compact-ui .mobile-scroll-window .mobile-native-surface > .ui-frame-head { display: none; }
.is-compact-ui .mobile-scroll-window .mobile-window-head { display: flex; position: sticky; top: 0; left: 0; z-index: 100; height: 44px; background: #20231c; border-bottom: 1px solid #746d52; }
.is-compact-ui .mobile-window-head button { min-width: 44px; padding: 6px 8px; }
.is-compact-ui .mobile-window-head button:first-child { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; touch-action: none; }
.is-compact-ui .mobile-scroll-window .ui-edit-input, .is-compact-ui .mobile-scroll-window .ui-combo-select { min-height: 44px; font-size: 16px; }
.is-compact-ui .mobile-scroll-window .ui-tab { flex-shrink: 0; min-width: 44px; min-height: 44px; justify-content: center; }
.is-compact-ui .mobile-scroll-window .ui-itemgrid { grid-auto-rows: 44px !important; gap: 8px !important; padding: 0 !important; overflow: auto; }
.is-compact-ui .mobile-scroll-window .ui-slot { width: 44px !important; height: 44px !important; touch-action: pan-x pan-y; }
.is-compact-ui .mobile-scroll-window .ui-slot-icon, .is-compact-ui .mobile-scroll-window .ui-slot-bg { left: calc(50% - 16px) !important; top: calc(50% - 16px) !important; width: 32px !important; height: 32px !important; }
.is-compact-ui .mobile-scroll-window .ui-list-row, .is-compact-ui .mobile-scroll-window .ui-tree-row { min-height: 44px; padding-block: 10px; }
.is-compact-ui .mobile-scroll-window .ui-status-row { gap: 8px; margin-bottom: 8px; }
.is-compact-ui .mobile-scroll-window .ui-status-icon { min-width: 44px; min-height: 44px; background-size: 32px 32px; background-position: center; background-repeat: no-repeat; }
.is-compact-ui .mobile-scroll-window .ui-html .h-link { display: inline-flex; align-items: center; min-height: 44px; padding: 4px; }
.is-compact-ui .mobile-scroll-window .ui-html .h-button { min-width: 44px; min-height: 44px; }
.is-compact-ui .mobile-scroll-window .ui-html input, .is-compact-ui .mobile-scroll-window .ui-html select { min-height: 44px; font-size: 16px; }
.is-compact-ui .mobile-hud-open { display: block; position: absolute; inset: 0; z-index: 90; width: 100%; height: 100%; border: 0; background: transparent; color: transparent; }
.is-compact-ui .mobile-scroll-window .mobile-hud-open { display: none; }
.is-compact-ui .ui-tooltip { max-width: min(280px, calc(100vw - 16px)); }
@media (any-pointer: coarse) {
	input, select, textarea, .native-login-field input, .native-create input, .native-create select { font-size: 16px; }
	.ui-edit-input, .ui-combo-select, .ui-html input, .ui-html select, .ui-html textarea { font-size: 16px; }
	.lobby-button, .server-row, .native-login-field, .native-remember { min-height: 44px; }
	.native-login-field input { height: 44px; }
	.lobby-actions { gap: 8px; }
	.lobby-image-button { width: 44px; height: 44px; }
	.lobby-image-button img { width: 32px; height: 32px; margin: auto; }
}
@media (max-width: 700px), (any-pointer: coarse) and (max-width: 1100px), (any-pointer: coarse) and (max-height: 600px) {
	.lobby-screen { overflow: auto; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
	.lobby-button, .server-row { min-height: 44px; }
	.lobby-music { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); min-height: 44px; }
	.native-login { top: 44%; max-width: calc(100% - 24px); }
	.native-login-field { min-height: 44px; height: auto; }
	.native-login-field input { height: 44px; font-size: 16px; }
	.native-remember { min-height: 44px; }
	.native-login .login-button { height: 44px; }
	.native-heading { top: calc(60px + env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
	.native-select { left: max(12px, env(safe-area-inset-left)); top: calc(96px + env(safe-area-inset-top)); }
	.native-select .char-list { top: 0; height: 44px; width: 158px; }
	.native-select .char { min-height: 44px; padding: 14px 4px; }
	#char-toggle { left: 208px; top: 0; width: 44px; height: 44px; }
	#char-level-class { top: 44px; }
	.native-lobby-gauge.hp { top: 65px; }
	.native-lobby-gauge.mp { top: 85px; }
	.native-lobby-gauge.xp { top: 105px; }
	#select-sp { top: 65px; } #select-karma, .native-karma-label { top: 85px; }
	#char-details { top: 138px; }
	.native-bottom { position: absolute; bottom: 0; display: grid; gap: 8px; padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
	.native-bottom > .lobby-actions { position: static; flex-wrap: wrap; gap: 8px; }
	.native-bottom .select-start { width: 100%; }
	.native-bottom .lobby-button { min-width: 80px; }
	.native-create { left: max(12px, env(safe-area-inset-left)); top: calc(96px + env(safe-area-inset-top)); width: min(300px, calc(100% - 24px)); max-height: calc(100% - 280px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; }
	.native-create input, .native-create select { min-height: 44px; font-size: 16px; }
	.create-controls { bottom: max(12px, env(safe-area-inset-bottom)); }
	.lobby-image-button { width: 44px; height: 44px; }
	.select-error { bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (max-height: 550px) {
	.native-login { top: max(64px, calc(50% - 98px)); max-height: calc(100% - 72px); overflow: auto; }
	.lobby-brand { top: 0; left: 20%; }
	.lobby-brand img { width: 110px; }
	.lobby-copyright { display: none; }
	.native-create { top: 64px; max-height: calc(100% - 76px); width: min(300px, calc(100% - 200px)); }
	.create-controls { left: auto; right: max(12px, env(safe-area-inset-right)); top: 64px; bottom: max(8px, env(safe-area-inset-bottom)); transform: none; overflow: auto; align-content: start; }
	.native-heading { top: max(8px, env(safe-area-inset-top)); max-width: calc(100% - 180px); font-size: 18px !important; }
	.native-select { top: 56px; }
	.native-bottom { left: auto; width: min(270px, 44%); top: 64px; align-content: end; }
	.native-bottom > .lobby-actions { flex-direction: column; }
	.native-bottom .lobby-button { width: 100%; }
	#char-details { max-height: calc(var(--app-height, 100dvh) - 208px); overflow: auto; }
	.mobile-panel { bottom: calc(104px + env(safe-area-inset-bottom)); max-height: calc(100% - 116px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
@media (hover: none) {
	.ui-slot:hover .ui-slot-outline { opacity: 0; }
	.ui-slot.is-selected .ui-slot-outline { opacity: 1; }
	.ui-list-row:hover { background: transparent; }
	.ui-list-row.is-selected { background: rgba(176,155,121,.25); }
}
