/* General Body & Root Styles */
:root {
    --text-color-light: #F0F0F0;
    --text-color-dark: #222;
    --background-dark: #121212;
    --primary-accent: #E0E0E0;
    --transition-speed: 0.3s ease;
}

::-webkit-scrollbar { display: none; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-color-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Back Button */
header {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition-speed);
}

header.hidden-back-button {
    transform: translateY(-100%);
}

.home-button {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color-light);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
    font-family: 'Share Tech Mono', monospace; /* Techy font for button */
}

.home-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Main Home Screen */
#home-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #0A0A0A, #2C2C2C);
    opacity: 1;
    transition: opacity var(--transition-speed);
    box-sizing: border-box;
}

#home-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.main-title {
    font-family: 'Wallpoet', cursive;
    font-size: clamp(2.5em, 8vw, 6em);
    color: #F0F0F0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.tagline {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: clamp(1em, 3vw, 1.5em);
    color: #BBBBBB;
    margin-top: 0;
    margin-bottom: 50px;
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1200px;
    width: 100%;
}

.episode-card {
    background-color: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 25px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.episode-card:hover {
    transform: translateY(-10px);
    background-color: rgba(40, 40, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.episode-card .episode-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9em;
    color: #90CAF9;
    margin-bottom: 10px;
    display: block;
}

.episode-card h2 {
    font-family: 'Bebas Neue', cursive;
    font-size: 1.8em;
    color: var(--primary-accent);
    margin-top: 5px;
    margin-bottom: 10px;
}

.episode-card p {
    font-family: 'Roboto', sans-serif;
    font-size: 0.95em;
    color: #BBBBBB;
    line-height: 1.5;
}


/* Section General Styles */
.content-section {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
    overflow-y: auto;
}
.content-section.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

.section-inner-wrapper {
    padding: 100px 20px 40px 20px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
}

.section-title {
    font-family: 'Wallpoet', cursive;
    font-size: clamp(2em, 5vw, 4em);
    color: var(--primary-accent);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    margin-bottom: 30px;
    line-height: 1.2;
}

.section-title small {
    display: block;
    font-size: 0.5em;
    font-family: 'Roboto Condensed', sans-serif;
    color: #BBBBBB;
    margin-top: 5px;
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 600px;
}

.input-group label {
    display: block;
    font-size: 1.1em;
    margin-bottom: 5px;
    font-family: 'Roboto Mono', monospace;
}

.input-group input[type="date"],
.input-group button {
    padding: 12px 20px;
    border-radius: 5px;
    font-size: 1em;
    border: none;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
    transition: all 0.3s ease;
}

.input-group input[type="date"] {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color-light);
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-grow: 1;
    min-width: 200px;
}

.input-group input[type="date"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(144, 202, 249, 0.5);
}

.input-group button {
    background-color: #90CAF9;
    color: var(--background-dark);
    font-weight: bold;
    flex-shrink: 0;
}

.input-group button:hover {
    background-color: #64B5F6;
    transform: translateY(-2px);
}

.results-container {
    width: 100%;
    max-width: 900px;
    background-color: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-color-light);
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin-bottom: 20px;
}

.results-container h3 {
    margin-top: 0;
    color: var(--primary-accent);
    font-family: 'Bebas Neue', cursive;
    font-size: 1.5em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.results-container p {
    margin-bottom: 10px;
    font-size: 1em;
}

.results-container img, .results-container video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}
/* APOD video container for responsive sizing */
.apod-video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    margin-top: 20px;
    border-radius: 8px;
}
.apod-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


.results-container .error-message {
    color: #FF5252;
    font-weight: bold;
    font-size: 1.1em;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    color: white;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.5em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-top: 8px solid #90CAF9;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Individual Section Styles - Love, Death + Robots inspired */

/* MARS ROVER EXPLORER (EPISODE 01) */
#mars-rover {
    filter: sepia(0.3) brightness(0.9);
}

