/*
 * app.css
 * ============================================================
 * AI 답안지 스캐너 화면 전체 CSS
 * ------------------------------------------------------------
 * 디자인 기준
 * - 기본 배경은 흰색입니다.
 * - 학교/교육기관에서 많이 쓰는 남색, 회청색, 옅은 녹색 계열을 중심으로 잡았습니다.
 * - 그라데이션은 쓰지 않고, 선/여백/명도 차이로 차분하게 구분합니다.
 * - 기본 글자 크기는 16px입니다.
 * - 전체 폰트 크기는 12px ~ 32px 안에서만 사용합니다.
 * - font-weight는 600을 넘기지 않습니다.
 *
 * 반응형 기준
 * - PC: 카메라 영역 + 설정/결과 패널 2열
 * - 태블릿: 1열 중앙 정렬
 * - 모바일: 버튼과 옵션을 터치하기 쉬운 1열 중심으로 재배치
 */
 
 @import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

:root {
	--bg: #ffffff;
	--page: #f5f7fa;
	--surface: #ffffff;
	--surface-soft: #f8fafc;
	--surface-blue: #eef4f8;
	--surface-green: #eef8f3;
	--surface-warn: #fff8e8;

	--text: #1f2937;
	--text-soft: #475569;
	--muted: #64748b;
	--placeholder: #94a3b8;

	--navy: #1f3a5f;
	--navy-2: #2f527a;
	--blue: #3b638c;
	--green: #2f7660;
	--green-2: #3f8f72;
	--red: #b4544f;
	--amber: #9a6a22;

	--line: #d9e2ec;
	--line-strong: #b9c7d6;
	--line-dark: #8da0b5;

	--camera-bg: #132033;
	--camera-line: #314967;

	--shadow: 0 12px 28px rgba(31, 58, 95, 0.12);
	--shadow-soft: 0 6px 16px rgba(31, 58, 95, 0.08);

	--radius-lg: 14px;
	--radius-md: 10px;
	--radius-sm: 8px;
	--touch: 46px;
}

* {
	box-sizing: border-box;
}

html {
	min-width: 320px;
	background: var(--bg);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100svh;
	background: var(--bg);
	color: var(--text);
	font-family: 'Pretendard', "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
}

body.is-busy {
	overflow: hidden;
}

button,
input,
select {
	font: inherit;
}

button {
	cursor: pointer;
}

button:disabled {
	cursor: not-allowed;
}

img,
video,
canvas {
	max-width: 100%;
}

[hidden] {
	display: none !important;
}

h1,
h2,
p {
	margin-top: 0;
}

/*
 * 전체 화면 폭
 * ------------------------------------------------------------
 * PC에서는 너무 넓게 퍼지지 않게 최대 폭을 제한합니다.
 * 태블릿/모바일에서는 기기 폭을 충분히 사용합니다.
 */
.app-shell {
	width: min(1360px, calc(100% - 32px));
	margin: 0 auto;
	padding: 18px 0 30px;
}

/*
 * 상단 헤더
 * ------------------------------------------------------------
 * 학교 행정 시스템처럼 흰 카드 안에 제목과 상태를 단정하게 배치합니다.
 */
.topbar,
.app-header {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 16px;
	align-items: center;
	margin-bottom: 14px;
	padding: 18px 20px;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-soft);
}

.eyebrow {
	margin: 0 0 5px;
	color: var(--blue);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1.3;
	text-transform: uppercase;
}

h1 {
	margin-bottom: 0;
	color: var(--navy);
	font-size: 30px;
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.18;
}

h2 {
	margin-bottom: 12px;
	color: var(--navy);
	font-size: 18px;
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.3;
}

.lead {
	margin-bottom: 0;
	color: var(--text-soft);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.55;
}

.system-pill,
.run-state {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	min-height: 38px;
	padding: 0 13px;
	border: 1px solid #cbd9e7;
	border-radius: 999px;
	background: var(--surface-blue);
	color: var(--navy);
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
}

.pulse-dot,
.state-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--green-2);
	box-shadow: 0 0 0 5px rgba(63, 143, 114, 0.14);
}

/*
 * 메인 레이아웃
 * ------------------------------------------------------------
 * min-width:0은 grid 내부 요소가 옆 영역을 밀어내지 않도록 하는 핵심입니다.
 */
.scanner-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
	gap: 14px;
	align-items: start;
}

.scanner-layout > *,
.stage-panel,
.camera-card,
.control-panel,
.side-stack,
.panel,
.panel-section {
	min-width: 0;
}

.stage-panel,
.camera-card,
.control-panel,
.panel,
.panel-section {
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-soft);
}

.stage-panel,
.camera-card {
	padding: 12px;
	overflow: hidden;
}

.control-panel,
.side-stack {
	display: grid;
	gap: 12px;
}

.control-panel {
	border: 0;
	background: transparent;
	box-shadow: none;
}

.panel,
.panel-section {
	padding: 15px;
}

.panel-title,
.section-head {
	margin-bottom: 12px;
}

.panel-title.compact {
	margin-bottom: 10px;
}

.section-head,
.row-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

/*
 * 카메라 프레임
 * ------------------------------------------------------------
 * 높이를 고정하지 않고 aspect-ratio로 잡습니다.
 * PC/태블릿/모바일에서 영상 영역이 옵션 패널을 침범하지 않게 합니다.
 */
.camera-frame {
	position: relative;
	width: 100%;
	max-width: 100%;
	aspect-ratio: var(--camera-ratio, 4 / 3);
	min-height: 420px;
	max-height: none;
	overflow: hidden;
	border: 1px solid var(--camera-line);
	border-radius: 12px;
	background: var(--camera-bg);
}

.camera-frame video,
.camera-frame canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.camera-frame video {
	/*
	 * 4코너 스캐너는 화면 일부가 잘리면 안 됩니다.
	 * cover는 크게 보이지만 영상이 잘려서 가채점표 4개 코너가 빠질 수 있습니다.
	 * contain으로 전체 카메라 원본을 보여주고, 프레임 높이를 키워 실사용 크기를 확보합니다.
	 */
	object-fit: contain;
	background: var(--camera-bg);
}

