/* ============================================
   기본 컨테이너 및 레이아웃
   PnP: style.css 미의존. font-family는 페이지 상속.
   ============================================ */
/* img-trans2 페이지: 페이지 스크롤바가 우측 콘텐츠 가리는 것 방지 */
html:has(.img-trans2) {
	scrollbar-gutter: stable;
}
.container {
	text-align: center;
	background: white;
	border-radius: 8px;
}

h2 {
	margin: 0 0 10px 0;
}

/* ============================================
   언어 선택 관련
   ============================================ */
.language-selection {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 6px;
	flex-wrap: wrap;
}

.language-select {
	position: relative;
	display: flex;
	align-items: center;
	margin-right: 10px;
	flex-wrap: nowrap;
}

.language-select-right {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: nowrap;
}

/* 슬롯($imgTransSlotAfterRefresh): 새로고침 오른쪽 배치 시 여백 */
.language-selection > .h3-title {
	margin-left: 12px;
	margin-bottom: 0;
}

.language-select .selected {
	border: 1px solid #ccc;
	padding: 5px 10px;
	padding-right: 20px;
	border-radius: 4px;
	cursor: pointer;
	background-color: #fff;
	min-width: 150px;
	max-width: 150px;
	flex-basis: 150px;
	text-align: left;
	position: relative;
	display: flex;
	align-items: center;
	gap: 4px;
	box-sizing: border-box;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.language-select .selected svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	fill: #434343;
}

.language-select .selected span {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.language-select .ai_model {
	width: 140px;
}

.language-select div.selected::after {
	content: "";
	background: #fff url(/chat/images/sub_layout_06.gif) no-repeat center center;
	position: absolute;
	right: 10px;
	top: calc(50% - 2px);
	width: 7px;
	height: 4px;
}

.language-select div.selected.on::after {
	transform: rotate(180deg);
}

.language-select .options.on > ul{padding: 0;margin: 0;}
.language-select .options.on.long24{display: flex !important;}
.language-select .options.on.long24 *{box-sizing: border-box;}
.language-categories{width: 100%;}
.language-select #sourceLangOptions.options.long24{left:-60%;overflow-x: hidden;}
.language-select #targetLangOptions.options.long24{left:auto;right: -200%;overflow-x: hidden;}
.language-select #sourceLangOptions.options.on.long24, .language-select #targetLangOptions.options.on.long24{flex-wrap: wrap;min-width: 685px;width: auto;padding: 0;}
.language-select #sourceLangOptions.options.on.long24 ul, .language-select #targetLangOptions.options.on.long24 ul{width:100%;display:grid;grid-template-columns:repeat(5,1fr);padding:0;margin:0;}
.language-select #sourceLangOptions.options.on.long24 ul li, .language-select #targetLangOptions.options.on.long24 ul li{padding:6px 5px 6px 10px;white-space:nowrap;}
.language-select #sourceLangOptions.options.on.long24 h5, .language-select #targetLangOptions.options.on.long24 h5{grid-column: 1 / -1;font-weight: bold;font-size: 15px;color: #000;border-top: 1px solid #ddd;background: #fafafa; cursor: auto !important;width: 100%;padding: 6px 5px 6px 10px; margin: 0;text-align:left;}
.language-select #sourceLangOptions.options.on.long24 ul:first-child, .language-select #targetLangOptions.options.on.long24 ul:first-child{border-top: 0;}
.language-select #sourceLangOptions.options.on.long24 ul:last-child, .language-select #targetLangOptions.options.on.long24 ul:last-child{grid-auto-flow: column;grid-template-rows: repeat(16, auto);}
.language-select #sourceLangOptions.options.on.long24::-webkit-scrollbar, .language-select #targetLangOptions.options.on.long24::-webkit-scrollbar{width:8px;height:8px}
.language-select #sourceLangOptions.options.on.long24::-webkit-scrollbar-track, .language-select #targetLangOptions.options.on.long24::-webkit-scrollbar-track{background:#f1f1f1;border-radius:4px}
.language-select #sourceLangOptions.options.on.long24::-webkit-scrollbar-thumb, .language-select #targetLangOptions.options.on.long24::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px;transition:background .3s ease}
.language-select #sourceLangOptions.options.on.long24::-webkit-scrollbar-thumb:hover, .language-select #targetLangOptions.options.on.long24::-webkit-scrollbar-thumb:hover{background:#a8a8a8}
.language-select #sourceLangOptions.options.on.long24::-webkit-scrollbar-thumb:active, .language-select #targetLangOptions.options.on.long24::-webkit-scrollbar-thumb:active{background:#888888}
.language-select #sourceLangOptions.options.on.long24::-webkit-scrollbar-corner, .language-select #targetLangOptions.options.on.long24::-webkit-scrollbar-corner{background:#f1f1f1}
.language-select #sourceLangOptions.options.on.long24 ul.other-languages, .language-select #targetLangOptions.options.on.long24 ul.other-languages{grid-auto-flow: column;grid-template-rows: repeat(16, auto);}

.language-select .options {position:absolute;top:calc(100% - 1px);left: auto;right:0;border:1px solid #ccc;border-radius:4px;background-color:#fff;display:none;z-index:1000;max-height:300px;overflow-y:auto;overflow-x:hidden;min-width: calc(100% - 80px);box-sizing: border-box;padding-left: 0; margin: 0;height:auto;width: auto;}
.language-select .options li {padding:6px 5px 6px 10px;cursor:pointer;transition:0.3s;box-sizing:border-box;list-style:none;text-align: left;text-shadow: 0 0 0px BLACK;white-space: nowrap;}
.language-select .options li:hover {background-color:#f0f0f0;}
.language-select #sourceLangOptions.options.on.long24 ul li, .language-select #targetLangOptions.options.on.long24 ul li{white-space: nowrap;color: #000;}
.language-select #sourceLangOptions.options.on.long24 ul li span, .language-select #targetLangOptions.options.on.long24 ul li span{font-size: 13px;color: #777;display: block;margin-left: 0px;}
.language-select #sourceLangOptions.options.on.long24 ul:nth-child(2) span, .language-select #targetLangOptions.options.on.long24 ul:nth-child(2) li span{display: inline-block;}

@media screen and (max-width: 768px){
	.language-selection{width: 100%;justify-content: center;}
	.language-select{margin-right:10px;}
	.language-select > span{width:60px;}
	#translatePageBtn{margin-right:0;padding:5px 10px;}
	#compareBtn{padding:5px 10px;}
	.language-select .options{left:60px;width: calc(100% - 60px);}
	#webpageUrl{width:32%;}
}

.language-select .options {
	position: absolute;
	top: calc(100% - 1px);
	border: 1px solid #ccc;
	border-radius: 4px;
	background-color: #fff;
	display: none;
	z-index: 1000;
	max-height: 300px;
	overflow-y: auto;
	min-width: calc(100% - 80px);
	box-sizing: border-box;
	padding-left: 0;
	margin: 0;
}

.language-select .options ul {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
}

.language-select .options li {
	padding: 6px 5px 6px 10px;
	cursor: pointer;
	transition: 0.3s;
	box-sizing: border-box;
	list-style: none;
	text-align: left;
}

.refresh-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	text-decoration: none;
	color: #007BFF;
	font-size: 13px;
	white-space: nowrap;
	transition: color 0.2s;
	flex-shrink: 0;
}

.refresh-link:hover {
	color: #0056b3;
	text-decoration: underline;
}

.refresh-link img {
	margin: 0;
}

/* ============================================
   업로드 영역
   ============================================ */
#upload-area {
	padding: 20px;
	margin-bottom: 10px;
	position: relative;
	height: 150px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px dashed #e0e6ed;
	border-radius: 16px;
	box-sizing: border-box;
	transition: all .3s ease;
	background: #fff;
}

#upload-area:hover {
	border-color: #007bff;
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
}

