:root {
    --bg-gradient-1: #4f46e5;
    --bg-gradient-2: #ec4899;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --danger: #ef4444;
    --radius-lg: 24px;
    --radius-md: 12px;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(30, 41, 59, 0.7);
        --glass-border: rgba(255, 255, 255, 0.1);
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --accent: #6366f1;
        --accent-hover: #818cf8;
    }
}
* { margin: 0; padding: 0; box-sizing: border-box; outline: none; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #0f172a;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out;
    opacity: 0.6;
}
.orb-1 { width: 400px; height: 400px; background: var(--bg-gradient-1); top: -100px; left: -100px; }
.orb-2 { width: 300px; height: 300px; background: var(--bg-gradient-2); bottom: -50px; right: -50px; animation-delay: -5s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, 50px); } }
.container { width: 100%; max-width: 900px; padding: 2rem 1.5rem; z-index: 1; }
header { text-align: center; margin-bottom: 2.5rem; }
h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.025em; }
.subtitle { color: var(--text-secondary); font-size: 0.95rem; max-width: 500px; margin: 0 auto; line-height: 1.5; }
.card { background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); transition: transform 0.3s ease; }
.preview-box { width: 100%; min-height: 350px; border: 2px dashed var(--glass-border); border-radius: var(--radius-md); background: rgba(0, 0, 0, 0.05); display: flex; justify-content: center; align-items: center; position: relative; overflow: hidden; cursor: pointer; transition: all 0.3s ease; margin-bottom: 2rem; }
.preview-box:hover { background: rgba(0, 0, 0, 0.08); border-color: var(--accent); }
.preview-box.drag-over { background: rgba(99, 102, 241, 0.1); border-color: var(--accent); transform: scale(1.01); }
.preview-box img { max-width: 100%; max-height: 60vh; object-fit: contain; display: none; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); transition: filter 0.2s; }
.upload-hint { text-align: center; color: var(--text-secondary); pointer-events: none; }
.upload-icon { width: 48px; height: 48px; margin-bottom: 1rem; opacity: 0.6; color: var(--text-primary); }
.compare-badge { position: absolute; bottom: 16px; background: rgba(0, 0, 0, 0.7); color: white; padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s; pointer-events: none; display: flex; align-items: center; gap: 6px; }
.preview-box:hover .img-active + .compare-badge { opacity: 1; }
.action-bar { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.btn { border: none; padding: 0.85rem 1.5rem; border-radius: var(--radius-md); font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 8px; position: relative; overflow: hidden; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4); }
.btn-secondary { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); border: 1px solid var(--glass-border); }
.btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.2); }
.history-section { margin-top: 2rem; border-top: 1px solid var(--glass-border); padding-top: 1.5rem; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.history-btn { cursor: pointer; font-size: 0.8rem; text-decoration: underline; }
.history-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.history-thumb { flex: 0 0 80px; height: 80px; border-radius: 12px; overflow: hidden; cursor: pointer; border: 2px solid transparent; background: rgba(0, 0, 0, 0.1); transition: all 0.2s; }
.history-thumb:hover { border-color: var(--accent); transform: translateY(-2px); }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.loading-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 10; border-radius: var(--radius-md); }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 0.8rem; }
.loading-text { color: white; font-size: 0.9rem; font-weight: 500; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: rgba(30, 41, 59, 0.9); color: white; padding: 10px 20px; border-radius: 50px; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); display: flex; align-items: center; gap: 8px; opacity: 0; animation: slideIn 0.3s forwards; backdrop-filter: blur(8px); }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }
@media (max-width: 600px) {
    .container { padding: 1rem; }
    .card { padding: 1.5rem; }
    .preview-box { min-height: 250px; }
    .btn { flex: 1; justify-content: center; font-size: 0.9rem; padding: 0.7rem; }
}