.camera-frame canvas {
	z-index: 4;
	pointer-events: none;
}

.camera-frame video {
	z-index: 1;
}

.scan-guide {
	z-index: 3;
}

.lock-badge,
.scan-counter,
.direction-punches {
	z-index: 25;
}

.camera-frame.is-ready .empty-camera {
	display: none;
}

.empty-camera {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	align-content: center;
	gap: 10px;
	padding: 24px;
	/*background: var(--camera-bg);*/
	color: #f8fafc;
	text-align: center;
	z-index:1;
}

.empty-camera strong {
	color: #ffffff;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.35;
}

.empty-camera p {
	max-width: 440px;
	margin-bottom: 0;
	color: #d5dee8;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.55;
}

.lens-mark {
	width: 64px;
	height: 64px;
	border: 3px solid rgba(255, 255, 255, 0.78);
	border-radius: 50%;
	box-shadow: inset 0 0 0 14px rgba(255, 255, 255, 0.08);
}

.scan-guide {
	position: absolute;
	inset: 24px;
	pointer-events: none;
	opacity: 0.72;
}

.scan-guide span {
	position: absolute;
	width: 42px;
	height: 42px;
	border-color: rgba(255, 255, 255, 0.82);
	border-style: solid;
}

.scan-guide span:nth-child(1) {
	top: 0;
	left: 0;
	border-width: 3px 0 0 3px;
}

.scan-guide span:nth-child(2) {
	top: 0;
	right: 0;
	border-width: 3px 3px 0 0;
}

.scan-guide span:nth-child(3) {
	right: 0;
	bottom: 0;
	border-width: 0 3px 3px 0;
}

.scan-guide span:nth-child(4) {
	bottom: 0;
	left: 0;
	border-width: 0 0 3px 3px;
}

/*
 * 인식 중 움직임 표시
 * ------------------------------------------------------------
 * OpenCV는 구형폰 보호를 위해 90~115ms 간격으로만 실행합니다.
 * 사용자가 “인식이 돌고 있는지” 알 수 있도록 가이드 박스 자체에
 * 아주 가벼운 CSS 스캔 라인만 표시합니다. OpenCV 메모리 사용량과 무관합니다.
 */
.scan-guide::before {
	content: "";
	position: absolute;
	left: 8%;
	right: 8%;
	top: 10%;
	height: 2px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.72);
	box-shadow: 0 0 14px rgba(255, 255, 255, 0.52);
	opacity: 0;
	transform: translateY(0);
}

.camera-frame.is-ready:not(.is-locked) .scan-guide::before {
	opacity: 0;
	/*animation: guide-scan-line 1.35s ease-in-out infinite;*/
	animation: none !important;
}

.camera-frame.is-locked .scan-guide::before {
	display: none;
}

@keyframes guide-scan-line {
	0% { transform: translateY(0); opacity: 0; }
	15% { opacity: 1; }
	85% { opacity: 1; }
	100% { transform: translateY(calc(100% + 60px)); opacity: 0; }
}

.direction-punches {
	position: absolute;
	left: 50%;
	top: 8px;
	z-index: 24;
	display: none;
	align-items: center;
	gap: 7px;
	padding: 6px 11px;
	border: 1px solid rgba(255, 255, 255, 0.32);
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.42);
	color: rgba(255, 255, 255, 0.92);
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 1px;
	transform: translateX(-50%);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	pointer-events: none;
}

.direction-punches em {
	margin-left: 4px;
	font-style: normal;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0;
	opacity: 0.92;
}

.camera-frame.is-ready .direction-punches {
	display: inline-flex;
}

.camera-frame.is-locked .direction-punches {
	border-color: rgba(188, 220, 202, 0.85);
	background: rgba(31, 138, 91, 0.44);
}

.lock-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 5;
	display: none;
	align-items: center;
	min-height: 30px;
	padding: 0 10px;
	border: 1px solid #c7d7e6;
	border-radius: 999px;
	background: #ffffff;
	color: var(--navy);
	font-size: 12px;
	font-weight: 500;
	box-shadow: var(--shadow-soft);
}

.camera-frame.is-ready .lock-badge {
	display: inline-flex;
}

.camera-frame.is-locked .lock-badge {
	border-color: #bcdcca;
	background: var(--surface-green);
	color: var(--green);
}

.camera-frame.is-too-small .lock-badge {
	border-color: #f1d58d;
	background: #fff8e8;
	color: var(--amber);
}



/*
 * 카메라 위 실사용 컨트롤
 * ------------------------------------------------------------
 * 카메라 화면을 크게 쓰면 아래 버튼까지 손을 내리기 불편합니다.
 * 그래서 카메라 위에 수동촬영 버튼과 인식 카운터를 고정 배치합니다.
 */
.scan-counter {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 6;
	display: none;
	align-items: center;
	gap: 7px;
	min-width: 86px;
	min-height: 30px;
	padding: 0 10px;
	overflow: hidden;
	border: 1px solid rgba(203, 217, 231, 0.95);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.94);
	color: var(--navy);
	font-size: 12px;
	font-weight: 500;
	box-shadow: var(--shadow-soft);
}

.scan-counter span,
.scan-counter strong {
	position: relative;
	z-index: 2;
	line-height: 1;
	white-space: nowrap;
}

.scan-counter strong {
	font-weight: 600;
}

.scan-counter i {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 3px;
	border-radius: 999px;
	background: rgba(47, 118, 96, 0.45);
	transition: width 0.12s linear;
}

.camera-frame.is-ready .scan-counter {
	display: inline-flex;
}

.camera-frame.is-locked .scan-counter {
	border-color: #bcdcca;
	background: rgba(238, 248, 243, 0.96);
	color: var(--green);
}

.camera-float-actions {
	position: absolute;
	left: 50%;
	bottom: max(14px, env(safe-area-inset-bottom));
	z-index: 30;
	display: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: calc(100% - 24px);
	transform: translateX(-50%);
	pointer-events: auto;
	touch-action: manipulation;
}