#upload-area.dragover {
	border-color: #007bff;
	background: linear-gradient(135deg, #e8f0ff 0%, #d0e0ff 100%);
	box-shadow: 0 12px 30px rgba(0, 123, 255, 0.2);
}

#upload-area #fileElem {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100% !important;
	opacity: 0;
}

#upload-button {
	background: none;
	border: none;
	padding: 10px 20px;
	padding-top: 0;
	border-radius: 4px;
	cursor: pointer;
	text-align: center;
}

#upload-button p {
	margin: 4px 0 0;
	color: #666;
}

#upload-button .upload-icon {
	width: 40px;
	height: 40px;
	object-fit: contain;
	display: block;
	margin: 0 auto 8px;
}

/* ============================================
   결과 컨테이너 및 그리드 레이아웃
   ============================================ */
#result-container {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	width: 100%;
	align-items: start;
	margin-top: 10px;
}

#result-container[data-view-mode="init"] .translated-panel-bar { display: none !important; }
#result-container[data-view-mode="init"] > .result-col-original { grid-column: 1 / -1; display: flex; }
#result-container[data-view-mode="init"] > .result-col-translated { display: none !important; }

#result-container[data-view-mode="translated"] .translated-panel-bar { display: grid !important; }
#result-container[data-view-mode="translated"] > .result-col-original { display: none !important; }
#result-container[data-view-mode="translated"] > .result-col-translated { grid-column: 1 / -1; display: flex; }

#result-container[data-view-mode="original"] .translated-panel-bar { display: grid !important; }
#result-container[data-view-mode="original"] > .result-col-original { grid-column: 1 / -1; display: flex; }
#result-container[data-view-mode="original"] > .result-col-translated { display: none !important; }

#result-container[data-view-mode="compare"] .translated-panel-bar { display: grid !important; }
#result-container[data-view-mode="compare"] > .result-col-original,
#result-container[data-view-mode="compare"] > .result-col-translated { display: flex; }

.translated-panel-bar {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: minmax(180px, auto) minmax(0, 1fr) minmax(180px, auto);
	align-items: center;
	gap: 12px;
	padding: 4px 6px;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
	box-sizing: border-box;
}

.translated-panel-bar-left,
.translated-panel-bar-center,
.translated-panel-bar-right {
	display: flex;
	align-items: center;
	min-width: 0;
}

.translated-panel-bar-center {
	justify-content: center;
}

.translated-panel-bar-right {
	justify-content: flex-end;
}

.translated-panel-nav {
	display: none;
	align-items: center;
	gap: 6px;
}

#result-container[data-view-mode="translated"] .translated-panel-nav,
#result-container[data-view-mode="original"] .translated-panel-nav,
#result-container[data-view-mode="compare"] .translated-panel-nav {
	display: inline-flex;
}

#result-container[data-view-mode="translated"] > .result-col-translated .button-section .nav-img.next-img,
#result-container[data-view-mode="compare"] > .result-col-translated .button-section .nav-img.next-img {
	display: none;
}

.result-view-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0;
	position: relative;
	isolation: isolate;
	border: 1px solid #d6dfeb;
	border-radius: 999px;
	background: linear-gradient(180deg, #f8fbff 0%, #edf3fa 100%);
	padding: 2px;
	user-select: none;
	touch-action: none;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 1px 2px rgba(15, 23, 42, 0.06);
	-webkit-user-select: none;
}

.result-view-toggle-thumb {
	position: absolute;
	left: 2px;
	height: calc(100% - 2px);
	border-radius: 999px;
	background:
		linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,248,255,0.98) 100%);
	border: 1px solid rgba(203, 214, 229, 0.95);
	box-shadow:
		0 10px 22px rgba(21, 101, 192, 0.12),
		0 2px 5px rgba(15, 23, 42, 0.10);
	pointer-events: none;
	z-index: 0;
	opacity: 0;
	transform: translateX(0);
	transition:
		transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
		width 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
		opacity 0.18s ease,
		box-shadow 0.2s ease;
	will-change: transform, width;
}

.result-view-toggle-thumb-grip {
	display: none;
}

.result-view-toggle.is-ready .result-view-toggle-thumb {
	opacity: 1;
}

.result-view-toggle.is-dragging .result-view-toggle-thumb {
	box-shadow:
		0 14px 26px rgba(21, 101, 192, 0.18),
		0 4px 8px rgba(15, 23, 42, 0.12);
}

.result-view-toggle.is-dragging,
.result-view-toggle.is-dragging .result-view-toggle-btn {
	cursor: grabbing;
}

.result-view-toggle-btn {
	position: relative;
	z-index: 1;
	border: 0;
	background: transparent;
	color: #5b6472;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	padding: 9px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition:
		color 0.18s ease,
		transform 0.18s ease,
		opacity 0.18s ease;
	white-space: nowrap;
}

.result-view-toggle-btn:hover:not(:disabled) {
	color: #1f2937;
	transform: translateY(-1px);
}

.result-view-toggle-btn.active {
	color: #1565c0;
}

.result-view-toggle-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

/* result-col: 원본|번역 2열 구조 (images-wrapper/buttons-wrapper 대체) */
#result-container > .result-col {
	display: flex;
	flex-direction: column;
	min-width: 0;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	/* padding: 12px; */
	box-sizing: border-box;
}
#result-container > .result-col-span {
	grid-column: 1 / -1;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	padding: 12px;
	box-sizing: border-box;
}

/* 기존 images-wrapper (레거시 호환) */
.images-wrapper {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	width: 100%;
	align-items: start;
}
.images-wrapper > .master-img,
.images-wrapper > .result-img {
	width: 100%;
	display: flex;
	flex-direction: column;
}

/* ============================================
   buttons-wrapper (버튼 영역) / result-col 내 button-section
   ============================================ */
.buttons-wrapper {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 20px;
	width: 100%;
	align-items: center;
}

.buttons-wrapper .button-section,
#result-container .result-col .button-section {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-width: 0;
	overflow: visible;
	margin: 6px 0;
}

.buttons-wrapper .button-section .dw-box,
#result-container .result-col .button-section .dw-box {
	display: flex;
	margin-top: 0;
	position: relative;
	width: 100%;
	align-items: center;
	min-height: 44px;
	min-width: 0;
	container-type: inline-size;
	container-name: dw-box;
}

/* source: 다운로드 버튼만 단독 중앙 정렬 */
.buttons-wrapper .source-button-section .dw-box,
#result-container .result-col .source-button-section .dw-box {
	justify-content: center;
}
.buttons-wrapper .source-button-section .btn-group-source,
#result-container .result-col .source-button-section .btn-group-source {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex: 0 1 auto;
	min-width: 0;
	position: relative;
	z-index: 2;
}
.buttons-wrapper .source-button-section .btn-group-source > *,
#result-container .result-col .source-button-section .btn-group-source > * {
	flex: 0 1 auto;
	min-width: 0;
}

