:root {
    --primary: #4a90e2;
    --secondary: #357abd;
    --text: #333;
    --light-bg: #f5f5f5;
    --white: #ffffff;
    --red: #e74c3c;
    --green: #2ecc71;
    --gray: #95a5a6;
}

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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.game-play {
    text-align: center;
    max-height: 100vh;
    overflow-y: auto;
    padding: 1rem;
}

.game-instructions {
    text-align: center;
    padding: 2rem;
}

.game-instructions h2 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.intro-text {
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.game-instructions ul {
    list-style: none;
    margin-bottom: 2rem;
    text-align: left;
    padding-left: 2rem;
}

.game-instructions li {
    margin: 1rem 0;
    font-size: 1.1rem;
    color: var(--text);
    position: relative;
}

.game-instructions li:before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: -1.5rem;
}

.start-btn, .submit-btn, .next-btn, .restart-btn {
    font-size: 1.2rem;
    padding: 0.8rem 2rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.start-btn:hover, .submit-btn:hover, .next-btn:hover, .restart-btn:hover {
    background: var(--secondary);
}

.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    font-size: 1.2rem;
    color: var(--text);
    padding: 0 1rem;
}

.level, .score {
    background: var(--light-bg);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: bold;
}

.level span, .score span {
    color: var(--primary);
}

.number-display {
    font-size: 6rem;
    font-weight: bold;
    text-align: center;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
    color: var(--text);
    transition: all 0.3s ease;
}

.number-display.fade-in {
    opacity: 1;
    transform: scale(1.1);
}

.number-display.fade-out {
    opacity: 0;
    transform: scale(0.9);
}

.number-pad {
    margin-top: 1rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.number-btn {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem;
    background: var(--light-bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.number-btn:hover {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.05);
}

.input-display {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin: 0.5rem 0;
    min-height: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#inputNumbers {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text);
    letter-spacing: 0.2rem;
}

.control-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.control-btn {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    background: var(--gray);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.control-btn:hover {
    background: var(--text);
}

.level-result, .final-result {
    text-align: center;
    padding: 2rem;
}

.level-result h3, .final-result h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.result-details {
    margin: 2rem 0;
    font-size: 1.2rem;
    color: var(--text);
}

.result-details p {
    margin: 1rem 0;
}

.hidden {
    display: none;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .number-display {
        font-size: 4rem;
        min-height: 120px;
    }

    .number-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.4rem;
    }

    .number-btn {
        font-size: 1.2rem;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .number-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.3rem;
    }

    .number-btn {
        font-size: 1rem;
        padding: 0.6rem;
    }
}