.camera-frame.is-ready .camera-float-actions {
	display: flex;
}

.float-capture,
.float-close {
	appearance: none;
	-webkit-appearance: none;
	min-height: 46px;
	padding: 0 18px;
	border: 1px solid rgba(255, 255, 255, 0.34);
	border-radius: 999px;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	pointer-events: auto;
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
}

.float-capture {
	min-width: 154px;
	background: rgba(31, 58, 95, 0.90);
}

.float-close {
	min-width: 74px;
	background: rgba(15, 23, 42, 0.72);
}

.float-capture:disabled,
.float-close:disabled {
	background: rgba(92, 112, 132, 0.55);
	color: rgba(255, 255, 255, 0.72);
}

/*
 * 버튼
 * ------------------------------------------------------------
 * 색상은 주 버튼만 남색으로 강조하고, 나머지는 회청색 계열로 낮춥니다.
 */
.capture-bar,
.action-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	margin-top: 10px;
}

.btn,
.link-btn {
	appearance: none;
	-webkit-appearance: none;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--navy);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0;
	transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--touch);
	padding: 0 14px;
}

.btn:hover:not(:disabled),
.link-btn:hover:not(:disabled) {
	border-color: var(--blue);
	background: var(--surface-blue);
	box-shadow: var(--shadow-soft);
	transform: translateY(-1px);
}

.btn.primary,
.btn.strong {
	border-color: var(--navy-2);
	background: var(--navy-2);
	color: #ffffff;
}

.btn.soft {
	border-color: #cbd9e7;
	background: var(--surface-blue);
	color: var(--navy);
}

.btn.ghost {
	border-color: var(--line);
	background: var(--surface-soft);
	color: var(--muted);
}

.btn:disabled {
	border-color: #d6dde6;
	background: #edf1f5;
	color: #94a3b8;
	box-shadow: none;
	opacity: 0.78;
	transform: none;
}

.file-btn {
	position: relative;
	overflow: hidden;
}

.file-btn input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

.link-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 0 12px;
	font-size: 14px;
}

/*
 * 상태 영역
 * ------------------------------------------------------------
 * 현재 상태를 짧은 카드로 보여줍니다.
 */
.status-strip,
.status-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	margin-top: 10px;
}

.status-strip div,
.status-grid div {
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface-soft);
}

.label,
.status-grid span {
	display: block;
	margin-bottom: 4px;
	color: var(--blue);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
}

.status-strip strong,
.status-grid strong {
	display: block;
	overflow: hidden;
	color: var(--navy);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/*
 * 입력 필드
 * ------------------------------------------------------------
 * 시험 ID/응시번호 입력은 일반 학교 업무 시스템처럼 단순한 박스로 구성합니다.
 */
.field {
	display: grid;
	gap: 7px;
	margin-bottom: 11px;
}

.field:last-child {
	margin-bottom: 0;
}

.field span {
	color: var(--text-soft);
	font-size: 14px;
	font-weight: 500;
}

.field input,
.field-row select {
	width: 100%;
	min-width: 0;
	height: 42px;
	padding: 0 12px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	background: #ffffff;
	color: var(--text);
	font-size: 15px;
	font-weight: 400;
	outline: none;
}

.field input::placeholder {
	color: var(--placeholder);
}

.field input:focus,
.field-row select:focus {
	border-color: var(--blue);
	box-shadow: 0 0 0 3px rgba(59, 99, 140, 0.14);
}

/*
 * 처리 방식 선택
 * ------------------------------------------------------------
 * 라디오 버튼은 탭처럼 보이게 하되, 실제 input은 유지합니다.
 */
.segmented {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px;
	margin-bottom: 12px;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface-soft);
}

.segmented label {
	position: relative;
	display: block;
}

.segmented input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.segmented span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	color: var(--text-soft);
	font-size: 14px;
	font-weight: 500;
}

.segmented input:checked + span {
	border-color: var(--blue);
	background: #ffffff;
	color: var(--navy);
	box-shadow: var(--shadow-soft);
}

/*
 * 토글 옵션
 * ------------------------------------------------------------
 * 사용자가 실제로 이해해야 하는 설명을 strong/em으로 분리합니다.
 */
.toggle-row,
.big-toggle {
	display: grid;
	grid-template-columns: 24px minmax(0, 1fr);
	gap: 11px;
	align-items: start;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface-soft);
	cursor: pointer;
}

.toggle-row {
	position: relative;
	grid-template-columns: minmax(0, 1fr);
	padding-left: 45px;
}

.toggle-row + .toggle-row,
.big-toggle + .big-toggle {
	margin-top: 9px;
}

.toggle-row input,
.big-toggle input,
.mini-toggle input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.fake-check {
	content: "";
	width: 22px;
	height: 22px;
	margin-top: 2px;
	border: 2px solid var(--line-dark);
	border-radius: 6px;
	background: #ffffff;
}

.toggle-row span::before {
	content: "";
	position: absolute;
	top: 14px;
	left: 12px;
	width: 22px;
	height: 22px;
	border: 2px solid var(--line-dark);
	border-radius: 6px;
	background: #ffffff;
}

.toggle-row input:checked + span::before,
.big-toggle input:checked + .fake-check {
	border-color: var(--navy-2);
	background: var(--navy-2);
	box-shadow: inset 0 0 0 4px #ffffff;
}

.toggle-row strong,
.big-toggle strong {
	display: block;
	margin-bottom: 3px;
	color: var(--navy);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
}

.toggle-row em,
.big-toggle em {
	display: block;
	color: var(--muted);
	font-size: 13px;
	font-style: normal;
	font-weight: 400;
	line-height: 1.45;
}

/*
 * 흐름/안내 태그
 * ------------------------------------------------------------
 * 이전 버전의 보조 설명 영역까지 호환되도록 유지합니다.
 */
.rule-panel p,
.note {
	margin-bottom: 10px;
	color: var(--text-soft);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.55;
}

.flow-tags {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 6px;
}

.flow-tags span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 30px;
	padding: 0 8px;
	border: 1px solid #cbd9e7;
	border-radius: 999px;
	background: var(--surface-blue);
	color: var(--navy);
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
}

