* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #ffc857 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Navigation Menu */
.nav-menu {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-btn {
    padding: 12px 20px;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.nav-btn:hover {
    background: linear-gradient(45deg, #4ecdc4, #44a3a0);
    color: white;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(45deg, #ff6b6b, #ee5a6f);
    color: white;
}

.nav-btn.music-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a3a0);
    color: white;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.music-btn:hover {
    background: linear-gradient(45deg, #45b7d1, #3498db);
    transform: translateY(-2px);
}

/* Floating Background Shapes */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 8s ease-in-out infinite;
}

.shape-1 {
    width: 80px;
    height: 80px;
    background: #ff6b6b;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    background: #4ecdc4;
    top: 70%;
    right: 10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    background: #45b7d1;
    bottom: 20%;
    left: 30%;
    animation-delay: 4s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    background: #96ceb4;
    top: 40%;
    right: 20%;
    animation-delay: 6s;
}

.shape-5 {
    width: 90px;
    height: 90px;
    background: #feca57;
    bottom: 10%;
    right: 40%;
    animation-delay: 8s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Main Game Container */
.game-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 120px 20px 40px;
    position: relative;
    z-index: 10;
}

/* Progress Bar */
.progress-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.progress-label {
    text-align: center;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.progress-bar {
    background: #e0e0e0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    height: 100%;
    width: 10%;
    transition: width 0.5s ease;
    border-radius: 5px;
}

/* Game Header */
.game-header {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 300% 300%;
    animation: gradientMove 8s ease infinite;
    padding: 30px;
    border-radius: 25px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-title {
    font-size: 2.5em;
    font-weight: 700;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Game Stats Container */
.game-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.score-display {
    background: rgba(255, 255, 255, 0.9);
    display: inline-block;
    padding: 10px 20px;
    border-radius: 15px;
    font-weight: 600;
    color: #333;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.timer-display {
    background: rgba(255, 255, 255, 0.9);
    display: inline-block;
    padding: 10px 20px;
    border-radius: 15px;
    font-weight: 600;
    color: #333;
    font-size: 1.2em;
    transition: all 0.3s ease;
    animation: pulse 2s ease-in-out infinite;
}

.timer-display i {
    color: #ff6b6b;
    margin-right: 8px;
}

.score-display i {
    color: #ffc857;
    margin-right: 8px;
}

.score-display:hover,
.timer-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Main Game Area */
.main-game-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

/* Image Section */
.image-section {
    text-align: center;
    margin-bottom: 40px;
}

.image-frame {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-radius: 20px;
    padding: 20px;
    display: inline-block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.image-frame:hover {
    transform: translateY(-5px);
}

.image-frame img {
    width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.image-hint {
    font-size: 1.2em;
    color: #666;
    font-weight: 600;
    animation: bounce 2s ease-in-out infinite;
}

.image-hint i {
    color: #feca57;
    margin-right: 8px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Word Building Area */
.word-building-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* Word Slots */
.word-slots {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 80px;
}

.letter-slot {
    width: 60px;
    height: 60px;
    border: 3px dashed #ddd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    font-weight: 700;
    color: #333;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    position: relative;
}

.letter-slot.filled {
    border: 3px solid #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    transform: scale(1.1);
}

.letter-slot.correct {
    border: 3px solid #55efc4;
    background: rgba(85, 239, 196, 0.2);
    animation: correctPulse 0.6s ease;
}

.letter-slot.incorrect {
    border: 3px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    animation: shake 0.5s ease;
}

.letter-slot.drag-over {
    border: 3px solid #4ecdc4;
    background: rgba(78, 205, 196, 0.2);
    transform: scale(1.1);
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Letters Pool */
.letters-pool {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 80px;
    padding: 20px;
    background: rgba(240, 240, 240, 0.5);
    border-radius: 15px;
    border: 2px dashed #ccc;
}

.letter-tile {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: 700;
    color: white;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.letter-tile:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.letter-tile:active {
    cursor: grabbing;
}

.letter-tile.dragging {
    opacity: 0.5;
    transform: scale(1.2) rotate(5deg);
    z-index: 1000;
}

.letter-tile.used {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.8);
}

/* Control Buttons */
.control-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-nav {
    background: linear-gradient(45deg, #96ceb4, #88b0a3);
    color: white;
}

.btn-reset {
    background: linear-gradient(45deg, #ff6b6b, #ee5a6f);
    color: white;
}

.btn-check {
    background: linear-gradient(45deg, #55efc4, #00b894);
    color: white;
    font-size: 1.2em;
    padding: 18px 30px;
}

.btn-play-again {
    background: linear-gradient(45deg, #feca57, #f39c12);
    color: white;
    font-size: 1.3em;
    padding: 20px 40px;
}

/* Feedback Area */
.feedback-area {
    text-align: center;
}

.feedback-message {
    background: linear-gradient(45deg, #ff7979, #ff6348, #ff4757, #ee5a6f);
    background-size: 300% 300%;
    animation: gradientMove 6s ease infinite;
    color: white;
    padding: 20px 30px;
    border-radius: 20px;
    font-size: 1.3em;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: inline-block;
    animation: slideInUp 0.5s ease;
    max-width: 600px;
}

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

/* Celebration Screen */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.celebration.show {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.celebration-content {
    background: white;
    border-radius: 25px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    animation: scaleIn 0.5s ease;
}

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

@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.celebration-icon {
    font-size: 4em;
    color: #feca57;
    margin-bottom: 20px;
    animation: spin 2s ease-in-out infinite;
}

@keyframes spin {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.celebration h2 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
}

.celebration p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
}

.final-stats {
    margin: 20px 0;
}

.final-score,
.final-time {
    font-size: 1.3em;
    font-weight: 700;
    color: #4ecdc4;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.final-time {
    color: #ff6b6b;
}

.word-times-summary {
    margin-top: 20px;
    text-align: left;
    background: rgba(240, 240, 240, 0.5);
    border-radius: 15px;
    padding: 15px;
}

.word-times-summary h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 10px;
    text-align: center;
}

#wordTimesList {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 150px;
    overflow-y: auto;
}

.word-time-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    background: white;
    border-radius: 8px;
    font-size: 0.9em;
}

.word-time-item .word {
    font-weight: 600;
    color: #333;
}

.word-time-item .time {
    color: #ff6b6b;
    font-weight: 600;
}

/* Confetti */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3);
    animation: confettiFall 3s ease-in-out;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 100px 15px 30px;
    }

    .nav-menu {
        flex-direction: column;
        padding: 8px;
    }

    .nav-btn {
        font-size: 0.8em;
        padding: 10px 15px;
    }

    .game-title {
        font-size: 1.8em;
    }

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

    .image-frame img {
        width: 250px;
        height: 150px;
    }

    .letter-slot {
        width: 45px;
        height: 45px;
        font-size: 1.4em;
    }

    .letter-tile {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }

    .word-slots {
        gap: 10px;
    }

    .letters-pool {
        gap: 10px;
        padding: 15px;
    }

    .control-buttons {
        gap: 10px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9em;
    }

    .btn-check {
        padding: 15px 25px;
        font-size: 1em;
    }

    .feedback-message {
        font-size: 1.1em;
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 90px 10px 20px;
    }

    .game-title {
        font-size: 1.5em;
    }

    .image-frame img {
        width: 200px;
        height: 120px;
    }

    .letter-slot {
        width: 35px;
        height: 35px;
        font-size: 1.2em;
    }

    .letter-tile {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }

    .celebration-content {
        padding: 30px 20px;
        margin: 20px;
    }

    .celebration h2 {
        font-size: 2em;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .letter-tile:hover {
        transform: none;
    }

    .image-frame:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }
}

/* Game Footer */
.game-footer {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    animation: slideInUp 0.6s ease;
}

.game-footer .creator-credit {
    text-align: center;
    margin: 0;
    padding: 0;
    border: none;
}

.game-footer .made-by {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 3px;
    font-weight: 500;
}

.game-footer .creator-name {
    color: #00b894;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.game-footer .creator-name:hover {
    color: #4ecdc4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.game-footer .visit-site {
    font-size: 0.7em;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.game-footer .visit-site:hover {
    color: #00b894;
}

.game-footer .creator-link {
    color: #00b894;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.game-footer .creator-link:hover {
    color: #4ecdc4;
    border-bottom-color: #4ecdc4;
}

.game-footer .visit-site i {
    color: #feca57;
    font-size: 0.8em;
}