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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 50px;
    max-width: 1400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #667eea;
    font-size: 1.1em;
    font-weight: 600;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    margin-top: 20px;
}

.grid-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 3px solid #ddd;
    border-radius: 12px;
    cursor: pointer;
    font-size: 2.5em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.grid-item:hover:not(.selected):not(.blank) {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.grid-item.selected {
    border-color: #764ba2;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
    position: relative;
}

.grid-item.blank {
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #764ba2;
    color: white;
    font-size: 1.5em;
    font-weight: bold;
    transition: all 0.3s ease;
    flex-direction: column;
    gap: 10px;
}

.grid-item.blank:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.grid-item.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.5);
    border-radius: 9px;
}

.grid-item.selected::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    color: white;
    font-weight: bold;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.number {
    display: none;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}



.counter {
    font-size: 1.1em;
    color: #333;
    font-weight: 600;
}

.result-container {
    display: none;
    text-align: center;
    animation: slideIn 0.5s ease;
}

.result-container.show {
    display: block;
}

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

.result-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.drum {
    perspective: 1000px;
    margin-bottom: 40px;
    height: 150px;
}

.drum-roll {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    animation: drumRoll 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes drumRoll {
    0% {
        opacity: 0;
        transform: rotateY(0deg) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: rotateY(0deg) scale(1);
    }
    80% {
        opacity: 1;
        transform: rotateY(1080deg) scale(1);
    }
    100% {
        opacity: 1;
        transform: rotateY(1080deg) scale(1);
    }
}

.drum-item {
    font-size: 2em;
}

.selected-numbers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    animation: revealNumbers 0.5s ease 2s both;
}

@keyframes revealNumbers {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.number-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    font-size: 2em;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.number-label {
    font-size: 0.6em;
    opacity: 0.9;
}

.reset-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.reset-btn:active {
    transform: translateY(0);
}

/* Responsive layout improvements */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 40px;
    }
    .grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 18px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    .subtitle {
        font-size: 1em;
    }
    .container {
        padding: 24px;
    }
    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
    .grid-item {
        border-width: 2px;
    }
    .grid-item.blank {
        font-size: 1.3em;
    }
    .selected-numbers {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .number-card {
        padding: 16px;
        font-size: 1.6em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.6em;
    }
    .subtitle {
        font-size: 0.95em;
    }
    .container {
        padding: 16px;
        border-radius: 12px;
    }
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .grid-item {
        border-width: 2px;
    }
    .grid-item.blank {
        font-size: 1.2em;
    }
    .selected-numbers {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .number-card {
        padding: 14px;
        font-size: 1.4em;
    }
}

