/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --space-dark: #05071a;
    --space-blue: #0a0e2e;
    --space-purple: #1a0a3e;
    --star-yellow: #ffd700;
    --nebula-pink: #ff6eb4;
    --nebula-blue: #4fc3f7;
    --nebula-purple: #ce93d8;
    --planet-orange: #ff8a50;
    --card-bg: rgba(255,255,255,0.08);
    --card-border: rgba(255,255,255,0.15);
    --text-light: #e8f4fd;
    --text-bright: #ffffff;
    --font-main: 'Nunito', 'Comic Sans MS', cursive, sans-serif;
    --radius-card: 24px;
    --shadow-glow: 0 0 30px rgba(79, 195, 247, 0.3);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--space-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== STARFIELD CANVAS ===== */
#starfield {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== AUDIO CONTROLS ===== */
#audio-controls {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 1000;
    display: flex;
    gap: 8px;
}

#audio-controls button {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 48px; height: 48px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#audio-controls button:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

#audio-controls button.muted {
    opacity: 0.4;
    filter: grayscale(1);
}

/* ===== HEADER ===== */
.main-header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 60px 20px 40px;
    overflow: hidden;
}

.header-content {
    position: relative;
    z-index: 2;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 56px;
    animation: rocket-bounce 2s ease-in-out infinite;
    display: inline-block;
}

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

.logo-text {
    font-size: clamp(42px, 8vw, 72px);
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700, #ff6eb4, #4fc3f7, #ce93d8);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 4s ease infinite;
    text-shadow: none;
    letter-spacing: -2px;
}

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

.tagline {
    font-size: clamp(18px, 3vw, 26px);
    color: var(--nebula-blue);
    font-weight: 700;
    letter-spacing: 1px;
}

