/* elevenplus.css */

:root {
    --bg-main: #f8fafc;
    --text-dark: #1e293b;
    --text-light: #64748b;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    overflow-x: hidden;
    position: relative;
    /* Modern Dot Grid Background */
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 40px 40px;
    min-height: 100vh;
}

/* --- Hero & Header --- */
.hero-wrapper {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 4rem 1rem 1rem; 
    text-align: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.5s ease;
}

/* --- WAVE ANIMATION --- */
.waves-container {
    position: relative;
    width: 100%;
    height: 100px;
    margin-bottom: -7px;
    min-height: 100px;
    max-height: 150px;
}

.waves {
    position: relative;
    width: 100%;
    height: 100%;
    margin-bottom: -7px;
    min-height: 100px;
    max-height: 150px;
}

.parallax > use {
    animation: move-forever 25s cubic-bezier(.55,.5,.45,.5) infinite;
}
.parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 7s; fill: rgba(248, 250, 252, 0.7); }
.parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 10s; fill: rgba(248, 250, 252, 0.5); }
.parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 13s; fill: rgba(248, 250, 252, 0.3); }
.parallax > use:nth-child(4) { animation-delay: -5s; animation-duration: 20s; fill: #f8fafc; }

@keyframes move-forever {
    0% { transform: translate3d(-90px,0,0); }
    100% { transform: translate3d(85px,0,0); }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
    margin-bottom: 3rem;
}

/* --- The Olympic Circle Hub --- */
.hub-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    margin-top: -8rem; 
    position: relative;
    z-index: 10;
    min-height: 45vh;
}

.magic-circle {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* Original Border and Shadow */
    border: 6px solid rgba(255, 255, 255, 0.3); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    /* Transition for Hover Scale */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    margin: 0 -25px;
    background-color: white;
}

/* FIX: Changed animation from 'transform' to 'margin-top'.
   This prevents the animation from fighting with the hover scale effect.
*/
.magic-circle { animation: float 6s ease-in-out infinite; }
.magic-circle:nth-child(1) { animation-delay: 0s; z-index: 1; }
/* Keep the vertical stagger using margin-bottom */
.magic-circle:nth-child(2) { animation-delay: 2s; z-index: 2; margin-bottom: 40px; } 
.magic-circle:nth-child(3) { animation-delay: 4s; z-index: 1; }

.magic-circle:hover {
    /* Now this transform will work perfectly every time */
    transform: scale(1.15) translateY(-15px);
    z-index: 50 !important;
    border-color: rgba(255, 255, 255, 1);
    box-shadow: 0 25px 50px rgba(0,0,0,0.4), 0 0 20px rgba(255,255,255,0.4);
    /* We don't even need to stop the animation because it uses margins now! */
}

.magic-circle i {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.magic-circle h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

/* Circle Themes */
.circle-reading { background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); }
.circle-grammar { background: linear-gradient(135deg, #c084fc 0%, #7e22ce 100%); }
.circle-writing { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); }

/* --- Grid Views --- */
.module-section {
    display: none;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    animation: fadeIn 0.5s ease-out forwards;
}

.back-btn-container {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
    min-height: 80px; 
    position: relative;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

/* --- Cards --- */
.module-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e2e8f0;
    overflow: visible; 
    position: relative;
    z-index: 1; 
}

.module-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    z-index: 30; 
}

.card-top-stripe { 
    height: 8px; 
    width: 100%; 
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
}

.card-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; }
.card-content h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-content .meta { font-family: 'Lora', serif; font-style: italic; color: var(--text-light); font-size: 0.9rem; margin-bottom: 1rem; }
.card-content .desc { color: var(--text-dark); line-height: 1.6; font-size: 0.95rem; flex-grow: 1; }

.card-footer { 
    padding: 1rem 1.5rem; 
    background: #f8fafc; 
    border-top: 1px solid #f1f5f9; 
    display: flex;
    justify-content: space-between; 
    align-items: center;
    border-bottom-left-radius: 1.5rem;
    border-bottom-right-radius: 1.5rem;
}

.card-btn { 
    display: inline-block; 
    text-align: center; 
    padding: 0.6rem 1.2rem; 
    border-radius: 12px; 
    color: white; 
    font-weight: 500; 
    text-decoration: none; 
    transition: opacity 0.3s; 
    font-size: 0.95rem;
}
.card-btn:hover { opacity: 0.9; }

