* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: #f5f5f5;
    background-image: linear-gradient(to bottom right, #e9e6ff, #f5f5f5);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    width: 100%;
    max-width: 500px;
    background-color: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(103, 58, 183, 0.15);
    padding: 24px;
    transform: translateY(0);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

h1 {
    font-size: 28px;
    color: #673AB7;
    font-weight: 700;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.05);
}

.game-timer {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background-color: #673AB7;
    padding: 6px 12px;
    border-radius: 12px;
    box-shadow: 0 3px 6px rgba(103, 58, 183, 0.2);
    animation: pulse 1s ease-in-out infinite;
}

.settings-icon {
    color: #673AB7;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.settings-icon:hover {
    background-color: rgba(103, 58, 183, 0.1);
    transform: rotate(30deg);
}

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

.words-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 28px;
}

.word-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 18px;
    background-color: #f9f9f9;
    border-radius: 12px;
    align-items: center;
    border-left: 4px solid #673AB7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.word-row:hover {
    transform: translateX(5px);
    background-color: #f3f0ff;
}

.word-display {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 2px;
}

.word-timer {
    font-size: 14px;
    color: #673AB7;
    font-weight: 600;
}

.current-word-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.word-letters-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.letter {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    border-radius: 10px;
    background-color: #673AB7;
    color: white;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 4px 8px rgba(103, 58, 183, 0.2);
}

.letter:hover {
    transform: translateY(-5px) rotate(5deg);
    background-color: #7E57C2;
}

.letter:active {
    transform: scale(0.92);
}

.letter.used {
    opacity: 0.5;
    pointer-events: none;
    transform: scale(0.9);
}

.build-word-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background-color: #f9f9f9;
    padding: 16px;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.build-word-label {
    font-size: 18px;
    color: #673AB7;
    font-weight: 700;
}

.build-word-letters {
    display: flex;
    gap: 10px;
    min-height: 52px;
    padding: 5px 10px;
    background-color: rgba(255,255,255,0.7);
    border-radius: 10px;
    border: 2px dashed #673AB7;
    min-width: 80%;
    justify-content: center;
}

.build-letter {
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    font-weight: bold;
    border-radius: 8px;
    background-color: #673AB7;
    color: white;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(103, 58, 183, 0.2);
    animation: popIn 0.3s ease forwards;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.build-letter:hover {
    transform: scale(1.1) rotate(-5deg);
    background-color: #7E57C2;
}

.correct-word {
    color: #4CAF50;
    font-weight: 700;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease forwards;
    overflow: hidden;
}

@keyframes slideIn {
    0% { transform: translateY(50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #673AB7;
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.close {
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.close:hover {
    transform: scale(1.1);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
}

.setting-row {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.setting-row label {
    flex: 1;
    min-width: 150px;
    font-weight: 600;
    color: #673AB7;
}

.setting-row .slider {
    flex: 2;
    height: 10px;
    background: #e0e0e0;
    outline: none;
    border-radius: 5px;
    margin: 0 15px;
    -webkit-appearance: none;
}

.setting-row .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #673AB7;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-row .slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.setting-row span {
    width: 40px;
    text-align: center;
    font-weight: 600;
}

.btn {
    background-color: #673AB7;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    background-color: #5e35b1;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#gameOverMessage {
    text-align: center;
    font-size: 18px;
    margin: 20px 0;
}

#solvedCount {
    font-weight: 700;
    color: #673AB7;
}