#mars-rover .section-title { color: #FF8F00; text-shadow: 0 0 8px rgba(255, 143, 0, 0.7); }
#mars-rover .input-group label { color: #E0E0E0; }
#mars-rover input[type="date"] {
    background-color: rgba(120, 40, 0, 0.3);
    color: #FFE0B2;
    border: 1px solid #FF8F00;
}
#mars-rover input[type="date"]:focus {
    box-shadow: 0 0 0 3px rgba(255, 143, 0, 0.5);
}
#mars-rover button {
    background-color: #FF8F00;
    color: #3E2723;
}
#mars-rover button:hover { background-color: #E65100; }
#mars-rover .results-container {
    background-color: rgba(62, 39, 35, 0.8);
    border: 2px solid #FF8F00;
    box-shadow: 0 0 20px rgba(255, 143, 0, 0.4);
    color: #FFE0B2;
}
#mars-rover .results-container h3 { color: #FF8F00; border-bottom-color: rgba(255, 143, 0, 0.3); }

/* Specific for Mars Gallery */
#mars-rover .mars-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

#mars-rover .mars-photo-item {
    background-color: rgba(30, 10, 0, 0.6);
    border: 1px solid rgba(255, 143, 0, 0.4);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#mars-rover .mars-photo-item img {
    max-width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 143, 0, 0.2);
}

#mars-rover .mars-photo-item p {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
    color: #FFC107;
    margin: 5px 0;
}


/* APOD PORTAL (EPISODE 02) */
#apod {
    background: radial-gradient(circle at top left, #0A0A0A 0%, #151515 50%, #0A0A0A 100%);
    background-blend-mode: multiply;
    animation: panBackground 60s linear infinite alternate;
}

@keyframes panBackground {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

#apod .section-title { font-family: 'Cinzel Decorative', cursive; color: #BBDEFB; text-shadow: 0 0 15px rgba(179, 229, 252, 0.7); }
#apod .section-title small { font-family: 'Cormorant Garamond', serif; }
#apod .input-group label { color: #E3F2FD; }
#apod input[type="date"] {
    background-color: rgba(0, 0, 20, 0.5);
    color: #BBDEFB;
    border: 1px solid #1976D2;
}
#apod input[type="date"]:focus {
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.5);
}
#apod button {
    background-color: #2196F3;
    color: #E3F2FD;
    border: 1px solid #1976D2;
}
#apod button:hover { background-color: #1976D2; }
#apod .results-container {
    background-color: rgba(0, 0, 10, 0.7);
    border: 2px solid #2196F3;
    box-shadow: 0 0 30px rgba(33, 150, 243, 0.6);
    color: #E3F2FD;
    font-family: 'Spectral', serif;
}
#apod .results-container h3 { font-family: 'Cinzel Decorative', cursive; color: #BBDEFB; border-bottom-color: rgba(33, 150, 243, 0.3); }

/* ASTEROID RADAR (EPISODE 03) */
#asteroids {
    background-color: #000;
    background-image: none;
}

#asteroids .section-title {
    font-family: 'Share Tech Mono', monospace;
    color: #00FF00;
    text-shadow: 0 0 5px #00FF00, 0 0 10px #00FF00;
    font-size: clamp(1.8em, 4vw, 3.5em);
    text-align: left;
    width: 100%;
    max-width: 900px;
    margin-bottom: 20px;
    padding-left: 20px; 
    box-sizing: border-box;
}
#asteroids .section-title small { display: none; }

#asteroids .input-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    max-width: 900px;
    padding-left: 20px;
    box-sizing: border-box;
}

#asteroids .input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#asteroids .input-group label {
    font-family: 'Share Tech Mono', monospace;
    color: #00FF00;
    font-size: 1.1em;
    margin-bottom: 0;
    white-space: nowrap;
}

#asteroids .input-group input[type="date"] {
    background-color: #000;
    color: #00FF00;
    border: 1px solid #00FF00;
    flex-grow: 0;
    width: auto;
    padding: 8px 12px;
    font-size: 1em;
    min-width: 150px;
}
#asteroids .input-group input[type="date"]:focus {
    box-shadow: 0 0 0 2px #00FF00;
    outline: none;
}