/* target: btn-group-target 중앙 정렬, next-img 우측 고정 */
.buttons-wrapper .target-button-section .dw-box,
#result-container .result-col .target-button-section .dw-box {
	justify-content: space-between;
}
.buttons-wrapper .target-button-section .btn-group-target,
#result-container .result-col .target-button-section .btn-group-target {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: 1;
	min-width: 0;
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	position: relative;
	z-index: 2;
}
/* 좌우 그룹: 자연 크기, 공간 부족 시 축소 (space-between으로 가운데 여백) */
.buttons-wrapper .target-button-section .btn-group-target > *,
#result-container .result-col .target-button-section .btn-group-target > * {
	flex: 0 1 auto;
	min-width: 0;
}
.buttons-wrapper .target-button-section .btn-group-target::-webkit-scrollbar,
#result-container .result-col .target-button-section .btn-group-target::-webkit-scrollbar {
	display: none;
}
.buttons-wrapper .target-button-section .download-btn,
.buttons-wrapper .target-button-section .nav-img,
#result-container .result-col .target-button-section .download-btn,
#result-container .result-col .target-button-section .nav-img {
	white-space: nowrap;
	height: auto;
}
/* 버튼 36px, status-select 26px 고정 (축소 시 width만 변경) */
.buttons-wrapper .button-section .dw-box .download-btn,
#result-container .result-col .button-section .dw-box .download-btn {
	height: 36px;
	min-height: 36px;
	box-sizing: border-box;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;  /* 텍스트 세로 정중앙 */
}
.buttons-wrapper .button-section .dw-box .status-select,
#result-container .result-col .button-section .dw-box .status-select {
	height: 26px;
	min-height: 26px;
	box-sizing: border-box;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
/* nav-img는 축소 제외 (좌우 끝 고정) */
.buttons-wrapper .button-section .dw-box .nav-img,
#result-container .result-col .button-section .dw-box .nav-img {
	flex: 0 0 auto;
}

.buttons-wrapper .button-section .dw-box .status-select,
#result-container .result-col .button-section .dw-box .status-select {
	padding: 4px 10px;
}

/* dw-box: 구간 394 / 480 / 540 */
/* base: <394px (가장 축소) */
@container dw-box (max-width: 393px) {
	.dw-box .trans-status-group .download-btn,
	.dw-box .btn-group-downloads .download-btn { font-size: 10px; padding-left: 6px; padding-right: 6px; }
	.dw-box .trans-status-group .download-btn img,
	.dw-box .btn-group-downloads .download-btn img { width: 11px; height: 11px; margin-right: 2px; }
	.dw-box .status-select { font-size: 8px !important; padding: 4px 5px; min-width: 70px;}
	.source-button-section .dw-box .download-btn { font-size: 10px; padding-left: 6px; padding-right: 6px; }
	.source-button-section .dw-box .download-btn img { width: 11px; height: 11px; margin-right: 2px; }
}
/* min-width: 394px → 394~480px */
@container dw-box (min-width: 394px) {
	.dw-box .trans-status-group .download-btn,
	.dw-box .btn-group-downloads .download-btn { font-size: 11px; padding-top: 7px; padding-bottom: 7px; padding-left: 8px; padding-right: 8px; }
	.dw-box .trans-status-group .download-btn img,
	.dw-box .btn-group-downloads .download-btn img { width: 12px; height: 12px; margin-right: 2px; }
	.dw-box .status-select { font-size: 9px !important; padding: 4px 6px; min-width: 70px;}
	.source-button-section .dw-box .download-btn { font-size: 11px; padding-top: 7px; padding-bottom: 7px; padding-left: 8px; padding-right: 8px; }
	.source-button-section .dw-box .download-btn img { width: 12px; height: 12px; margin-right: 2px; }
}
/* min-width: 480px → 480~540px */
@container dw-box (min-width: 480px) {
	.dw-box .trans-status-group .download-btn,
	.dw-box .btn-group-downloads .download-btn { font-size: 12px; padding-left: 10px; padding-right: 10px; }
	.dw-box .trans-status-group .download-btn img,
	.dw-box .btn-group-downloads .download-btn img { width: 14px; height: 14px; margin-right: 3px; }
	.dw-box .status-select { font-size: 10px !important; padding: 4px 8px; }
	.source-button-section .dw-box .download-btn { font-size: 12px; padding-left: 10px; padding-right: 10px; }
	.source-button-section .dw-box .download-btn img { width: 14px; height: 14px; margin-right: 3px; }
}
/* min-width: 540px → ≥540px */
@container dw-box (min-width: 540px) {
	.dw-box .trans-status-group .download-btn,
	.dw-box .btn-group-downloads .download-btn,
	.source-button-section .dw-box .download-btn { font-size: 14px; }
	.dw-box .status-select { font-size: 12px !important; }
	.dw-box .trans-status-group .download-btn img,
	.dw-box .btn-group-downloads .download-btn img { width: 17px; height: 17px; margin-right: 4px; }
	.source-button-section .dw-box .download-btn img { width: 17px; height: 17px; margin-right: 4px; }
}

.text-wrapper {
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
}

.text-section {
	display: flex;
	flex-direction: column;
	width: 100%;
}

.text-section #recognized-text-container,
.text-section #recognized-text,
.text-section #translated-text {
	width: 100%;
	margin-bottom: 20px;
	margin-top: 20px;
	box-sizing: border-box;
}
.text-section #recognized-text,
.text-section #translated-text {
	height: 200px;
	padding: 10px;
	border: 1px solid #ccc;
	border-radius: 5px;
	resize: none;
}

#recognized-text,
#translated-text {
	max-height: 500px;
}