/*
 * 접이식 고급 설정
 * ------------------------------------------------------------
 * 현재 index.php에는 없을 수 있지만, 이전 버전 호환용으로 남깁니다.
 */
.advanced-panel {
	padding: 0;
	overflow: hidden;
}

.advanced-panel details {
	padding: 0;
}

.advanced-panel summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 50px;
	padding: 0 14px;
	color: var(--navy);
	font-size: 15px;
	font-weight: 600;
	list-style: none;
	cursor: pointer;
}

.advanced-panel summary::-webkit-details-marker {
	display: none;
}

.advanced-panel summary::after {
	content: "+";
	display: inline-grid;
	place-items: center;
	width: 25px;
	height: 25px;
	border: 1px solid var(--line-strong);
	border-radius: 50%;
	color: var(--blue);
	font-size: 18px;
	font-weight: 500;
	line-height: 1;
}

.advanced-panel details[open] summary::after {
	content: "-";
}

.advanced-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	padding: 0 14px 14px;
}

.mini-toggle,
.field-row {
	min-width: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface-soft);
}

.mini-toggle {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 11px;
	cursor: pointer;
}

.mini-toggle span {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--navy);
	font-size: 13px;
	font-weight: 500;
}

.mini-toggle span::before {
	content: "";
	width: 18px;
	height: 18px;
	border: 2px solid var(--line-dark);
	border-radius: 5px;
	background: #ffffff;
}

.mini-toggle input:checked + span::before {
	border-color: var(--navy-2);
	background: var(--navy-2);
	box-shadow: inset 0 0 0 4px #ffffff;
}

.field-row {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr);
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 6px 8px 6px 11px;
}

.field-row span {
	color: var(--text-soft);
	font-size: 13px;
	font-weight: 500;
}

.field-row select {
	height: 34px;
	font-size: 13px;
}

/*
 * 미리보기
 * ------------------------------------------------------------
 * 실제 서버로 보낼 이미지가 확인되는 영역입니다.
 */
.preview-box {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 170px;
	max-height: 360px;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface-blue);
}

.preview-box img {
	display: none;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #ffffff;
}

.preview-box.has-image img {
	display: block;
}

.preview-box.has-image #previewPlaceholder {
	display: none;
}

.preview-box p {
	margin: 0;
	padding: 18px;
	color: var(--muted);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	text-align: center;
}

/*
 * 결과 영역
 * ------------------------------------------------------------
 * 표 형태 결과와 원본 JSON이 모두 읽기 편하도록 구성합니다.
 */
.result-view {
	/* min-height: 90px; */
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: #ffffff;
}

.empty-result {
	display: grid;
	place-items: center;
	min-height: 64px;
	margin: 0;
	color: var(--muted);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	text-align: center;
}

.result-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--line);
}

.result-pill {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0 9px;
	border: 1px solid #cbd9e7;
	border-radius: 999px;
	background: var(--surface-blue);
	color: var(--navy);
	font-size: 13px;
	font-weight: 500;
}

.subject-result + .subject-result {
	margin-top: 12px;
}

.subject-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
	color: var(--navy);
	font-size: 15px;
	font-weight: 600;
}

.answer-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: #ffffff;
}

