:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #e0e7ff;
    --secondary-text: #4338ca;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --red-ball: #ef4444;
    --blue-ball: #3b82f6;
    --hit-glow: 0 0 10px rgba(255, 255, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #ec4899;
    bottom: -50px;
    right: -50px;
    animation-delay: 2s;
}

.blob-3 {
    width: 200px;
    height: 200px;
    background: #06b6d4;
    top: 40%;
    left: 60%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    margin: 20px;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.icon {
    font-size: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Upload Section */
.upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.upload-box:hover,
.upload-box.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-box h3 {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.upload-box p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Preview Section */
.preview-section {
    margin-top: 1.5rem;
}

.image-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
    background: #000;
}

#preview-image {
    width: 100%;
    display: block;
    max-height: 400px;
    object-fit: contain;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

.actions {
    display: flex;
    gap: 1rem;
}

.btn {
    flex: 1;
    padding: 0.875rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    animation: slideUp 0.4s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.lottery-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
}

.lottery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.lottery-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lottery-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.lottery-issue {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.winning-section {
    margin-bottom: 1.5rem;
}

.section-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.balls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ball {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.ball::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 50% 50% 0 0;
}

.ball.red {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.ball.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.ball.hit {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6), 0 0 5px rgba(255, 255, 255, 0.8) inset;
    transform: scale(1.1);
    z-index: 1;
    border: 2px solid #fff;
}

.ticket-rows {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-row {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.ticket-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.row-index {
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 1rem;
}

.row-numbers {
    flex: 1;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.prize-info {
    margin-left: 1rem;
    min-width: 80px;
    text-align: right;
}

.prize-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.prize-badge.win {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.prize-badge.lose {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

.hidden {
    display: none;
}

footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .ticket-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .prize-info {
        margin-left: 0;
        width: 100%;
        text-align: left;
        padding-left: 2.5rem;
    }

    .row-numbers {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .row-numbers::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .ball {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
}