.para-text-edit-container { width: 100%; }
.para-edit-block { margin-bottom: 0; }
.para-edit-block .para-edit-textarea {
  width: 100%; min-height: 1.5em; max-height: 7.5em; padding: 8px; border: 1px solid #ccc; border-radius: 4px;
  resize: none; box-sizing: border-box; overflow-y: auto; line-height: 1.4;
}
/* para-pair-row: 블록별 원문|번역 나란히 */
.para-pairs-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  grid-column: 1 / -1;
  min-height: 120px;
  max-height: min(55vh, 550px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
.para-pairs-container::-webkit-scrollbar { width: 10px; }
.para-pairs-container::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.para-pairs-container::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
.para-pairs-container::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
.para-pairs-container.hidden { display: none !important; }
.para-pairs-container:not(.has-translation) {
  width: calc(50% - 10px);
  min-width: 200px;
  align-self: start;
}
/* has-translation: block+고정높이+scroll로 스크롤바 확실히 노출 (flex는 자식 축소됨) */
.para-pairs-container.has-translation {
	display: block;
	height: min(55vh, 550px);
	overflow-y: auto;
}
.para-pairs-container.has-translation .para-pair-item {
	margin-bottom: 16px;
}
.para-pairs-container.has-translation .para-pair-item:last-child {
	margin-bottom: 0;
}
.para-pair-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.para-pair-row {
  order: 0;
  right: 4px;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 10px;
  padding: 8px;
  padding-right: 32px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
  min-width: 0;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}
.para-pairs-container:not(.has-translation) .para-pair-row {
  grid-template-columns: auto 1fr;
  width: 100%;
}
.para-pairs-container:not(.has-translation) .translated-edit-block { display: none !important; }
.para-pairs-container.manual-order .para-pair-row .para-close,
.para-pairs-container.manual-order .para-pair-row .para-edit-textarea,
.para-pairs-container.manual-order .para-pair-row .translated-edit-textarea {
  cursor: default;
}
.para-drag-handle {
  width: 18px;
  min-width: 18px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  cursor: grab;
  border-radius: 6px;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
}
.para-drag-handle::before {
  content: "";
  width: 8px;
  height: 14px;
  background-image:
    radial-gradient(circle, #7f8c8d 1px, transparent 1.2px),
    radial-gradient(circle, #7f8c8d 1px, transparent 1.2px),
    radial-gradient(circle, #7f8c8d 1px, transparent 1.2px),
    radial-gradient(circle, #7f8c8d 1px, transparent 1.2px),
    radial-gradient(circle, #7f8c8d 1px, transparent 1.2px),
    radial-gradient(circle, #7f8c8d 1px, transparent 1.2px);
  background-size: 2px 2px;
  background-repeat: no-repeat;
  background-position:
    0 0,
    6px 0,
    0 6px,
    6px 6px,
    0 12px,
    6px 12px;
}
.para-pair-item:hover .para-drag-handle,
.para-pair-item.dragging .para-drag-handle,
.para-pair-item .para-drag-handle:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.para-pair-item:hover .para-drag-handle {
  background: rgba(0, 123, 255, 0.08);
}
.para-pair-item .para-drag-handle:hover {
  background: rgba(0, 123, 255, 0.14);
}
.para-pair-item .para-drag-handle:active {
  cursor: grabbing;
}
.para-drop-indicator {
  width: 100%;
  height: 3px;
  background: #007BFF;
  border-radius: 999px;
  pointer-events: none;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.14);
}
.para-pair-row.dragging {
  opacity: 0.65;
  border-color: #66b0ff;
  background: #f5fbff;
}
.para-pair-row .para-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc3545;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
}
.para-pair-row .para-close:hover { background: #c82333; }
.para-block-index {
	font-size: 12px;
	color: #888;
	font-weight: 600;
	display: flex;
	align-items: flex-start;
}
.para-pair-row:hover { background: #fafafa; }
.para-pair-item.highlighted .para-pair-row {
  border-color: #007BFF;
  background: #f0f7ff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.2);
}
.para-pairs-container.promote-selected .para-pair-item.highlighted { order: -1; }
.para-pair-row .para-edit-block,
.para-pair-row .translated-edit-block { margin-bottom: 0; min-width: 0; }
.translated-edit-block { font-size: 14px; line-height: 1.5; }
.translated-edit-text,
.translated-edit-textarea {
  min-height: 1.5em; max-height: 7.5em; padding: 8px; border: 1px solid #e8e8e8; border-radius: 4px;
  background: #f9f9f9; white-space: pre-wrap; word-break: break-word; box-sizing: border-box;
  overflow-x: hidden; overflow-y: hidden; line-height: 1.4;
}
.translated-edit-textarea { width: 100%; resize: none; }
.translated-edit-text.translated-placeholder,
.translated-edit-textarea.translated-placeholder { color: #888; font-style: italic; }
.text-wrapper.ocr-pending { display: none !important; }

.textarea {
	width: 100%;
	height: 200px;
	margin-bottom: 20px;
	margin-top: 20px;
	padding: 10px;
	border: 1px solid #ccc;
	border-radius: 5px;
	resize: none;
}

/* ============================================
   이미지 미리보기 컨테이너
   ============================================ */
#image-preview-container,
#translated-image-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 300px;
	max-height: 3000px;
	width: 100%;
	height: auto;
	box-shadow: 0 0 2px #007BFF;
	border-radius: 5px;
	position: relative;
}

#image-preview-container {
	position: relative;
	overflow: hidden;
}
#image-zoom-pan-wrapper {
	position: relative;
	display: inline-block;
	transform-origin: center center;
}
.master-img.big #image-preview-container {
	overflow: hidden;
}

#image-preview-container::before {
	z-index: 0;
	pointer-events: none;
}

#translated-image-container {
	height: auto !important;
	overflow: hidden;
	position: relative;
}
#translated-image-container.noSize{min-height: auto !important;}
#translated-image-container::before {
	z-index: 0;
	pointer-events: none;
}

#image-preview-container::before,
#translated-image-container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(45deg, #ffffff, #f5edea, #f9edf6, #d1e3ff, #f5d8ed, #ffe8e1, #efeaea);
	background-size: 200% 200%;
	animation: gradientAnimation 5s ease infinite;
	border-radius: 10px;
}

#image-preview,
#translated-image {
	position: relative;
	z-index: 5;
	max-height: 100%;
}

#image-preview {
	background: white;
}

#translated-image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	height: auto;
}

/* ============================================
   애니메이션
   ============================================ */
@keyframes gradientAnimation {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

@keyframes fadeInOut {
	0% { opacity: 0; transform: translateY(20px); }
	20% { opacity: 1; transform: translateY(0); }
	80% { opacity: 1; transform: translateY(0); }
	100% { opacity: 0; transform: translateY(-20px); }
}

@keyframes spin {
	0% { transform: rotate(0); }
	100% { transform: rotate(360deg); }
}

/* ============================================
   버튼 스타일
   ============================================ */
.td-btns {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
}

/* para-pairs td 버튼: 버튼 박스와 아이콘 크기를 분리해서 제어 */
.img-trans2 .td-btns button {
	font-size: 14px;
	color: #fff;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	transition: 0.3s;
	background: #007BFF;
	display: inline-flex;
	justify-content: center;
	align-items: center;
	white-space: nowrap;
	padding: 0;
	width: 36px;
	height: 25px;
}

.img-trans2 .td-btns button:hover {
	background: #0f63bd;
}


.img-trans2 .td-btns .copy-btn {
	background: transparent;
}

.img-trans2 .td-btns .speak-btn img,
.img-trans2 .td-btns .stop-btn img {
	width: 16px;
	height: 16px;
	display: block;
}

.img-trans2 .td-btns .copy-btn img {
	width: 20px;
	height: 20px;
	display: block;
}

.start-btn {
	background: #007BFF;
	color: #fff;
	border: none;
	padding: 10px 18px;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.start-btn:hover {
	background: #0f63bd;
}

.download-btn {
	font-size: 14px;
	color: #fff;
	border: none;
	padding: 8px 15px;
	border-radius: 5px;
	cursor: pointer;
	transition: 0.3s;
	background: #007BFF;
	display: flex;
	justify-content: center;
	align-items: center;
}

.download-btn:hover {
	background: #0f63bd;
}

.download-btn img {
	width: 17px;
	margin-right: 4px;
}

.dw-box {
	display: flex;
	justify-content: center;
	margin-top: 35px;
	position: relative;
}

button#image-start-stop-btn {
	transition: .3s;
	height: 36px;
	padding: 0 20px;
	background: #f40;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	display: block;
	width: 100%;
}

button#image-start-stop-btn:hover {
	opacity: 0.8;
}

button#image-start-stop-btn.idle:not(:disabled) {
	background: #0056b3;
}

button#image-start-stop-btn:disabled {
	background: #bfbfbf;
}

.button-group {
	bottom: 16px;
	left: 10px;
	display: flex;
	gap: 5px;
}

/* 이미지 컨트롤 버튼 공통 스타일 */
.image-control-group {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 66;
	display: flex;
	align-items: center;
	gap: 6px;
}

.image-control-btn {
	position: relative;
	z-index: 1;
	background: #007BFF;
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 0;
	width: 21px;
	height: 21px;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
	transition: 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.image-control-btn:not(#windowbs):not(#translated-fullscreen-btn) {
	border: 1.5px solid #fff;
}

/*.image-control-btn:hover {
	background: #0f63bd;
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
}*/

/* add-para-btn 개별 스타일 */
#add-para-btn,
#translated-add-para-btn {
	font-size: 18px;
	line-height: 1;
	text-align: center;
	font-weight: 500;
}

#add-para-btn,
#translated-add-para-btn,
#translated-overlay-viz-btn {
	border-radius: 4px;
}

/* windowbs 개별 스타일 */
#windowbs {
	background: #007BFF url("./images/wbw.png") no-repeat center center;
	background-size: cover;
}

#windowbs.on {
	background: #007BFF url("./images/ws1w.png") no-repeat center center;
	background-size: cover;
}

/* 번역 패널: 원본과 동일 image-control-btn 스타일 (파란 배경, 흰색, 흰색 경계) */
#translated-overlay-viz-btn {
	color: #fff;
	background: #007BFF url("./images/edit.svg") no-repeat center center;
	background-size: 12px 12px;
}
#translated-overlay-viz-btn svg { display: none; }
#translated-overlay-viz-btn.active {
	background: #0f63bd url("./images/edit.svg") no-repeat center center;
	background-size: 12px 12px;
}
#translated-fullscreen-btn {
	background: #007BFF url("./images/wbw.png") no-repeat center center;
	background-size: cover;
}
#translated-fullscreen-btn.on {
	background: #007BFF url("./images/ws1w.png") no-repeat center center;
	background-size: cover;
}

