/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #232526, #1c1c1c);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #e0e0e0;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    background-color: #2c2f33;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    width: 380px;
    max-width: 90vw;
    user-select: none;
    border: 2px solid #7289da;
    transition: box-shadow 0.3s ease;
}

.game-container:hover {
    box-shadow: 0 15px 40px rgba(114, 137, 218, 0.8);
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
    text-transform: uppercase;
    color: #7289da;
    text-shadow: 0 0 12px #7289da;
    font-family: 'Orbitron', sans-serif;
}

.instructions {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #b9bbbe;
    font-weight: 500;
}

input[type="number"] {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.2rem;
    border-radius: 12px;
    border: none;
    outline: none;
    margin-bottom: 25px;
    transition: box-shadow 0.4s ease, background-color 0.3s ease;
    background-color: #23272a;
    color: #e0e0e0;
    box-shadow: inset 0 0 8px #7289da;
}

input[type="number"]::placeholder {
    color: #99aab5;
}

input[type="number"]:focus {
    box-shadow: 0 0 12px #7289da;
    background-color: #2c2f33;
}

button {
    width: 100%;
    padding: 14px 0;
    font-size: 1.3rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background-color: #7289da;
    color: #fff;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    user-select: none;
    box-shadow: 0 4px 12px rgba(114, 137, 218, 0.6);
}

button:disabled {
    background-color: #99aab5;
    cursor: not-allowed;
    box-shadow: none;
}

button:not(:disabled):hover {
    background-color: #5b6eae;
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(91, 110, 174, 0.8);
}

#message {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 20px;
    min-height: 1.8em;
    transition: opacity 0.5s ease;
    color: #f04747;
    text-shadow: 0 0 6px #f04747;
}

.attempts {
    margin-top: 25px;
    font-size: 1.1rem;
    color: #b9bbbe;
    font-weight: 600;
}

#reset {
    margin-top: 30px;
    background-color: #43b581;
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 181, 129, 0.7);
}

#reset:hover {
    background-color: #2c8e5a;
    box-shadow: 0 6px 18px rgba(44, 142, 90, 0.9);
}

body.win-effect {
    background: linear-gradient(135deg, #43b581, #2c8e5a);
    transition: background 1s ease;
}

#leaderboard-container {
    margin-top: 30px;
    background-color: #2c2f33;
    border: 2px solid #7289da;
    border-radius: 20px;
    padding: 20px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    user-select: none;
    color: #e0e0e0;
}

#leaderboard-container h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: #7289da;
    margin-bottom: 15px;
    text-shadow: 0 0 12px #7289da;
}

#leaderboard-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    padding-left: 0;
}

#leaderboard-list li {
    background-color: #23272a;
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    box-shadow: inset 0 0 8px #7289da;
}

#change-name {
    background-color: #f04747;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(240, 71, 71, 0.7);
}

#change-name:hover {
    background-color: #b03030;
    box-shadow: 0 6px 18px rgba(176, 48, 48, 0.9);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(28, 28, 28, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #2c2f33;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    width: 320px;
    max-width: 90vw;
    text-align: center;
    color: #e0e0e0;
}

.modal-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #7289da;
    text-shadow: 0 0 12px #7289da;
}

#name-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.2rem;
    border-radius: 12px;
    border: none;
    outline: none;
    margin-bottom: 20px;
    background-color: #23272a;
    color: #e0e0e0;
    box-shadow: inset 0 0 8px #7289da;
}

#name-input::placeholder {
    color: #99aab5;
}

#name-input:focus {
    box-shadow: 0 0 12px #7289da;
    background-color: #2c2f33;
}

#save-name {
    width: 100%;
    padding: 14px 0;
    font-size: 1.3rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background-color: #7289da;
    color: #fff;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    user-select: none;
    box-shadow: 0 4px 12px rgba(114, 137, 218, 0.6);
}

#save-name:disabled {
    background-color: #99aab5;
    cursor: not-allowed;
    box-shadow: none;
}

#save-name:not(:disabled):hover {
    background-color: #5b6eae;
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(91, 110, 174, 0.8);
}
