* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Comic Sans MS', 'Marker Felt', 'Arial Rounded MT Bold', sans-serif;
}

body {
    background: url('bg.jpg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;

    position: relative;
}

/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('bg.jpg') no-repeat center center fixed;

    background-size: 400% 400%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: gradientBG 8s ease infinite;
    transition: opacity 0.8s, visibility 0.8s;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.spelling-loader {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
}

.letter-box {
    width: 60px;
    height: 80px;
    background: white;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.8rem;
    font-weight: bold;
    color: #ff6b6b;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: bounce 1.8s infinite alternate;
    transform-style: preserve-3d;
}

.letter-box:nth-child(1) {
    animation-delay: 0s;
}

.letter-box:nth-child(2) {
    animation-delay: 0.1s;
}

.letter-box:nth-child(3) {
    animation-delay: 0.2s;
}

.letter-box:nth-child(4) {
    animation-delay: 0.3s;
}

.letter-box:nth-child(5) {
    animation-delay: 0.4s;
}

/* Modal Background */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

/* Modal Box */
.modal-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: popIn 0.3s ease;
}

/* Animation */
@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Close Button */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 22px;
    color: #333;
    cursor: pointer;
}


@keyframes bounce {
    0% {
        transform: translateY(0) rotateX(0);
    }

    100% {
        transform: translateY(-40px) rotateX(360deg);
    }
}

.loader-content {
    text-align: center;
}

.loader-content h1 {
    color: white;
    font-size: 3.2rem;
    margin-bottom: 20px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: textPulse 2s infinite alternate;
}

@keyframes textPulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    100% {
        transform: scale(1.05);
        text-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
    }
}

.loader-content p {
    color: white;
    font-size: 1.5rem;
    max-width: 80%;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.progress-bar {
    width: 80%;
    max-width: 500px;
    height: 25px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.progress {
    height: 100%;
    width: 0;
    background: linear-gradient(to right, #ff9a9e, #fad0c4, #fbc2eb, #a6c1ee);
    border-radius: 15px;
    transition: width 0.4s ease;
}

/* Game Container */
#game-container {
    display: none;
    width: 95%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    padding: 20px;
    position: relative;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.game-title {
    color: #ff6b6b;
    font-size: 2.1rem;
    margin-bottom: 15px;
    text-shadow: 3px 3px 0px #ffe66d;
    background: linear-gradient(to right, #ff6b6b, #4ecdc4, #6ecbf5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-subtitle {
    color: #5a5a5a;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 35px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-box {
    background: linear-gradient(135deg, #6ecbf5, #a18afd);
    padding: 10px 35px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    transition: transform 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
}

.stat-box i {
    font-size: 1.8rem;
}

/* Main Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

/* Spelling Challenge */
.spelling-container {
    background: #f0f8ff;
    border-radius: 25px;
    padding: 15px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.spelling-header {
    font-size: 1.8rem;
    color: #4ecdc4;
    margin-bottom: 10px;
    text-align: center;
}

.spelling-prompt {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 20px;
    color: #5a5a5a;
    font-weight: bold;
}

.spelling-image {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.image-placeholder {
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.spelling-input {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.letter-input {
    width: 65px;
    height: 80px;
    font-size: 2.8rem;
    text-align: center;
    border: 4px solid #a1c4fd;
    border-radius: 20px;
    outline: none;
    font-weight: bold;
    color: #ff6b6b;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.letter-input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
    transform: scale(1.05);
}

.letter-input.correct {
    background: #c8f4d9;
    border-color: #4ecdc4;
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 60px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.control-btn:hover {
    transform: translateY(-7px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
}

.check-btn {
    background: linear-gradient(to right, #4ecdc4, #6ecbf5);
    color: white;
}

.hint-btn {
    background: linear-gradient(to right, #ffe66d, #ffd166);
    color: #333;
}

.new-game-btn {
    background: linear-gradient(to right, #ff6b6b, #ff9a9e);
    color: white;
}

/* Celebration Animation */
.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    background: #ff6b6b;
    animation: confetti-fall 5s ease-in-out infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.celebration-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.celebration-word {
    position: absolute;
    font-size: 4.5rem;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9);
    animation: floatUp 2s ease-out forwards;
    z-index: 20;
}

@keyframes floatUp {
    0% {
        transform: translateY(100px) scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-50px) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(-200px) scale(0.5);
        opacity: 0;
    }
}

.success-icon {
    position: absolute;
    font-size: 8rem;
    color: #4ecdc4;
    animation: spinIn 1.2s ease-out forwards;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9);
    z-index: 15;
}

@keyframes spinIn {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.2) rotate(360deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.8rem;
    }

    .stat-box {
        padding: 8px 25px;
        font-size: 1.2rem;
        min-width: 160px;
    }

    .letter-input {
        width: 55px;
        height: 70px;
        font-size: 2.2rem;
    }

    .control-btn {
        padding: 15px 30px;
        font-size: 1.2rem;
    }

    .image-placeholder {
        width: 150px;
        height: 150px;
        font-size: 4rem;
    }
}

@media (max-width: 480px) {
    .spelling-input {
        gap: 10px;
    }

    .letter-input {
        width: 45px;
        height: 60px;
        font-size: 1.8rem;
    }

    .game-stats {
        gap: 15px;
    }

    .stat-box {
        min-width: 140px;
        padding: 12px 20px;
    }
}