/* ============================================
   진행 상태 및 알림
   ============================================ */
#recognition-progress {
	width: 90%;
	height: 20px;
	margin-top: 10px;
	position: absolute;
	left: 5%;
	bottom: 5px;
	transition: 0.3s;
}

#status-text {
	position: absolute;
	bottom: 35px;
	text-align: center;
	font-weight: bold;
	color: #007BFF;
}

.progress-bar {
	width: 100%;
	height: 30px;
	background-color: #f3f3f3;
	border-radius: 4px;
	overflow: hidden;
	position: relative;
	display: flex;
	align-items: center;
}

/* 번역 시작 전(0%): 채움 색 없음 — 진행률이 올라갈 때만 .has-fill로 색상 표시 */
.progress-bar-inner {
	height: 100%;
	min-width: 0;
	background-color: transparent;
	text-align: left;
	line-height: 28px;
	padding: 0 8px;
	color: transparent;
	border-radius: 4px;
	font-size: 12px;
	transition: width 0.5s ease, background-color 0.2s ease, color 0.2s ease;
	box-sizing: border-box;
}
.progress-bar-inner.has-fill {
	min-width: 2.5em;
	background-color: #007bff;
	color: #fff;
}

.progress-bar .tit {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	font-size: 14px;
	font-weight: 700;
	pointer-events: none;
	white-space: nowrap;
	z-index: 2;
}

.progress-barAll {
	width: 100%;
}

.toast-message,
.volume-toast {
	position: fixed;
	bottom: 30px;
	right: 30px;
	padding: 12px 24px;
	background: rgba(0, 123, 255, .9);
	color: #fff;
	border-radius: 25px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, .2);
	font-family: Arial, sans-serif;
	font-size: 16px;
	opacity: 0;
	animation: fadeInOut 1s ease;
	z-index: 1000;
}

.spinner {
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-right: 6px;
	border: 2px solid #fff;
	border-top: 2px solid #999;
	border-radius: 50%;
	animation: spin .8s linear infinite;
	vertical-align: middle;
}

/* translated-image-mask 내부에서만 비례 크기 적용 */
.translated-image-mask .loading {
	position: absolute;
	width: min(20%, 96px);
	height: min(20%, 96px);
	min-width: 24px;
	min-height: 24px;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

/* 마스크 밖의 .loading은 기존 고정 크기 유지 */
.loading {
	position: absolute;
	width: 48px;
	height: 48px;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

.translated-image-mask .loading img {
	display: none;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* ============================================
   텍스트 영역
   ============================================ */
pre {
	margin: 0;
	width: 100%;
	height: 100%;
	line-height: 140%;
	border: 1px solid #ddd;
	border-radius: 4px;
	white-space: pre;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-y: auto;
	overflow-x: hidden;
}

textarea#userInput {
	margin: 0;
	width: 100%;
	height: 100%;
	line-height: 140%;
	border: 0;
	border-bottom: 1px solid #ddd;
	resize: none;
	white-space: pre;
	white-space: pre-wrap;
	word-wrap: break-word;
}

/* ============================================
   이미지 전송 레이아웃
   ============================================ */
.img-trans2 {
	display: flex;
	width: 100%;
	font-family: inherit;
	padding-right: 17px; /* 페이지 스크롤바(~17px)에 콘텐츠 가려짐 방지 */
	box-sizing: border-box;
}

.img-trans2 .container {
	width: 100%;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
}

.img-trans2.mw100 .container {
	max-width: 100%;
}

.img-trans2 .control {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	text-align: center;
}

.img-trans2 .control .tit {
	font-size: 20px;
	font-weight: 700;
	width: 100%;
}

.img-trans2 .control .txt {
	width: 100%;
}

.img-trans2-tp {
	display: flex;
	flex-direction: column;
}
.img-trans2-tp-row {
	display: grid;
	grid-template-columns: 7fr 3fr;
	grid-template-rows: auto auto;
	gap: 0px 10px;
	align-items: center;
}
.img-trans2-tp-row .language-selection { grid-column: 1; grid-row: 1; }
.img-trans2-tp-row .progress-barAll { grid-column: 2; grid-row: 1; min-width: 200px; }
.img-trans2-tp-row #urlInputWrap { grid-column: 1; grid-row: 2; }
.img-trans2-tp-row .control-btn-wrap { grid-column: 2; grid-row: 2; display: flex; align-items: center; }
.img-trans2-tp-row #upload-area {
	grid-column: 1;
	grid-row: 3;
	width: 100%;
	margin-top: 8px;
}

.result-img {
	position: relative;
}

.translated-image-mask {
	display: none;
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
}

.translated-image-mask::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	background: white;
	border-radius: 5px;
}

.translated-image-mask span {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	text-align: center;
	font-size: 25px;
	font-weight: 700;
	color: #fff;
	text-shadow: 0px 0px 4px #000;
	position: relative;
}

#translated-image-container .translated-image-mask .box {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	position: relative;
	font-size: 20px;
	font-weight: 700;
	color: #fff;
	text-shadow: 0px 0px 4px #000;
	z-index: 1;
}

#translated-image-container .translated-image-mask .box .start-btn {
	position: absolute;
	top: 30%;
	left: 50%;
	transform: translateX(-50%);
}

/* ============================================
   볼륨 컨트롤
   ============================================ */
.volume-control {
	display: flex;
	align-items: center;
	gap: 5px;
}

.volume-icon {
	width: 20px !important;
	height: 20px !important;
	filter: invert(50%);
}

/* ============================================
   전환 텍스트 스위치 + 상태 그룹
   ============================================ */
.trans-txt-switch-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}
.trans-txt-switch {
	text-align: left;
}
.trans-txt-switch-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	margin-left: auto;
}
.trans-txt-switch-actions .btn-base {
	white-space: nowrap;
}
/* trans-status-group / btn-group-downloads: space-between으로 좌측·우측 정렬, 충돌 시 축소 */
#result-container .trans-status-group {
	display: flex;
	align-items: center;
	margin-left: 6px;
	gap: 6px;
	min-width: 0;
	flex: 0 1 auto;
}
#result-container .btn-group-downloads {
	display: flex;
	align-items: center;
	margin-right: 6px;
	gap: 6px;
	min-width: 0;
	flex: 0 1 auto;
}
#result-container .trans-status-group .status-select {
	flex: 1 1 0;
	min-width: 70px;
	width: auto;
	border-radius: 5px;
}
#result-container .trans-status-group .download-btn {
	flex: 0 1 auto;
	min-width: 2.5em;
	white-space: nowrap;
}
#result-container .btn-group-downloads .download-btn {
	flex: 0 1 auto;
	min-width: 2.5em;
	white-space: nowrap;
}

.trans-txt-switch a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 18px;
	position: relative;
	padding: 8px 40px 8px 12px;
	border-radius: 8px;
	transition: background 0.2s ease;
}

.trans-txt-switch a:hover {
	background: rgba(0, 0, 0, 0.04);
}

