/* Magical Riddles CSS - Cute theme for 8-year-old */

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

body {
    font-family: 'Comfortaa', cursive;
    background: linear-gradient(135deg, #FFE4E1 0%, #E6E6FA 25%, #F0F8FF 50%, #E0FFFF 75%, #F5FFFA 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 182, 193, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(221, 160, 221, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(173, 216, 230, 0.3) 0%, transparent 50%);
    animation: shimmer 8s ease-in-out infinite;
    z-index: -1;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Container */
.magical-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

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

.sparkle, .heart {
    position: absolute;
    font-size: 1.5rem;
    animation-duration: 6s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

.sparkle-1 { animation: float1 6s infinite; top: 10%; left: 10%; }
.sparkle-2 { animation: float2 7s infinite; top: 20%; right: 15%; }
.sparkle-3 { animation: float3 5s infinite; top: 60%; left: 5%; }
.sparkle-4 { animation: float1 8s infinite; top: 80%; right: 10%; }
.sparkle-5 { animation: float2 6s infinite; top: 40%; left: 85%; }
.sparkle-6 { animation: float3 7s infinite; top: 70%; right: 20%; }

.heart-1 { animation: heartFloat 4s infinite; top: 30%; left: 70%; }
.heart-2 { animation: heartFloat 5s infinite; top: 50%; right: 5%; }
.heart-3 { animation: heartFloat 6s infinite; top: 10%; left: 50%; }

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

@keyframes float2 {
    0%, 100% { transform: translateX(0px) scale(1); }
    50% { transform: translateX(15px) scale(1.2); }
}

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

@keyframes heartFloat {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.3) rotate(15deg); }
}

/* Header */
.palace-header {
    text-align: center;
    background: linear-gradient(45deg, #FFB6C1, #DDA0DD, #B0E0E6);
    padding: 30px;
    border-radius: 25px;
    margin-bottom: 30px;
    box-shadow: 
        0 8px 32px rgba(221, 160, 221, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 3px solid #FFB6C1;
    position: relative;
}

.crown {
    font-size: 3rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-10px); }
}

.magical-title {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    font-weight: 700;
    color: #8B008B;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8); }
    to { text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8), 0 0 15px #FFB6C1; }
}

.subtitle {
    font-size: 1.1rem;
    color: #8B008B;
    font-weight: 400;
    margin-bottom: 20px;
}

/* Loading Animation */
.enchanted-loading {
    margin: 20px 0;
}

.loading-text {
    color: #8B008B;
    font-weight: 700;
    margin-bottom: 15px;
}

.magic-progress {
    position: relative;
    height: 30px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    border: 2px solid #FFB6C1;
    overflow: hidden;
    margin: 10px auto;
    max-width: 300px;
}

.magic-wand {
    position: absolute;
    font-size: 1.5rem;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    animation: wandMove 3s ease-in-out forwards;
    z-index: 2;
}

.magic-trail {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #FFB6C1, #DDA0DD, #B0E0E6, #FFB6C1);
    width: 0;
    border-radius: 15px;
    animation: trailGrow 3s ease-in-out forwards;
    box-shadow: 0 0 20px rgba(221, 160, 221, 0.6);
}

.complete-text {
    margin-top: 15px;
    color: #8B008B;
    font-weight: 700;
    opacity: 0;
    animation: showComplete 0.5s ease-in-out 3s forwards;
}

@keyframes wandMove {
    0% { left: -30px; }
    100% { left: calc(100% + 10px); }
}

@keyframes trailGrow {
    0% { width: 0; }
    100% { width: 100%; }
}

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

/* Riddles Container */
.riddles-palace {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #FFB6C1;
}

.welcome-message {
    text-align: center;
    margin-bottom: 40px;
}

.palace-msg {
    color: #8B008B;
    font-size: 1.1rem;
    margin: 10px 0;
    font-weight: 400;
}

.magical-divider {
    margin: 20px 0;
    text-align: center;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Individual Riddles */
.riddle-card {
    background: linear-gradient(135deg, #FFF0F5, #F0F8FF);
    border-radius: 20px;
    padding: 25px;
    margin: 25px 0;
    border: 3px solid #FFB6C1;
    box-shadow: 0 5px 15px rgba(221, 160, 221, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.riddle-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 182, 193, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.riddle-card:hover::before {
    opacity: 1;
    animation: shine 1.5s ease-in-out;
}

.riddle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(221, 160, 221, 0.4);
    border-color: #DDA0DD;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.riddle-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.riddle-gem {
    font-size: 1.5rem;
    animation: gemSparkle 2s infinite;
}

@keyframes gemSparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

.riddle-number {
    font-family: 'Dancing Script', cursive;
    font-size: 1.3rem;
    color: #8B008B;
    font-weight: 700;
}

.riddle-question {
    background: rgba(255, 182, 193, 0.3);
    padding: 15px;
    border-radius: 15px;
    border-left: 5px solid #FFB6C1;
    font-size: 1.1rem;
    color: #8B008B;
    margin: 15px 0;
    line-height: 1.5;
}

.riddle-answer {
    background: linear-gradient(45deg, #DDA0DD, #B0E0E6);
    padding: 15px;
    border-radius: 15px;
    border-left: 5px solid #DDA0DD;
    font-size: 1rem;
    margin: 15px 0;
    line-height: 1.5;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    /* Hidden state */
    color: transparent;
    text-shadow: 0 0 8px rgba(139, 0, 139, 0.8);
    background: linear-gradient(45deg, #DDA0DD, #B0E0E6);
    transition: all 0.4s ease;
}

.riddle-answer::before {
    content: '✨ Click the magic crystal to reveal! ✨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8B008B;
    font-weight: 700;
    text-shadow: none;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.riddle-answer.revealed {
    color: #FFFFFF;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #32CD32, #FFD700);
    border-left-color: #32CD32;
    animation: revealSparkle 0.6s ease-out;
}

.riddle-answer.revealed::before {
    opacity: 0;
}

@keyframes revealSparkle {
    0% { 
        transform: scale(0.8); 
        box-shadow: 0 0 20px #FFD700;
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 0 30px #FFD700;
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 5px 15px rgba(221, 160, 221, 0.2);
    }
}

/* Navigation */
.palace-navigation {
    text-align: center;
    margin: 30px 0;
}

.magic-button {
    display: inline-block;
    background: linear-gradient(45deg, #FFB6C1, #DDA0DD);
    color: #8B008B;
    font-weight: 700;
    padding: 15px 30px;
    border-radius: 25px;
    text-decoration: none;
    border: 3px solid #FFB6C1;
    box-shadow: 0 5px 15px rgba(221, 160, 221, 0.3);
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.magic-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(221, 160, 221, 0.5);
    background: linear-gradient(45deg, #DDA0DD, #B0E0E6);
}

/* Footer */
.palace-footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    border: 2px solid #FFB6C1;
}

.footer-animals {
    margin: 20px 0;
    font-size: 2rem;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cute-animal {
    animation-duration: 3s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

.unicorn { animation: bounce 3s infinite; animation-delay: 0s; }
.butterfly { animation: flutter 2s infinite; animation-delay: 0.5s; }
.fairy { animation: float1 4s infinite; animation-delay: 1s; }
.rainbow { animation: glow 3s infinite; animation-delay: 1.5s; }
.cat { animation: bounce 2.5s infinite; animation-delay: 2s; }
.butterfly2 { animation: flutter 2s infinite; animation-delay: 2.5s; }

@keyframes flutter {
    0%, 100% { transform: translateY(0px) rotate(-5deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.made-with-love {
    color: #8B008B;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .magical-container {
        padding: 15px;
    }
    
    .magical-title {
        font-size: 2rem;
    }
    
    .palace-header {
        padding: 20px;
    }
    
    .riddles-palace {
        padding: 20px;
    }
    
    .riddle-card {
        padding: 20px;
        margin: 20px 0;
    }
    
    .footer-animals {
        font-size: 1.5rem;
        gap: 15px;
    }
    
    .sparkle, .heart {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .magical-title {
        font-size: 1.7rem;
    }
    
    .riddle-question, .riddle-answer {
        font-size: 1rem;
        padding: 12px;
    }
    
    .magic-progress {
        max-width: 250px;
    }
    
    .footer-animals {
        font-size: 1.3rem;
        gap: 10px;
    }
}