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

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
    font-family: 'Saira', -apple-system, BlinkMacSystemFont, sans-serif;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
}

#webcam {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    opacity: 0.42;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
    z-index: 2;
}

#three-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-out;
    z-index: 8;
}

/* ── Telemetry-style status — top left ── */
#status {
    position: absolute;
    top: 18px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    z-index: 10;
}
#status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ff5e2e;
    box-shadow: 0 0 8px rgba(255, 94, 46, 0.6);
    animation: pulse-dot 1.8s ease-in-out infinite;
    flex: none;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* ── Planet info — minimal glass card, top right ── */
#planet-info {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 250px;
    padding: 16px 18px;
    background: rgba(4, 6, 10, 0.68);
    color: #fff;
    border-radius: 12px;
    z-index: 10;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#planet-info.hidden {
    transform: translateX(300px);
    opacity: 0;
}

#planet-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

#planet-facts {
    font-size: 11.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
}

#planet-facts p {
    margin-bottom: 7px;
    padding-left: 9px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

#planet-facts .fact-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* ── Instructions — single quiet line, bottom center ── */
#instructions {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    z-index: 10;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    animation: instructions-dim 1s ease 10s forwards;
}
@keyframes instructions-dim {
    to { opacity: 0.25; }
}

#instructions p { margin: 0; }

#instructions .touch-only { display: none; }
@media (hover: none) and (pointer: coarse) {
    #instructions .desktop-only { display: none; }
    #instructions .touch-only { display: block; }
}

#instructions strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* ── Zoom readout — bottom left ── */
#zoom-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    z-index: 10;
}
#zoom-indicator::before {
    content: 'Zoom ';
    color: rgba(255, 255, 255, 0.35);
}

.hidden {
    display: none !important;
}

/* Cursor pointer for selected planet */
.planet-cursor {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    pointer-events: none;
    z-index: 15;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}

/* Highlight ring animation */
@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.highlight-ring {
    animation: pulse-ring 1s ease-out infinite;
}

/* Loading spinner — thin, quiet */
.loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 4px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    flex: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    /* Planet info becomes a bottom sheet — the side card doesn't fit */
    #planet-info {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 52px;
        width: auto;
        max-height: 36vh;
        overflow-y: auto;
        padding: 12px 14px;
    }

    #planet-info.hidden {
        transform: translateY(140%);
        opacity: 0;
    }

    #planet-name {
        font-size: 12px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    /* Two-column facts to save vertical space */
    #planet-facts {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
        font-size: 10.5px;
        line-height: 1.45;
    }

    #planet-facts p {
        margin-bottom: 0;
    }

    /* The long fun-fact line spans both columns */
    #planet-facts p:last-child {
        grid-column: 1 / -1;
    }

    #instructions {
        bottom: 12px;
        font-size: 8px;
        letter-spacing: 0.18em;
        white-space: normal;
        max-width: 92vw;
    }

    /* Zoom readout moves top-right so the bottom stays clear for the sheet */
    #zoom-indicator {
        top: 18px;
        right: 16px;
        bottom: auto;
        left: auto;
    }

    #status {
        max-width: 55vw;
        font-size: 9px;
    }
}