.trans-txt-switch a::after {
	content: "";
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23434343' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat center;
	background-size: contain;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trans-txt-switch a.on::after {
	transform: translateY(-50%) rotate(180deg);
}

/* trans-txt-collapsible: Grid 0fr→1fr 접기/펼치기 */
.trans-txt-collapsible {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.trans-txt-collapsible.open {
	grid-template-rows: 1fr;
}
.trans-txt-collapsible-inner {
	min-height: 0;
	overflow: hidden;
}
/* 펼쳤을 때 trans-txt-switch-row와 para-pairs-toolbar 사이 경계 */
.trans-txt-collapsible.open .trans-txt-collapsible-inner {
	border-top: 1px solid #e8e8e8;
	margin-top: 8px;
	padding-top: 8px;
}

/* para-pairs-toolbar: 3열 grid [자동정렬|원문|번역], 반영하기는 레거시로 숨김 유지 */
.para-pairs-toolbar {
	display: grid;
	grid-template-columns: auto 1fr 1fr;
	gap: 16px;
	align-items: center;
	margin-top: 12px;
	margin-bottom: 8px;
}
.para-pairs-toolbar #para-order-toggle-btn { grid-column: 1; justify-self: start; margin-left: 25px }
.para-pairs-toolbar .para-source-label { grid-column: 2; margin-right: 14%}
.para-pairs-toolbar .para-target-label { grid-column: 3; margin-right: 7%}
.para-pairs-toolbar #rerender-btn { display: none !important; }
.translated-panel-toolbar-edit {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 36px;
	padding: 2px 0 4px;
}
.translated-panel-toolbar-edit .toolbar-hint {
	font-size: 12px;
	color: #777;
}
.translated-panel-toolbar-edit .toolbar-select,
.translated-panel-toolbar-edit .toolbar-number,
.translated-panel-toolbar-edit .toolbar-toggle {
	height: 32px;
	border: 1px solid #d7dbe3;
	border-radius: 8px;
	background: #fff;
	color: #333;
	padding: 0 10px;
	font-size: 12px;
	box-sizing: border-box;
	line-height: 30px;
}
.translated-panel-toolbar-edit .toolbar-select:disabled,
.translated-panel-toolbar-edit .toolbar-number:disabled,
.translated-panel-toolbar-edit .toolbar-toggle:disabled,
.translated-panel-toolbar-edit .toolbar-color:disabled,
.translated-panel-toolbar-edit .toolbar-align-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	background: #f8fafc;
	color: #94a3b8;
}
.translated-panel-toolbar-edit .toolbar-select {
	max-width: 150px;
	padding-right: 32px;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 4.2L6 8l3.8-3.8' fill='none' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px 12px;
}
.translated-panel-toolbar-edit .toolbar-number {
	width: 64px;
}
.translated-panel-toolbar-edit .toolbar-toggle {
	min-width: 32px;
	padding: 0 8px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
}
.translated-panel-toolbar-edit .toolbar-toggle strong {
	font-weight: 700;
}
.translated-panel-toolbar-edit .toolbar-toggle.active {
	border-color: #0f63bd;
	background: rgba(15, 99, 189, 0.12);
	color: #0f63bd;
}
.translated-panel-toolbar-edit .toolbar-color {
	width: 36px;
	height: 32px;
	border: 1px solid #d7dbe3;
	border-radius: 8px;
	padding: 4px 6px 5px;
	background: #fff;
	cursor: pointer;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	line-height: 1;
	flex: 0 0 auto;
}
.translated-panel-toolbar-edit .toolbar-color-label {
	display: block;
	font-size: 14px;
	line-height: 1;
	font-weight: 700;
	color: #111827;
	flex: 0 0 auto;
}
.translated-panel-toolbar-edit .toolbar-color-icon-fixed {
	display: block;
	width: 16px;
	height: 14px;
	flex: 0 0 auto;
	background-color: #111827;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	-webkit-mask-image: var(--toolbar-color-icon-mask);
	mask-image: var(--toolbar-color-icon-mask);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}
.translated-panel-toolbar-edit .toolbar-color-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}
.translated-panel-toolbar-edit .toolbar-color-wrap:has(.toolbar-color:disabled) .toolbar-color-popover {
	display: none !important;
}
.translated-panel-toolbar-edit .toolbar-color-swatch {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 4px;
}
.translated-panel-toolbar-edit .toolbar-color-swatch-bar {
	width: 100%;
	height: 6px;
	padding: 2px 0px;
	border-radius: 999px;
	border: 1px solid rgba(15, 23, 42, 0.08);
	background-clip: padding-box;
}
.translated-panel-toolbar-edit .toolbar-color-swatch-bar.is-transparent {
	background-image:
		linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
		linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
		linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
	background-size: 6px 6px;
	background-position: 0 0, 0 3px, 3px -3px, -3px 0;
	background-color: #fff;
}
.translated-panel-toolbar-edit .toolbar-color-swatch.is-transparent,
.translated-panel-toolbar-edit .toolbar-color-preview.is-transparent {
	background-image:
		linear-gradient(45deg, #d5d9e0 25%, transparent 25%),
		linear-gradient(-45deg, #d5d9e0 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #d5d9e0 75%),
		linear-gradient(-45deg, transparent 75%, #d5d9e0 75%);
	background-size: 8px 8px;
	background-position: 0 0, 0 4px, 4px -4px, -4px 0;
	background-color: #fff;
}
.translated-panel-toolbar-edit .toolbar-color-popover {
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	width: 240px;
	padding: 12px;
	border: 1px solid #d7dbe3;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 12px 28px rgba(0,0,0,0.14);
	z-index: 80;
}
.translated-panel-toolbar-edit .toolbar-color-spectrum {
	position: relative;
	width: 100%;
	height: 116px;
	border-radius: 10px;
	overflow: hidden;
	cursor: crosshair;
	background:
		linear-gradient(to top, #000, transparent),
		linear-gradient(to right, #fff, #f00);
}
.translated-panel-toolbar-edit .toolbar-color-controls-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
}
.translated-panel-toolbar-edit .toolbar-color-hue {
	position: relative;
	flex: 1 1 auto;
	height: 16px;
	border-radius: 999px;
	background: linear-gradient(
		to right,
		#ff0000 0%,
		#ffff00 17%,
		#00ff00 33%,
		#00ffff 50%,
		#0000ff 67%,
		#ff00ff 83%,
		#ff0000 100%
	);
	cursor: ew-resize;
}
.translated-panel-toolbar-edit .toolbar-color-spectrum-cursor,
.translated-panel-toolbar-edit .toolbar-color-hue-cursor {
	position: absolute;
	pointer-events: none;
}
.translated-panel-toolbar-edit .toolbar-color-spectrum-cursor {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
	transform: translate(-50%, -50%);
}
.translated-panel-toolbar-edit .toolbar-color-hue-cursor {
	top: 50%;
	width: 6px;
	height: calc(100% + 6px);
	border-radius: 999px;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
	transform: translate(-50%, -50%);
}
.translated-panel-toolbar-edit .toolbar-color-meta {
	margin-top: 10px;
	display: grid;
	gap: 6px;
}
.translated-panel-toolbar-edit .toolbar-color-clear {
	margin-top: 10px;
	width: 100%;
	height: 32px;
	border: 1px solid #d7dbe3;
	border-radius: 8px;
	background: #f8fafc;
	color: #334155;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}
.translated-panel-toolbar-edit .toolbar-color-clear:hover {
	background: #f1f5f9;
}
.translated-panel-toolbar-edit .toolbar-color-eyedropper {
	width: 32px;
	height: 32px;
	border: 1px solid #d7dbe3;
	border-radius: 8px;
	background: #f8fafc;
	color: #334155;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}
.translated-panel-toolbar-edit .toolbar-color-eyedropper img {
	display: block;
	width: 16px;
	height: 16px;
	object-fit: contain;
}
.translated-panel-toolbar-edit .toolbar-color-eyedropper:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}
.translated-panel-toolbar-edit .toolbar-color-preview {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.16);
	flex: 0 0 auto;
}
.translated-panel-toolbar-edit .toolbar-color-meta-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 12px;
}
.translated-panel-toolbar-edit .toolbar-color-meta-label {
	color: #666;
	font-weight: 600;
}
.translated-panel-toolbar-edit .toolbar-color-code-input {
	width: 118px;
	height: 30px;
	padding: 0 10px;
	border: 1px solid #d7dbe3;
	border-radius: 8px;
	background: #f5f7fb;
	color: #334155;
	font-size: 11px;
	box-sizing: border-box;
	text-align: right;
}
.translated-panel-toolbar-edit .toolbar-align-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.translated-panel-toolbar-edit .toolbar-align-btn {
	min-width: 32px;
	height: 32px;
	border: 1px solid #d7dbe3;
	border-radius: 8px;
	background: #fff;
	color: #666;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
}
.translated-panel-toolbar-edit .toolbar-align-btn.active {
	background: #eaf3ff;
	border-color: #5a9bff;
	color: #0b63ce;
}
.translated-panel-toolbar-edit .toolbar-align-btn.active:disabled {
	background: #f8fafc;
	border-color: #d7dbe3;
	color: #94a3b8;
}
.para-pairs-toolbar .para-column-label {
	font-size: 16px;
	font-weight: bold;
	color: #666;
	text-align: center;
}
.trans-txt-collapsible-inner:not(.has-translation) .para-target-label { display: none; }

/* para-pairs-toolbar: 버튼 공통 (크기/모양) */
.para-pairs-toolbar > button {
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 8px;
	border: 1px solid;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}
.para-pairs-toolbar button:disabled {
	cursor: not-allowed;
}

/* para-pairs-toolbar: 자동 정렬 버튼 색상 */
.para-pairs-toolbar #para-order-toggle-btn {
	border-color: #ddd;
	background: #f5f5f5;
	color: #666;
	box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.para-pairs-toolbar #para-order-toggle-btn:hover {
	background: rgba(0,0,0,0.04);
	color: #333;
}
.para-pairs-toolbar #para-order-toggle-btn.active {
	background: #fff;
	color: #007BFF;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* para-pairs-toolbar: 반영하기 버튼 스타일(레거시 숨김) */
.para-pairs-toolbar #rerender-btn {
	border-color: #155724;
	background: #1e7e34;
	color: #fff;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
	margin-right: 12px;
}
.para-pairs-toolbar #rerender-btn:hover {
	background: #218838;
	border-color: #155724;
	color: #fff;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.1);
}
.para-pairs-toolbar #rerender-btn:disabled {
	opacity: 0.5;
	background: #1e7e34;
}

