* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: url('bg.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 1280px;
    height: auto;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(to right, #4a00e0, #8e2de2);
    color: white;
    padding: 15px 30px;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

h1 {
    font-size: 36px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-between;
    padding: 10px 30px;
    background-color: #f0f0f0;
    border-bottom: 2px solid #ddd;
}

.score-container,
.level-container {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.main-game-area {
    display: flex;
    padding: 20px;
}

.image-hint {
    flex: 1;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.image-hint img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-controls {
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

.word-display {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.letter-slot {
    display: inline-block;
    width: 60px;
    height: 70px;
    margin: 0 5px;
    border-bottom: 3px solid #4a00e0;
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    color: #333;
    line-height: 70px;
}

.letter-slot.filled {
    color: #4a00e0;
}

.letters-container {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.letter {
    width: 50px;
    height: 60px;
    background: linear-gradient(to bottom, #8e2de2, #4a00e0);
    color: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    font-weight: bold;
    cursor: grab;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.letter:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.letter.dragging {
    opacity: 0.7;
    transform: scale(1.1);
}

.game-buttons {
    display: flex;
    justify-content: space-between;
    padding: 0 30px 20px;
}

button {
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#hint-btn {
    background: linear-gradient(to right, #00b09b, #96c93d);
    color: white;
}

#hint-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#hint-btn:active {
    transform: translateY(1px);
}

#next-btn {
    background: linear-gradient(to right, #ff512f, #f09819);
    color: white;
}

#next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#next-btn:active {
    transform: translateY(1px);
}

#reset-btn {
    background: linear-gradient(to right, #ff416c, #ff4b2b);
    color: white;
}

#reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#reset-btn:active {
    transform: translateY(1px);
}

.message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 10;
    display: none;
}

.message h2 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #4a00e0;
}

.message p {
    font-size: 24px;
    margin-bottom: 30px;
    color: #333;
}

.message button {
    background: linear-gradient(to right, #4a00e0, #8e2de2);
    color: white;
    padding: 12px 40px;
    font-size: 20px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideUp 0.5s ease;
    color: white;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-content p {
    font-size: 20px;
    margin-bottom: 15px;
    color: white;
}

.modal-btn {
    background: white;
    color: #667eea;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    margin: 10px 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Success Modal */
.success-modal {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.points-earned {
    font-size: 28px !important;
    font-weight: bold;
    color: #fff700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Spelling Modal */
.spelling-modal {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.incorrect-word {
    color: #ffcccc;
    text-decoration: line-through;
    font-weight: bold;
}

.correct-word {
    color: #fff700;
    font-weight: bold;
    font-size: 26px;
}

.try-again-btn {
    background: #4CAF50 !important;
    color: white !important;
}

.skip-btn {
    background: #f44336 !important;
    color: white !important;
}

/* Game Over Modal */
.gameover-modal {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    max-width: 600px;
}

.final-stats {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
}

.final-stats p {
    font-size: 24px;
    margin: 10px 0;
}

.final-stats strong {
    color: #fff700;
    font-size: 28px;
}

.scroll-container {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    border: 3px solid rgba(255, 255, 255, 0.5);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.8);
    }
}

.scroll-container h3 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #fff700;
}

.achievement-text {
    font-size: 18px;
    font-style: italic;
}

.restart-btn {
    background: #4CAF50 !important;
    color: white !important;
    font-size: 20px !important;
    padding: 18px 50px !important;
}

/* Confetti Animation */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall linear infinite;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

#hint-image {
    height: 290px;
    margin: auto;
    width: auto;
    display: block;
}

@media (max-width: 1300px) {
    #game-container {
        transform: scale(0.8);
    }
}

@media (max-width: 1024px) {
    #game-container {
        transform: scale(0.7);
    }
    
    .main-game-area {
        flex-direction: column;
    }

    .image-hint {
        max-width: 400px;
        margin: 0 auto;
    }

    h1 {
        font-size: 32px;
    }

    .game-info {
        padding: 10px 20px;
    }

    .score-container,
    .level-container {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 28px;
    }

    .letter-slot {
        width: 45px;
        height: 55px;
        font-size: 24px;
    }

    .letter {
        width: 40px;
        height: 50px;
        font-size: 22px;
    }

    .game-buttons {
        flex-direction: column;
        align-items: center;
    }

    button {
        width: 80%;
        margin-bottom: 10px;
    }

    .message {
        padding: 20px 30px;
    }

    .message h2 {
        font-size: 28px;
    }

    .message p {
        font-size: 20px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-content h2 {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }

    .game-info {
        padding: 8px 15px;
    }

    .score-container,
    .level-container {
        font-size: 18px;
    }

    .letter-slot {
        width: 35px;
        height: 45px;
        font-size: 20px;
    }

    .letter {
        width: 35px;
        height: 45px;
        font-size: 18px;
    }

    .main-game-area {
        padding: 10px;
    }

    .word-display,
    .letters-container {
        padding: 15px;
    }

    .message {
        padding: 15px 20px;
    }

    .message h2 {
        font-size: 24px;
    }

    .message p {
        font-size: 18px;
    }
    
    .modal-content h2 {
        font-size: 18px;
    }
    
    .modal-content p {
        font-size: 16px;
    }
    
    .modal-btn {
        padding: 12px 30px;
        font-size: 16px;
    }
}

.sound-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
}