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

body {
    background: radial-gradient(circle at 20% 50%, #0a0a2e, #16213e, #000);
    height: 100vh;
    overflow: hidden;
    font: 16px system-ui, sans-serif;
    color: #fff;
    position: relative;
}

/* Animated star field background */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s infinite alternate;
}

@keyframes twinkle {
    0% { 
        opacity: 0.3; 
        transform: scale(0.8); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1.2); 
    }
}

.lab {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1;
}

.header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 300;
}

.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 12px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    text-align: center;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

input[type="checkbox"] {
    display: none;
}

#clear:checked + .clear-btn {
    background: rgba(255, 59, 48, 0.9);
    border-color: rgba(255, 59, 48, 1);
    transform: scale(0.95);
}

.clear-btn::after {
    content: "🗑 Clear";
}

#pause:checked + .pause-btn {
    background: rgba(255, 204, 0, 0.9);
    border-color: rgba(255, 204, 0, 1);
    transform: scale(0.95);
}

.pause-btn::after {
    content: "⏸ Pause";
}

#pause:checked + .pause-btn::after {
    content: "▶ Resume";
}

#gravity:checked + .gravity-btn {
    background: rgba(76, 175, 80, 0.9);
    border-color: rgba(76, 175, 80, 1);
}

.gravity-btn::after {
    content: "🌍 Gravity: ON";
}

#gravity:not(:checked) + .gravity-btn::after {
    content: "🌍 Gravity: OFF";
}

.space {
    position: relative;
    width: 90vw;
    height: 75vh;
    max-width: 1000px;
    max-height: 650px;
    background: radial-gradient(circle at center, rgba(20, 20, 80, 0.4), rgba(5, 5, 30, 0.9));
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    cursor: crosshair;
    position: relative;
}

.space::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 60% 10%, rgba(255,255,255,0.2), transparent);
    background-size: 200px 200px, 100px 100px, 150px 150px, 120px 120px;
    animation: stars-move 20s linear infinite;
    pointer-events: none;
}

@keyframes stars-move {
    0% { 
        transform: translateX(0) translateY(0); 
    }
    100% { 
        transform: translateX(-100px) translateY(-100px); 
    }
}

.planet {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 25px currentColor, inset -3px -3px 8px rgba(0, 0, 0, 0.3);
    animation: orbit 8s linear infinite;
    z-index: 3;
    cursor: pointer;
    transition: all 0.3s ease;
}

.planet:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 35px currentColor, inset -3px -3px 8px rgba(0, 0, 0, 0.3);
}

.planet-small {
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 35% 25%, #4ecdc4, #26a0a7, #1a5d5d);
    color: #4ecdc4;
    animation-duration: 3s;
}

.planet-medium {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 35% 25%, #ff6b6b, #e74c3c, #8b2635);
    color: #ff6b6b;
    animation-duration: 5s;
}

.planet-large {
    width: 26px;
    height: 26px;
    background: radial-gradient(circle at 35% 25%, #feca57, #f39c12, #b8860b);
    color: #feca57;
    animation-duration: 7s;
}

.sun {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 35% 25%, #fff, #ffeb3b, #ff9800);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 40px #ffeb3b, 0 0 80px rgba(255, 235, 59, 0.6), 0 0 120px rgba(255, 152, 0, 0.3);
    animation: sun-pulse 4s ease-in-out infinite;
    z-index: 4;
    cursor: pointer;
}

.sun:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 50px #ffeb3b, 0 0 100px rgba(255, 235, 59, 0.8), 0 0 150px rgba(255, 152, 0, 0.5);
}

.orbit-path {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    animation: orbit-glow 8s ease-in-out infinite alternate;
}

@keyframes orbit-glow {
    0% { 
        border-color: rgba(255, 255, 255, 0.05); 
    }
    100% { 
        border-color: rgba(255, 255, 255, 0.15); 
    }
}

.orbit-1 { width: 130px; height: 130px; }
.orbit-2 { width: 220px; height: 220px; }
.orbit-3 { width: 310px; height: 310px; }
.orbit-4 { width: 400px; height: 400px; }
.orbit-5 { width: 490px; height: 490px; }

.trail {
    position: absolute;
    width: 3px;
    height: 3px;
    background: radial-gradient(circle, currentColor, transparent);
    border-radius: 50%;
    opacity: 0.8;
    animation: trail-fade 3s ease-out forwards;
    pointer-events: none;
    z-index: 2;
}

#clear:checked ~ .space .planet,
#clear:checked ~ .space .trail {
    display: none;
}

.comet {
    background: radial-gradient(circle at 35% 25%, #fff, #48cae4, #0077be) !important;
    color: #48cae4 !important;
    animation-duration: 2.5s !important;
    animation-timing-function: ease-in-out !important;
}

.comet::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor 30%, transparent);
    border-radius: 2px;
    transform: translateY(-50%);
    opacity: 0.8;
}

.asteroid {
    background: radial-gradient(circle at 35% 25%, #95a5a6, #34495e, #2c3e50) !important;
    color: #95a5a6 !important;
    animation-duration: 4.5s !important;
    width: 10px !important;
    height: 10px !important;
}

.moon {
    background: radial-gradient(circle at 35% 25%, #ddd, #bbb, #999) !important;
    color: #ddd !important;
    width: 6px !important;
    height: 6px !important;
    animation-duration: 1s !important;
}

.instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    padding: 15px 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 90%;
}

.physics-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    line-height: 1.5;
}

.stats {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 11px;
    line-height: 1.4;
}

@keyframes orbit {
    0% { 
        transform: translate(-50%, -50%) rotate(0deg) translateX(var(--radius)) rotate(0deg); 
    }
    100% { 
        transform: translate(-50%, -50%) rotate(360deg) translateX(var(--radius)) rotate(-360deg); 
    }
}

@keyframes sun-pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.15); 
    }
}

@keyframes trail-fade {
    0% { 
        opacity: 0.9; 
        transform: scale(1.2); 
    }
    100% { 
        opacity: 0; 
        transform: scale(0.2); 
    }
}

@keyframes gravitational-wave {
    0% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 0.5; 
    }
    100% { 
        transform: translate(-50%, -50%) scale(3); 
        opacity: 0; 
    }
}

.gravity-wave {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: gravitational-wave 2s ease-out;
    pointer-events: none;
    z-index: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .space { 
        width: 95vw; 
        height: 65vh; 
    }
    .title { 
        font-size: 28px; 
    }
    .controls { 
        right: 15px; 
        top: 15px; 
        gap: 8px; 
    }
    .btn { 
        padding: 10px 14px; 
        font-size: 11px; 
        min-width: 85px; 
    }
    .sun { 
        width: 40px; 
        height: 40px; 
    }
    .orbit-1 { width: 110px; height: 110px; }
    .orbit-2 { width: 180px; height: 180px; }
    .orbit-3 { width: 250px; height: 250px; }
    .orbit-4 { width: 320px; height: 320px; }
    .orbit-5 { width: 390px; height: 390px; }
    .header { 
        padding: 12px 20px; 
    }
    .physics-info, .stats { 
        font-size: 10px; 
        padding: 10px 12px; 
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    body {
        background: radial-gradient(circle at 20% 50%, #1a1a3e, #2d1b69, #000);
    }
}