/* ============================================
   그리드 오버레이 (문서 분할)
   ============================================ */
#grid-overlay {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 50;
	pointer-events: auto;
}

.grid-line {
	position: absolute;
	background: rgba(15, 99, 189, .9);
	pointer-events: auto;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .7);
	z-index: 51;
}

.grid-line.vertical {
	width: 3px;
	top: 0;
	bottom: 0;
	cursor: col-resize;
}

.grid-line.horizontal {
	height: 3px;
	left: 0;
	right: 0;
	cursor: row-resize;
}

.grid-handle {
	position: absolute;
	width: 12px;
	height: 12px;
	background: #0f63bd;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	pointer-events: auto;
	cursor: move;
}

.grid-controls {
	margin-top: 10px;
	display: flex;
	width: 100%;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	overflow-x: auto;
	overflow-y: hidden;
}

.grid-controls .gc-row,
.grid-controls .gc-row-btn {
	display: flex;
	gap: 6px;
	align-items: center;
	margin-top: 0;
	flex: 0 0 auto;
}

.grid-controls .gc-row label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	line-height: 1;
	font-size: 13px;
	color: #333;
}

.grid-controls .gc-row label input[type="checkbox"] {
	margin: 0;
}

.grid-controls .gc-col-ctl {
	display: flex;
	gap: 6px;
	align-items: center;
}

.grid-controls .gc-cols-label {
	font-size: 12px;
	color: #666;
}

.grid-controls .gc-btn {
	background: #007BFF;
	color: #fff;
	border: none;
	padding: 8px 12px;
	border-radius: 5px;
	cursor: pointer;
	transition: .2s;
	font-size: 13px;
}

.grid-controls .gc-btn:hover {
	background: #0f63bd;
}

.grid-controls .gc-btn.ghost {
	background: #f0f3f8;
	color: #333;
}

.grid-controls .gc-btn.ghost:hover {
	background: #e2e8f3;
}

.grid-controls input[type="number"] {
	width: 64px;
	padding: 4px;
	border: 1px solid #ccc;
	border-radius: 4px;
}

/* ============================================
   ROI 편집 오버레이
   ============================================ */
#bbox-overlay {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 60;
	pointer-events: none;
	touch-action: none;
}

.bbox-box {
	position: absolute;
	border: 2px solid rgba(255, 0, 0, .85);
	background: rgba(255, 0, 0, .08);
	pointer-events: auto;
	cursor: move;
}

.bbox-handle {
	position: absolute;
	width: 10px;
	height: 10px;
	background: #f40;
	border-radius: 1px;
}

.bbox-handle.nw {
	left: -5px;
	top: -5px;
	cursor: nw-resize;
}

.bbox-handle.ne {
	right: -5px;
	top: -5px;
	cursor: ne-resize;
}

.bbox-handle.sw {
	left: -5px;
	bottom: -5px;
	cursor: sw-resize;
}

.bbox-handle.se {
	right: -5px;
	bottom: -5px;
	cursor: se-resize;
}

/* ============================================
   블록 및 단어 오버레이
   ============================================ */
.para-box {
	position: absolute;
	z-index: 1;
	border: 2px solid rgba(255, 0, 0, .85);
	background: rgba(0, 123, 255, .06);
	pointer-events: auto;
	cursor: move;
	transition: border-color 0.2s, background 0.2s;
	transform-origin: center center;
}

.para-box .para-close {
	position: absolute;
	right: 2px;
	top: 2px;
	width: 16px;
	height: 16px;
	border-radius: 8px;
	background: #007aff;
	color: #fff;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	line-height: 16px;
	text-align: center;
	cursor: pointer;
	z-index: 61;
}

.para-box.show-close .para-close {
	display: flex;
}

.para-box.para-excluded {
	opacity: .2;
	border-color: #999;
	background: transparent;
	pointer-events: none;
	visibility: hidden;
}

.para-box.selected {
	z-index: 10;
	border-color: #2ecc71 !important;
	background: rgba(46, 204, 113, .15) !important;
	border-width: 2px !important;
}

.para-handle {
	position: absolute;
	width: 7px;
	height: 7px;
	background: #f40;
	border-radius: 50%;
}

.para-rotate-handle {
	position: absolute;
	top: -30px;
	left: 50%;
	transform: translateX(-50%);
	width: 24px;
	height: 24px;
	background: rgba(0, 123, 255, 0.9);
	border: 2px solid white;
	border-radius: 50%;
	display: none;
	color: white;
	font-size: 16px;
	font-weight: bold;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
	user-select: none;
	z-index: 65;
	/* 가로 세로 중앙 정렬 */
	align-items: center;
	justify-content: center;
}

.para-box:hover .para-rotate-handle {
	display: flex;
}

.para-rotate-handle:active {
	background: rgba(0, 123, 255, 1);
}

.para-handle.nw {
	left: -4px;
	top: -4px;
	cursor: nw-resize;
}

.para-handle.ne {
	right: -4px;
	top: -4px;
	cursor: ne-resize;
}

.para-handle.sw {
	left: -4px;
	bottom: -4px;
	cursor: sw-resize;
}

.para-handle.se {
	right: -4px;
	bottom: -4px;
	cursor: se-resize;
}

#marquee-rect {
	position: absolute;
	border: 1px dashed #0d6efd;
	background: rgba(13, 110, 253, .08);
	pointer-events: none;
	z-index: 65;
}

