/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Serif', serif;
    background: linear-gradient(135deg, #87CEEB 0%, #4682B4 50%, #191970 100%);
    color: #2F4F4F;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Animated Background Elements */
.ocean-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at bottom, rgba(255,255,255,0.1) 0%, transparent 50%),
        linear-gradient(135deg, #87CEEB 0%, #4682B4 30%, #1E90FF 60%, #191970 100%);
    animation: oceanWaves 20s ease-in-out infinite;
    z-index: -3;
}

.palm-trees {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300'%3E%3Cpath d='M0,300 L50,250 Q100,200 150,220 L200,180 Q250,160 300,200 L1200,300 Z' fill='%23228B22'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: bottom;
    z-index: -2;
    opacity: 0.8;
}

@keyframes oceanWaves {
    0%, 100% { transform: translateY(0px) scale(1); }
    25% { transform: translateY(-10px) scale(1.02); }
    50% { transform: translateY(-5px) scale(1.01); }
    75% { transform: translateY(-15px) scale(1.03); }
}

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

.cloud {
    position: absolute;
    width: 100px;
    height: 40px;
    background: rgba(255,255,255,0.8);
    border-radius: 40px;
    animation: floatCloud 25s linear infinite;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
}

.cloud::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 10px;
}

.cloud::after {
    width: 60px;
    height: 40px;
    top: -15px;
    right: 10px;
}

.cloud1 { top: 10%; left: -120px; animation-delay: 0s; }
.cloud2 { top: 20%; left: -120px; animation-delay: -12s; }

@keyframes floatCloud {
    0% { transform: translateX(-120px); }
    100% { transform: translateX(calc(100vw + 120px)); }
}

.seagull {
    position: absolute;
    width: 20px;
    height: 15px;
    animation: flySeagull 30s linear infinite;
}

.seagull::before {
    content: '🕊️';
    font-size: 20px;
    display: block;
    animation: flapWings 2s ease-in-out infinite;
}

.seagull1 { top: 15%; left: -30px; animation-delay: 0s; }
.seagull2 { top: 25%; left: -30px; animation-delay: -15s; }

@keyframes flySeagull {
    0% { transform: translateX(-30px) translateY(0px); }
    50% { transform: translateX(50vw) translateY(-20px); }
    100% { transform: translateX(calc(100vw + 30px)) translateY(0px); }
}

@keyframes flapWings {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeInSlide 1s ease-out;
}

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

/* Welcome Screen */
.island-welcome {
    text-align: center;
    max-width: 800px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem;
    border: 2px solid rgba(255,215,0,0.3);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.island-title {
    font-family: 'Cinzel', serif;
    font-size: 4rem;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    margin-bottom: 1rem;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { text-shadow: 3px 3px 6px rgba(0,0,0,0.5), 0 0 20px rgba(255,215,0,0.3); }
    100% { text-shadow: 3px 3px 6px rgba(0,0,0,0.5), 0 0 30px rgba(255,215,0,0.6); }
}

.subtitle {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    color: #F0F8FF;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.ricardo-greeting {
    background: rgba(139,69,19,0.8);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    border: 3px solid #FFD700;
    position: relative;
}

.ricardo-greeting::before {
    content: '"';
    font-size: 4rem;
    color: #FFD700;
    position: absolute;
    top: -10px;
    left: 20px;
    font-family: 'Cinzel', serif;
}

.greeting-text {
    font-style: italic;
    font-size: 1.2rem;
    color: #F0F8FF;
    line-height: 1.6;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.enter-island-btn {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border: none;
    border-radius: 50px;
    padding: 1rem 3rem;
    font-size: 1.3rem;
    font-weight: bold;
    color: #8B4513;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    margin-top: 2rem;
}

.enter-island-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    background: linear-gradient(45deg, #FFA500, #FFD700);
}

/* Screen Headers */
.screen-header {
    text-align: center;
    margin-bottom: 3rem;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    border: 2px solid rgba(255,215,0,0.3);
}

.screen-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: #FFD700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.screen-header p {
    font-size: 1.2rem;
    color: #F0F8FF;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Back Button */
.back-btn {
    background: rgba(70,130,180,0.8);
    border: 2px solid #4682B4;
    border-radius: 25px;
    padding: 0.5rem 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.back-btn:hover {
    background: rgba(70,130,180,1);
    transform: translateX(-5px);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
}

.category-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    border: 2px solid rgba(255,215,0,0.3);
    position: relative;
    overflow: hidden;
}

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

.category-card:hover::before {
    animation: cardShine 1s ease-in-out;
}

@keyframes cardShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); opacity: 0; }
}

.category-card:hover {
    transform: translateY(-10px) scale(1.05);
    background: rgba(255,255,255,0.25);
    border-color: #FFD700;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

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

.category-card h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: #FFD700;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.category-card p {
    color: #F0F8FF;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Media Search */
.media-search {
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
    position: relative;
}

#media-search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid rgba(255,215,0,0.5);
    border-radius: 25px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
}