.answer-table,
.result-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.answer-table th,
.answer-table td,
.result-table th,
.result-table td {
	padding: 8px 9px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

.answer-table th,
.result-table th {
	background: var(--surface-soft);
	color: var(--navy);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.answer-table tr:last-child td,
.result-table tr:last-child td {
	border-bottom: 0;
}

.raw-text {
	color: var(--muted);
	font-size: 13px;
}

.warning-text,
.warning-box {
	margin-top: 10px;
	padding: 10px;
	border: 1px solid #e9d4a9;
	border-radius: var(--radius-md);
	background: var(--surface-warn);
	color: var(--amber);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
}

.raw-result,
.raw-json {
	margin-top: 10px;
}

.raw-result summary,
.raw-json summary {
	cursor: pointer;
	color: var(--navy-2);
	font-size: 14px;
	font-weight: 500;
}

.raw-result pre,
.raw-json pre {
	max-height: 260px;
	overflow: auto;
	margin: 9px 0 0;
	padding: 12px;
	border: 1px solid #26374d;
	border-radius: var(--radius-md);
	background: #132033;
	color: #e7eef6;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
}

/*
 * 처리 모달
 * ------------------------------------------------------------
 * 촬영/전송 중 사용자가 상태를 명확히 볼 수 있게 가운데 고정합니다.
 */
.process-modal {
	position: fixed;
	inset: 0;
	z-index: 20000;
	display: grid;
	place-items: center;
	padding: 20px;
	background: rgba(15, 23, 42, 0.38);
	backdrop-filter: blur(3px);
}

.process-card {
	width: min(360px, 100%);
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: #ffffff;
	box-shadow: var(--shadow);
	text-align: center;
}

.process-spinner {
	width: 50px;
	height: 50px;
	margin: 0 auto 14px;
	border: 5px solid #dbe5ee;
	border-top-color: var(--navy-2);
	border-radius: 50%;
	animation: spin 0.9s linear infinite;
}

.process-card.is-done .process-spinner,
.process-card.is-error .process-spinner {
	border-color: transparent;
	animation: none;
}

.process-card.is-done .process-spinner::before,
.process-card.is-error .process-spinner::before {
	display: grid;
	place-items: center;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	font-size: 26px;
	font-weight: 600;
}

.process-card.is-done .process-spinner::before {
	content: "✓";
	background: var(--surface-green);
	color: var(--green);
}

.process-card.is-error .process-spinner::before {
	content: "!";
	background: #fff1f1;
	color: var(--red);
}

.process-card strong {
	display: block;
	color: var(--navy);
	font-size: 18px;
	font-weight: 600;
}

.process-card p {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/*
 * 카메라 실행 중 화면 확대
 * ------------------------------------------------------------
 * 카메라가 켜진 뒤에는 설정 패널보다 촬영 영역이 중요합니다.
 * 프레임을 크게 키우고, 사용자가 가채점표를 화면 안에 넉넉하게 맞출 수 있게 합니다.
 */
body.is-camera-on .camera-frame {
	min-height: clamp(520px, 76svh, 860px);
}

body.is-camera-on .camera-card {
	box-shadow: var(--shadow);
}

/* 카메라가 켜져 있을 때는 화면 위 플로팅 버튼을 주 조작으로 사용합니다. */
body.is-camera-on #captureBtn {
	display: none;
}

/*
 * 태블릿
 * ------------------------------------------------------------
 * 1100px 아래에서는 1열로 바꾸고, 옵션 패널이 화면을 무리하게 누르지 않게 합니다.
 */
@media (max-width: 1100px) {
	.app-shell {
		width: min(860px, calc(100% - 24px));
	}

	.scanner-layout {
		grid-template-columns: 1fr;
	}

	.camera-frame {
		max-height: none;
		min-height: 380px;
	}

	.control-panel,
	.side-stack {
		grid-template-columns: 1fr;
	}
}

/*
 * 모바일
 * ------------------------------------------------------------
 * 손가락 터치 영역을 확보하고, 텍스트가 너무 작아지지 않게 유지합니다.
 */
@media (max-width: 720px) {
	.app-shell {
		width: min(100% - 14px, 540px);
		padding-top: 8px;
		padding-bottom: 18px;
	}

	.topbar,
	.app-header {
		grid-template-columns: 1fr;
		gap: 10px;
		margin-bottom: 10px;
		padding: 14px;
	}

	h1 {
		font-size: 25px;
	}

	h2 {
		font-size: 17px;
	}

	.system-pill,
	.run-state {
		justify-self: start;
		min-height: 36px;
		font-size: 13px;
	}

	.stage-panel,
	.camera-card,
	.panel,
	.panel-section {
		padding: 10px;
		border-radius: 12px;
	}

	.camera-frame {
		min-height: 440px;
		aspect-ratio: var(--camera-ratio, 9 / 14);
		border-radius: 10px;
	}

	body.is-camera-on .camera-frame {
		min-height: min(78svh, 720px);
		max-height: none;
	}

	.empty-camera {
		gap: 8px;
		padding: 18px;
	}

	.lens-mark {
		width: 54px;
		height: 54px;
	}

	.empty-camera strong {
		font-size: 18px;
	}

	.empty-camera p {
		font-size: 13px;
	}

	.scan-guide {
		inset: 10px;
	}

	/*.capture-bar,
	.action-grid {
		grid-template-columns: 1fr 1fr;
	}*/

	.btn {
		min-height: 44px;
		font-size: 14px;
	}

	/*.status-strip,
	.status-grid {
		grid-template-columns: 1fr;
	}*/

	.section-head,
	.row-title {
		align-items: flex-start;
		flex-direction: column;
	}

	.link-btn {
		width: 100%;
	}

	.toggle-row,
	.big-toggle {
		padding: 11px;
	}

	.toggle-row strong,
	.big-toggle strong {
		font-size: 15px;
	}

	.toggle-row em,
	.big-toggle em {
		font-size: 13px;
	}

	.flow-tags {
		grid-template-columns: 1fr 1fr;
	}

	.advanced-grid {
		grid-template-columns: 1fr;
	}

	.field-row {
		grid-template-columns: 88px minmax(0, 1fr);
	}

	.preview-box {
		min-height: 150px;
		max-height: 300px;
	}
}

/*
 * 좁은 모바일
 * ------------------------------------------------------------
 * 420px 아래에서는 버튼을 1열로 내려 오작동을 줄입니다.
 */
@media (max-width: 420px) {
	h1 {
		font-size: 23px;
	}

	/*.capture-bar,
	.action-grid {
		grid-template-columns: 1fr;
	}*/

	.status-strip div,
	.status-grid div {
		padding: 9px 10px;
	}

	.flow-tags {
		grid-template-columns: 1fr;
	}
}

/* ============================================================
 * 20260707 full-screen camera UX patch
 * ------------------------------------------------------------
 * 카메라 시작 후에는 페이지 안의 카드가 아니라 휴대폰 카메라 앱처럼
 * 촬영 화면이 전체를 덮습니다. 자동 추출이 끝나거나 닫기를 누르면
 * body.is-camera-on 이 제거되어 본 화면으로 돌아갑니다.
 * ============================================================ */
html.is-camera-fullscreen,
html.is-camera-fullscreen body {
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #000;
}

body.is-camera-on {
	background: #000;
	overscroll-behavior: none;
}

body.is-camera-on .app-shell {
	position: fixed;
	inset: 0;
	z-index: 9999;
	width: 100vw;
	height: 100dvh;
	max-width: none;
	margin: 0;
	padding: 0;
	background: #000;
	border-radius: 0;
	overflow: hidden;
}

body.is-camera-on .app-header,
body.is-camera-on .side-stack,
body.is-camera-on .camera-card > .action-grid,
body.is-camera-on .camera-card > .status-grid,
body.is-camera-on .stage-panel,
body.is-camera-on .panel.basic-options {
	display: none !important;
}

body.is-camera-on .scanner-layout {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
}

body.is-camera-on .camera-card {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100dvh;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #000;
	box-shadow: none;
	overflow: hidden;
}

body.is-camera-on .camera-frame {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100dvh;
	min-height: 100dvh;
	max-height: none;
	aspect-ratio: auto;
	border: 0;
	border-radius: 0;
	background: #000;
	box-shadow: none;
}

body.is-camera-on .camera-frame video {
	object-fit: contain;
	background: #000;
}

/*
 * 상태 배지는 과감히 숨깁니다.
 * 화면에는 중앙 가이드와 버튼만 남겨 실제 카메라 앱처럼 보이게 합니다.
 */
body.is-camera-on .lock-badge,
body.is-camera-on .scan-counter {
	display: none !important;
}

/*
 * 중앙 가로형 가이드
 * ------------------------------------------------------------
 * 가채점표는 가로 직사각형으로 넣는 쪽이 OCR에 유리하므로,
 * 카메라 시작 시 가이드도 가로형으로 의도합니다.
 */
body.is-camera-on .scan-guide {
	left: 50%;
	top: 50%;
	right: auto;
	bottom: auto;
	width: min(96vw, 132dvh);
	max-width: 1100px;
	height: auto;
	aspect-ratio: 1.62 / 1;
	transform: translate(-50%, -50%);
	opacity: 1;
	filter: drop-shadow(0 14px 34px rgba(0, 0, 0, 0.35));
}

body.is-camera-on .scan-guide span {
	width: clamp(34px, 8vw, 64px);
	height: clamp(34px, 8vw, 64px);
	border-color: rgba(255, 255, 255, 0.92);
	animation: seek-corner-breathe 1.05s ease-in-out infinite;
}

body.is-camera-on .camera-frame.is-locked .scan-guide span {
	border-color: rgba(48, 196, 123, 0.98);
	animation: none;
}

/* 기존 위아래로 훑는 스캔 라인은 제거하고, 중앙에서 직사각형을 찾는 느낌으로 변경 */
body.is-camera-on .scan-guide::before {
	content: "";
	position: absolute;
	inset: 9%;
	border: 1px solid rgba(255, 255, 255, 0.58);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.035);
	box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.025), 0 0 26px rgba(255, 255, 255, 0.14);
	opacity: 1;
	transform: scale(0.985);
	animation: seek-rect-pulse 1.05s ease-in-out infinite;
}

