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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-bottom: 60px;
}

.container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    max-width: 900px;
    width: 100%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.top-subtitle {
    color: #333;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 25px;
    margin-top: 0;
}

.header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 25px;
}

.logo-section {
    flex-shrink: 0;
}

.logo {
    width: 250px;
    height: 250px;
    object-fit: contain;
    margin: 0;
    padding: 0;
}

.content-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.subtitle {
    color: #666;
    margin-bottom: 0;
    font-size: 16px;
    text-align: left;
}

.feature-icons-section {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #eee;
}

.feature-icons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.feature-icon:hover {
    border-color: #4a7c3c;
    background: #fafafa;
    transform: translateY(-2px);
}

.feature-icon svg {
    color: #666;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.feature-icon:hover svg {
    color: #4a7c3c;
}

.feature-icon span {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    text-align: center;
}

.upload-section {
    margin: 0;
}

#fileInput {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 25px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.upload-label:hover {
    border-color: #4a7c3c;
    background: #fafafa;
    transform: translateY(-2px);
}

.upload-label svg {
    color: #999;
    margin-bottom: 15px;
}

.upload-label span {
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

.file-info {
    color: #999 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    margin-top: 5px;
}

.preview-section {
    margin-top: 30px;
}

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

.page-reorder-hint {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #856404;
    text-align: center;
}

.page-reorder-hint strong {
    display: block;
    margin-bottom: 5px;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.image-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
}

.image-preview.reorderable .image-item {
    cursor: move;
    user-select: none;
}

.image-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.image-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg) scale(0.95);
}

.image-item.drag-over {
    border: 3px dashed #4a7c3c;
    transform: scale(1.08);
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
}

.page-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(74, 124, 60, 0.95);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

.file-type-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

.image-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 3;
}

.image-item .remove-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #4a7c3c 0%, #6ba854 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 124, 60, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-annotate {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-annotate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    color: white;
    text-decoration: none;
}

.btn-annotate svg {
    flex-shrink: 0;
}

.loading-section {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a7c3c;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-section p {
    color: #666;
    font-size: 16px;
}

.settings-section {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.settings-section h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.setting-select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-select:hover {
    border-color: #4a7c3c;
}

.setting-select:focus {
    outline: none;
    border-color: #4a7c3c;
}

.quality-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a7c3c 0%, #6ba854 100%);
    cursor: pointer;
    transition: transform 0.2s;
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a7c3c 0%, #6ba854 100%);
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.quality-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.quality-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.quality-label {
    font-size: 12px;
    color: #999;
}

.setting-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #eee;
    padding: 12px 20px;
    text-align: center;
    font-size: 12px;
    color: #999;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.page-footer a {
    color: #666;
    text-decoration: none;
    margin: 0 8px;
    transition: color 0.2s ease;
}

.page-footer a:hover {
    color: #4a7c3c;
}

.page-footer span {
    color: #ccc;
    margin: 0 4px;
}

/* Mobile Responsive Optimizations */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 60px;
    }
    
    .container {
        padding: 15px;
        max-width: 100%;
        box-shadow: none;
        border-radius: 8px;
    }
    
    .top-subtitle {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 25px;
        line-height: 1.4;
        letter-spacing: -0.02em;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo {
        width: 150px;
        height: 150px;
    }
    
    .upload-label {
        padding: 25px 15px;
    }
    
    .upload-label span {
        font-size: 14px;
    }
    
    .image-preview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        max-height: 400px;
    }
    
    .image-item img {
        height: 120px;
    }
    
    .settings-section {
        padding: 15px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .page-footer {
        font-size: 11px;
        padding: 10px 15px;
    }
    
    .page-footer a {
        margin: 0 6px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .top-subtitle {
        font-size: 18px;
        font-weight: 600;
        line-height: 1.3;
        letter-spacing: -0.01em;
        margin-bottom: 20px;
    }
    
    .logo {
        width: 120px;
        height: 120px;
    }
    
    .image-preview {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .image-item img {
        height: 100px;
    }
    
    .page-number {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .file-type-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    .remove-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
}
