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

:root {
    --green-primary: #1a5c2a;
    --green-terminal: #00ff41;
    --green-dim: #00cc33;
    --copper: #b87333;
    --gold: #ffd700;
    --amber: #ffbf00;
    --dark-bg: #0a0a0a;
    --panel-bg: rgba(10, 30, 10, 0.88);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    overflow: hidden;
    background: var(--dark-bg);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    color: var(--green-terminal);
    cursor: crosshair;
    -webkit-user-select: none;
    user-select: none;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--dark-bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    width: 360px;
    max-width: 85vw;
    padding: 20px;
}

.loading-title {
    font-size: 13px;
    color: var(--green-terminal);
    margin-bottom: 20px;
    letter-spacing: 3px;
    animation: flicker 2s infinite;
}

.loading-bar-container {
    width: 100%;
    height: 6px;
    background: #1a2e1a;
    border: 1px solid rgba(0,255,65,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--green-terminal), var(--green-dim));
    box-shadow: 0 0 10px rgba(0,255,65,0.4);
    transition: width 0.3s ease;
}

.loading-status {
    font-size: 11px;
    color: rgba(0,255,65,0.5);
    margin-top: 12px;
    letter-spacing: 1px;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    92% { opacity: 1; }
    93% { opacity: 0.3; }
    94% { opacity: 1; }
}

/* Scene Container */
#scene-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

#scene-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Vignette */
#vignette {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
}

/* Scanlines */
#scanlines {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.015) 2px,
        rgba(0, 255, 65, 0.015) 4px
    );
    animation: scanline-scroll 8s linear infinite;
}

@keyframes scanline-scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

/* HUD */
#hud {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
    overflow: hidden;
}

#hud > * {
    pointer-events: auto;
}

/* Title Bar */
#title-bar {
    position: absolute;
    top: 16px;
    left: 16px;
    pointer-events: none;
    z-index: 20;
}

.title-main {
    font-size: 24px;
    font-weight: 700;
    color: var(--green-terminal);
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(0,255,65,0.25), 0 0 40px rgba(0,255,65,0.1);
    white-space: nowrap;
}

.title-sub {
    font-size: 10px;
    color: rgba(0,204,51,0.5);
    letter-spacing: 2px;
    margin-top: 2px;
}

.signal-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.signal-dot {
    width: 7px;
    height: 7px;
    background: var(--green-terminal);
    border-radius: 50%;
    animation: blink-dot 1.5s infinite;
    box-shadow: 0 0 6px var(--green-terminal);
    flex-shrink: 0;
}

@keyframes blink-dot {
    0%, 70% { opacity: 1; }
    71%, 100% { opacity: 0.2; }
}

.signal-text {
    font-size: 9px;
    color: rgba(0,255,65,0.5);
    letter-spacing: 2px;
}

/* Satellite Indicators */
#satellite-indicators {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 12px;
    z-index: 20;
}

.sat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    position: relative;
}

.sat-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(10, 30, 10, 0.95);
    border: 1px solid rgba(0,255,65,0.2);
    color: var(--green-terminal);
    font-size: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    width: 220px;
    z-index: 100;
    backdrop-filter: blur(10px);
    line-height: 1.4;
}

.sat-item:hover .sat-tooltip {
    display: block;
}

.sat-icon {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(0,255,65,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 30, 10, 0.6);
}

.nunchuk-stick {
    width: 6px;
    height: 6px;
    background: #333;
    border-radius: 50%;
    border: 1px solid #555;
}

.sensor-dots {
    width: 18px;
    height: 2px;
    position: relative;
}

.sensor-dots::before,
.sensor-dots::after {
    content: '';
    position: absolute;
    width: 3px; height: 3px;
    background: #ff4444;
    border-radius: 50%;
    animation: sensor-blink 0.125s steps(1) infinite;
}

.sensor-dots::before { left: 0; top: -1px; }
.sensor-dots::after { right: 0; top: -1px; }

@keyframes sensor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.1; }
}

.sat-label {
    font-size: 7px;
    letter-spacing: 2px;
    color: rgba(0,255,65,0.4);
}

/* Info Panel */
#info-panel {
    position: absolute;
    top: 70px;
    right: 16px;
    width: 340px;
    max-height: calc(100vh - 180px);
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,255,65,0.12);
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0,255,65,0.2) transparent;
    z-index: 30;
}

#info-drag-handle {
    display: none;
}

#info-panel.visible {
    transform: translateX(0);
}

#info-panel.hidden {
    transform: translateX(400px);
}

#info-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: 1px solid rgba(0,255,65,0.2);
    color: var(--green-terminal);
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#info-close:hover,
#info-close:active {
    background: rgba(0,255,65,0.1);
}

#info-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--green-terminal);
    margin-bottom: 10px;
    padding-right: 40px;
    text-shadow: 0 0 10px rgba(0,255,65,0.2);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-meta {
    font-size: 11px;
    color: var(--copper);
    margin-bottom: 4px;
    letter-spacing: 1px;
}

#info-description {
    font-size: 12px;
    line-height: 1.7;
    color: rgba(0,204,51,0.8);
    margin-top: 14px;
    border-top: 1px solid rgba(0,255,65,0.08);
    padding-top: 10px;
}

