/* Math Explorer Academy - Light Treasure Theme */

:root {
    --primary-gold: #FFB800;
    --secondary-orange: #FF6B35;
    --accent-purple: #9B59B6;
    --treasure-blue: #3498DB;
    --success-green: #2ECC71;
    --light-bg: #FFF9E6;
    --card-bg: #FFFFFF;
    --text-dark: #2C3E50;
    --text-dim: #7F8C8D;
    --border-color: #F0E5D8;
    --shadow: rgba(255, 184, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Touch-friendly interactions */
button, a, .module-card, .answer-btn, .quiz-option {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

button:active, a:active, .answer-btn:active, .quiz-option:active {
    opacity: 0.7;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE5CC 50%, #FFF9E6 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Background decorations */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 184, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(155, 89, 182, 0.05) 0%, transparent 50%);
    animation: drift 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(2%, 2%) rotate(2deg); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Back button */
.back-to-academy {
    margin-bottom: 20px;
}

.academy-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid var(--primary-gold);
}

.academy-home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 184, 0, 0.3);
    background: var(--light-bg);
}

/* Header */
.math-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-orange));
    border-radius: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px var(--shadow);
    position: relative;
    overflow: hidden;
}

.math-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
    animation: shine 20s linear infinite;
}

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

.header-decoration {
    position: relative;
    margin-bottom: 20px;
    z-index: 1;
}

.treasure-chest {
    font-size: 60px;
    animation: bounce 2s ease-in-out infinite;
    display: inline-block;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

.math-symbols {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.symbol {
    font-size: 36px;
    font-weight: bold;
    color: white;
    opacity: 0.8;
    animation: float 3s ease-in-out infinite;
    animation-delay: var(--delay);
}

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

.math-header h1 {
    font-size: 3em;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.tagline {
    font-size: 1.5em;
    color: white;
    opacity: 0.95;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.explorer-badge {
    display: inline-flex;
    gap: 20px;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.explorer-badge span {
    font-weight: 600;
    color: var(--text-dark);
}

#total-points {
    color: var(--primary-gold);
}

/* Progress */
.progress-container {
    background: white;
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px var(--shadow);
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--light-bg);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid var(--primary-gold);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-gold), var(--secondary-orange));
    width: 0%;
    transition: width 1s ease;
    box-shadow: 0 0 10px rgba(255, 184, 0, 0.5);
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-dark);
}

/* Badges */
.badges-earned {
    background: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px var(--shadow);
}

.badges-earned h3 {
    text-align: center;
    color: var(--primary-gold);
    font-size: 1.8em;
    margin-bottom: 20px;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.badge {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid var(--primary-gold);
    animation: slideIn 0.5s ease forwards;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.badge-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.badge-name {
    font-weight: 600;
    color: var(--text-dark);
}

/* Adventure Center */
.adventure-center {
    margin-bottom: 30px;
}

.adventure-center h2 {
    text-align: center;
    font-size: 2.5em;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.instruction {
    text-align: center;
    font-size: 1.2em;
    color: var(--text-dim);
    margin-bottom: 30px;
}

/* Module Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.module-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 3px solid transparent;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-gold), var(--secondary-orange), var(--accent-purple));
}

.module-card.unlocked {
    border-color: var(--primary-gold);
}

.module-card.completed {
    border-color: var(--success-green);
    background: linear-gradient(135deg, #fff 0%, #e8f8f0 100%);
}

.module-card.locked {
    opacity: 0.6;
    filter: grayscale(50%);
}

.module-card:not(.locked):hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 184, 0, 0.3);
}

.module-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 15px;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.1));
}

.module-card h3 {
    color: var(--text-dark);
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
}

.module-card p {
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.6;
}

.module-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 10px;
}

.status {
    font-weight: 600;
}

.points {
    color: var(--primary-gold);
    font-weight: bold;
}

.launch-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-orange));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
}

.launch-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 184, 0, 0.4);
}

.launch-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Parent Corner */
.parent-corner {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px var(--shadow);
}

.parent-corner summary {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.parent-corner summary:hover {
    background: var(--light-bg);
}

.parent-content {
    padding: 20px;
    margin-top: 15px;
}

.parent-content h3 {
    color: var(--primary-gold);
    margin-bottom: 15px;
}

.parent-content ul {
    list-style-position: inside;
    line-height: 2;
    color: var(--text-dim);
}

.parent-content li {
    margin-bottom: 10px;
}

.reset-btn {
    padding: 12px 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.reset-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Welcome Overlay */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-orange));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.welcome-content {
    text-align: center;
    color: white;
}

.treasure-animation {
    font-size: 100px;
    animation: bounce 1s ease-in-out infinite;
    margin-bottom: 20px;
}

.welcome-content h2 {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-content p {
    font-size: 1.3em;
    margin-bottom: 30px;
}

.loading-bar {
    width: 300px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-progress {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 1.5s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Sound Toggle */
.sound-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-orange));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    z-index: 1000;
}

.sound-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 184, 0, 0.4);
}

/* Language Toggle */
.language-toggle {
    position: fixed;
    bottom: 30px;
    right: 110px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-orange));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    z-index: 1000;
}

.language-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 184, 0, 0.4);
}

/* Touch-Friendly Enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover animations on touch devices */
    .module-card:not(.locked):hover {
        transform: none;
    }

    /* Larger touch targets */
    .launch-btn {
        min-height: 50px;
        padding: 18px;
        font-size: 1.2em;
    }

    .sound-toggle, .language-toggle {
        width: 70px;
        height: 70px;
    }

    /* Touch-friendly game buttons */
    .answer-btn {
        padding: 35px;
        font-size: 2em;
    }

    .start-btn, .submit-btn {
        min-height: 50px;
        padding: 18px 45px;
    }
}

/* Tablet Responsive (iPad) */
@media (max-width: 1024px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .badge-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sound-toggle, .language-toggle {
        bottom: 25px;
    }

    .sound-toggle {
        right: 30px;
    }

    .language-toggle {
        right: 120px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .math-header h1 {
        font-size: 2em;
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .explorer-badge {
        flex-direction: column;
        gap: 10px;
    }

    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Touch-friendly buttons */
    .launch-btn {
        padding: 16px;
        font-size: 1.1em;
    }

    /* Game interface adjustments */
    .answer-options {
        gap: 15px;
    }

    .answer-btn {
        padding: 25px;
        font-size: 1.5em;
    }

    .question-display {
        font-size: 2em;
        padding: 20px;
    }

    /* Stack toggles */
    .sound-toggle, .language-toggle {
        width: 60px;
        height: 60px;
        bottom: 20px;
    }

    .sound-toggle {
        right: 20px;
    }

    .language-toggle {
        right: 95px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .math-header h1 {
        font-size: 1.5em;
    }

    .answer-options {
        grid-template-columns: 1fr;
    }

    .badge-grid {
        grid-template-columns: 1fr;
    }

    /* Stack toggles vertically */
    .language-toggle {
        bottom: 90px;
        right: 20px;
    }
}