#marquee-rect-translated {
	position: absolute;
	border: 1px dashed #0d6efd;
	background: rgba(13, 110, 253, .08);
	pointer-events: none;
	z-index: 65;
}

#word-overlay {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 59;
	pointer-events: none;
}

.word-box {
	position: absolute;
	border: 1px dashed rgba(0, 0, 0, .35);
	background: transparent;
	pointer-events: auto;
	transition: all 0.2s;
}

.word-box.include {
	border-color: #28a745;
	box-shadow: 0 0 0 1px rgba(40, 167, 69, .6) inset;
}

.word-box.exclude {
	border-color: #999;
	opacity: .4;
}

.word-box.in-selection {
	border-color: #17a2b8 !important;
	box-shadow: 0 0 0 2px rgba(23, 162, 184, .6) inset;
	background: rgba(23, 162, 184, 0.15) !important;
}

.word-box.include.in-selection {
	border-color: #1e9e57 !important;
	box-shadow: 0 0 0 2px rgba(30, 158, 87, .7) inset;
	background: rgba(3, 255, 242, 0.938) !important;
	opacity: 0.3;
}

#word-popover {
	position: absolute;
	z-index: 70;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .10);
	padding: 6px;
	display: none !important;
	text-shadow: none;
	font-weight: 600;
	pointer-events: none;
	opacity: 0;
}

#word-popover .btn {
	display: none;
}

/* ============================================
   이미지 모드 라디오 버튼
   ============================================ */
.image-mode-radio {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.image-mode-radio .mode-label {
	font-weight: 600;
	margin-right: 2px;
	color: #333;
	white-space: nowrap;
}

.image-mode-radio label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 3px 3px;
	border: 1px solid #ccc;
	border-radius: 4px;
	transition: all 0.2s;
	font-size: 12px;
	background: #fff;
	min-width: 42px;
	white-space: nowrap;
}

.image-mode-radio label:hover {
	border-color: #007BFF;
	background: #f0f7ff;
}

.image-mode-radio input[type="radio"] {
	display: none;
}

.image-mode-radio label:has(input[type="radio"]:checked) {
	background: #007BFF;
	color: #fff;
	border-color: #007BFF;
	font-weight: 600;
}

/* ============================================
   URL 입력 및 업로드
   ============================================ */
.flex-center {
	display: flex;
	gap: 8px;
}

.flex-1 {
	flex: 1;
}

.input-base {
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	box-sizing: border-box;
}

.btn-base {
	padding: 8px 12px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.btn-primary {
	background: #007BFF;
	color: #fff;
}

#urlInputWrap .input-base {
	padding: 0 10px;
}

#urlInputWrap .btn-base {
	display: inline-flex;
	align-items: center;
	padding: 0 12px;
}

/* ============================================
   이미지 네비게이션
   ============================================ */
.nav-img {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	cursor: pointer;
	transition: transform .15s ease;
	z-index: 1000;
	background: transparent;
}

.nav-icon {
	width: 30px;
	height: 30px;
	fill: none;
	stroke: #2563eb;
	stroke-width: 5px;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* 하단 레거시 nav-img는 has-nav-image일 때만 표시. 상단 패널 네비게이션은 별도 제어 */
#result-container:not(.has-nav-image) .button-section .nav-img {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.translated-panel-nav[hidden] {
	display: none !important;
}

/* nav-img: flex 아이템, 좌/우 끝 배치 */
.nav-img {
	flex-shrink: 0;
}
.nav-img.prev-img {
	margin-right: auto;
}
.nav-img.next-img {
	margin-left: auto;
}
/* button-section dw-box 내: nav는 좌/우 끝 고정, margin auto 제거, 배경 투명 */
#result-container .result-col .button-section .dw-box .nav-img {
	margin-left: 0 !important;
	margin-right: 0 !important;
	background: transparent;
	z-index: 1;
}
.nav-img:hover { transform: scale(1.05); }
.nav-img:active { transform: scale(.95); }

.nav-img.disabled {
	opacity: .4;
	pointer-events: none;
}

.master-img{position:relative;}
.master-img.big{position: fixed;z-index: 1100;width: 100%;height: 100vh;top: 0;left: 0;box-sizing:border-box;}
.master-img #image-preview-container{height: 100%;box-sizing:border-box;}
body.img-fullscreen, html.img-fullscreen { overflow: hidden !important; }
body.img-fullscreen #image-preview-container,
html.img-fullscreen #image-preview-container {
	position: fixed !important;
	inset: 0 !important;
	z-index: 9999 !important;
	background: rgba(0,0,0,0.9) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-height: auto !important;
	max-height: none !important;
	border-radius: 0 !important;
}
body.img-fullscreen #image-zoom-pan-wrapper,
html.img-fullscreen #image-zoom-pan-wrapper {
	max-width: calc(100vw - 96px) !important;
	max-height: calc(100vh - 96px) !important;
}
body.img-fullscreen #image-preview-container::before,
html.img-fullscreen #image-preview-container::before {
	display: none !important;
}

/* 번역 패널: 줌/팬 래퍼 */
.translated-zoom-pan-wrap {
	position: relative;
	display: inline-block;
	transform-origin: center center;
}
#translated-bbox-overlay {
	position: absolute;
	left: 0;
	top: 0;
	pointer-events: auto;
	z-index: 60;
}
.translated-overlay-box {
	border: 2px solid rgba(255, 0, 0, .85);
	background: rgba(0, 123, 255, 0.08);
	cursor: pointer;
	overflow: visible;
}
.translated-overlay-box.selected {
	border-color: #2ecc71 !important;
	background: rgba(46, 204, 113, 0.12) !important;
}
.translated-overlay-text {
	position: absolute;
	inset: 0;
	padding: 4px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	box-sizing: border-box;
	white-space: pre-line;
	word-break: break-word;
	overflow-wrap: break-word;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
}
.translated-overlay-text.is-editing {
	pointer-events: auto;
	cursor: text;
	user-select: text;
	-webkit-user-select: text;
	outline: 2px solid rgba(11, 99, 206, 0.35);
	outline-offset: -2px;
}
body.translated-fullscreen,
html.translated-fullscreen { overflow: hidden !important; }
body.translated-fullscreen #translated-image-container,
html.translated-fullscreen #translated-image-container {
	position: fixed !important;
	inset: 0 !important;
	z-index: 9999 !important;
	background: rgba(0,0,0,0.9) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-height: auto !important;
	max-height: none !important;
	border-radius: 0 !important;
}
body.translated-fullscreen #translated-image-zoom-pan-wrapper,
html.translated-fullscreen #translated-image-zoom-pan-wrapper {
	max-width: calc(100vw - 96px) !important;
	max-height: calc(100vh - 96px) !important;
}
body.translated-fullscreen #translated-image-container::before,
html.translated-fullscreen #translated-image-container::before {
	display: none !important;
}

/* ============================================
   반응형 디자인
   ============================================ */
@media (max-width: 768px) {
	.img-trans2-tp-row {
		flex-direction: column;
	}
	.img-trans2-tp .rt {
		width: 100%;
		min-width: 0;
	}
	.images-wrapper,
	.buttons-wrapper,
	.text-wrapper {
		grid-template-columns: 1fr;
		gap: 15px;
		margin-left: 0;
	}
	#result-container {
		grid-template-columns: 1fr !important;
		margin-left: 0;
	}
	#result-container > .result-col-span { grid-column: 1; }
	.translated-panel-bar {
		grid-template-columns: 1fr;
		justify-items: stretch;
	}
	.translated-panel-bar-left,
	.translated-panel-bar-center,
	.translated-panel-bar-right {
		justify-content: center;
	}
}