body.is-camera-on .camera-frame.is-locked .scan-guide::before {
	border-color: rgba(48, 196, 123, 0.96);
	background: rgba(48, 196, 123, 0.07);
	box-shadow: 0 0 32px rgba(48, 196, 123, 0.28);
	animation: none;
}

/*body.is-camera-on .scan-guide::after {
	content: "▲  ▲  ▲  ▲  ▲   표 위쪽";
	position: absolute;
	left: 50%;
	top: -46px;
	transform: translateX(-50%);
	padding: 8px 14px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.42);
	color: rgba(255, 255, 255, 0.96);
	font-size: clamp(12px, 3.2vw, 16px);
	font-weight: 800;
	line-height: 1;
	letter-spacing: 1px;
	white-space: nowrap;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}*/

body.is-camera-on .scan-guide::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 12px;
	z-index: 20;

	width: 138px;
	height: 42px;

	transform: translateX(-50%);
	pointer-events: none;

	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;

	background-image: url("data:image/svg+xml,%3Csvg width='138' height='42' viewBox='0 0 138 42' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0.75' y='4.75' width='136.5' height='32.5' rx='16.25' fill='%230F172A' fill-opacity='0.62' stroke='white' stroke-opacity='0.26' stroke-width='1.5'/%3E%3Cg filter='url(%23shadow)'%3E%3Cpath d='M59 15L69 7L79 15' stroke='%2322C55E' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M69 8V20' stroke='%2322C55E' stroke-width='2.4' stroke-linecap='round' stroke-opacity='0.9'/%3E%3Ccircle cx='29' cy='25' r='4.2' fill='white' fill-opacity='0.9'/%3E%3Ccircle cx='49' cy='25' r='4.2' fill='white' fill-opacity='0.9'/%3E%3Ccircle cx='69' cy='25' r='5.4' fill='%2322C55E'/%3E%3Ccircle cx='89' cy='25' r='4.2' fill='white' fill-opacity='0.9'/%3E%3Ccircle cx='109' cy='25' r='4.2' fill='white' fill-opacity='0.9'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='shadow' x='18' y='2' width='102' height='32' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeDropShadow dx='0' dy='1.2' stdDeviation='1.5' flood-color='black' flood-opacity='0.42'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E");
}

body.is-camera-on .direction-punches {
	display: none !important;
}

@keyframes seek-rect-pulse {
	0%, 100% { transform: scale(0.975); opacity: 0.62; }
	50% { transform: scale(1.015); opacity: 1; }
}

@keyframes seek-corner-breathe {
	0%, 100% { transform: scale(0.96); opacity: 0.74; }
	50% { transform: scale(1.04); opacity: 1; }
}

/* 전체화면 조작 버튼: 하단 safe-area 위에 고정 */
body.is-camera-on .camera-float-actions {
	position: fixed;
	left: 50%;
	bottom: max(18px, calc(env(safe-area-inset-bottom) + 14px));
	z-index: 80;
	width: min(520px, calc(100vw - 28px));
	gap: 10px;
	transform: translateX(-50%);
}

body.is-camera-on .float-capture,
body.is-camera-on .float-close {
	min-height: 54px;
	border-color: rgba(255, 255, 255, 0.26);
	background: rgba(12, 18, 28, 0.58);
	font-size: 16px;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
}

body.is-camera-on .float-capture {
	flex: 1 1 auto;
}

body.is-camera-on .float-close {
	flex: 0 0 112px;
}

@media (max-width: 720px) {
	body.is-camera-on .scan-guide {
		width: min(96vw, 132dvh);
		aspect-ratio: 1.58 / 1;
	}

	body.is-camera-on .scan-guide::after {
		top: -42px;
	}

	body.is-camera-on .camera-float-actions {
		width: calc(100vw - 24px);
	}

	body.is-camera-on .float-capture,
	body.is-camera-on .float-close {
		min-height: 52px;
		font-size: 15px;
	}

	body.is-camera-on .float-close {
		flex-basis: 96px;
	}
}

/* ------------------------------------------------------------
 * 20260707 안정화 패치
 * ------------------------------------------------------------
 * 전체화면 카메라에서 중앙 가이드가 과하게 펄스/호흡하면
 * 실제 OpenCV 인식선과 섞여 사용자가 "인식 움직임이 이상하다"고 느낄 수 있습니다.
 * 가이드는 정적으로 두고, 실제 인식 결과는 overlayCanvas의 사각형만 움직이게 합니다.
 */
body.is-camera-on .scan-guide::before,
body.is-camera-on .scan-guide span {
	animation: none !important;
}