#asteroids .input-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) hue-rotate(90deg) brightness(2);
    cursor: pointer;
}


#asteroids button {
    background-color: #00FF00;
    color: #000;
    font-weight: bold;
    font-family: 'Share Tech Mono', monospace;
    padding: 10px 20px;
    border: 1px solid #00FF00;
    align-self: flex-start;
    margin-left: 20px;
}
#asteroids button:hover {
    background-color: #00CC00;
    box-shadow: 0 0 10px #00FF00;
    transform: none;
}

#asteroids .system-message {
    font-family: 'Share Tech Mono', monospace;
    color: #00FF00;
    font-size: 1.1em;
    text-align: left;
    width: 100%;
    margin-bottom: 10px;
    padding-left: 20px;
    box-sizing: border-box;
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.5);
}

#asteroids .results-container.terminal-output {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 100%;
    max-width: 900px;
    margin-top: 30px;
    text-align: left;
    display: block;
}

#asteroids .terminal-output p {
    font-family: 'Share Tech Mono', monospace;
    color: #00FF00;
    font-size: 1.1em;
    margin: 5px 0;
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.5);
    padding-left: 20px;
    box-sizing: border-box;
    line-height: 1.2;
}

#asteroids .terminal-output a {
    color: #00FFFF;
    text-decoration: none;
    text-shadow: 0 0 5px #00FFFF;
}
#asteroids .terminal-output a:hover {
    text-decoration: underline;
}


/* SPACE WEATHER WATCH (EPISODE 04) */
#space-weather {
    position: relative;
}
#space-weather::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 255, 0.1));
    animation: neonGlow 10s ease-in-out infinite alternate;
    z-index: 1;
}
#space-weather .section-inner-wrapper > * { z-index: 2; position: relative; }

#space-weather .section-title {
    font-family: 'Orbitron', sans-serif; color: #00FFFF; text-shadow: 0 0 15px rgba(0, 255, 255, 0.8), 0 0 20px rgba(255, 0, 255, 0.8);
}
#space-weather .input-group label { color: #E0F7FA; }
#space-weather input[type="date"] {
    background-color: rgba(0, 50, 50, 0.4);
    color: #E0F7FA;
    border: 1px solid #00FFFF;
}
#space-weather input[type="date"]:focus {
    box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.6);
}
#space-weather button {
    background-color: #00E5FF;
    color: #002233;
    font-weight: bold;
}
#space-weather button:hover { background-color: #00B8D4; }

#space-weather .results-container {
    background-color: rgba(0, 0, 10, 0.85);
    border: 2px solid #00FFFF;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.7), 0 0 30px rgba(255, 0, 255, 0.7);
    color: #E0F7FA;
    font-family: 'Electrolize', sans-serif;
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: left;
}

#space-weather .results-container h3 {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    color: #00FFFF;
    border-bottom-color: rgba(0, 255, 255, 0.3);
}

#space-weather .donki-category {
    background-color: rgba(0, 20, 20, 0.7);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

#space-weather .donki-category h4 {
    font-family: 'Electrolize', sans-serif;
    color: #00FFFF;
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 15px;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

#space-weather .donki-category .category-icon {
    font-size: 1.2em;
    color: #FF00FF;
    text-shadow: 0 0 5px #FF00FF;
}

#space-weather .event-list {
    display: grid;
    gap: 20px;
}

#space-weather .donki-event-card {
    background-color: rgba(0, 10, 10, 0.6);
    border-radius: 6px;
    padding: 15px;
    border: 1px dashed rgba(0, 255, 255, 0.1);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#space-weather .donki-event-card:hover {
    background-color: rgba(0, 15, 15, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

#space-weather .donki-event-card p {
    margin: 5px 0;
    font-size: 0.95em;
    line-height: 1.4;
}

#space-weather .donki-event-card strong {
    color: #BBDEFB;
}

#space-weather .highlight-class,
#space-weather .highlight-speed {
    font-weight: bold;
    color: #FF00FF;
    text-shadow: 0 0 5px #FF00FF;
}

