:root {
    /* 기본 색상 */
    --primary: #1a2a4f; /* 진한 남색 */
    --primary-dark: #0e1a32; /* 더 진한 남색 */
    --primary-rgb: 26, 42, 79; /* rgba 사용을 위한 RGB 값 */
    --secondary: #ff5722;
    --accent: #ff9500;
    --success: #00e676;
    --warning: #ffeb3b;
    --danger: #ff3d71;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --white: #ffffff;

    /* 기능별 색상 */
    --convert-color: var(--primary);
    --convert-hover: var(--primary-dark);
    --crop-color: var(--secondary);
    --crop-hover: #e64a19;
    --split-color: #7c4dff;
    --split-hover: #651fff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    height: 100%; /* Ensure full height for fixed positioning contexts */
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background-color: #f7f9fc; /* 원래 색상으로 되돌림 */
    color: var(--text-color);
    line-height: 1.6;
    scroll-behavior: smooth;
    word-break: keep-all; /* 한글 단어 단위 줄바꿈 */
    overflow-wrap: break-word; /* 긴 단어 강제 줄바꿈 */
}

body.menu-open {
    overflow: hidden;
}

header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

.logo img {
    max-height: 40px; /* 로고 이미지의 최대 높이 설정 */
    width: auto; /* 비율 유지 */
    vertical-align: middle;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 102;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
}

.hamburger-icon .bar {
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.main-nav {
    margin-left: auto;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: 16px;
    padding: 10px 15px;
    position: relative;
    transition: color 0.3s;
    display: block;
}

.main-nav a:hover {
    color: var(--primary);
}

.main-nav a.active {
    color: var(--primary);
    font-weight: 600;
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px 2px 0 0;
}

/* 탭 메뉴 스타일 */
.main-nav ul.tab-menu {
    background-color: var(--white);
    border-radius: 30px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.main-nav ul.tab-menu li {
    margin: 0 2px;
}

.main-nav ul.tab-menu a {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    display: inline-block;
}

.main-nav ul.tab-menu a:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.main-nav ul.tab-menu a.active {
    background-color: var(--primary);
    color: white;
}

.main-nav ul.tab-menu a.active::after {
    display: none;
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 90px 20px 0;
}

.container h1 {
    font-size: 38px;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
    margin-bottom: 40px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* 업로드 박스 스타일 */
.upload-box {
    border: 3px dashed #ccc;
    border-radius: 10px;
    padding: 50px 20px;
    text-align: center;
    margin-bottom: 30px;
    background-color: #ffffff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    border-color: var(--primary);
}

.upload-box.highlight {
    border-color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.05);
}

.upload-text {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #555;
}

.upload-info {
    font-size: 14px;
    color: #777;
    margin-bottom: 20px;
}

#fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

.upload-btn {
    background-color: var(--primary);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.upload-btn:hover {
    background-color: var(--primary-dark);
}

/* 미리보기 영역 스타일 */
.preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.preview-item {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    padding: 15px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    width: calc(33.333% - 14px);
    display: flex;
    flex-direction: column;
}

.preview-img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 10px;
}

.preview-info {
    margin-top: auto;
    text-align: center;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.file-size {
    font-size: 12px;
    color: #666;
}

.file-dimensions {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

/* 삭제 버튼 스타일 */
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 25px;
    height: 25px;
    background-color: #ff4757;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    transition: all 0.3s ease;
    z-index: 10;
}

.delete-btn::before {
    content: '×';
    font-size: 18px;
    line-height: 1;
}

.delete-btn:hover {
    background-color: #ff3742;
    transform: scale(1.1);
}

/* 섹션 제목 스타일 */
.section-title {
    margin: 40px 0 20px;
}

.section-title h3 {
    font-size: 22px;
    color: #333;
    position: relative;
    padding-left: 15px;
    display: inline-block;
}

.section-title h3:before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
}

/* 워터마크 컨테이너 스타일 */
.watermark-container {
    background-color: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.watermark-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.watermark-option-set {
    flex: 1;
    min-width: 250px;
}

.watermark-text-container,
.watermark-color-container,
.watermark-opacity-container,
.watermark-position-container {
    margin-bottom: 20px;
}

.watermark-text-container label,
.watermark-color-container label,
.watermark-opacity-container label,
.watermark-position-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

#watermarkText {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary);
}

#customColorPicker {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background-color: transparent;
    padding: 0;
    vertical-align: middle;
}

.custom-color-label {
    margin-left: 5px;
    font-size: 14px;
    color: #777;
    display: inline-block;
}

#watermarkOpacity {
    width: 100%;
    margin-right: 10px;
}