body.is-camera-on .scan-guide::before {
	transform: none !important;
	opacity: 0.82;
}
/* ============================================================
 * 20260708 exam select panel + option modal CSS patch
 * ------------------------------------------------------------
 * index.php 안에서 고사/탐구/제2외국어 선택 section이
 * scanner-layout의 첫 번째 grid 자식으로 추가되면 카메라 카드와
 * 결과 패널 위치가 밀릴 수 있습니다.
 *
 * 그래서 첫 번째 선택 section은 항상 상단 전체 폭을 차지하도록 고정합니다.
 * HTML에 class="exam-select-panel"을 붙이면 더 명확하고,
 * 기존처럼 class가 없어도 첫 번째 section을 자동으로 처리합니다.
 * ============================================================ */

/* 버튼 안 SVG 공통 보정 */
.btn svg {
	width: 19px;
	height: 19px;
	margin-right: 7px;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.status-grid span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.status-grid span svg {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/*
 * 고사/탐구 선택 상단 패널
 * ------------------------------------------------------------
 * 현재 HTML:
 * <section>
 *   <div><select id="examSelect">...</select></div>
 *   <div><table>...</table></div>
 * </section>
 *
 * 권장 HTML:
 * <section class="exam-select-panel">
 *   ...
 * </section>
 */
.exam-select-panel,
.scanner-layout > section:first-child:not(.camera-card) {
	grid-column: 1 / -1;
	min-width: 0;
	padding: 15px; /*다른것과 패딩값 맞췄습니다. 기존은 12로 되어있었습니다.*/
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-soft);
	display: grid;
	gap: 8px;
}

.exam-select-panel > div,
.scanner-layout > section:first-child:not(.camera-card) > div {
	min-width: 0;
}

.exam-select-panel table,
.scanner-layout > section:first-child:not(.camera-card) table {
	width: 100%;
	margin: 0;
	border-collapse: separate;
	border-spacing: 8px 0;
	table-layout: fixed;
}

.exam-select-panel td,
.scanner-layout > section:first-child:not(.camera-card) td {
	padding: 0;
	vertical-align: top;
}

.exam-select-panel select,
.scanner-layout > section:first-child:not(.camera-card) select {
	width: 100%;
	min-width: 0;
	height: 44px;
	padding: 0 38px 0 12px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-md);
	background-color: #ffffff;
	color: var(--text);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--blue) 50%),
		linear-gradient(135deg, var(--blue) 50%, transparent 50%);
	background-position:
		calc(100% - 19px) 50%,
		calc(100% - 13px) 50%;
	background-size:
		6px 6px,
		6px 6px;
	background-repeat: no-repeat;
	box-shadow: none;
}

.exam-select-panel select:focus,
.scanner-layout > section:first-child:not(.camera-card) select:focus {
	border-color: var(--blue);
	box-shadow: 0 0 0 3px rgba(59, 99, 140, 0.14);
}

.exam-select-panel select:disabled,
.scanner-layout > section:first-child:not(.camera-card) select:disabled {
	background-color: #edf1f5;
	color: var(--placeholder);
}

/*
 * 카메라 전체화면 모드에서는 선택 패널도 반드시 숨깁니다.
 * 이 처리가 없으면 camera-card 앞에 있는 section이 화면 위에 남을 수 있습니다.
 */
body.is-camera-on .exam-select-panel,
body.is-camera-on .scanner-layout > section:first-child:not(.camera-card) {
	display: none !important;
}

/* ============================================================
 * 선택 옵션 옆 설정 아이콘 + 설정 모달
 * ------------------------------------------------------------
 * index.php 안의 inline style을 빼도 깨지지 않도록 app.css에 포함합니다.
 * ============================================================ */

.panel-title.with-option-action {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
}

.option-icon-btn {
	width: 44px;
	height: 44px;
	border-radius: 16px;
	border: 1px solid rgba(96, 121, 149, 0.32);
	background: rgba(255, 255, 255, 0.82);
	color: var(--navy);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 20px rgba(30, 58, 95, 0.10);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.option-icon-btn svg {
	width: 22px;
	height: 22px;
	margin: 0;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.1;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.option-icon-btn:active {
	transform: scale(0.97);
}

.option-modal {
	position: fixed;
	inset: 0;
	z-index: 10020;
	display: none;
	align-items: flex-end;
	justify-content: center;
	padding: 18px;
	background: rgba(15, 23, 42, 0.48);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.option-modal.is-open {
	display: flex;
}

.option-modal-card {
	width: min(720px, 100%);
	max-height: min(86vh, 820px);
	overflow: auto;
	border-radius: 28px;
	background: #ffffff;
	box-shadow: 0 30px 80px rgba(15, 23, 42, 0.30);
	border: 1px solid rgba(164, 180, 199, 0.42);
}

.option-modal-head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 22px 14px;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(212, 222, 233, 0.78);
}

.option-modal-head h2 {
	margin: 0;
	font-size: 21px;
	font-weight: 600;
	letter-spacing: -0.04em;
	color: var(--navy);
}

.option-close-btn {
	width: 42px;
	height: 42px;
	border-radius: 999px;
	border: 1px solid rgba(96, 121, 149, 0.28);
	background: #f8fafc;
	color: #284767;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.option-modal-body {
	padding: 18px 22px 24px;
}

.option-block {
	border: 1px solid rgba(210, 222, 235, 0.90);
	border-radius: 15px;
	padding: 18px;
	background: #fbfdff;
	margin-bottom: 16px;
}

.option-block:last-child {
	margin-bottom: 0;
}

.option-block-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}

.option-block-title strong {
	font-size: 18px;
	font-weight: 600;
	letter-spacing: -0.035em;
	color: var(--navy);
}

.option-help {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.55;
	color: var(--muted);
}

.device-info-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.device-info-row {
	display: grid;
	grid-template-columns: 94px minmax(0, 1fr);
	gap: 10px;
	align-items: center;
	padding: 11px 12px;
	border-radius: 16px;
	background: #ffffff;
	border: 1px solid rgba(218, 228, 238, 0.92);
}

.device-info-row span {
	font-size: 12px;
	font-weight: 600;
	color: var(--muted);
}

.device-info-row code,
.device-info-row strong {
	min-width: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--navy);
	word-break: break-all;
}

