/* Original source screen: 640×360 world + 640×120 BOTTOM. Responsive fit is NEW_IMPLEMENTATION. */
html:has(body.original-ui-v6) {
	width: 100%;
	height: 100%;
	min-width: 0;
	overflow: hidden;
	overscroll-behavior: none;
	background: #000;
}
body.original-ui-v6 {
	--native-frame-limit: 640px;
	--native-chrome-height: calc(
		62px +
		env(safe-area-inset-top, 0px) +
		env(safe-area-inset-bottom, 0px)
	);
	position: relative;
	display: grid;
	grid-template-rows: calc(44px + env(safe-area-inset-top, 0px)) minmax(0, 1fr) calc(
			18px +
			env(safe-area-inset-bottom, 0px)
		);
	width: 100%;
	max-width: none;
	height: var(--mobile-height, 100dvh) !important;
	max-height: var(--mobile-height, 100dvh);
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background: #000;
}
/* Portal/fullscreen controls are outside the original image, including embedded and fallback views. */
body.original-ui-v6 .topbar,
body.original-ui-v6.embedded .topbar,
body.original-ui-v6.lk-fullscreen .topbar {
	position: relative;
	inset: auto;
	z-index: 40;
	display: flex;
	grid-row: 1;
	width: 100%;
	max-width: none;
	height: 100%;
	min-height: 0;
	margin: 0;
	padding: env(safe-area-inset-top, 0px)
		max(4px, env(safe-area-inset-right, 0px)) 0
		max(4px, env(safe-area-inset-left, 0px));
	border: 0;
	border-radius: 0;
	background: #10110e;
	box-shadow: none;
}
body.original-ui-v6 .topbar .brand,
body.original-ui-v6 .connection > i,
body.original-ui-v6 .connection > span,
body.original-ui-v6 #helpButton,
body.original-ui-v6 .portal-link span {
	display: none;
}
body.original-ui-v6 .portal-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	height: 44px;
	min-height: 44px;
	padding: 0;
	font-size: 30px;
}
body.original-ui-v6 .portal-link::after {
	content: none;
}
body.original-ui-v6 .connection {
	gap: 0;
}
body.original-ui-v6 .connection [data-game-fullscreen] {
	height: 40px !important;
	min-height: 40px !important;
	margin: 0;
	padding: 0 5px;
}
body.original-ui-v6 .game-shell,
body.original-ui-v6 .game-shell.classic,
body.original-ui-v6.lk-fullscreen .game-shell.classic {
	position: relative;
	inset: auto;
	grid-row: 2;
	align-self: center;
	justify-self: center;
	display: block;
	width: min(
		var(--native-frame-limit),
		calc(
			100% -
			env(safe-area-inset-left, 0px) -
			env(safe-area-inset-right, 0px)
		),
		calc(
			(var(--mobile-height, 100dvh) - var(--native-chrome-height)) *
			1.3333333333
		)
	) !important;
	height: auto !important;
	min-width: 0;
	min-height: 0;
	max-width: none;
	max-height: none;
	aspect-ratio: 640 / 480;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	overflow: hidden;
	background: #000;
}
body.original-ui-v6 .game-shell .viewport {
	position: absolute;
	inset: 0 0 25% !important;
	display: block;
	flex: none;
	width: 100%;
	height: 75% !important;
	min-width: 0;
	min-height: 0 !important;
	max-height: none;
	aspect-ratio: 640 / 360;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: hidden;
}
body.original-ui-v6 #world {
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	outline-offset: -2px;
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .bottom-panel {
	position: absolute !important;
	inset: 75% 0 0 !important;
	display: block !important;
	flex: none;
	width: 100% !important;
	height: 25% !important;
	min-width: 0;
	min-height: 0 !important;
	max-width: none;
	max-height: none;
	aspect-ratio: 640 / 120;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden;
	background:
		#000 url("./assets/original/ui/primary-tfrmbottom-00.png") 0 0 / 100% 100%
		no-repeat;
	image-rendering: pixelated;
	box-shadow: none;
}
body.original-ui-v6 .game-shell .hud,
body.original-ui-v6 .game-shell .sidebar,
body.original-ui-v6 .game-shell .mobile-tabs,
body.original-ui-v6 .location,
body.original-ui-v6 .world-meta,
body.original-ui-v6 #minimap,
body.original-ui-v6 .chat-header,
body.original-ui-v6 .touch-pad,
body.original-ui-v6 .touch-attack {
	display: none !important;
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .chat-panel {
	position: absolute;
	inset: 0;
	display: block !important;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	pointer-events: none;
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .chat-log {
	flex: none;
	height: auto;
	min-height: 0;
	padding: 0;
	overscroll-behavior: contain;
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .chat-log li {
	font-size: calc(13px * var(--native-ui-scale, 1));
	line-height: calc(13px * var(--native-ui-scale, 1));
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .chat-input {
	display: block;
	flex: none;
	height: auto;
	min-height: 0;
	padding: 0;
	border: 0;
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .chat-input input {
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	padding: 0 2px;
	font-size: calc(13px * var(--native-ui-scale, 1)) !important;
	line-height: calc(17px * var(--native-ui-scale, 1));
}
body.original-ui-v6 .game-shell.classic.native-ui-v4 .legacy-actions button,
body.original-ui-v6
	.game-shell.classic.native-ui-v4
	.native-hud-actions-v4
	button {
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent !important;
	box-shadow: none;
}
body.original-ui-v6
	.game-shell.classic.native-ui-v4
	.legacy-actions
	button:hover,
body.original-ui-v6
	.game-shell.classic.native-ui-v4
	.native-hud-actions-v4
	button:hover {
	outline: none;
}
body.original-ui-v6
	.game-shell.classic.native-ui-v4
	.native-hud-actions-v4
	button:focus-visible,
body.original-ui-v6
	.game-shell.classic.native-ui-v4
	.legacy-actions
	button:focus-visible {
	outline: 1px dotted white;
	outline-offset: -1px;
}
/* Source images and every source child use the renderer's single uniform transform. */
body.original-ui-v6 .native-item-hit-v6,
body.original-ui-v6 .native-magic-hit-v6 {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent !important;
	box-shadow: none;
	color: white;
	image-rendering: pixelated;
}
body.original-ui-v6 .native-item-hit-v6:disabled,
body.original-ui-v6 .native-magic-hit-v6:disabled {
	opacity: 1;
	cursor: default;
}
body.original-ui-v6 .native-selected-v6 {
	outline: 1px dotted #fff;
	outline-offset: -1px;
}
body.original-ui-v6 .native-item-quantity-v6 {
	position: absolute;
	right: 0;
	bottom: 0;
	font:
		10px / 10px Gulim,
		"굴림",
		sans-serif;
	color: white;
	text-shadow: 1px 1px #000;
	pointer-events: none;
}
body.original-ui-v6 .native-help-text-v6,
body.original-ui-v6 .native-received-chat-v6,
body.original-ui-v6 .native-text-list-v6,
body.original-ui-v6 .native-memo-v6 {
	display: block;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #000;
	color: #fff;
	font:
		13px / 13px Gulim,
		"굴림",
		sans-serif !important;
	text-align: left;
	text-shadow: none;
	white-space: pre-wrap;
	overflow: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	resize: none;
}
body.original-ui-v6 .native-text-row-v6 {
	display: block;
	width: 100%;
	min-width: 0;
	min-height: 13px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
body.original-ui-v6 .native-received-chat-v6 {
	list-style: none;
}
body.original-ui-v6 .native-received-chat-v6 li {
	margin: 0;
	padding: 0;
	font: inherit;
	white-space: pre-wrap;
}
body.original-ui-v6 .native-received-chat-v6 .chat-name {
	margin-inline-end: 8px;
}
body.original-ui-v6 .native-received-chat-v6 time {
	margin-inline-end: 4px;
	font-size: 9px;
}
/* These are explicitly web convenience controls, positioned in portal chrome, outside source pixels. */
body.original-ui-v6 .native-convenience-tools-v6 {
	position: fixed;
	top: env(safe-area-inset-top, 0px);
	left: calc(54px + env(safe-area-inset-left, 0px));
	right: calc(94px + env(safe-area-inset-right, 0px));
	bottom: auto;
	z-index: 41;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 4px;
	height: 44px;
	max-width: none;
	margin: 0;
	padding: 0;
	overflow: auto hidden;
	scrollbar-width: none;
	white-space: nowrap;
}
body.original-ui-v6 .native-convenience-page-v6 {
	display: flex;
	align-items: center;
	gap: 3px;
}
body.original-ui-v6 .native-convenience-tools-v6 button {
	flex: 0 0 auto;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 2px 5px;
	border: 1px solid #514b3d;
	border-radius: 0;
	background: #1a1b17;
	font: 11px / 16px sans-serif;
}
body.original-ui-v6 .native-convenience-tools-v6 output {
	font: 10px / 16px sans-serif;
}
/* VCL menu captions are verified; exact target Windows system colors remain RECONSTRUCTED. */
body.original-ui-v6 .lk-item-menu-v5 {
	width: 120px;
	min-width: 0;
	padding: 2px;
	border-width: 2px;
	border-style: solid;
	border-color: #fff #404040 #404040 #fff;
	border-radius: 0;
	background: #c0c0c0;
	box-shadow: 1px 1px #000;
	color: #000;
	font:
		13px / 20px Gulim,
		"굴림",
		sans-serif;
}
body.original-ui-v6 .lk-item-menu-title-v5 {
	display: none;
}
body.original-ui-v6 .lk-item-menu-v5 button {
	display: block;
	width: 100%;
	height: 20px;
	min-width: 0;
	min-height: 20px;
	margin: 0;
	padding: 0 8px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	white-space: nowrap;
}
body.original-ui-v6 .lk-item-menu-v5 button:hover,
body.original-ui-v6 .lk-item-menu-v5 button:focus-visible {
	outline: none;
	background: #000080;
	color: #fff;
}
body.original-ui-v6 .toast {
	top: 8px;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
	margin: 0;
	padding: 5px 7px;
	overflow: auto;
	font-size: 12px;
}
body.original-ui-v6 .entry-overlay {
	padding: 4px;
	overflow: auto;
}
body.original-ui-v6 .entry-card {
	max-width: 100%;
	max-height: 100%;
	min-width: 0;
	margin: auto;
	overflow: auto;
}
body.original-ui-v6 footer {
	grid-row: 3;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	max-width: 1280px;
	height: 100%;
	min-width: 0;
	min-height: 0;
	margin: 0 auto;
	padding: 0 6px env(safe-area-inset-bottom, 0px);
	gap: 8px;
	overflow: hidden;
	font-size: 8px;
	white-space: nowrap;
}
body.original-ui-v6 footer > span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}
@media (max-width: 950px) {
	/* NEW_IMPLEMENTATION keyboard access: the existing EdChat node expands only while focused. */
	body.original-ui-v6
		.game-shell.classic.native-ui-v4
		.chat-input:focus-within {
		position: fixed !important;
		inset: auto !important;
		top: max(0px, calc(var(--mobile-height, 100dvh) - 52px)) !important;
		left: 0 !important;
		right: 0 !important;
		bottom: auto !important;
		z-index: 100;
		display: flex !important;
		align-items: center;
		gap: 2px !important;
		width: 100% !important;
		height: 48px !important;
		min-height: 48px !important;
		margin: 0 !important;
		padding: 2px max(2px, env(safe-area-inset-right, 0px)) 2px
			max(2px, env(safe-area-inset-left, 0px)) !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: #000 !important;
		opacity: 1 !important;
		pointer-events: auto !important;
	}
	body.original-ui-v6
		.game-shell.classic.native-ui-v4
		.chat-input:focus-within
		input {
		flex: 1 1 0;
		width: 0;
		height: 44px;
		min-width: 0;
		min-height: 44px;
		padding: 0 4px;
		font-size: 16px !important;
		line-height: 22px;
	}
	body.original-ui-v6
		.game-shell.classic.native-ui-v4
		.chat-input:focus-within
		> button {
		display: block !important;
		flex: 0 0 44px;
		width: 44px;
		height: 44px;
		min-width: 44px;
		min-height: 44px;
		margin: 0;
		padding: 0 2px;
		border: 1px solid #808080;
		border-radius: 0;
		background: #1a1b17;
		color: white;
		font-size: 11px;
		line-height: 14px;
		white-space: normal;
	}
}
@media (min-width: 1280px) and (min-height: 1022px) {
	body.original-ui-v6 {
		--native-frame-limit: 1280px;
	}
}
