* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(
        135deg,
        #7b8df1 0%,  /* 밝은 블루 */
        #8a63c7 100% /* 연한 퍼플 */
    );
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* body와 같은 계열 + 대비만 강화 */
.header {
    background: linear-gradient(
        135deg,
        #5a6fe0 0%,   /* body보다 살짝 딥한 블루 */
        #6a3f9e 100%  /* 보라 채도 소폭 감소 */
    );
    color: white;
    padding: 30px;
    text-align: center;
}

.form-container {
    padding: 40px;
}


/* [변경] 마진 증가 (기존 25px -> 35px) */
.form-group { margin-bottom: 35px; }

.form-group label { display: block; margin-bottom: 12px; font-weight: 600; color: #333; font-size: 1em; }

/* [변경] 입력창 크기 및 폰트 확대 (위아래 패딩 증가) */
.form-group input:not([type=range]) {
    width: 100%;
    padding: 14px 18px;     /* 패딩 증가 */
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 17px;        /* 폰트 증가 */
    background: #f8f9fa;
    transition: 0.3s;
    height: 54px;           /* 높이 명시 */
}

/* Range Input 스타일 */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px; /* 레일 두께 약간 증가 */
    background: #e1e5e9;
    border-radius: 5px;
    padding: 0;
    outline: none;
    border: none;
    margin: 15px 0; /* 슬라이더 위아래 여백 증가 */
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; /* 썸 크기 증가 */
    height: 22px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

/* Range + Number 동기화 그룹 */
.input-sync-group { display: flex; flex-direction: column; gap: 8px; }

/* [변경] 좌표 입력칸 전용 스타일 (폰트 및 크기 확대) */
.input-sync-group input[type=number] {
    padding: 10px;
    font-size: 16px;
    text-align: center;
    height: 48px; /* 높이 증가 */
}

/* 프리뷰 영역 */
.preview-wrapper {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 35px; /* 마진 증가 */
    border: 1px solid #dee2e6;
}
.video-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease;
    cursor: crosshair;
}

/* [변경] 선택 영역 색상 변경 (노랑 -> 파랑 계열) */
.selection-area {
    position: absolute;
    border: 2px solid #00d2ff;          /* 밝은 하늘색 (Cyan) */
    background: rgba(0, 210, 255, 0.2); /* 반투명 하늘색 */
    transition: 0.1s;
    pointer-events: none;
}
.selection-area:hover {
    border-color: #007bff;              /* 진한 파랑 (Blue) */
    background: rgba(0, 123, 255, 0.3);
}

/* 레이아웃 */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; } /* 갭 증가 */
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* 툴팁 & 아이콘 */
.label-with-tooltip { display: flex; align-items: center; gap: 8px; }
.info-icon {
    display: inline-flex; justify-content: center; align-items: center;
    width: 24px; height: 24px; border-radius: 50%;
    background-color: #e1e5e9; color: #555;
    font-family: inherit; font-size: 0.9em; font-weight: bold;
    cursor: help; position: relative; transition: 0.2s;
}
.info-icon:hover { background-color: #667eea; color: white; transform: scale(1.1); }
.tooltip-box {
    visibility: hidden; opacity: 0; width: 240px; background-color: #333; color: #fff;
    text-align: left; border-radius: 6px; padding: 12px; position: absolute; z-index: 100;
    bottom: 135%; left: 50%; transform: translateX(-50%);
    font-size: 0.85em; line-height: 1.5; font-weight: normal;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: opacity 0.3s;
}
.tooltip-box::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: #333 transparent transparent transparent;
}
.info-icon:hover .tooltip-box { visibility: visible; opacity: 1; }

/* 버튼 및 상태창 */
.btn { width: 100%; padding: 18px; border: none; border-radius: 10px; font-weight: 600; font-size: 1.1em; cursor: pointer; transition: 0.3s; }
/* [수정] margin-top 제거하여 downloadBtn과 높이/위치 통일 */
.btn-run { background: linear-gradient(135deg, #007bff, #6610f2); color: white; }
.btn-download { background: linear-gradient(135deg, #fd7e14, #e83e8c); color: white; }
.button-group { display: flex; gap: 20px; margin-top: 30px; }

.status-area { margin-top: 40px; padding: 25px; border-radius: 10px; display: none; border-left: 5px solid #667eea; font-size: 1.05em; }
.loading-spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid #f3f3f3; border-top: 3px solid #667eea; border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* [추가] 모달 및 리포트 버튼 스타일 */
/* 모달 오버레이 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000; /* 드라이버보다 높게 설정 */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.open {
    display: flex;
}
/* 모달 콘텐츠 */
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.modal-body .form-group {
    margin-bottom: 15px;
}
.modal-body label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}
.modal-body input, .modal-body textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: inherit;
}
.modal-body textarea {
    resize: vertical;
    line-height: 1.4;
}
/* 읽기 전용 텍스트 영역 스타일 */
.modal-body textarea.debug-info {
    background-color: #f8f9fa;
    color: #666;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.85rem;
    border-color: #e9ecef;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.btn-modal {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    border: none;
    transition: background 0.2s;
}
.btn-modal-cancel {
    background: #f1f3f5;
    color: #495057;
}
.btn-modal-cancel:hover { background: #e9ecef; }
.btn-modal-send {
    background: #228be6;
    color: white;
}
.btn-modal-send:hover { background: #1c7ed6; }

/* 플로팅 리포트 버튼 */
.btn-float-report {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #6c757d; /* Darker gray background */
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4); /* Gray shadow */
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-float-report:hover {
    transform: translateY(-2px);
    background: #495057; /* Even darker gray on hover */
    box-shadow: 0 6px 16px rgba(73, 80, 87, 0.5); /* Darker gray shadow on hover */
}