/* ── Reset & Base ────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #04040e;
    --bg2: #0a0a1a;
    --bg3: #10102a;
    --border: rgba(255, 255, 255, 0.07);
    --gold: #d4a843;
    --gold-soft: rgba(212, 168, 67, 0.13);
    --text: #e0dff5;
    --text-dim: #6a6990;
    --radius: 16px;
    --glow-gold: 0 0 40px rgba(212, 168, 67, 0.10);
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Stars */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1px 1px at 8% 12%, rgba(255, 255, 255, 0.55) 0%, transparent 100%),
        radial-gradient(1px 1px at 22% 48%, rgba(255, 255, 255, 0.40) 0%, transparent 100%),
        radial-gradient(1px 1px at 48% 8%, rgba(255, 255, 255, 0.50) 0%, transparent 100%),
        radial-gradient(1px 1px at 68% 28%, rgba(255, 255, 255, 0.35) 0%, transparent 100%),
        radial-gradient(1px 1px at 82% 72%, rgba(255, 255, 255, 0.50) 0%, transparent 100%),
        radial-gradient(1px 1px at 33% 82%, rgba(255, 255, 255, 0.40) 0%, transparent 100%),
        radial-gradient(1px 1px at 58% 58%, rgba(255, 255, 255, 0.30) 0%, transparent 100%),
        radial-gradient(1px 1px at 88% 18%, rgba(255, 255, 255, 0.45) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 4% 92%, rgba(255, 255, 255, 0.50) 0%, transparent 100%),
        radial-gradient(1px 1px at 75% 88%, rgba(255, 255, 255, 0.38) 0%, transparent 100%),
        radial-gradient(1px 1px at 14% 62%, rgba(255, 255, 255, 0.33) 0%, transparent 100%),
        radial-gradient(1px 1px at 95% 50%, rgba(255, 255, 255, 0.43) 0%, transparent 100%);
}

.app {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px 48px;
}

/* ── Header ─────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 38px;
    animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(212, 168, 67, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(212, 168, 67, 0.85));
    }
}

h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #e8d88a, #c49a30);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 3px;
}

/* ── Header right group ──────────────────────────────── */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Mode toggle ─────────────────────────────────────── */
.mode-toggle {
    display: flex;
    gap: 8px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}

.mode-btn.active {
    background: var(--gold-soft);
    border-color: rgba(212, 168, 67, 0.45);
    color: var(--gold);
    font-weight: 600;
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

/* ── Fullscreen button ───────────────────────────────── */
.btn-fullscreen {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 10px;
    padding: 10px 13px;
    font-size: 17px;
    cursor: pointer;
    transition: all .2s;
    line-height: 1;
    flex-shrink: 0;
}

.btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.11);
    color: var(--gold);
    border-color: rgba(212, 168, 67, 0.35);
}

/* Fullscreen adjustments */
:fullscreen .app,
:-webkit-full-screen .app {
    max-width: 100%;
    padding: 0 28px 32px;
}

:fullscreen body,
:-webkit-full-screen body {
    overflow: auto;
}

/* ── Layout ──────────────────────────────────────────── */
.eclipse-section {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 24px;
}

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

.left-col,
.right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 900px) {
    .eclipse-section {
        grid-template-columns: 1fr;
    }
}

/* ── View card (main canvas area) ───────────────────── */
.view-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000008;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-card canvas {
    display: block;
    width: 100%;
}

.view-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lunar-moon-card {
    background: radial-gradient(ellipse at center, #0c0010 0%, #000 80%);
}

/* ── Info grid ───────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: border-color .2s;
}

.info-card:hover {
    border-color: rgba(212, 168, 67, 0.28);
}

.info-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 5px;
}

.info-val {
    font-size: 17px;
    font-weight: 600;
    color: var(--gold);
}

/* ── Slider section ─────────────────────────────────── */
.slider-section {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 2px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(212, 168, 67, 0.7);
    transition: transform .15s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 7px;
}

/* ── Controls ────────────────────────────────────────── */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.btn-primary {
    background: linear-gradient(135deg, #c49a30, #8a6a18);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(196, 154, 48, 0.3);
    min-width: 48px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(196, 154, 48, 0.45);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 17px;
    cursor: pointer;
    transition: all .2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
}

.speed-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-label {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}

.speed-slider {
    width: 80px;
}

#solarSpeedVal,
#lunarSpeedVal {
    font-size: 12px;
    color: var(--gold);
    min-width: 24px;
}

/* Subtype buttons */
.subtype-wrap {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.subtype-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all .18s;
}

.subtype-btn.active {
    background: var(--gold-soft);
    border-color: rgba(212, 168, 67, 0.45);
    color: var(--gold);
}

.subtype-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

/* ── Right column cards ──────────────────────────────── */
.card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 14px;
}

/* Upcoming list */
.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upcoming-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .18s;
    background: rgba(255, 255, 255, 0.03);
}

.upcoming-item:hover {
    background: var(--gold-soft);
    border-color: rgba(212, 168, 67, 0.3);
}

.upcoming-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.upcoming-info {
    flex: 1;
}

.upcoming-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.upcoming-desc {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 1px;
}

.upcoming-tag {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid;
}

/* Timeline canvas */
.timeline-card canvas {
    display: block;
    width: 100%;
    border-radius: 8px;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Fact card */
.fact-text {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
}

.fact-text strong {
    color: var(--gold);
}