@font-face { font-family: 'Inter'; src: url('/fonts/inter-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root[data-theme="dark"] {
    --bg-base: #0b0d10; --bg-surface: #14171d; --bg-surface-hover: #1f232b;
    --border-color: #272c36; --accent-primary: #3b82f6; --accent-hover: #2563eb;
    --text-primary: #f8fafc; --text-secondary: #94a3b8;
    --danger: #ef4444; --warning: #f59e0b;
    --font-ui: 'Inter', system-ui, sans-serif;
}
:root[data-theme="light"] {
    --bg-base: #f8fafc; --bg-surface: #ffffff; --bg-surface-hover: #f1f5f9;
    --border-color: #cbd5e1; --accent-primary: #2563eb; --accent-hover: #1d4ed8;
    --text-primary: #0f172a; --text-secondary: #475569;
    --danger: #dc2626; --warning: #d97706;
    --font-ui: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-base); color: var(--text-primary); font-family: var(--font-ui); line-height: 1.6; overflow-x: hidden; transition: background 0.3s, color 0.3s; }
.hidden { display: none !important; }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; }

/* Header */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; border-bottom: 1px solid var(--border-color); }
.app-header { height: 60px; display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); }
.back-link { color: var(--text-secondary); font-size: 1.2rem; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 6px; text-decoration: none; }
.back-link:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.logo { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo i { color: var(--accent-primary); }
.logo span { color: var(--text-secondary); font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); width: 36px; height: 36px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--bg-surface-hover); }
.badge { font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; background: rgba(59,130,246,0.1); color: var(--accent-primary); font-family: monospace; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0.6rem 1.4rem; border-radius: 9999px; font-weight: 500; cursor: pointer; font-family: var(--font-ui); border: none; transition: all 0.2s; }
.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--bg-surface-hover); }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0.7rem 2rem; }

/* Main Workspace */
.workspace { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.container { width: 100%; max-width: 900px; }

/* Upload Dropzone */
.dropzone { text-align: center; border: 2px dashed var(--border-color); border-radius: 20px; padding: 4rem 2rem; background: var(--bg-surface); cursor: pointer; transition: all 0.3s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent-primary); background: rgba(59, 130, 246, 0.04); }
.drop-icon { font-size: 4rem; color: var(--accent-primary); margin-bottom: 1rem; }
.dropzone h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.hint { color: var(--text-secondary); font-size: 0.9rem; }
.text-warning { color: var(--warning); }

/* Processing UI */
.processing-box { text-align: center; padding: 4rem 2rem; background: var(--bg-surface); border-radius: 20px; border: 1px solid var(--border-color); }
.spinner { width: 50px; height: 50px; border: 4px solid var(--border-color); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1.5rem; }
.progress-track { width: 100%; max-width: 400px; height: 8px; background: var(--border-color); border-radius: 4px; margin: 1.5rem auto 0; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent-primary); transition: width 0.2s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Compare UI */
.result-box { display: flex; flex-direction: column; gap: 1.5rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; }
.checkerboard {
    background-image: linear-gradient(45deg, var(--bg-surface-hover) 25%, transparent 25%), linear-gradient(-45deg, var(--bg-surface-hover) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg-surface-hover) 75%), linear-gradient(-45deg, transparent 75%, var(--bg-surface-hover) 75%);
    background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.compare-container { position: relative; width: 100%; aspect-ratio: 16/9; background-color: var(--bg-base); border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.3); touch-action: none; user-select: none; }
.compare-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; }
.compare-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%); }
.compare-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; background: #fff; transform: translateX(-50%); cursor: ew-resize; z-index: 10; box-shadow: 0 0 10px rgba(0,0,0,0.5); }
.compare-arrow { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--accent-primary); color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 10px rgba(0,0,0,0.5); border: 3px solid white; pointer-events: none; }

/* SEO Section */
.seo-content { background: var(--bg-surface); border-top: 1px solid var(--border-color); padding: 4rem 1.5rem; color: var(--text-secondary); }
.seo-container { max-width: 1200px; margin: 0 auto; }
.seo-container h2 { color: var(--text-primary); font-size: 2rem; margin-bottom: 1rem; }
.seo-container p { font-size: 1.05rem; line-height: 1.8; max-width: 900px; margin-bottom: 3rem; }
.seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 2rem; }
.seo-card { background: var(--bg-base); border: 1px solid var(--border-color); padding: 2rem; border-radius: 12px; }
.seo-card h3 { color: var(--text-primary); margin-bottom: 1rem; display: flex; align-items: center; gap: 10px; }
.seo-card h3 i { color: var(--accent-primary); font-size: 1.4rem; }

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 100px); background: var(--text-primary); color: var(--bg-base); padding: 12px 24px; border-radius: 8px; font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.5); opacity: 0; transition: all 0.3s; z-index: 1000; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Mobile Formatting */
@media (max-width: 768px) {
    .app-header { padding: 0 0.8rem; }
    .logo span { display: none; }
    .badge { display: none; }
    .workspace { padding: 1rem; }
    .compare-container { aspect-ratio: 1; }
    .toolbar { flex-direction: column; gap: 10px; }
    .toolbar .btn { width: 100%; }
}