@media (min-width: 720px) {
	.option-modal {
		align-items: center;
	}
}

@media (max-width: 720px) {
	.exam-select-panel,
	.scanner-layout > section:first-child:not(.camera-card) {
		padding: 10px;
		border-radius: 12px;
		gap: 8px;
	}

	.exam-select-panel table,
	.exam-select-panel tbody,
	.exam-select-panel tr,
	.exam-select-panel td,
	.scanner-layout > section:first-child:not(.camera-card) table,
	.scanner-layout > section:first-child:not(.camera-card) tbody,
	.scanner-layout > section:first-child:not(.camera-card) tr,
	.scanner-layout > section:first-child:not(.camera-card) td {
		display: block;
		width: 100% !important;
	}

	.exam-select-panel table,
	.scanner-layout > section:first-child:not(.camera-card) table {
		border-spacing: 0;
	}

	.exam-select-panel td + td,
	.scanner-layout > section:first-child:not(.camera-card) td + td {
		margin-top: 8px;
	}

	.exam-select-panel select,
	.scanner-layout > section:first-child:not(.camera-card) select {
		height: 43px;
		font-size: 14px;
	}

	.option-modal {
		padding: 10px;
	}

	.option-modal-card {
		border-radius: 15px;
		max-height: 88vh;
	}

	.option-modal-head {
		padding: 16px 16px 12px;
	}

	.option-modal-head h2 {
		font-size: 18px;
	}

	.option-modal-body {
		padding: 14px 16px 18px;
	}

	.option-block {
		padding: 14px;
		border-radius: 18px;
	}

	.device-info-row {
		grid-template-columns: 76px minmax(0, 1fr);
	}
}











/* ============================================================
 * 모바일 결과 화면 - 인식된 이미지 상단 고정
 * ------------------------------------------------------------
 * #screenView 자체를 sticky 처리해야 실제로 위에 붙습니다.
 * 안쪽 preview-box만 sticky 주면 section 내부에서만 움직여서 효과가 약합니다.
 * ============================================================ */
@media (max-width: 720px) {
	body.is-ocr-result-review #screenView,
	body.is-ocr-result-review .preview-panel {
		position: sticky;
		top: 0;
		z-index: 50;
		background: var(--surface);
		border-radius: 0 0 14px 14px;
		box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
	}

	body.is-ocr-result-review #screenView .panel-title {
		margin-bottom: 6px;
	}

	body.is-ocr-result-review #screenView .eyebrow {
		display: none;
	}

	body.is-ocr-result-review #screenView h2 {
		font-size: 14px;
		margin: 0;
	}

	body.is-ocr-result-review #previewBox {
		height: 32svh;
		min-height: 160px;
		max-height: 260px;
	}

	body.is-ocr-result-review #previewImage {
		width: 100%;
		height: 100%;
		object-fit: contain;
	}
}




/*
*
*	기존 인덱스에 포함 시켰던 모달
*/
.btn svg {
	width: 19px;
	height: 19px;
	margin-right: 7px;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.status-grid span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.status-grid span svg {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}


/* ============================================================
 * 선택 옵션 옆 설정 아이콘 + 설정 모달
 * ------------------------------------------------------------
 * index.php 안에서만 추가한 임시 스타일입니다.
 * 나중에 정리할 때는 assets/css/app.css로 이동하면 됩니다.
 * ============================================================ */
.panel-title.with-option-action {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
}

.option-icon-btn {
	width: 44px;
	height: 44px;
	border-radius: 16px;
	border: 1px solid rgba(96, 121, 149, 0.32);
	background: rgba(255, 255, 255, 0.82);
	color: #1e3a5f;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 20px rgba(30, 58, 95, 0.10);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.option-icon-btn svg {
	width: 22px;
	height: 22px;
	margin: 0;
	stroke-width: 2.1;
}

.option-icon-btn:active {
	transform: scale(0.97);
}

.option-modal {
	position: fixed;
	inset: 0;
	z-index: 10020;
	display: none;
	align-items: flex-end;
	justify-content: center;
	padding: 18px;
	background: rgba(15, 23, 42, 0.48);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.option-modal.is-open {
	display: flex;
}

.option-modal-card {
	width: min(720px, 100%);
	max-height: min(86vh, 820px);
	overflow: auto;
	border-radius: 28px;
	background: #ffffff;
	box-shadow: 0 30px 80px rgba(15, 23, 42, 0.30);
	border: 1px solid rgba(164, 180, 199, 0.42);
}

.option-modal-head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 22px 14px;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(212, 222, 233, 0.78);
}

.option-modal-head h2 {
	margin: 0;
	font-size: 21px;
	letter-spacing: -0.04em;
	color: #18365a;
}

.option-close-btn {
	width: 42px;
	height: 42px;
	border-radius: 999px;
	border: 1px solid rgba(96, 121, 149, 0.28);
	background: #f8fafc;
	color: #284767;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.option-modal-body {
	padding: 18px 22px 24px;
}

.option-block {
	border: 1px solid rgba(210, 222, 235, 0.90);
	border-radius: 15px;
	padding: 18px;
	background: #fbfdff;
	margin-bottom: 16px;
}

.option-block-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}

.option-block-title strong {
	font-size: 18px;
	letter-spacing: -0.035em;
	color: #18365a;
}

.option-help {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.55;
	color: #6b7d91;
}

.device-info-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.device-info-row {
	display: grid;
	grid-template-columns: 94px minmax(0, 1fr);
	gap: 10px;
	align-items: center;
	padding: 11px 12px;
	border-radius: 16px;
	background: #ffffff;
	border: 1px solid rgba(218, 228, 238, 0.92);
}

.device-info-row span {
	font-size: 12px;
	font-weight: 800;
	color: #6b7d91;
}

.device-info-row code,
.device-info-row strong {
	min-width: 0;
	font-size: 13px;
	font-weight: 800;
	color: #18365a;
	word-break: break-all;
}


@media (min-width: 720px) {
	.option-modal {
		align-items: center;
	}
}