#info-extra {
    margin-top: 10px;
    font-size: 11px;
    color: var(--gold);
    line-height: 1.5;
}

/* Discovery Log */
#discovery-log {
    position: absolute;
    bottom: 68px;
    left: 16px;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: 140px;
    background: rgba(5, 12, 5, 0.92);
    border: 1px solid rgba(0,255,65,0.1);
    border-radius: 6px;
    padding: 10px 14px;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.6;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,255,65,0.12) transparent;
    z-index: 15;
}

.log-header {
    font-size: 8px;
    letter-spacing: 3px;
    color: rgba(0,255,65,0.4);
    margin-bottom: 6px;
}

#log-text {
    color: rgba(0,204,51,0.7);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.log-cursor {
    color: var(--green-terminal);
    animation: cursor-blink 0.8s steps(1) infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Bottom Toolbar */
#toolbar {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    background: rgba(10, 30, 10, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0,255,65,0.1);
    z-index: 20;
}

.toolbar-btn {
    background: #1a3a1a;
    border: 2px solid #2a5a2a;
    color: rgba(0,255,65,0.5);
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.2s;
    min-width: 54px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.toolbar-btn:hover,
.toolbar-btn:active {
    background: #1a4a1a;
    border-color: rgba(0,255,65,0.25);
    color: var(--green-terminal);
}

.toolbar-btn.active {
    background: #1a4a1a;
    border-color: rgba(0,255,65,0.4);
    color: var(--green-terminal);
    box-shadow: 0 0 12px rgba(0,255,65,0.12), inset 0 0 8px rgba(0,255,65,0.06);
}

.btn-icon {
    font-size: 16px;
    line-height: 1;
}

.btn-label {
    letter-spacing: 2px;
    font-size: 9px;
}

/* POI Label */
#poi-label {
    position: absolute;
    background: rgba(10, 30, 10, 0.92);
    border: 1px solid rgba(0,255,65,0.25);
    color: var(--green-terminal);
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 4px;
    letter-spacing: 2px;
    white-space: nowrap;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform: translate(-50%, -100%);
    margin-top: -12px;
    z-index: 25;
}

#poi-label.hidden {
    display: none;
}

/* Footer */
#footer {
    position: absolute;
    bottom: 2px;
    right: 12px;
    font-size: 8px;
    color: rgba(0,255,65,0.2);
    letter-spacing: 1px;
    z-index: 5;
    pointer-events: auto;
}

#footer a {
    color: rgba(0,255,65,0.3);
    text-decoration: none;
}

#footer a:hover {
    color: var(--green-terminal);
}

/* ===== MOBILE STYLES ===== */
@media (max-width: 768px) {
    #title-bar {
        top: 12px;
        left: 12px;
        max-width: calc(100vw - 110px);
    }

    .title-main {
        font-size: 15px;
        letter-spacing: 2px;
    }

    .title-sub {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .signal-text {
        font-size: 8px;
    }

    #satellite-indicators {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    .sat-icon {
        width: 28px;
        height: 28px;
    }

    .sat-label {
        font-size: 6px;
    }

    .sat-tooltip {
        right: -10px;
        width: 180px;
        font-size: 9px;
    }

    /* Info Panel becomes bottom sheet on mobile */
    #info-panel {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 55vh;
        border-radius: 14px 14px 0 0;
        transform: translateY(110%);
        padding: 12px 16px 20px;
        padding-bottom: calc(20px + var(--safe-bottom));
    }

    #info-drag-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(0,255,65,0.25);
        border-radius: 2px;
        margin: 0 auto 10px;
    }

    #info-panel.visible {
        transform: translateY(0);
    }

    #info-panel.hidden {
        transform: translateY(110%);
    }

    #info-title {
        font-size: 15px;
        padding-right: 44px;
    }

    #info-description {
        font-size: 11px;
        line-height: 1.6;
    }

    #info-close {
        width: 40px;
        height: 40px;
        font-size: 22px;
        top: 8px;
        right: 8px;
    }

    /* Discovery Log */
    #discovery-log {
        width: calc(100vw - 24px);
        max-height: 85px;
        bottom: 62px;
        left: 12px;
        font-size: 9px;
        padding: 8px 10px;
        line-height: 1.5;
    }

    .log-header {
        font-size: 7px;
        margin-bottom: 4px;
    }

    /* Toolbar */
    #toolbar {
        padding: 5px 6px;
        gap: 4px;
        bottom: 10px;
        padding-bottom: calc(5px + var(--safe-bottom));
    }

    .toolbar-btn {
        padding: 7px 9px;
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
    }

    .btn-icon {
        font-size: 15px;
    }

    .btn-label {
        font-size: 7px;
        letter-spacing: 1px;
    }

    #footer {
        display: none;
    }
}

@media (max-width: 380px) {
    .title-main {
        font-size: 13px;
        letter-spacing: 1px;
    }

    .title-sub {
        font-size: 7px;
    }

    #discovery-log {
        max-height: 65px;
        font-size: 8px;
        bottom: 60px;
    }

    .toolbar-btn {
        min-width: 44px;
        padding: 6px 7px;
    }

    .btn-label {
        display: none;
    }
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,255,65,0.2);
    border-radius: 2px;
}