/* ===== FLOATING PLANETS ===== */
.floating-planets {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.fp {
    position: absolute;
    font-size: 32px;
    opacity: 0.6;
    animation: float-around linear infinite;
}

.fp1 { left: 5%; top: 20%; font-size: 40px; animation-duration: 8s; animation-delay: 0s; }
.fp2 { left: 90%; top: 30%; font-size: 28px; animation-duration: 6s; animation-delay: -2s; }
.fp3 { left: 15%; top: 70%; font-size: 36px; animation-duration: 10s; animation-delay: -4s; }
.fp4 { left: 85%; top: 65%; font-size: 24px; animation-duration: 7s; animation-delay: -1s; }
.fp5 { left: 50%; top: 10%; font-size: 30px; animation-duration: 9s; animation-delay: -3s; }

@keyframes float-around {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
    75% { transform: translateY(-25px) rotate(270deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== WELCOME SECTION ===== */
.welcome-section {
    text-align: center;
    margin-bottom: 48px;
    padding: 40px 20px;
    background: rgba(255,255,255,0.04);
    border-radius: 32px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.welcome-title {
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 900;
    color: var(--star-yellow);
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.welcome-text {
    font-size: clamp(16px, 2.5vw, 22px);
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== TOPICS GRID ===== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 10px;
}

/* ===== TOPIC CARDS ===== */
.topic-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-card);
    padding: 36px 28px;
    text-decoration: none;
    color: var(--text-bright);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.topic-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79,195,247,0.1), rgba(206,147,216,0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-card);
}

.topic-card:hover {
    transform: translateY(-12px) scale(1.03);
    border-color: rgba(255,255,255,0.4);
    box-shadow: var(--shadow-glow), 0 20px 60px rgba(0,0,0,0.4);
}

.topic-card:hover::before { opacity: 1; }

.topic-card:nth-child(1):hover { border-color: #ff8a50; box-shadow: 0 0 30px rgba(255,138,80,0.4), 0 20px 60px rgba(0,0,0,0.4); }
.topic-card:nth-child(2):hover { border-color: #ffd700; box-shadow: 0 0 30px rgba(255,215,0,0.5), 0 20px 60px rgba(0,0,0,0.4); }
.topic-card:nth-child(3):hover { border-color: #c8c8ff; box-shadow: 0 0 30px rgba(200,200,255,0.4), 0 20px 60px rgba(0,0,0,0.4); }
.topic-card:nth-child(4):hover { border-color: #ffd700; box-shadow: 0 0 30px rgba(255,215,0,0.4), 0 20px 60px rgba(0,0,0,0.4); }
.topic-card:nth-child(5):hover { border-color: #ce93d8; box-shadow: 0 0 30px rgba(206,147,216,0.4), 0 20px 60px rgba(0,0,0,0.4); }
.topic-card:nth-child(6):hover { border-color: #4fc3f7; box-shadow: 0 0 30px rgba(79,195,247,0.4), 0 20px 60px rgba(0,0,0,0.4); }
.topic-card:nth-child(7):hover { border-color: #ffd700; box-shadow: 0 0 40px rgba(255,215,0,0.6), 0 20px 60px rgba(0,0,0,0.4); }

.card-icon {
    font-size: 64px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.topic-card:hover .card-icon {
    transform: scale(1.2) rotate(10deg);
}

.card-title {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-bright);
}

.card-desc {
    font-size: 15px;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
}

.card-glow {
    position: absolute;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    top: -30px; right: -30px;
    transition: all 0.4s ease;
}

.topic-card:hover .card-glow {
    width: 200px; height: 200px;
    top: -80px; right: -80px;
}

.quiz-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(255,138,80,0.1));
    border-color: rgba(255,215,0,0.4);
}

.quiz-card .card-icon { font-size: 80px; }
.quiz-card .card-title { font-size: 28px; color: var(--star-yellow); }

/* ===== FOOTER ===== */
.main-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 32px 20px;
    color: rgba(255,255,255,0.5);
    font-size: 15px;
    margin-top: 60px;
}

/* ===== PAGE LAYOUT (inner pages) ===== */
.page-container {
    position: relative;
    z-index: 10;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.page-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    padding: 10px 24px;
    color: var(--text-bright);
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateX(-4px);
}

.page-title {
    font-size: clamp(32px, 6vw, 64px);
    font-weight: 900;
    text-align: center;
    margin-bottom: 8px;
    text-shadow: 0 0 30px currentColor;
}

.page-subtitle {
    text-align: center;
    font-size: clamp(16px, 2.5vw, 20px);
    color: rgba(255,255,255,0.7);
    margin-bottom: 48px;
}

/* ===== INFO CARDS ===== */
.info-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 24px;
    backdrop-filter: blur(8px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.info-card h2 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card p {
    font-size: 17px;
    line-height: 1.7;
    color: rgba(255,255,255,0.85);
}

/* ===== PLANET GRID ===== */
.planet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.planet-item {
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 24px 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.planet-item:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: rgba(255,255,255,0.3);
}

.planet-emoji {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
    animation: planet-spin 10s linear infinite;
}

@keyframes planet-spin {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.planet-name {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-bright);
    margin-bottom: 6px;
}

.planet-fact {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}

/* ===== FUN FACTS ===== */
.fun-fact-box {
    background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(255,138,80,0.08));
    border: 2px solid rgba(255,215,0,0.3);
    border-radius: 20px;
    padding: 24px;
    margin: 24px 0;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.fun-fact-icon {
    font-size: 36px;
    flex-shrink: 0;
    animation: bounce 1.5s ease-in-out infinite;
}

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

.fun-fact-text {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-light);
}

.fun-fact-text strong { color: var(--star-yellow); }

/* ===== CONSTELLATION DISPLAY ===== */
.constellation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.constellation-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.constellation-card:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.03);
}

.constellation-stars {
    font-size: 48px;
    margin-bottom: 10px;
}

.constellation-name {
    font-size: 18px;
    font-weight: 900;
    color: var(--star-yellow);
    margin-bottom: 6px;
}

.constellation-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

/* ===== MOON PHASES ===== */
.moon-phases {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 32px 0;
}

.moon-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    min-width: 90px;
    transition: transform 0.3s ease;
}

.moon-phase:hover { transform: scale(1.1); }
.moon-phase-emoji { font-size: 42px; }
.moon-phase-name { font-size: 13px; font-weight: 700; text-align: center; color: rgba(255,255,255,0.8); }

/* ===== GALAXY CARD ===== */
.galaxy-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.galaxy-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 28px;
    text-align: center;
    transition: all 0.35s ease;
    position: relative;
    overflow: hidden;
}

.galaxy-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(206,147,216,0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.galaxy-card:hover { transform: scale(1.04); }
.galaxy-card:hover::after { opacity: 1; }

.galaxy-emoji { font-size: 64px; margin-bottom: 12px; display: block; }
.galaxy-name { font-size: 20px; font-weight: 900; color: var(--nebula-purple); margin-bottom: 8px; }
.galaxy-info { font-size: 14px; color: rgba(255,255,255,0.6); line-height: 1.5; }

/* ===== ASTRONAUT SECTION ===== */
.astronaut-timeline {
    position: relative;
    margin: 32px 0;
}

.astronaut-event {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px;
    padding: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    border-left: 4px solid var(--nebula-blue);
    transition: all 0.3s ease;
}

.astronaut-event:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(8px);
}

.astronaut-emoji { font-size: 40px; flex-shrink: 0; }
.astronaut-info h3 { font-size: 18px; font-weight: 900; color: var(--nebula-blue); margin-bottom: 6px; }
.astronaut-info p { font-size: 15px; color: rgba(255,255,255,0.75); line-height: 1.5; }
.astronaut-year { font-size: 13px; color: var(--star-yellow); font-weight: 700; margin-top: 4px; }

/* ===== QUIZ STYLES ===== */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.progress-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.progress-dot.active { background: var(--nebula-blue); transform: scale(1.3); }
.progress-dot.done { background: #66bb6a; }
.progress-dot.wrong { background: #ef5350; }

.quiz-question-card {
    background: rgba(255,255,255,0.07);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 24px;
    padding: 36px;
    margin-bottom: 24px;
    animation: slide-in 0.4s ease;
}

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

.quiz-question-num {
    font-size: 14px;
    color: var(--nebula-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.quiz-question-text {
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 28px;
    color: var(--text-bright);
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 480px) {
    .quiz-options { grid-template-columns: 1fr; }
}

.quiz-option {
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-main);
    color: var(--text-bright);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiz-option:hover:not(:disabled) {
    background: rgba(255,255,255,0.18);
    border-color: var(--nebula-blue);
    transform: scale(1.03);
}

.quiz-option.correct {
    background: rgba(102,187,106,0.25);
    border-color: #66bb6a;
    color: #c8e6c9;
}

.quiz-option.wrong {
    background: rgba(239,83,80,0.25);
    border-color: #ef5350;
    color: #ffcdd2;
}

.quiz-option:disabled { cursor: not-allowed; }

.quiz-feedback {
    text-align: center;
    padding: 20px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 900;
    margin-top: 16px;
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.quiz-feedback.correct-fb {
    background: rgba(102,187,106,0.2);
    color: #c8e6c9;
    border: 2px solid rgba(102,187,106,0.4);
}

.quiz-feedback.wrong-fb {
    background: rgba(239,83,80,0.2);
    color: #ffcdd2;
    border: 2px solid rgba(239,83,80,0.4);
}

.quiz-next-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, var(--nebula-blue), var(--nebula-purple));
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 900;
    font-family: var(--font-main);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slide-in 0.4s ease;
}

.quiz-next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(79,195,247,0.3);
}

.quiz-result {
    text-align: center;
    padding: 40px;
    background: rgba(255,255,255,0.05);
    border-radius: 24px;
    animation: slide-in 0.5s ease;
}

.quiz-score-emoji { font-size: 80px; display: block; margin-bottom: 16px; }
.quiz-score-text { font-size: 28px; font-weight: 900; color: var(--star-yellow); margin-bottom: 8px; }
.quiz-score-sub { font-size: 18px; color: rgba(255,255,255,0.7); margin-bottom: 32px; }

.quiz-restart-btn {
    background: linear-gradient(135deg, var(--star-yellow), var(--planet-orange));
    border: none;
    border-radius: 50px;
    padding: 16px 40px;
    font-size: 20px;
    font-weight: 900;
    font-family: var(--font-main);
    color: var(--space-dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(255,215,0,0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .topics-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
    .planet-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .quiz-question-card { padding: 24px; }
}

@media (max-width: 480px) {
    .main-header { padding: 40px 16px 30px; }
    .topics-grid { grid-template-columns: 1fr; }
    .card-icon { font-size: 48px; }
    .fp { display: none; }
}

/* ===== ANIMATIONS ===== */
.page-enter {
    animation: page-fade-in 0.5s ease;
}

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== STAR TWINKLE ===== */
.twinkle {
    display: inline-block;
    animation: twinkle 1.5s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* ===== SUN GLOW ===== */
.sun-glow {
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ff8a50, 0 0 80px #ff6eb4;
    animation: sun-pulse 2s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%, 100% { text-shadow: 0 0 20px #ffd700, 0 0 40px #ff8a50; }
    50% { text-shadow: 0 0 40px #ffd700, 0 0 80px #ff8a50, 0 0 120px #ffcc02; }
}

/* ===== SCROLL REVEAL ===== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
