/* Space Adventure Theme for Kids */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    /* Playful Color Palette */
    --space-dark: #0a0e27;
    --space-blue: #1e3a8a;
    --cosmic-purple: #7c3aed;
    --star-yellow: #fbbf24;
    --rocket-red: #ef4444;
    --alien-green: #10b981;
    --moon-gray: #94a3b8;
    --panel-bg: rgba(15, 23, 42, 0.85);
    --panel-border: rgba(139, 92, 246, 0.5);
    --glow-blue: #60a5fa;
    
    /* Typography */
    --font-display: 'Fredoka', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

body {
    font-family: var(--font-display);
    overflow: hidden;
    background: linear-gradient(135deg, #0a0e27 0%, #1e1b4b 50%, #312e81 100%);
    color: white;
    user-select: none;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeOut 0.5s ease-out 2s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

.rocket-loader {
    text-align: center;
}

.rocket {
    font-size: 80px;
    animation: rocketFloat 2s ease-in-out infinite, rocketLaunch 2s ease-out;
    filter: drop-shadow(0 0 20px var(--star-yellow));
}

@keyframes rocketFloat {
    0%, 100% { transform: translateY(0px) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes rocketLaunch {
    0% { transform: translateY(100vh) scale(0.5); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.loading-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--star-yellow);
    margin: 20px 0;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-bar {
    width: 300px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    margin: 20px auto;
    border: 2px solid var(--cosmic-purple);
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--cosmic-purple), var(--glow-blue), var(--alien-green));
    border-radius: 20px;
    animation: loadingProgress 2s ease-out forwards;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Canvas */
#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Control Panels */
.control-panel {
    position: fixed;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 3px solid var(--panel-border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.left-panel {
    bottom: 40px;
    left: 40px;
    animation-delay: 0.2s;
}

.right-panel {
    bottom: 40px;
    right: 40px;
    animation-delay: 0.4s;
}

.panel-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--cosmic-purple);
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--star-yellow);
    text-shadow: 0 0 10px var(--star-yellow);
    letter-spacing: 1px;
}

/* Movement Controls */
.movement-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.horizontal-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.3), rgba(59, 130, 246, 0.3));
    border: 2px solid var(--glow-blue);
    border-radius: 16px;
    padding: 16px 24px;
    color: white;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.3);
}

.control-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 25px rgba(96, 165, 250, 0.5);
    border-color: var(--star-yellow);
}

.control-btn:active {
    transform: translateY(-2px) scale(1.02);
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.5), rgba(59, 130, 246, 0.5));
}

.btn-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.btn-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Gauges */
.gauge-container {
    margin-top: 16px;
}

.gauge-label {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--star-yellow);
    margin-bottom: 8px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 2px;
}

.gauge {
    position: relative;
    width: 100%;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 2px solid var(--glow-blue);
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--alien-green), var(--star-yellow), var(--rocket-red));
    border-radius: 18px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Joystick */
.joystick-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.joystick-base {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(30, 58, 138, 0.4), rgba(15, 23, 42, 0.6));
    border-radius: 50%;
    border: 4px solid var(--glow-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.5),
                0 8px 30px rgba(96, 165, 250, 0.4);
    position: relative;
}

.joystick-base::before {
    content: '';
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    border: 2px dashed rgba(96, 165, 250, 0.3);
}

.joystick-stick {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, var(--cosmic-purple), var(--glow-blue));
    border-radius: 50%;
    border: 3px solid white;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
    transition: transform 0.1s ease;
    position: relative;
}

.joystick-stick:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.joystick-center {
    width: 25px;
    height: 25px;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Angle Gauges */
.angle-gauges {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.angle-gauge {
    flex: 1;
    text-align: center;
}

.angle-display {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--glow-blue);
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--glow-blue);
    border-radius: 12px;
    padding: 8px 12px;
    text-shadow: 0 0 10px var(--glow-blue);
}

/* 3D Orientation Display */
.orientation-display {
    margin-top: 20px;
    text-align: center;
}

.orientation-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--star-yellow);
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 1px;
}

#orientationCanvas {
    border: 2px solid var(--glow-blue);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Time Control */
.time-control {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 3px solid var(--panel-border);
    border-radius: 20px;
    padding: 16px 24px;
    z-index: 100;
    animation: slideDown 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.6s backwards;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.time-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--star-yellow);
    margin-bottom: 12px;
    text-align: center;
    text-shadow: 0 0 10px var(--star-yellow);
}

.time-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.time-btn {
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.3), rgba(59, 130, 246, 0.3));
    border: 2px solid var(--glow-blue);
    border-radius: 12px;
    padding: 10px 16px;
    color: white;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.time-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
    border-color: var(--star-yellow);
}

