:root {
    --bg: #fdfdfd;
    --space-bg: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    --primary: #5c67f2;
    --secondary: #ff8fb1;
    --accent: #ffd93d;
    --text: #2d3436;
    --text-dim: #636e72;
    --glass: rgba(255, 255, 255, 0.95);
    --border: #f1f2f6;
    --card-shadow: 0 10px 30px rgba(92, 103, 242, 0.1);
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-hand: 'Patrick Hand', cursive;
}

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

@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes star-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.5); opacity: 1; }
}

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

body {
    background: var(--bg);
    background-image: var(--space-bg);
    color: var(--text);
    font-family: var(--font-hand);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Playful Starfield */
.starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.starfield::before {
    content: '⭐ 🌕 ✨ 🛸 ☄️';
    position: absolute;
    top: 10%; left: 10%;
    font-size: 2rem;
    opacity: 0.3;
    animation: float 6s infinite ease-in-out;
}

.launch-overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.launch-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.5);
}

.launch-logo-orb {
    width: 200px;
    height: 200px;
    background: var(--accent);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 70%;
    padding: 30px;
    box-shadow: 0 15px 40px rgba(255, 217, 61, 0.4);
    animation: wiggle 4s infinite ease-in-out;
}

.launch-logo-orb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.launch-content h1 {
    font-size: 4rem;
    color: var(--primary);
    text-shadow: 4px 4px 0 var(--secondary);
}

.launch-btn {
    padding: 20px 80px;
    background: var(--primary);
    border: none;
    border-radius: 100px;
    color: white;
    font-size: 2rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 0 #3b44b8;
    transition: all 0.1s;
}

.launch-btn:active {
    transform: translateY(8px);
    box-shadow: 0 2px 0 #3b44b8;
}

.app-container {
    position: relative;
    z-index: 1;
    width: 98vw;
    height: 98vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

header.doodle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: white;
    border-radius: 40px;
    box-shadow: var(--card-shadow);
}

.mission-status {
    display: flex;
    align-items: center;
    gap: 30px;
}

.lyrics-card {
    background: rgba(92, 103, 242, 0.08);
    border: 3px dashed var(--primary);
    padding: 12px 30px;
    border-radius: 50px;
    min-width: 350px;
    text-align: center;
    box-shadow: inset 0 0 15px rgba(92, 103, 242, 0.1);
}

#current-lyric {
    color: var(--primary);
    font-family: var(--font-hand);
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    white-space: nowrap;
    animation: lyric-bounce 1.5s infinite ease-in-out;
}

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


.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-orb-wrapper {
    width: 70px;
    height: 70px;
    background: var(--accent);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    transform: rotate(-5deg);
}

.logo-orb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.title-group h1 {
    font-size: 2.8rem;
    color: var(--primary);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--secondary);
    font-weight: bold;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f1f2f6;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.audio-btn.active {
    background: var(--accent);
    transform: scale(1.1);
}

.main-viewport {
    flex: 1;
    display: flex;
    gap: 25px;
    overflow: hidden;
}

.doodle-card {
    background: white;
    border-radius: 40px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
}

.control-panel {
    width: 350px;
}

.step-num {
    background: var(--secondary);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.planet-btn {
    background: #f8f9fa;
    border: 3px solid transparent;
    border-radius: 25px;
    padding: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
    font-size: 1.3rem;
}

.planet-btn:hover {
    background: #fff;
    border-color: var(--primary);
    transform: scale(1.02);
}

.planet-btn.active {
    background: #eef2ff;
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(92, 103, 242, 0.2);
}

.viewport-canvas-container {
    flex: 1;
    position: relative;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 8px solid #f1f2f6;
}

#physics-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    background: transparent;
}

.background-texture {
    position: absolute;
    inset: 0;
    opacity: 0.9; /* High visibility for cute backgrounds */
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: background-image 0.8s ease;
}

.bg-earth .background-texture { background-image: url('assets/earth_bg.png'); }
.bg-moon .background-texture { background-image: url('assets/moon_bg.png'); }
.bg-jupiter .background-texture { background-image: url('assets/jupiter_bg.png'); }


.jump-action-btn {
    background: var(--primary);
    border: none;
    padding: 25px;
    border-radius: 30px;
    color: white;
    font-size: 1.8rem;
    font-weight: 900;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 10px 0 #3b44b8;
    transition: all 0.1s;
}

.jump-action-btn:active {
    transform: translateY(8px);
    box-shadow: 0 2px 0 #3b44b8;
}

#mass-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: #f1f2f6;
    height: 15px;
    border-radius: 10px;
}

#mass-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 35px;
    height: 35px;
    background: var(--secondary);
    border: 5px solid white;
    border-radius: 50%;
    cursor: pointer;
}

.speech-bubble {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: var(--primary);
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.4rem;
    font-weight: 900;
    z-index: 100;
    box-shadow: var(--card-shadow);
    border: 4px solid var(--primary);
}

.science-log-panel h3 {
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 1.8rem;
}

.photo-card, .featured-img, .photo-caption { display: none; }

.log-entry {
    background: #f8f9fa;
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: var(--font-hand);
}

.footer-doodle {
    padding: 20px;
    font-size: 1.2rem;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 1200px) {
    body {
        height: auto;
        overflow-y: auto;
        display: block; /* Switch from flex center to allow natural scrolling */
    }
    .app-container {
        padding: 15px;
        height: auto; /* Allow overflow */
        min-height: 100vh;
    }
    .main-viewport {
        flex-direction: column;
        overflow: visible;
        gap: 20px;
    }
    .control-panel, .science-log-panel {
        width: 100%;
    }
    .viewport-canvas-container {
        min-height: 400px;
    }
    .mission-status {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    .lyrics-card {
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 600px) {
    header.doodle-header {
        flex-direction: column;
        padding: 20px;
        align-items: center;
        text-align: center;
        gap: 20px;
    }
    .logo-container {
        flex-direction: column;
        gap: 10px;
    }
    .title-group h1 {
        font-size: 2.2rem;
    }
    .lyrics-card {
        padding: 10px 15px;
    }
    #current-lyric {
        font-size: 1.1rem;
        white-space: normal; /* Wrap long lines on mobile */
    }
    .planet-buttons {
        grid-template-columns: 1fr;
    }
    .jump-action-btn {
        width: 100%;
        padding: 18px;
        font-size: 1.6rem;
    }
    .speech-bubble {
        width: 85%;
        padding: 12px;
        font-size: 1rem;
    }
}