#space-weather .event-note {
    font-style: italic;
    color: #90CAF9;
    font-size: 0.85em;
}

#space-weather .no-events-message {
    text-align: center;
    font-style: italic;
    color: rgba(224, 247, 250, 0.7);
    margin-top: 15px;
    padding: 10px;
    border: 1px dashed rgba(224, 247, 250, 0.1);
    border-radius: 5px;
}

#space-weather .donki-event-card a {
    color: #FFEB3B;
    text-decoration: none;
    font-family: 'Share Tech Mono', monospace;
}
#space-weather .donki-event-card a:hover {
    text-decoration: underline;
}


/* EARTH'S DAILY PORTRAIT (EPISODE 05) */
#epic {
    background: linear-gradient(180deg, #0A0A0A 0%, #1A1A1A 100%);
    background-size: cover, cover;
    background-blend-mode: overlay;
}

#epic .section-title { font-family: 'Electrolize', sans-serif; color: #76FF03; text-shadow: 0 0 10px rgba(118, 255, 3, 0.7); }
#epic .section-title small { font-family: 'Share Tech Mono', monospace; }
#epic .input-group label { color: #E8F5E9; }
#epic input[type="date"] {
    background-color: rgba(10, 30, 0, 0.5);
    color: #C8E6C9;
    border: 1px solid #76FF03;
}
#epic input[type="date"]:focus {
    box-shadow: 0 0 0 3px rgba(118, 255, 3, 0.6);
}
#epic button {
    background-color: #76FF03;
    color: #001100;
    font-weight: bold;
}
#epic button:hover { background-color: #558B2F; }
#epic .results-container {
    background-color: rgba(5, 15, 0, 0.9);
    border: 2px solid #76FF03;
    box-shadow: 0 0 25px rgba(118, 255, 3, 0.7);
    color: #C8E6C9;
    font-family: 'Roboto Mono', monospace;
}
#epic .results-container h3 { color: #76FF03; border-bottom-color: rgba(118, 255, 3, 0.3); }

@media (max-width: 768px) {
    .main-title { font-size: 3.5em; }
    .tagline { font-size: 1.2em; }
    .episode-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    .episode-card { padding: 20px; }
    .episode-card h2 { font-size: 1.5em; }

    .section-inner-wrapper { padding-top: 80px; }
    .section-title { font-size: 2.5em; margin-bottom: 20px; }
    .input-group { flex-direction: column; align-items: stretch; }
    .input-group input[type="date"],
    .input-group button { width: 100%; box-sizing: border-box; }
    .results-container { padding: 20px; }

    #asteroids .section-title { font-size: 2em; padding-left: 10px; }
    #asteroids .system-message { padding-left: 10px; }
    #asteroids .input-group { padding-left: 10px; }
    #asteroids button { margin-left: 10px; }
    #asteroids .terminal-output p { padding-left: 10px; }

    #space-weather .results-container { padding: 20px; gap: 20px; }
    #space-weather .donki-category { padding: 15px; }
    #space-weather .donki-category h4 { font-size: 1.2em; }
    #space-weather .donki-event-card { padding: 12px; }
}

@media (max-width: 480px) {
    .main-title { font-size: 2.8em; }
    .tagline { font-size: 1em; }
    .episode-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .home-button { font-size: 0.9em; padding: 8px 15px; }

    .section-inner-wrapper { padding-top: 60px; }
    .section-title { font-size: 2em; }

    #asteroids .section-title { font-size: 1.8em; padding-left: 5px; }
    #asteroids .system-message { padding-left: 5px; }
    #asteroids .input-group { padding-left: 5px; }
    #asteroids button { margin-left: 5px; }
    #asteroids .terminal-output p { padding-left: 5px; }
    #asteroids .input-group input[type="date"] { min-width: 120px; }

    #space-weather .results-container { padding: 15px; gap: 15px; }
    #space-weather .donki-category { padding: 10px; }
    #space-weather .donki-category h4 { font-size: 1.1em; }
    #space-weather .donki-event-card { padding: 10px; }
    #space-weather .donki-event-card p { font-size: 0.85em; }
}