* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Inter", sans-serif; }

body {
    background: #0f172a;
    color: #e5e7eb;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at top left, #6366f120, transparent 40%),
        radial-gradient(circle at bottom right, #22d3ee20, transparent 40%);
}

.top { text-align: center; padding: 40px 20px; }
.top h1 { font-size: 2.8rem; font-weight: 700; color: #fff; }
.top p { color: #94a3b8; margin-top: 8px; }

.app {
    max-width: 1400px; margin: auto; padding: 20px;
    display: grid; grid-template-columns: 150px 380px 1fr; gap: 24px;
}

/* History Sidebar */
.history-panel { background: rgba(255,255,255,0.03); border-radius: 18px; padding: 15px; text-align: center; }
.history-panel h3 { font-size: 0.8rem; text-transform: uppercase; color: #64748b; margin-bottom: 15px; }
.history-grid { display: flex; flex-direction: column; gap: 12px; }
.history-item { 
    width: 100%; height: 70px; border-radius: 10px; overflow: hidden; 
    border: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: 0.3s;
}
.history-item:hover { transform: scale(1.05); border-color: #6366f1; }
.history-item img { width: 100%; height: 100%; object-fit: cover; }

/* Control Panels */
.upload-card, .preview-card, .filter {
    background: rgba(255,255,255,0.06); backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
    padding: 20px; margin-bottom: 20px; text-align: center;
}

.primary {
    width: 100%; background: linear-gradient(135deg, #6366f1, #22d3ee);
    border: none; padding: 16px; border-radius: 14px;
    color: white; font-weight: 600; font-size: 1rem; cursor: pointer;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3); margin-bottom: 20px;
}

.preview-card img { width: 100%; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); }

.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }

.card { 
    background: rgba(255,255,255,0.04); border-radius: 18px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05); transition: 0.3s;
}
.card:hover { transform: translateY(-5px); border-color: #6366f1; background: rgba(255,255,255,0.08); }
.card img { width: 100%; height: 180px; object-fit: cover; }
.card-body { padding: 16px; }
.card-body h4 { font-weight: 600; margin-bottom: 4px; }
.card-body p { font-size: 0.85rem; color: #94a3b8; }

.skeleton { padding: 40px; text-align: center; color: #6366f1; font-weight: 600; }

.clear-btn { margin-top: 20px; background: none; border: none; color: #ef4444; cursor: pointer; font-size: 0.75rem; }

@media (max-width: 1000px) { .app { grid-template-columns: 1fr; } .history-panel { display: none; } }