:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-subtle: #f8fafc;
    --bg-white: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --accent: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-subtle);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Upload Area */
.upload-wrapper {
    max-width: 500px;
    margin: 0 auto 5rem;
}

.drop-zone {
    background: var(--bg-white);
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.drop-zone:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.drop-zone i {
    color: var(--primary);
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.drop-zone p {
    font-weight: 600;
    color: var(--text-main);
}

.drop-zone .subtitle {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: block;
}

.drop-zone input {
    display: none;
}

#preview-img {
    max-width: 100%;
    max-height: 480px;
    display: none;
    border-radius: 8px;
    margin: 0 auto;
    object-fit: contain;
    z-index: 5;
    position: relative;
}

.drop-zone.has-image {
    padding: 1rem;
    border-style: solid;
    border-color: var(--primary);
}

.drop-zone.has-image i,
.drop-zone.has-image p,
.drop-zone.has-image .subtitle {
    display: none;
}

/* Loader */
.loading {
    display: none;
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

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

/* Results Display */
.results-container {
    display: none;
    animation: slideUp 0.5s ease-out;
}

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

.category-section {
    margin-bottom: 5rem;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-main);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.img-container {
    width: 100%;
    aspect-ratio: 1 / 1.1;
    overflow: hidden;
    background: #f1f5f9;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 1rem;
}

.card-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.card-score {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Best Pair */
.best-pair-grid {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin-bottom: 4rem;
}

.best-pair-card {
    width: 260px;
    border: 2px solid var(--primary);
}

.best-pair-card .card-info {
    background: rgba(79, 70, 229, 0.03);
}

@media (max-width: 640px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
    h1 { font-size: 2rem; }
}