.time-display {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--star-yellow);
    min-width: 60px;
    text-align: center;
    text-shadow: 0 0 10px var(--star-yellow);
}

.reset-btn {
    width: 100%;
}

/* Info Display */
.info-display {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 3px solid var(--panel-border);
    border-radius: 16px;
    padding: 16px 24px;
    max-width: 500px;
    z-index: 100;
    animation: slideDown 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.8s backwards, fadeOutInfo 1s ease-out 5s forwards;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3);
}

@keyframes fadeOutInfo {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
        pointer-events: none;
    }
}

.info-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--star-yellow);
    margin-bottom: 8px;
    text-shadow: 0 0 10px var(--star-yellow);
}

.info-content {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

/* Planet Detail View */
.planet-detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(15px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.detail-content {
    position: relative;
    max-width: 800px;
    max-height: 90vh;
    background: var(--panel-bg);
    border: 4px solid var(--cosmic-purple);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.5);
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--rocket-red);
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5);
    z-index: 10;
}

.close-btn:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.7);
}

.detail-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--star-yellow);
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--star-yellow);
}

.detail-info {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.8;
}

#detailCanvas {
    width: 100%;
    height: 400px;
    border-radius: 16px;
    border: 3px solid var(--glow-blue);
    box-shadow: 0 8px 30px rgba(96, 165, 250, 0.4);
}

.detail-controls {
    margin-top: 20px;
    text-align: center;
}

.detail-control-label {
    font-size: 16px;
    color: var(--glow-blue);
    font-weight: 600;
}

/* Help Button */
.help-btn {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, var(--cosmic-purple), var(--glow-blue));
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-size: 32px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
    z-index: 100;
    animation: pulse 2s ease-in-out infinite;
}

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

.help-btn:hover {
    transform: scale(1.2) rotate(20deg);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.7);
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.help-content {
    position: relative;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--panel-bg);
    border: 4px solid var(--cosmic-purple);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.5);
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.help-content h2 {
    font-size: 32px;
    color: var(--star-yellow);
    margin-bottom: 24px;
    text-align: center;
    text-shadow: 0 0 20px var(--star-yellow);
}

.help-section {
    margin-bottom: 28px;
}

.help-section h3 {
    font-size: 22px;
    color: var(--glow-blue);
    margin-bottom: 12px;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section li {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    padding-left: 28px;
    position: relative;
    line-height: 1.6;
}

.help-section li::before {
    content: '⭐';
    position: absolute;
    left: 0;
    top: 0;
}

.help-section strong {
    color: var(--star-yellow);
}

/* Responsive Design */
@media (max-width: 768px) {
    .left-panel, .right-panel {
        bottom: 20px;
        padding: 16px;
    }
    
    .left-panel {
        left: 20px;
    }
    
    .right-panel {
        right: 20px;
    }
    
    .control-btn {
        padding: 12px 16px;
        min-width: 80px;
    }
    
    .btn-icon {
        font-size: 24px;
    }
    
    .btn-label {
        font-size: 12px;
    }
    
    .joystick-base {
        width: 140px;
        height: 140px;
    }
    
    .joystick-stick {
        width: 60px;
        height: 60px;
    }
    
    .time-control {
        top: 20px;
        padding: 12px 16px;
    }
    
    .info-display {
        top: 100px;
        left: 20px;
        right: 20px;
        transform: none;
        max-width: none;
    }
    
    .help-btn {
        top: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--cosmic-purple), var(--glow-blue));
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--glow-blue), var(--cosmic-purple));
}

/* Planet Labels */
.planet-label {
    position: absolute;
    color: white;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    padding: 4px 10px;
    border-radius: 12px;
    border: 2px solid;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
    z-index: 50;
}

.planet-label.sun { border-color: #FDB813; color: #FDB813; }
.planet-label.mercury { border-color: #8C7853; color: #D4C4A8; }
.planet-label.venus { border-color: #FFC649; color: #FFC649; }
.planet-label.earth { border-color: #2F6A9F; color: #6BAED6; }
.planet-label.mars { border-color: #CD5C5C; color: #F08080; }
.planet-label.jupiter { border-color: #C88B3A; color: #E9C6A0; }
.planet-label.saturn { border-color: #FAD5A5; color: #FAD5A5; }
.planet-label.uranus { border-color: #4FD0E7; color: #4FD0E7; }
.planet-label.neptune { border-color: #4166F5; color: #7B9BFF; }
.planet-label.pluto { border-color: #BCA89F; color: #BCA89F; }
.planet-label.ceres { border-color: #9C9C9C; color: #C8C8C8; }
.planet-label.moon { border-color: #C0C0C0; color: #E8E8E8; }

.planet-label .distance {
    font-size: 11px;
    opacity: 0.8;
    margin-left: 6px;
}

