* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

header {
    background: #1a1a2e;
    color: #fff;
    padding: 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.reset-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.2s;
}

.reset-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

main {
    max-width: 800px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Upload area */
.upload-area {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area.dragover {
    border-color: #4a90d9;
    background: #e8f0fe;
}

.upload-area p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #666;
}

/* Buttons */
.btn {
    background: #4a90d9;
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    min-height: 48px;
    touch-action: manipulation;
}

.btn:active {
    background: #3a7bc8;
}


/* Preview */
.preview {
    margin: 1rem 0;
    text-align: center;
}

.preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results */
.results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.card-result {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-result-inner {
    display: flex;
    flex-direction: column;
}

.card-result img {
    width: 100%;
    display: block;
}

.card-info {
    padding: 1rem;
}



.badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.badge.active {
    background: #d4edda;
    color: #155724;
}

.badge.inactive {
    background: #e9ecef;
    color: #999;
}

.result-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* Uncertain cards spoiler */
.uncertain-section {
    margin-top: 0.5rem;
}

.uncertain-section summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
    user-select: none;
}

.uncertain-section[open] summary {
    border-radius: 8px 8px 0 0;
}

.uncertain-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
}

.uncertain-cards .card-result {
    opacity: 0.7;
}

.no-cards {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1rem;
}

/* Desktop: side-by-side card layout */
@media (min-width: 600px) {
    .card-result-inner {
        flex-direction: row;
    }

    .card-result img {
        width: 250px;
        height: auto;
        object-fit: contain;
    }

    .card-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}
