/* --- Dark Theme - Kid Friendly --- */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #E8E8E8;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.container {
    background-color: #2C3E50;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    text-align: center;
    width: 360px;
    border: 2px solid #3498DB;
}

h1 {
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 2.2em;
    margin-bottom: 20px;
}

#progress-info {
    background-color: #34495E;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #FFD700;
    border: 1px solid #4A90E2;
}

/* --- Input Fields --- */
input {
    width: 90%;
    padding: 12px;
    margin: 10px 0;
    border: 3px solid #9B59B6;
    border-radius: 10px;
    font-size: 18px;
    text-align: center;
    outline: none;
    background-color: #34495E;
    color: #FFFFFF;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

input:focus {
    border-color: #FFD700;
    background-color: #3A4F63;
    transform: scale(1.05);
}

input:disabled {
    background-color: #2C3E50 !important;
    border-color: #5A6C7D !important;
    color: #7F8C8D !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

input:not(:disabled) {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

input::placeholder {
    color: #BDC3C7;
}

/* --- Buttons --- */
button {
    background: linear-gradient(45deg, #9B59B6, #8E44AD);
    color: #FFFFFF;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    display: inline-block;
}

button:hover {
    background: linear-gradient(45deg, #8E44AD, #9B59B6);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

button:active {
    transform: translateY(0);
}

/* Submit button on its own row */
#submit-btn {
    display: block;
    width: 90%;
    margin: 20px auto 15px auto;
    font-size: 18px;
    padding: 15px;
}

/* Other buttons in a row */
.button-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* Help Button */
#help-btn {
    background: linear-gradient(45deg, #F39C12, #E67E22);
}

#help-btn:hover {
    background: linear-gradient(45deg, #E67E22, #F39C12);
}

/* New Game Button */
#new-game-btn {
    background: linear-gradient(45deg, #27AE60, #229954);
}

#new-game-btn:hover {
    background: linear-gradient(45deg, #229954, #27AE60);
}

/* Theme Toggle Button */
#theme-toggle {
    background: linear-gradient(45deg, #6C757D, #5A6268);
}

#theme-toggle:hover {
    background: linear-gradient(45deg, #5A6268, #6C757D);
}

/* Clear Scores Button */
#clear-scores-btn {
    background: linear-gradient(45deg, #E74C3C, #C0392B);
    font-size: 14px;
    padding: 8px 15px;
    margin: 15px auto 0 auto;
    display: block;
    width: 90%;
}

#clear-scores-btn:hover {
    background: linear-gradient(45deg, #C0392B, #E74C3C);
}

/* --- Feedback and Countdown --- */
#feedback {
    margin: 20px 0;
    font-size: 20px;
    font-weight: bold;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #34495E;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #4A90E2;
    white-space: pre-line;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.success { 
    color: #2ECC71;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.failure { 
    color: #E74C3C;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.highlight { 
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#countdown {
    margin: 15px 0;
    font-size: 28px;
    font-weight: bold;
    color: #FF69B4;
    text-shadow: 0 0 15px rgba(255, 105, 180, 0.7);
    animation: pulse 1s infinite;
}

/* --- Leaderboard --- */
#leaderboard {
    margin-top: 25px;
    background: linear-gradient(135deg, #34495E, #2C3E50);
    border-radius: 15px;
    padding: 15px;
    text-align: left;
    border: 2px solid #FFD700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#leaderboard h3 {
    color: #FFD700;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 1.3em;
    margin-bottom: 10px;
}

#score-list {
    padding-left: 25px;
    list-style: none;
}

#score-list li {
    margin: 8px 0;
    color: #E8E8E8;
    font-size: 1.1em;
    padding: 5px;
    background-color: rgba(52, 73, 94, 0.5);
    border-radius: 5px;
    transition: transform 0.2s;
}

#score-list li:hover {
    transform: translateX(5px);
    background-color: rgba(52, 73, 94, 0.8);
}

/* --- Help Modal --- */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(44, 62, 80, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-content {
    display: inline-block;
    width: auto;
    min-width: 450px;
    max-width: 85%;
    white-space: normal;
    word-wrap: break-word;
    background: linear-gradient(135deg, #2C3E50, #34495E);
    padding: 30px;
    border-radius: 15px;
    text-align: left;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border: 2px solid #9B59B6;
}

.modal-content h2 {
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 15px;
}

.modal-content p {
    color: #E8E8E8;
    line-height: 1.6;
    font-size: 1.1em;
}

#close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #E74C3C;
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    transition: transform 0.3s;
}

#close-modal:hover {
    transform: scale(1.2);
    color: #FFD700;
}

.hidden {
    display: none;
}

/* --- Animations --- */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* --- Responsive Design --- */
@media (max-width: 480px) {
    .container {
        width: 95%;
        padding: 20px;
    }
    
    .modal-content {
        min-width: 90%;
        padding: 20px;
    }
}
