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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Entrance animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animations for grid items */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-container.visible .stagger-item {
    opacity: 1;
    transform: translateY(0);
}

.stagger-container.visible .stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-container.visible .stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-container.visible .stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-container.visible .stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-container.visible .stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-container.visible .stagger-item:nth-child(6) { transition-delay: 0.6s; }

:root {
    --primary: #2563eb;
    --primary-light: #60a5fa;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --light: #f8fafc;
    --border: #e2e8f0;
    --checkerboard-gradient: repeating-conic-gradient(#f0f0f0 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Navbar Styles */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25em;
}

.navbar-logo {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.navbar-menu {
    display: flex;
    gap: 32px;
    align-items: center;
}

.navbar-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

.navbar-cta {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.navbar-cta:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Language Selector Styles */
.language-selector {
    position: relative;
    margin-left: 20px;
    margin-right: 20px;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.language-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.language-flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
}

.language-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.language-selector.active .language-arrow {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.language-selector.active .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.language-option:hover {
    background: rgba(37, 99, 235, 0.05);
}

.language-option.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.language-option-flag {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.language-name {
    flex: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-selector {
        margin-left: 10px;
        margin-right: 10px;
    }

    .language-button {
        padding: 6px 10px;
    }

    .language-dropdown {
        right: -20px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
}

.header {
    background: #ffffff;
    color: var(--text-primary);
    padding: 100px 40px 60px;
    text-align: center;
    position: relative;
    overflow: visible;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.header h1 {
    font-size: 3.5em;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header p {
    font-size: 1.25em;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-cta .btn {
    padding: 14px 32px;
    font-size: 1.1em;
    border-radius: 12px;
    border: 2px solid transparent;
}

.hero-cta .btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text-primary);
}

.hero-cta .btn-secondary:hover {
    background: var(--light);
    border-color: var(--primary);
    color: var(--primary);
}

.upload-section {
    padding: 60px 40px 20px 40px;
    background: #ffffff;
    position: relative;
}

.upload-container {
    max-width: 900px;
    margin: 0 auto;
    background: #f7f8fa;
    border-radius: 24px;
    padding: 50px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
    animation: fadeInScale 0.8s ease-out 0.6s both;
}

.upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
}

.drop-zone.dragging {
    border-color: var(--primary);
    background: linear-gradient(to bottom, #f0f9ff, #e0f2fe);
    transform: scale(1.01);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.12);
}

.drop-zone .icon {
    font-size: 3.5em;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

.drop-zone h3 {
    font-size: 1.5em;
    color: var(--dark);
    margin: 0;
    font-weight: 700;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin: 0;
    opacity: 0.8;
}

.drop-zone .format-text {
    margin-bottom: 4px;
}

.drop-zone .divider-text {
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 500;
    position: relative;
    margin: 8px 0;
    opacity: 0.6;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 200px;
}

.drop-zone .divider-text::before,
.drop-zone .divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 12px;
}

.drop-zone .btn {
    margin-top: 4px;
    padding: 14px 36px;
    font-size: 1.05em;
}

.file-input {
    display: none;
}

/* Result Display Styles */
.result-display {
    width: 100%;
    animation: fadeInScale 0.5s ease-out;
}

.result-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.result-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.result-header h3 {
    font-size: 1.4em;
    color: var(--dark);
    margin: 0;
    flex: 1;
    text-align: center;
    padding: 0 20px;
}

.btn-back {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-back:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(-3px);
}

.result-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Comparison Container Styles */
.comparison-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    background: var(--checkerboard-gradient);
    aspect-ratio: 16/9;
    min-height: 400px;
    transition: all 0.3s ease;
}

.comparison-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.comparison-image canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.comparison-original {
    z-index: 2;
}

.comparison-result {
    z-index: 3;
    clip-path: inset(0 0 0 50%);
}

.comparison-label {
    position: absolute;
    top: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* 鼠标悬停时标签更明显 */
.comparison-container:hover .comparison-label {
    opacity: 1;
    background: rgba(255, 255, 255, 0.98);
}

.comparison-label-left {
    left: 20px;
}

.comparison-label-right {
    right: 20px;
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 40px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 5;
    cursor: col-resize;
    transition: opacity 0.3s ease;
}

.slider-handle {
    position: relative;
    width: 100%;
    height: 100%;
}

.slider-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    transition: background 0.3s ease;
}

/* 鼠标悬停时加强分界线 */
.comparison-container:hover .slider-line {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    cursor: col-resize;
    opacity: 0;
    transition: all 0.3s ease;
}

/* 鼠标悬停时显示滑块按钮 */
.comparison-container:hover .slider-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 拖动时保持滑块按钮显示 */
.comparison-container.dragging .slider-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* 拖动时的鼠标样式 */
.comparison-container.dragging {
    cursor: col-resize;
}

.comparison-container.dragging * {
    cursor: col-resize !important;
}

.slider-button svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

.slider-button:hover {
    transform: translate(-50%, -50%) scale(1.15);
    background: #f8f9fa;
}

.result-item {
    text-align: center;
}

.result-item h4 {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 600;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.result-image-container {
    background: transparent;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

/* 移除CSS伪元素背景，改用Canvas渲染 */

.result-image-container canvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

.result-arrow {
    font-size: 2em;
    color: var(--primary);
    font-weight: bold;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.result-actions .btn-sm {
    padding: 12px 24px;
    font-size: 0.9em;
    min-width: 140px;
    white-space: nowrap;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.95em;
}

.process-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 40px;
    text-align: center;
}

.prompt-icon {
    font-size: 3em;
    opacity: 0.7;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

.process-prompt p {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin: 0;
}

.btn {
    padding: 12px 30px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(25, 25);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

/* Options Container for horizontal layout */
.options-container {
    display: none;
    grid-template-columns: 1fr 1.2fr 1.5fr;
    gap: 20px;
    padding: 20px;
    background: white;
    margin-top: 20px;
}

.options-container.active {
    display: grid;
}

/* Quick actions standalone style (before upload) */
.quick-actions.standalone {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 150px));
    justify-content: center;
    gap: 20px;
    padding: 40px 20px;
    background: #ffffff;
    margin: 20px 0;
}

.quick-actions.standalone .quick-actions-header {
    text-align: center;
}

.quick-actions.standalone .quick-actions-header h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: var(--dark);
}

.quick-actions.standalone .quick-actions-header p {
    font-size: 0.95em;
    margin-bottom: 25px;
    color: var(--text-secondary);
}

.quick-actions.standalone .quick-btn {
    padding: 18px 12px;
    font-size: 0.95em;
}

.quick-actions.standalone .quick-btn .emoji {
    font-size: 2em;
    margin-bottom: 8px;
}

.controls-panel {
    padding: 25px 20px;
    background: linear-gradient(to bottom, #ffffff, #fafbfc);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    position: relative;
}

.controls-panel.active {
    display: block;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 400px;
    }
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 15px;
    row-gap: 20px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-item label {
    font-weight: 600;
    color: var(--dark);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}

.control-item input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 5px 0;
}

.control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-item input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.control-item select {
    padding: 8px 10px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.control-item select:focus {
    outline: none;
    border-color: var(--primary);
}

.range-value {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: auto;
    font-weight: 500;
}

.workspace {
    padding: 40px;
    background: white;
    display: none !important; /* Always hidden - results shown in upload area */
}

.workspace.active {
    display: none !important; /* Always hidden - results shown in upload area */
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.image-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.image-panel:hover {
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.image-panel h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.image-container {
    background: transparent;
    border-radius: 12px;
    padding: 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* 移除CSS伪元素背景，改用Canvas渲染 */

.image-container img,
.image-container canvas {
    max-width: 100%;
    max-height: 400px;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.checkerboard {
    background-image: 
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 30px;
    background: var(--light);
    flex-wrap: wrap;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.25);
}

.btn-success:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(245, 158, 11, 0.25);
}

.btn-warning:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.2);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(239, 68, 68, 0.25);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.processing-overlay.active {
    display: flex;
}

.processing-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
}

.quick-actions-header {
    grid-column: 1 / -1;
    text-align: left;
    margin-bottom: 5px;
}

.quick-actions-header h3 {
    font-size: 1.1em;
    margin-bottom: 5px;
}

.quick-actions-header p {
    font-size: 0.85em;
    margin-bottom: 10px;
}

.quick-btn.active {
    border-color: var(--primary) !important;
    background: var(--primary) !important;
    color: white !important;
}

.quick-btn.active::before {
    width: 300px;
    height: 300px;
}

.quick-btn {
    padding: 12px 8px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-weight: 600;
    font-size: 0.85em;
    color: var(--dark);
    position: relative;
    overflow: hidden;
}

.quick-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: 0;
}

.quick-btn:hover::before {
    width: 300px;
    height: 300px;
}

.quick-btn:hover {
    border-color: var(--primary);
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.2);
}

.quick-btn > * {
    position: relative;
    z-index: 1;
}

.quick-btn .emoji {
    display: block;
    font-size: 1.5em;
    margin-bottom: 3px;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 20px 40px;
    background: white;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9em;
    color: #64748b;
    margin-top: 5px;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.show {
    transform: translateX(0);
}

.background-preview-section {
    padding: 20px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.bg-tabs {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.bg-tab {
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85em;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-weight: 500;
}

.bg-tab:hover {
    color: var(--primary);
}

.bg-tab.active {
    color: var(--primary);
}

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

.bg-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.bg-tab-content.active {
    display: block;
}

.background-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.bg-preset {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-preset:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.bg-preset.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    transform: scale(1.05);
}

.color-picker-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.color-picker-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
}

#colorPicker {
    width: 50px;
    height: 30px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#colorPicker:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-upload-area {
    max-width: 100%;
    margin: 10px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px dashed var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.custom-upload-area p {
    margin: 10px 0;
    font-size: 0.85em;
}

.custom-upload-area:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

/* Compact style when image is uploaded */
.custom-upload-area.has-image {
    padding: 8px;
    margin: 5px 0;
    border-style: solid;
}

.custom-upload-area.has-image .upload-icon,
.custom-upload-area.has-image .upload-description,
.custom-upload-area.has-image .upload-info {
    display: none;
}

.custom-upload-area.has-image .upload-bg-btn {
    padding: 5px 10px;
    font-size: 0.8em;
}

.custom-upload-area.has-image .upload-bg-btn span:first-child {
    font-size: 1em;
}

.upload-bg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.upload-bg-btn:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

#bgImageInput {
    display: none;
}

/* Custom Background Control Styles */
.custom-bg-controls {
    margin-top: 15px;
    padding: 12px;
    background: rgba(37, 99, 235, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.1);
    display: none;
}

.custom-bg-controls.active {
    display: block;
}

/* Two Column Layout */
.bg-controls-layout {
    display: flex;
    gap: 15px;
}

.bg-control-left {
    flex-shrink: 0;
}

.bg-control-right {
    flex: 1;
    min-width: 0;
}

.bg-control-section {
    margin-bottom: 12px;
}

.bg-control-section:last-child {
    margin-bottom: 0;
}

.bg-control-label {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.size-mode-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.size-mode-btn {
    padding: 5px 6px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
}

.size-mode-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.size-mode-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.slider-control {
    margin-top: 10px;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-input {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    transition: background 0.3s;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.slider-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.slider-value {
    min-width: 40px;
    text-align: right;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--primary);
}

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

.position-btn {
    width: 28px;
    height: 28px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.position-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.position-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.position-btn.active::after {
    content: '●';
    color: white;
    font-size: 8px;
}

.repeat-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.repeat-btn {
    padding: 5px 6px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.65em;
    transition: all 0.2s;
}

.repeat-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.repeat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.bg-label {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: var(--dark);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* Responsive adjustments for custom background controls */
@media (max-width: 480px) {
    .bg-controls-layout {
        flex-direction: column;
        gap: 10px;
    }
    
    .bg-control-left {
        display: flex;
        justify-content: center;
    }
    
    .position-grid {
        max-width: none;
    }
    
    .size-mode-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .repeat-selector {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .options-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    
    .background-preview-section {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .options-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .quick-actions.standalone {
        grid-template-columns: repeat(3, minmax(100px, 130px));
        justify-content: center;
        padding: 20px 10px;
    }
    
    .image-comparison {
        grid-template-columns: 1fr;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .result-content {
        padding: 10px;
    }
    
    .comparison-container {
        max-width: 100%;
        min-height: 300px;
        aspect-ratio: 4/3;
    }
    
    .comparison-label {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .comparison-label-left {
        left: 10px;
    }
    
    .comparison-label-right {
        right: 10px;
    }
    
    .slider-button {
        width: 32px;
        height: 32px;
    }
    
    .slider-button svg {
        width: 20px;
        height: 20px;
    }
    
    .result-arrow {
        transform: rotate(90deg);
    }
    
    .result-header-top {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .result-header-top .btn-back {
        align-self: flex-start;
    }
    
    .result-header-top > div:last-child {
        display: none;
    }
    
    .result-header h3 {
        text-align: center;
        padding: 0;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .result-actions .btn-sm {
        width: 100%;
        min-width: auto;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

.zoom-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    background: white;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.zoom-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background: var(--primary-light);
}

/* Footer Styles */
.site-footer {
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    border-top: 1px solid var(--border);
    margin-top: 100px;
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-light), 
        var(--primary), 
        var(--primary-light), 
        transparent
    );
    opacity: 0.3;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
    padding: 60px 0 40px;
}

/* Footer Brand Section */
.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.footer-logo-wrapper h3 {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.footer-description {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95em;
    margin: 0;
}

.footer-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Footer Sections */
.footer-section h4 {
    font-size: 1em;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links li {
    margin: 0;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95em;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary);
    transform: translateX(4px);
}

.footer-links a::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.footer-links a:hover::before {
    opacity: 1;
}

/* Footer Bottom */
.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 25px 0;
    background: rgba(248, 250, 252, 0.5);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-copyright {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-copyright p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.footer-tagline {
    font-size: 0.85em !important;
    opacity: 0.8;
}

.footer-tech {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.footer-tech .separator {
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 40px;
    }

    .footer-section:last-child {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .site-footer {
        margin-top: 60px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 40px 0 30px;
    }

    .footer-brand {
        text-align: center;
    }

    .footer-logo-wrapper {
        justify-content: center;
    }

    .footer-badges {
        justify-content: center;
    }

    .footer-section {
        text-align: center;
    }

    .footer-section h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-links {
        align-items: center;
    }

    .footer-links a::before {
        display: none;
    }

    .footer-links a:hover {
        transform: none;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .footer-tech {
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-tech .separator:first-of-type {
        display: none;
    }
}

@media (max-width: 480px) {
    .footer-badges {
        flex-direction: column;
    }

    .footer-badge {
        width: 100%;
        justify-content: center;
    }

    .footer-tech {
        font-size: 0.75em;
    }

    .footer-tech span {
        width: 100%;
        text-align: center;
    }

    .footer-tech .separator {
        display: none;
    }
}