/* ============================================
   기본 컨테이너 및 레이아웃
   ============================================ */
.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: 12px;
	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;
}

.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: 20px;
	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: flex;
	flex-direction: column !important;
	gap: 20px;
}

.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 (버튼 영역)
   ============================================ */
.buttons-wrapper {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 20px;
	width: 100%;
	align-items: center;
}

.buttons-wrapper .button-section {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-width: 0;
	overflow: visible;
}

.buttons-wrapper .button-section .dw-box {
	margin-top: 0;
	position: relative;
	width: 100%;
	align-items: center;
}

/* source: prev-img 좌측, 다운로드 정중앙 */
.buttons-wrapper .source-button-section .dw-box {
	display: grid;
	grid-template-columns: 40px 1fr 40px;
	gap: 8px;
}
.buttons-wrapper .source-button-section .download-btn {
	grid-column: 2;
	justify-self: center;
}

/* target: 좌측(status/저장/초기화) · 우측(다운로드/배경/업로드/next-img) */
.buttons-wrapper .target-button-section .dw-box {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 12px;
	overflow: visible;
	min-width: 0;
}
.buttons-wrapper .target-button-section .btn-group-left,
.buttons-wrapper .target-button-section .btn-group-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: nowrap;
	flex-shrink: 0;
}
.buttons-wrapper .target-button-section .download-btn,
.buttons-wrapper .target-button-section .nav-img,
.buttons-wrapper .target-button-section select {
	flex-shrink: 0;
	white-space: nowrap;
	height: auto;
}
.buttons-wrapper .target-button-section .btn-group-left {
	grid-column: 1;
	justify-self: start;
	justify-content: flex-start;
}
.buttons-wrapper .target-button-section .btn-group-right {
	grid-column: 3;
	justify-self: end;
	justify-content: flex-end;
}

.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;
  max-height: min(55vh, 550px);
  overflow-y: auto;
  overflow-x: hidden;
}
.para-pairs-container.hidden { display: none !important; }
.para-pair-row {
  order: 0;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 16px;
  padding: 12px;
  padding-top: 12px;
  padding-right: 30px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  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: 48%;
  align-self: start;
}
.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 {
  cursor: default;
}
.para-drop-indicator {
  width: 100%;
  height: 4px;
  background: #007BFF;
  border-radius: 2px;
  pointer-events: none;
  flex-shrink: 0;
}
.para-pair-row.dragging {
  opacity: 0.6;
}
.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; padding-top: 12px;
}
.para-pair-row:hover { background: #fafafa; }
.para-pair-row.highlighted {
  border-color: #007BFF;
  background: #f0f7ff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.2);
}
.para-pairs-container.promote-selected .para-pair-row.highlighted { order: -1; }
.para-pair-row .para-edit-block,
.para-pair-row .translated-edit-block { margin-bottom: 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;
}
#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%;
	height: 100% !important;
}

/* ============================================
   애니메이션
   ============================================ */
@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;
}

.td-btns button {
	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;
	height: 36px;
}

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

.td-btns button img {
	width: 17px;
	margin-right: 4px;
}

.td-btns button.copy-btn {
	background: none;
}

.td-btns button.copy-btn img {
	width: auto;
}

.speak-btn,
.copy-btn,
.stop-btn {
	background: #007BFF;
	color: white;
	border: none;
	padding: 8px 15px;
	border-radius: 5px;
	cursor: pointer;
	transition: 0.3s;
}

.speak-btn img,
.copy-btn img,
.stop-btn img {
	width: 20px;
}

.speak-btn:hover,
.copy-btn:hover,
.stop-btn:hover {
	background: #0f63bd;
}

.copy-btn {
	left: 260px;
	bottom: 16px;
}

.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;
	margin-top: 10px;
	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-btn {
	position: absolute;
	z-index: 66;
	background: #007BFF;
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 0;
	top: 6px;
	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:hover {
	background: #0f63bd;
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
}*/

/* add-para-btn 개별 스타일 */
#add-para-btn {
	right: 6px;
	font-size: 18px;
	border:1.5px solid #fff;
	    line-height: 21px;
    text-align: center;
}

/* windowbs 개별 스타일 */
#windowbs {
	right: 35px;
	background: #007BFF url("https://dev.han.kr/chat/images/sub/wbw.png") no-repeat center center;
	background-size: cover;
}

#windowbs.on {
	background: #007BFF url("https://dev.han.kr/chat/images/sub/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: 20px;
	margin-top: 5px;
	background-color: #f3f3f3;
	border-radius: 4px;
	overflow: hidden;
}

.progress-bar-inner {
	height: 100%;
	width: 0%;
	background-color: #007bff;
	text-align: center;
	line-height: 20px;
	color: white;
	border-radius: 4px;
	font-size: 12px;
	transition: width 0.5s ease;
}

.progress-barAll {
	padding-top: 15px;
	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;
}

.loading {
	position: absolute;
	width: 48px;
	height: 48px;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

.loading img {
	display: none;
	max-width: 96px;
	max-height: 96px;
}

/* ============================================
   텍스트 영역
   ============================================ */
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;
}

.img-trans2 .container {
	width: 100%;
	box-sizing: border-box;
}

.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;
}

.img-trans2-tp .lf {
	max-width: 70%;
	width: 100%;
}

.img-trans2-tp .rt {
	flex: 0 0 auto;
	align-self: flex-start;
	width: 30%;
	margin-left: 20px;
	position: relative;
	top: -17px;
}

.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 {
	text-align: left;
}

.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;
}

/* para-pairs-toolbar: 4열 grid [자동정렬|원문|번역|반영하기] */
.para-pairs-toolbar {
	display: grid;
	grid-template-columns: auto 1fr 1fr auto;
	gap: 16px;
	align-items: center;
	margin-top: 12px;
	margin-bottom: 8px;
}
.para-pairs-toolbar #para-order-toggle-btn { grid-column: 1; justify-self: start; }
.para-pairs-toolbar .para-source-label { grid-column: 2; margin-right: 10%}
.para-pairs-toolbar .para-target-label { grid-column: 3; margin-left: 10%}
.para-pairs-toolbar #rerender-btn { grid-column: 4; justify-self: end; }
.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);
}
.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;
}

#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;
	height: 40px;
	cursor: pointer;
	transition: transform .15s ease;
	z-index: 1000;
}

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

/* nav-img: flex 아이템, 좌/우 끝 배치 */
.nav-img {
	flex-shrink: 0;
}
.nav-img.prev-img {
	margin-right: auto; /* prev-img를 좌측 끝으로 */
}
.nav-img.next-img {
	margin-left: auto; /* next-img를 우측 끝으로 */
}
.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; }

/* ============================================
   반응형 디자인
   ============================================ */
@media (max-width: 768px) {
	.images-wrapper,
	.buttons-wrapper,
	.text-wrapper {
		grid-template-columns: 1fr;
		gap: 15px;
		margin-left: 0;
	}

	#result-container {
		margin-left: 0;
	}
}