#opacityValue {
    font-size: 14px;
    color: #555;
}

.position-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.position-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.position-btn:hover {
    background-color: #e9e9e9;
}

.position-btn.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 변환 옵션 컨테이너 스타일 */
.conversion-options-container {
    background-color: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.conversion-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.conversion-btn {
    background-color: #eee;
    color: #555;
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.conversion-btn:hover {
    background-color: #e0e0e0;
}

.conversion-btn.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.convert-btn {
    background-color: var(--primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.convert-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.convert-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* 다운로드 영역 스타일 */
.download-area {
    margin-top: 30px;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.download-text {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
}

.download-btn {
    background-color: var(--primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.download-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* 반응형 스타일 */
@media (max-width: 1200px) {
    .preview-item {
        width: calc(50% - 10px);
    }
}

/* 태블릿 반응형 */
@media (max-width: 992px) {
    .header-container {
        padding: 12px 15px;
    }
    
    .container {
        padding: 80px 15px 0;
    }
    
    .features-grid {
        gap: 25px;
        padding: 0 15px;
        max-width: 800px;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .feature-content h2 {
        font-size: 20px;
    }
    
    .feature-content p {
        font-size: 14px;
    }
    
    .preview-item {
        width: 100%;
    }
    
    .hero-section {
        padding: 25px 15px;
        margin: 25px 0 45px;
    }
    
    .hero-section h1 {
        font-size: 32px;
    }
    
    .hero-section p {
        font-size: 17px;
    }
}

/* 중간 화면 반응형 */
@media (max-width: 900px) {
    .features-grid {
        gap: 22px;
        padding: 0 12px;
        max-width: 700px;
    }
    
    .feature-card {
        padding: 22px 18px;
    }
    
    .feature-content h2 {
        font-size: 19px;
    }
    
    .feature-content p {
        font-size: 13.5px;
    }
}

/* 작은 태블릿에서도 1열로 - 더 넓은 범위 */
@media (max-width: 850px) {
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 25px;
        padding: 0 15px;
        max-width: 600px;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
}

/* 모바일 반응형 - 768px 이하에서 1열로 강제 변경 */
@media (max-width: 768px) {
    .header-container {
        padding: 10px 12px;
    }
    
    .container {
        padding: 70px 10px 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background-color: var(--white);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        padding: 80px 20px 30px;
        z-index: 101;
        transition: right 0.3s ease;
        overflow-y: auto;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul.tab-menu {
        flex-direction: column;
        background: none;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        width: 100%;
        overflow-x: visible;
    }
    
    .main-nav ul.tab-menu li {
        margin: 0;
        width: 100%;
    }
    
    .main-nav ul.tab-menu a {
        padding: 15px;
        border-radius: 5px;
        display: block;
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
        font-size: 16px;
    }
    
    /* 모바일에서 확실히 1열로 */
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
        padding: 0 10px;
        max-width: 500px;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .feature-content h2 {
        font-size: 20px;
    }
    
    .feature-content p {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .feature-btn {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
        max-width: 250px;
    }
    
    .hero-section {
        padding: 20px 10px;
        margin: 20px 0 35px;
    }
    
    .hero-section h1 {
        font-size: 26px;
        margin-bottom: 12px;
    }
    
    .hero-section p {
        font-size: 15px;
        line-height: 1.5;
    }
    
    .info-section {
        padding: 25px 15px;
        margin: 35px 5px;
    }
    
    .info-section h2 {
        font-size: 22px;
    }
    
    .info-section p {
        font-size: 14px;
    }
    
    /* 기타 모바일 최적화 */
    .conversion-options-container {
        padding: 20px 10px;
    }
    
    .conversion-options {
        gap: 10px;
    }
    
    .conversion-btn, .convert-btn {
        width: 100%;
    }
    
    .watermark-options-row {
        flex-direction: column;
    }
    
    .watermark-option-set {
        width: 100%;
    }
    
    .position-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preview-item {
        width: 100%;
    }
    
    .preview-img {
        height: 120px;
    }
}

/* 소형 모바일 최적화 */
@media (max-width: 600px) {
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 18px;
        padding: 0 8px;
        max-width: 450px;
    }
    
    .feature-card {
        padding: 20px 15px;
    }
    
    .feature-content h2 {
        font-size: 18px;
    }
    
    .feature-content p {
        font-size: 13px;
    }
    
    .hero-section {
        padding: 18px 8px;
    }
    
    .hero-section h1 {
        font-size: 24px;
    }
    
    .hero-section p {
        font-size: 14px;
    }
}

/* 초소형 모바일 최적화 */
@media (max-width: 480px) {
    .header-container {
        padding: 8px 10px;
    }
    
    .container {
        padding: 60px 8px 0;
    }
    
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 0 5px;
        max-width: 400px;
    }
    
    .feature-card {
        padding: 18px 12px;
    }
    
    .feature-content h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .feature-content p {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .feature-btn {
        padding: 10px 15px;
        font-size: 12px;
        max-width: 200px;
    }
    
    .hero-section {
        padding: 15px 5px;
        margin: 15px 0 25px;
    }
    
    .hero-section h1 {
        font-size: 20px;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .hero-section p {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .info-section {
        padding: 20px 10px;
        margin: 25px 3px;
    }
    
    .info-section h2 {
        font-size: 18px;
    }
    
    .info-section p {
        font-size: 13px;
        line-height: 1.5;
    }
    
    .preview-item {
        padding: 10px;
    }
    
    .preview-img {
        height: 100px;
    }
}

/* 이미지 자르기 섹션 */
.crop-container {
    margin-top: 30px;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.img-container {
    max-width: 100%;
    margin: 0 auto 20px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 500px;
    width: 100%;
}

#imageToCrop {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.controls {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    align-items: center;
}

.ratio-buttons,
.action-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.ratio-buttons button,
.action-buttons button {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
}

.ratio-buttons button:hover,
.action-buttons button:hover {
    background-color: #e0e0e0;
}

.ratio-buttons button.active,
.action-buttons button.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 크롭 및 리셋 버튼은 별도의 스타일을 가질 수 있으므로 convert-btn 클래스를 재사용 */
.convert-btn {
    background-color: var(--primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.convert-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.convert-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

#croppedImageView {
    max-width: 100%;
    max-height: 400px;
    border: 1px solid #eee;
    display: block;
    margin: 0 auto;
}

/* 사용법 버튼 및 팝업 스타일 */
.top-actions {
    margin-bottom: 20px;
    overflow: hidden;
}

.manual-btn {
    background-color: #FF5722; /* 매우 밝은 오렌지색 */
    color: #FFFFFF; /* 흰색 텍스트로 대비 강조 */
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    float: right;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); /* 그림자 강화 */
}

.manual-btn:hover {
    background-color: #E64A19; /* 호버 시 약간 더 진한 오렌지 */
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6); /* 호버 시 그림자 더 강화 */
}

.manual-popup-overlay {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    right: 0;   /* Ensure it spans full width */
    bottom: 0;  /* Ensure it spans full height */
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    display: none; /* Hidden by default, activated by .show class */
}

.manual-popup-overlay.show {
    display: flex; /* Show when .show class is added by JS and use flex for centering */
    align-items: center;
    justify-content: center;
}

.manual-content {
    background-color: #fff;
    /* Removed margin: 5% auto; to allow flexbox centering */
    padding: 30px;
    width: 80%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close-popup {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 15px;
    right: 15px;
    transition: background-color 0.3s ease;
}

.close-popup:hover {
    background-color: var(--primary-dark);
}

.manual-content h2 {
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.manual-section {
    margin-bottom: 25px;
}

.manual-section h3 {
    color: var(--primary);
    font-size: 18px;
    margin-bottom: 10px;
}

.manual-section p {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #666;
}

/* 이미지 분할 관련 스타일 */
.split-container {
    margin-top: 30px;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.image-preview-container {
    display: block; /* Ensure block behavior */
    min-height: 300px;
    margin: 0 auto 20px; /* Centers and adds space below */
    position: relative; /* For absolute positioning of delete-btn */
    max-width: 100%;
    text-align: center; /* Centers content */
}

#originalImage {
    max-width: 100%;
    max-height: 500px;
    display: block;
    margin: 0 auto;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    box-sizing: border-box;
    border: 2px solid rgba(124, 77, 255, 0.7);
    margin: 0 auto;
    width: 100%;
    height: 100%;
}

.split-options {
    margin-top: 20px;
}

.split-type-options {
    margin-bottom: 20px;
}

.split-type-options label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #555;
}

.split-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.split-btn {
    background-color: #eee;
    color: #555;
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.split-btn:hover {
    background-color: #e0e0e0;
}

.split-btn.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.custom-split-options {
    margin-top: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.custom-row-col {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    align-items: center;
}

.input-group label {
    margin-right: 10px;
    color: #555;
    font-weight: 500;
}

.input-group input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.apply-btn {
    background-color: var(--primary);
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 20px;
    display: block;
    width: 100%;
}

.apply-btn:hover {
    background-color: var(--primary-dark);
}

.split-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.split-btn-action {
    background-color: var(--primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.split-btn-action:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.split-results {
    margin-top: 30px;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.split-results h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
    text-align: center;
}

.split-images-container {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
    /* grid-template-columns는 JavaScript에서 동적으로 설정됨 */
}

.split-image-item {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.split-image-item img {
    max-width: 100%;
    border: 1px solid #eee;
    border-radius: 3px;
}

.split-image-info {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.new-split-btn {
    background-color: #FF5722; /* 사용법 버튼과 동일한 오렌지색 */
    color: #FFFFFF;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.new-split-btn:hover {
    background-color: #E64A19; /* 호버 시 약간 더 진한 오렌지 */
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

/* 복사하기 버튼 스타일 */
.copy-split-btn {
    background-color: #4CAF50; /* 초록색 */
    color: #FFFFFF;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    margin-left: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.copy-split-btn:hover {
    background-color: #45a049; /* 호버 시 약간 더 진한 초록 */
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.copy-split-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 메인 페이지 스타일 */
.hero-section {
    text-align: center;
    margin: 40px 0 60px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(0,195,255,0.1) 0%, rgba(255,149,0,0.1) 100%);
    border-radius: 15px;
    animation: fadeIn 0.8s ease;
}

.hero-section h1 {
    font-size: 36px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 800;
}

.hero-section p {
    font-size: 18px;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 60px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.feature-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    padding: 30px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-top: 5px solid transparent;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(var(--primary-rgb), 0.1); /* 새로운 primary 색상에 맞는 shadow */
}

.convert-card {
    border-top-color: var(--convert-color);
}

.crop-card {
    border-top-color: var(--crop-color);
}

.split-card {
    border-top-color: var(--split-color);
}

.favicon-card {
    border-top-color: #f5576c;
}

.feature-icon {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.feature-icon img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.feature-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.feature-content h2 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.feature-content p {
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: center;
}

.feature-list {
    list-style-type: none;
    margin: 0 0 25px;
    padding: 0;
}

.feature-list li {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    font-size: 14px;
    color: #555;
    position: relative;
    padding-left: 22px;
    text-align: left;
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li::before {
    content: '✓';
    color: var(--success);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.feature-btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-top: auto;
    align-self: center;
}

.feature-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.info-section {
    text-align: center;
    margin: 50px 0;
    padding: 40px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.05);
}

.info-section h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 20px;
}

.info-section p {
    font-size: 16px;
    color: #666;
    max-width: 800px;
    margin: 0 auto 25px;
    line-height: 1.7;
}

.manual-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.manual-link:hover {
    color: var(--primary-dark);
}

footer {
    background-color: #f8f9fa;
    padding: 30px 0 50px;
    text-align: center;
    margin-top: 50px;
    border-top: 1px solid #eee;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content p {
    color: #777;
    font-size: 14px;
}

/* 픽사베이 이미지 검색 관련 스타일 */
.pixabay-search-container {
    background-color: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 50px;
    overflow: hidden;
}

#searchQuery {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 0;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

#searchQuery:focus {
    border-color: var(--primary);
    box-shadow: none;
}

.search-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 0 50px 50px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.search-btn:hover {
    background-color: var(--primary-dark);
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.search-result-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.search-result-item.selected {
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.2);
}

.search-result-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.search-result-item .image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px;
    font-size: 12px;
    text-align: center;
}

.search-result-item .select-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.search-result-item.selected .select-icon {
    opacity: 1;
}

.search-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #666;
}

.search-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
}

.search-loading:after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 195, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* 초기화 버튼 스타일 */
.reset-btn {
    background-color: #f0f0f0; /* 밝은 회색 배경 */
    color: #555; /* 어두운 회색 텍스트 */
    padding: 12px 30px;
    border: 1px solid #ddd; /* 연한 테두리 */
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 30px; /* split-btn-action과 동일한 간격 유지 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 미묘한 그림자 */
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.reset-btn:hover {
    background-color: #e0e0e0; /* 호버 시 약간 더 진한 회색 */
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* 호버 시 그림자 강화 */
}

/* Global utility classes */
.hidden {
    display: none !important;
}

/* Favicon Maker specific styles */
.favicon-maker-wrapper {
    display: block; /* Ensures vertical stacking of main sections */
    margin-top: 30px;
}

.image-editing-section {
    display: block; /* Ensures vertical stacking of internal sections */
    margin-top: 30px; /* Space from upload section */
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center; /* Center content within this section */
    width: 100%;
}

@media (min-width: 768px) {
    .image-editing-section {
        /* Ensure block layout is maintained on larger screens */
        flex-direction: unset; 
        grid-template-columns: unset; 
    }
}

.image-preview-container {
    display: block; /* Ensure block behavior */
    min-height: 300px;
    margin: 0 auto 20px; /* Centers and adds space below */
    position: relative; /* For absolute positioning of delete-btn */
    max-width: 100%;
    text-align: center; /* Centers content */
}

#uploadedImagePreview {
    max-width: 100%;
    max-height: 250px; /* Limit image height */
    object-fit: contain;
    display: block; /* Ensures proper centering */
    margin: 0 auto; /* Centers the image */
}

.favicon-options-section {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.05);
    padding: 25px;
    display: flex; /* Keep flex for its internal content (h3, buttons) */
    flex-direction: column;
    gap: 20px;
    margin-top: 20px; /* Space from image-preview-container */
    margin-bottom: 0;
    width: 100%;
}

.favicon-options-section h3 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 10px;
    text-align: center;
}

.favicon-size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.favicon-size-btn {
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.favicon-size-btn:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.favicon-size-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 5px rgba(var(--primary-rgb), 0.2);
}

.favicon-size-btn.active:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Styling for the favicon actions buttons (Generate, Reset) */
.favicon-actions {
    display: flex;
    justify-content: center;
    gap: 15px; /* Space between buttons */
    margin-top: 20px; /* Match split-actions container's margin-top */
}

.favicon-actions .convert-btn, .favicon-actions .reset-btn {
    padding: 12px 30px; /* Larger padding for action buttons */
    border-radius: 8px; /* Rounded corners */
    font-size: 18px; /* Larger font size */
    font-weight: 600; /* Bolder text */
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    /* background-color will be set individually below */
    display: inline-flex; /* Align text and potentially icons */
    align-items: center;
    gap: 10px;
}

.favicon-actions .convert-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    margin-top: 30px; /* Match split-btn-action's margin-top */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Match split-btn-action's box-shadow */
}

.favicon-actions .convert-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.favicon-actions .convert-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.favicon-actions .reset-btn {
    background-color: #f0f0f0 !important; /* Match split-page's reset button color (light grey) */
    color: #555 !important; /* Match split-page's reset button text color */
    border: 1px solid #ddd !important; /* Match split-page's reset button border */
    margin-top: 30px; /* Corrected to match .reset-btn's margin-top (30px) */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Match split-page's reset button box-shadow */
}

.favicon-actions .reset-btn:hover {
    background-color: #e0e0e0 !important; /* Match split-page's reset button hover color and ensure precedence */
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Match split-page's reset button hover box-shadow */
}

.favicon-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    border: 1px dashed #eee;
    border-radius: 10px;
    background-color: #fdfdff;
}

.favicon-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.favicon-preview-item img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 10px;
    border: 1px solid #f0f0f0;
}

.favicon-preview-item p {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    word-break: break-all;
}

.download-single-btn {
    display: inline-block;
    background-color: #5cb85c;
    color: white;
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.download-single-btn:hover {
    background-color: #4cae4c;
}

.favicon-code-area {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
    width: 100%;
}

.favicon-code-area h3 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 15px;
    text-align: center;
}

.favicon-code-area pre {
    background-color: #e9e9e9;
    border-radius: 5px;
    padding: 15px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.copy-code-btn {
    display: block;
    width: fit-content;
    margin: 15px auto 0;
    background-color: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.copy-code-btn:hover {
    background-color: var(--primary-dark);
}

.new-favicon-btn {
    display: block;
    width: fit-content;
    margin: 20px auto 0;
    background-color: var(--accent);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.new-favicon-btn:hover {
    background-color: #e68a00;
    transform: translateY(-2px);
}

.download-area {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.05);
    padding: 25px;
    margin-top: 30px; /* Match split-results' margin-top */
    width: 100%;
}

/* Ensure the reset button specifically uses the correct grey color */
#resetFaviconToolBtn {
    background-color: #f0f0f0 !important; /* 강제 적용: 밝은 회색 */
    color: #555 !important; /* 강제 적용: 어두운 회색 텍스트 */
    border: 1px solid #ddd !important; /* 강제 적용: 테두리 */
}

#resetFaviconToolBtn:hover {
    background-color: #e0e0e0 !important; /* 강제 적용: 호버 시 약간 더 진한 회색 */
}