#media-search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

#media-search-input:focus {
    border-color: #FFD700;
    background: rgba(255,255,255,0.2);
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 0 0 15px 15px;
    border: 2px solid rgba(255,215,0,0.5);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.suggestion-item {
    padding: 0.8rem 1.5rem;
    color: #2F4F4F;
    cursor: pointer;
    transition: background 0.2s ease;
}

.suggestion-item:hover {
    background: rgba(255,215,0,0.2);
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    width: 100%;
}

.media-item {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,215,0,0.2);
}

.media-item:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.2);
    border-color: #FFD700;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.media-item h4 {
    color: #FFD700;
    margin-bottom: 0.5rem;
    font-family: 'Cinzel', serif;
}

.media-item p {
    color: #F0F8FF;
    font-size: 0.9rem;
}

/* Story Type Cards */
.story-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    width: 100%;
}

.story-type-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    border: 2px solid rgba(255,215,0,0.3);
    position: relative;
}

.story-type-card:hover {
    transform: translateY(-10px) scale(1.03);
    background: rgba(255,255,255,0.25);
    border-color: #FFD700;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.type-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.story-type-card h3 {
    font-family: 'Cinzel', serif;
    color: #FFD700;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.story-type-card p {
    color: #F0F8FF;
    line-height: 1.6;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.example {
    background: rgba(139,69,19,0.6);
    border-radius: 10px;
    padding: 1rem;
    font-style: italic;
    color: #FFE4B5;
    border: 1px solid rgba(255,215,0,0.3);
}

/* Generation Screen */
.generation-container {
    text-align: center;
    max-width: 600px;
}

.generation-container h2 {
    font-family: 'Cinzel', serif;
    color: #FFD700;
    font-size: 2rem;
    margin-bottom: 3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.magic-circle {
    width: 300px;
    height: 300px;
    margin: 0 auto 2rem;
    border: 3px solid #FFD700;
    border-radius: 50%;
    position: relative;
    animation: rotateCircle 10s linear infinite;
    background: radial-gradient(circle, rgba(255,215,0,0.1) 0%, transparent 70%);
}

@keyframes rotateCircle {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.inner-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border: 2px solid rgba(255,215,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotateInner 8s linear infinite reverse;
}

@keyframes rotateInner {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    animation: sparkleAnim 2s ease-in-out infinite;
}

.sparkle1 { top: 20%; left: 30%; animation-delay: 0s; }
.sparkle2 { top: 60%; right: 25%; animation-delay: 0.7s; }
.sparkle3 { bottom: 25%; left: 20%; animation-delay: 1.4s; }

@keyframes sparkleAnim {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.5); }
}

.generation-text {
    color: #F0F8FF;
    font-style: italic;
    text-align: center;
    padding: 0 1rem;
    animation: textGlow 3s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 0 5px rgba(255,215,0,0.3); }
    50% { text-shadow: 0 0 15px rgba(255,215,0,0.6); }
}

.generation-status {
    color: #87CEEB;
    font-size: 1.1rem;
    animation: fadeInOut 2s ease-in-out infinite;
}

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

/* Story Display */
.story-container {
    max-width: 800px;
    width: 100%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 3rem;
    border: 2px solid rgba(255,215,0,0.3);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.story-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(255,215,0,0.3);
    padding-bottom: 1rem;
}

#story-title {
    font-family: 'Cinzel', serif;
    color: #FFD700;
    font-size: 2.2rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.story-meta {
    color: #87CEEB;
    font-style: italic;
}

.story-content {
    color: #F0F8FF;
    line-height: 1.8;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 2rem;
}

.story-content p {
    margin-bottom: 1.5rem;
}

.story-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.action-btn.primary {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #8B4513;
}

.action-btn.secondary {
    background: rgba(70,130,180,0.8);
    color: white;
    border: 2px solid #4682B4;
}

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

/* Footer */
.island-footer {
    background: rgba(0,0,0,0.3);
    color: #F0F8FF;
    text-align: center;
    padding: 2rem;
    position: relative;
    margin-top: 4rem;
}

.footer-wave {
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    height: 50px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,0 Q300,60 600,0 T1200,0 L1200,120 L0,120 Z' fill='rgba(0,0,0,0.3)'/%3E%3C/svg%3E");
    background-size: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
    .island-title {
        font-size: 2.5rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .story-types {
        grid-template-columns: 1fr;
    }
    
    .story-container {
        padding: 2rem;
        margin: 1rem;
    }
    
    .magic-circle {
        width: 200px;
        height: 200px;
    }
    
    .screen {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .island-title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.3rem;
    }
    
    .ricardo-greeting {
        padding: 1.5rem;
    }
    
    .greeting-text {
        font-size: 1rem;
    }
    
    .story-actions {
        flex-direction: column;
    }
}