/* Cross-Link Mini Tabs */
.cross-link-container { display: flex; gap: 0.5rem; }

.cross-link-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.cross-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cross-link-btn.to-reading:hover { color: #0ea5e9; border-color: #0ea5e9; background: #f0f9ff; }
.cross-link-btn.to-grammar:hover { color: #a855f7; border-color: #a855f7; background: #faf5ff; }
.cross-link-btn.to-writing:hover { color: #d97706; border-color: #d97706; background: #fffbeb; }

.cross-link-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-80%); 
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 8px;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.cross-link-btn:hover::after { opacity: 1; }

/* Theme Variations */
.theme-cy h3 { color: #0284c7; } .theme-cy .card-top-stripe, .theme-cy .card-btn { background-color: #0ea5e9; }
.theme-re h3 { color: #dc2626; } .theme-re .card-top-stripe, .theme-re .card-btn { background-color: #ef4444; }
.theme-pu h3 { color: #7e22ce; } .theme-pu .card-top-stripe, .theme-pu .card-btn { background-color: #a855f7; }
.theme-gr h3 { color: #15803d; } .theme-gr .card-top-stripe, .theme-gr .card-btn { background-color: #22c55e; }
.theme-go h3 { color: #b45309; } .theme-go .card-top-stripe, .theme-go .card-btn { background-color: #f59e0b; }

/* --- HOME BUTTON & HINT --- */
.floating-home-button {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 15px !important;
    width: 45px !important;
    height: 45px !important;
    font-size: 1.3rem !important; 
    border-radius: 50% !important;
    z-index: 50 !important;
    display: flex; 
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none; 
}

.home-hint-bubble {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 70px !important;
    font-size: 0.75rem !important;
    padding: 6px 12px !important;
    background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
    color: white;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
    z-index: 9998;
    opacity: 0;
    display: none;
}

.home-hint-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 6px solid #dc2626;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.animate-hint { display: block; animation: slideHint 5s ease-in-out forwards; }

/* UPDATED FLOAT ANIMATION 
   Uses margin-top instead of transform to allow hover effects to work 
*/
@keyframes float {
    0% { margin-top: 0px; }
    50% { margin-top: -12px; }
    100% { margin-top: 0px; }
}

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

/* --- OCEAN WAVE ANIMATION (Desktop Only) --- */
.ocean {
    display: none; /* Hidden by default on mobile */
}

/* --- RETRO GAME STYLES --- */
.retro-game-container { display: none; }

/* =========================================
   DESKTOP MEDIA QUERIES (Min Width 769px)
   ========================================= */
@media (min-width: 769px) {
    .floating-home-button {
        position: static !important; width: 70px !important; height: 70px !important;
        font-size: 2.2rem !important; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        transform: none !important; color: white;
    }
    .floating-home-button:hover { transform: scale(1.1) !important; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3); }
    .floating-home-button:active { transform: scale(0.95) !important; }
    
    .home-hint-bubble {
        position: absolute !important; top: 50% !important; right: auto !important;
        left: 50% !important; margin-left: 50px !important; transform: translateY(-50%) !important;
        font-size: 0.85rem !important; padding: 8px 16px !important;
    }
    .home-hint-bubble::after { right: auto; left: -6px; border-right: 6px solid #f97316; border-left: none; }
    
    @keyframes slideHint {
        0% { opacity: 0; transform: translate(10px, -50%); }
        10% { opacity: 1; transform: translate(0, -50%); }
        80% { opacity: 1; transform: translate(0, -50%); }
        100% { opacity: 0; transform: translate(10px, -50%); }
    }

    /* 2. THE OCEAN WAVE ANIMATION (Only appears here) */
    .ocean { 
        display: block;
        height: 5%;
        width: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        background: #015871;
        z-index: 0; /* Behind everything */
    }

    .wave {
        background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/85486/wave.svg) repeat-x; 
        position: absolute;
        top: -198px;
        width: 6400px;
        height: 198px;
        animation: wave 7s cubic-bezier( 0.36, 0.45, 0.63, 0.53) infinite;
        transform: translate3d(0, 0, 0);
    }

    .wave:nth-of-type(2) {
        top: -175px;
        animation: wave 7s cubic-bezier( 0.36, 0.45, 0.63, 0.53) -.125s infinite, swell 7s ease -1.25s infinite;
        opacity: 1;
    }

    @keyframes wave {
        0% { margin-left: 0; }
        100% { margin-left: -1600px; }
    }

    @keyframes swell {
        0%, 100% { transform: translate3d(0,-25px,0); }
        50% { transform: translate3d(0,5px,0); }
    }
}

/* =========================================
   LARGE SCREEN EXTRAS (Retro Game)
   ========================================= */
@media (min-width: 1024px) {
    .retro-game-container { display: block; }
    
    #game-trigger {
        position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px;
        background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        border-radius: 50%; cursor: pointer; z-index: 9999;
        display: flex; align-items: center; justify-content: center;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    #game-trigger:hover { transform: scale(1.1) rotate(10deg); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
    #game-trigger i { font-size: 24px; color: #64748b; }
    
    .pixel-tooltip {
        position: absolute; right: 75px; background: #1e293b; padding: 6px 12px;
        font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.8rem; color: #fff;
        border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.3s;
    }
    #game-trigger:hover .pixel-tooltip { opacity: 1; }
    
    #retro-modal {
        display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(15, 23, 42, 0.8); z-index: 10000;
        justify-content: center; align-items: center; flex-direction: column; backdrop-filter: blur(8px);
    }
    .tv-bezel {
        background: #1e293b; padding: 10px; border-radius: 12px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); position: relative; border: 1px solid #334155;
    }
    canvas#gameCanvas { background: #0f172a; border-radius: 4px; image-rendering: pixelated; }
    .game-ui { font-family: 'Press Start 2P', cursive; color: #fff; text-align: center; margin-top: 20px; }
    .close-retro {
        position: absolute; top: -15px; right: -15px; background: #ef4444; color: white;
        border: 4px solid #1e293b; width: 36px; height: 36px; border-radius: 50%; font-weight: bold;
        cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center;
        transition: transform 0.2s;
    }
    .close-retro:hover { transform: scale(1.1); }
}

/* =========================================
   MOBILE ADJUSTMENTS (Max Width 768px)
   ========================================= */
@media (max-width: 768px) {
    .hero-wrapper { 
        padding: 3rem 1.5rem 5rem; 
        border-bottom-left-radius: 50% 20px;
        border-bottom-right-radius: 50% 20px;
    }
    .hero-title { font-size: 2.5rem; margin-bottom: 0.5rem; }
    .hero-subtitle { font-size: 1.1rem; padding: 0 1rem; margin-bottom: 2rem; }
    .hub-container { flex-direction: column; gap: 1.5rem; padding-top: 0; margin-top: -3.5rem; }
    .magic-circle { width: 100%; max-width: 300px; height: 180px; margin: 0; border-radius: 20px; flex-direction: row; justify-content: flex-start; padding: 0 2rem; border-width: 0; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
    .magic-circle:not(:first-child) { margin-top: 0; }
    .magic-circle:nth-child(2) { margin-bottom: 0; }
    .magic-circle i { font-size: 2.5rem; margin-bottom: 0; margin-right: 1.5rem; }
    .magic-circle h2 { font-size: 1.25rem; text-align: left; }
    .magic-circle h2 br { display: none; }
    .magic-circle h2 span { display: block; font-size: 0.85rem; margin-top: 2px; }
    .back-btn-container { display: block !important; height: auto; position: relative; margin-bottom: 1.5rem; padding: 0; text-align: left; }
    .module-section { padding: 0 1rem 3rem 1rem; }
    .grid-layout { gap: 1.5rem; grid-template-columns: 1fr; }
    
    /* Ensure Ocean is hidden on mobile */
    .ocean { display: none; }
    
    /* Mobile-specific fix for the hero waves */
    .waves-container { height: 60px; min-height: 60px; }
    .waves { height: 60px; min-height: 60px; }
    
    @keyframes slideHint {
        0% { opacity: 0; transform: translate(-10px, -50%); }
        10% { opacity: 1; transform: translate(0, -50%); }
        80% { opacity: 1; transform: translate(0, -50%); }
        100% { opacity: 0; transform: translate(5px, -50%); }
    }
}