:root {
    --bg-color: #050510;
    --text-primary: #e0f2fe;
    --text-secondary: #94a3b8;
    --accent-blue: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.5);
    --panel-bg: rgba(15, 23, 42, 0.85);
    --panel-border: rgba(56, 189, 248, 0.3);
    --font-main: 'Rajdhani', sans-serif;
    --font-heading: 'Orbitron', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Prevent text selection for touch */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden; /* App-like feel */
    width: 100vw;
    height: 100vh;
}

/* Background Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: radial-gradient(circle at center, #0b0f19 0%, #020205 100%);
}

/* Solar System Container */
#solar-system-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    z-index: -1;
    transition: transform 0.5s ease-out;
    pointer-events: none; /* Let container pass clicks, children will catch */
    opacity: 0;
    visibility: hidden;
}

#solar-system-container.active {
    opacity: 1;
    visibility: visible;
}

#sun {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    margin-left: -40px;
    margin-top: -40px;
    background: radial-gradient(circle, #fff 10%, #fde047 40%, #ea580c 80%);
    border-radius: 50%;
    box-shadow: 0 0 40px 20px rgba(250, 204, 21, 0.4), 0 0 100px 40px rgba(234, 88, 12, 0.2);
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    animation: pulse 4s infinite alternate;
}

@keyframes pulse {
    0% { box-shadow: 0 0 40px 20px rgba(250, 204, 21, 0.4), 0 0 100px 40px rgba(234, 88, 12, 0.2); }
    100% { box-shadow: 0 0 50px 25px rgba(250, 204, 21, 0.6), 0 0 120px 50px rgba(234, 88, 12, 0.3); }
}

#orbits-container, #planets-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
}

.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.planet-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.planet {
    position: absolute;
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.5), 0 0 10px rgba(255,255,255,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.planet:hover, .planet.active {
    transform: scale(1.5);
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.5), 0 0 20px var(--accent-blue);
    z-index: 20;
}

.planet-label {
    position: absolute;
    top: -25px;
    color: white;
    font-size: 14px;
    white-space: nowrap;
    text-shadow: 0 0 4px black;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.planet-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(75deg);
    border: 4px solid rgba(234, 214, 184, 0.6);
    border-radius: 50%;
    pointer-events: none;
}

/* UI Overlay */
#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none; /* Let clicks pass through UI to canvas/planets unless on a UI element */
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.view.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Home View */
#home-view {
    justify-content: space-between;
    align-items: center;
    padding: 5vh 0;
}

/* We still want solar system interactive on home view, so home-view should pass pointer events where transparent */
#home-view { pointer-events: none; }
#home-view > * { pointer-events: auto; }

.header-container {
    text-align: center;
    margin-top: 5%;
    text-shadow: 0 0 20px var(--accent-glow);
}

.main-title {
    font-family: var(--font-heading);
    font-size: 6rem;
    font-weight: 900;
    background: linear-gradient(to right, #38bdf8, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 5px;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: 2px;
    margin-top: 10px;
}

.main-menu {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 5%;
    padding: 0 20px;
}

/* Buttons */
.btn {
    font-family: var(--font-heading);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--accent-blue);
    color: var(--text-primary);
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: auto;
}

.btn:hover, .btn:active {
    background: rgba(14, 165, 233, 0.3);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(45deg, rgba(14,165,233,0.2), rgba(129,140,248,0.2));
    border-width: 2px;
    font-weight: bold;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.5rem;
}

.btn-secondary {
    background: transparent;
    border-color: rgba(255,255,255,0.3);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    pointer-events: auto;
}

.top-bar h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    letter-spacing: 2px;
}

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

/* Floating buttons */
.btn-teacher { position: absolute; bottom: 20px; right: 20px; }
.btn-audio { position: absolute; bottom: 20px; left: 20px; }
.btn-fullscreen { position: absolute; bottom: 20px; left: 140px; }

/* Panels */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    pointer-events: auto;
    color: var(--text-primary);
}

.panel.hidden {
    display: none;
}

.btn-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Info Panel */
#info-panel {
    position: absolute;
    right: 20px;
    top: 100px;
    width: 400px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px;
}

.planet-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.planet-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.5);
}

#info-name {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--accent-blue);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 5px;
}

.info-item span:first-child {
    color: var(--text-secondary);
}

.info-section {
    margin-bottom: 20px;
}

.info-section h4 {
    color: var(--accent-blue);
    margin-bottom: 10px;
    font-family: var(--font-heading);
}

.info-section ul {
    list-style-position: inside;
    color: #cbd5e1;
}

.info-section.highlight {
    background: rgba(14, 165, 233, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-blue);
}

/* Compare Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: auto;
}

.modal.hidden { display: none; }

.modal-content.large {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 15px;
    width: 80%;
    max-width: 900px;
    padding: 30px;
    position: relative;
    backdrop-filter: blur(10px);
}

.compare-selectors {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.compare-selectors select {
    padding: 10px;
    font-size: 1.2rem;
    background: rgba(0,0,0,0.5);
    color: white;
    border: 1px solid var(--accent-blue);
    border-radius: 5px;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.compare-card {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 10px;
}

/* Eclipse View */
#eclipse-simulation-container {
    flex-grow: 1;
    position: relative;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#eclipse-canvas {
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 90%;
    max-height: 60vh;
}

#eclipse-controls {
    margin-top: 20px;
    width: 90%;
    max-width: 700px;
    text-align: center;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    text-align: left;
}

.slider-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.1rem;
}

.slider-group input[type="range"] {
    width: 70%;
    accent-color: var(--accent-blue);
}

#eclipse-info-panel {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 20px;
    width: 300px;
}

/* Mission & Quiz Views */
.quiz-container, #mission-ui {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.quiz-section, .mission-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 800px;
    width: 90%;
}

.quiz-section.hidden { display: none; }

.question-text, #mission-title {
    font-size: 2rem;
    margin-bottom: 30px;
    font-family: var(--font-heading);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.btn-option {
    padding: 20px;
    font-size: 1.2rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: 0.3s;
}

.btn-option:hover { background: rgba(14, 165, 233, 0.3); }
.btn-option.correct { background: rgba(34, 197, 94, 0.5); border-color: #22c55e; }
.btn-option.wrong { background: rgba(239, 68, 68, 0.5); border-color: #ef4444; }

.feedback-container, .feedback-text {
    background: rgba(0,0,0,0.5);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

#mission-text {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

/* Teacher Panel */
#teacher-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    padding: 30px;
    z-index: 300;
}

.teacher-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.teacher-options label {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1366px) {
    .main-title { font-size: 4rem; }
    #info-panel { width: 350px; }
    .options-grid { grid-template-columns: 1fr; }
}
