@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;700&display=swap');

/* 🔥 TOUCH-ACTION FIX: Nur auf den Body anwenden, was nötig ist 🔥 */
html, body { margin: 0; padding: 0; width: 100vw; height: 100vh; background-color: black; overflow: hidden; overscroll-behavior: none; user-select: none; -webkit-user-select: none; font-family: 'Space Grotesk', sans-serif; position: relative; cursor: none !important; }
a, button, canvas { cursor: none !important; }

/* 3D Canvas isolieren, damit es auf dem Handy keine Scroll-Gesten stört */
#webgl-canvas { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1; display: block; touch-action: none; }

#cursor-dot { position: fixed; top: 0; left: 0; width: 6px; height: 6px; background: #ff8c00; border-radius: 50%; pointer-events: none; z-index: 1000000; transform: translate(-50%, -50%); transition: width 0.2s, height 0.2s, background 0.2s; }
#cursor-ring { position: fixed; top: 0; left: 0; width: 35px; height: 35px; border: 1px solid rgba(255, 140, 0, 0.5); border-radius: 50%; pointer-events: none; z-index: 999999; transform: translate(-50%, -50%); transition: width 0.3s, height 0.3s, border-color 0.3s, transform 0.3s; }
body.cursor-hover #cursor-dot { background: #4b90ff; width: 10px; height: 10px; }
body.cursor-hover #cursor-ring { border-color: #4b90ff; width: 50px; height: 50px; border-style: dashed; transform: translate(-50%, -50%) rotate(45deg); }

.sci-fi-tooltip { position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); border: 1px solid rgba(255, 255, 255, 0.3); color: white; padding: 5px 12px; border-radius: 4px; font-size: 0.9rem; font-weight: bold; letter-spacing: 1px; pointer-events: none; z-index: 9999; opacity: 0; transform: translate(-50%, -100%); transition: opacity 0.2s ease; box-shadow: 0 0 10px rgba(255, 255, 255, 0.2); }

#labels-container { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 99; }
.planet-label { position: fixed; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(2px); border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.6); padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; letter-spacing: 1px; pointer-events: none; transform: translate(-50%, -100%); transition: opacity 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, background 0.3s ease; box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); }
.planet-label.hovered { color: #ffffff; background: rgba(0, 0, 0, 0.8); transform: translate(-50%, -115%) scale(1.1); z-index: 100; }
.planet-label.hidden { opacity: 0 !important; }

#loader-screen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: #050505; z-index: 99999; display: flex; align-items: center; justify-content: center; color: white; transition: opacity 1.5s ease-in-out; }
.loader-content { text-align: center; width: 80%; max-width: 500px; }
#loader-text { font-size: 1.5rem; margin-bottom: 20px; color: #ff8c00; letter-spacing: 2px; transition: color 0.5s ease; text-shadow: 0 0 15px rgba(255, 140, 0, 0.5); }
.progress-bar { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
#progress-fill { width: 0%; height: 100%; background: #ff8c00; box-shadow: 0 0 15px #ff8c00; transition: width 0.2s ease, background 0.5s ease, box-shadow 0.5s ease; }
#loader-percentage { font-size: 1.2rem; font-weight: bold; color: #aaaaaa; }

.ui-layer { position: absolute; top: 30px; left: 40px; color: white; z-index: 100; pointer-events: none; }
#ui-title { opacity: 0; margin: 0; font-size: 2.2rem; line-height: 1.2; font-weight: 300; letter-spacing: 1px; white-space: nowrap; text-shadow: 0 4px 15px rgba(0,0,0,1), 0 0 30px rgba(0,0,0,0.8); }
#ui-title span { font-weight: bold; color: rgb(255, 128, 0); text-shadow: 0 4px 15px rgba(0,0,0,1), 0 0 30px rgba(0,0,0,0.8); }

#menu-btn { position: fixed; top: 30px; right: 30px; width: 35px; height: 25px; display: flex; flex-direction: column; justify-content: space-between; z-index: 20000; cursor: none; }
#menu-btn .bar { width: 100%; height: 3px; background-color: white; transition: all 0.3s ease; box-shadow: 0 0 5px rgba(255,255,255,0.5); }
#menu-btn:hover .bar { background-color: #ff8c00; box-shadow: 0 0 10px #ff8c00; }
#menu-btn.open .bar:nth-child(1) { transform: translateY(11px) rotate(45deg); background-color: #ff8c00; }
#menu-btn.open .bar:nth-child(2) { opacity: 0; }
#menu-btn.open .bar:nth-child(3) { transform: translateY(-11px) rotate(-45deg); background-color: #ff8c00; }

/* --- 🔥 NEU: INTRO POPUP ZENTRIERT OBEN 🔥 --- */
#intro-popup { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); max-width: 400px; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px); border: 1px solid rgba(255, 140, 0, 0.3); border-radius: 12px; padding: 20px 25px; z-index: 100; opacity: 0; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#intro-popup p { margin: 0; color: #ddd; font-size: 1rem; line-height: 1.6; text-align: center; }
#intro-popup .close-btn { position: absolute; top: 10px; right: 15px; font-size: 1.2rem; background: none; border: none; color: white; opacity: 0.7; transition: opacity 0.3s; cursor: none; }
#intro-popup .close-btn:hover { opacity: 1; color: #ff8c00; }

#tutorial-overlay { position: fixed; bottom: 8vh; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; z-index: 100; color: rgba(255, 255, 255, 0.9); text-align: center; transition: opacity 0.8s ease, transform 0.8s ease; opacity: 1; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(8px); padding: 15px 30px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.05); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.tutorial-icons { display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.mouse-icon { width: 24px; height: 38px; border: 2px solid rgba(255, 255, 255, 0.8); border-radius: 12px; position: relative; box-shadow: 0 0 15px rgba(255, 255, 255, 0.2); animation: mouseMove 2.5s infinite ease-in-out; }
.wheel { width: 4px; height: 8px; background: #4b90ff; border-radius: 2px; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); box-shadow: 0 0 8px #4b90ff; animation: scrollWheel 2s infinite; }
.keyboard-icon { display: flex; flex-direction: column; gap: 4px; }
.key-row { display: flex; gap: 4px; justify-content: center; }
.key { width: 22px; height: 22px; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 4px; display: flex; justify-content: center; align-items: center; font-size: 0.7rem; font-weight: bold; color: rgba(255, 255, 255, 0.7); box-shadow: 0 0 5px rgba(255,255,255,0.1); }
.highlight-move { animation: keyPressMove 2.5s infinite ease-in-out; }
.highlight-zoom { animation: keyPressZoom 2s infinite ease-in-out; border-color: #4b90ff; color: #4b90ff; }
#tutorial-overlay p { margin: 0; font-size: 0.9rem; letter-spacing: 1.5px; line-height: 1.5; text-shadow: 0 2px 5px rgba(0,0,0,0.8); }
@keyframes mouseMove { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px) rotate(-5deg); } 75% { transform: translateX(10px) rotate(5deg); } }
@keyframes scrollWheel { 0% { top: 6px; opacity: 1; } 100% { top: 16px; opacity: 0; } }
@keyframes keyPressMove { 0%, 100% { background: transparent; transform: scale(1); } 50% { background: rgba(255,255,255,0.2); transform: scale(0.9); } }
@keyframes keyPressZoom { 0%, 100% { background: transparent; transform: scale(1); box-shadow: 0 0 5px rgba(75, 144, 255, 0.1); } 50% { background: rgba(75, 144, 255, 0.2); transform: scale(0.9); box-shadow: 0 0 10px rgba(75, 144, 255, 0.5); } }
.tutorial-hidden { opacity: 0 !important; transform: translate(-50%, 20px) !important; }

#help-btn { position: fixed; bottom: 30px; left: 30px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.7); padding: 8px 18px; border-radius: 25px; font-family: 'Space Grotesk', sans-serif; font-size: 0.85rem; font-weight: bold; letter-spacing: 1px; z-index: 200; transition: all 0.3s ease; }
#help-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; border-color: rgba(255, 255, 255, 0.5); box-shadow: 0 0 15px rgba(255, 255, 255, 0.2); transform: translateY(-2px); }

#help-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.7); z-index: 50000; display: flex; justify-content: center; align-items: center; opacity: 1; transition: opacity 0.3s ease; }
#help-modal.modal-hidden { opacity: 0; pointer-events: none; }
.help-content { background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 20px; padding: 2.5rem; max-width: 450px; width: 85%; position: relative; transform: translateY(0); transition: transform 0.3s ease; box-shadow: 0 0 40px rgba(0,0,0,0.8); }
#help-modal.modal-hidden .help-content { transform: translateY(20px); }
.help-content h2 { margin-top: 0; color: #ff8c00; font-size: 1.5rem; margin-bottom: 1.8rem; letter-spacing: 1px;}
.help-grid { display: flex; flex-direction: column; gap: 20px; margin-bottom: 25px; }
.help-item { display: flex; align-items: flex-start; gap: 15px; }
.help-item span { font-size: 1.5rem; line-height: 1.2; text-align: center; min-width: 30px; display: inline-block;}
.help-item p { margin: 0; color: #ccc; font-size: 0.95rem; line-height: 1.5; }
.help-item strong { color: #fff; }
.help-footer { margin: 0; font-size: 0.85rem; color: #888; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 15px; line-height: 1.5;}
.close-btn { position: absolute; top: 20px; right: 25px; background: none; border: none; color: white; font-size: 1.2rem; opacity: 0.7; transition: opacity 0.3s; }
.close-btn:hover { opacity: 1; color: #ff8c00; }

/* 🔥 SCROLL-FIX: Menu Touch-Action erlaubt 🔥 */
#fast-travel-menu { position: fixed; top: 0; right: -100%; width: 400px; height: 100vh; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(20px); border-left: 1px solid rgba(255,255,255,0.1); z-index: 10000; transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1); display: flex; flex-direction: column; justify-content: center; padding: 0 50px; box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#fast-travel-menu.open { right: 0; }
#fast-travel-menu h2 { color: #ff8c00; font-size: 1.2rem; letter-spacing: 3px; margin-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }
#fast-travel-menu ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 20px; }
#fast-travel-menu a { color: white; text-decoration: none; font-size: 1.6rem; font-weight: bold; transition: all 0.3s; display: block; position: relative; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
#fast-travel-menu a span { font-size: 0.9rem; color: #888; font-weight: normal; margin-left: 10px; transition: color 0.3s; }
#fast-travel-menu a:hover { color: #4b90ff; transform: translateX(10px); text-shadow: 0 2px 15px rgba(75,144,255,0.4); }
#fast-travel-menu a:hover span { color: #ccc; }

.menu-divider { width: 100%; height: 1px; background: rgba(255,255,255,0.1); margin: 25px 0; }

#sound-toggle { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 12px 20px; color: white; font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: bold; letter-spacing: 1px; border-radius: 8px; width: 100%; text-align: left; transition: 0.3s; cursor: none; }
#sound-toggle.active { color: #4b90ff; border-color: #4b90ff; background: rgba(75, 144, 255, 0.1); box-shadow: 0 0 10px rgba(75, 144, 255, 0.2); }
#sound-toggle:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }

#mission-log-container { background: rgba(0,0,0,0.4); padding: 15px; border-radius: 12px; border: 1px solid rgba(255, 140, 0, 0.2); margin-top: 15px; }
.quest-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.8rem; color: #ccc; transition: all 0.3s; }
.quest-item.completed { color: #00ff00; text-decoration: line-through; opacity: 0.6; }
.quest-checkbox { width: 14px; height: 14px; border: 1px solid #ff8c00; border-radius: 3px; display: flex; justify-content: center; align-items: center; font-size: 0.7rem; }
.quest-item.completed .quest-checkbox { border-color: #00ff00; background: rgba(0, 255, 0, 0.2); }
.quest-item.completed .quest-checkbox::after { content: '✔'; color: #00ff00; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: rgba(255, 140, 0, 0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 140, 0, 0.8); }

body { animation: warpFadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes warpFadeIn {
  0% { opacity: 0; filter: brightness(0) blur(10px); }
  100% { opacity: 1; filter: brightness(1) blur(0px); }
}

@media (pointer: coarse) {
    #cursor-dot, #cursor-ring { display: none !important; }
    html, body, a, button, canvas, .btn, .close-btn, #sound-toggle { cursor: auto !important; }
    #tutorial-overlay { display: none !important; }
}

/* --- 🔥 NORMALE MOBILE ANSICHT (Hochkant) 🔥 --- */
@media (max-width: 768px) {
    .ui-layer { top: 25px; left: 20px; width: calc(100vw - 80px); }
    #ui-title { font-size: 1.4rem; line-height: 1.3; }
    #menu-btn { top: 25px; right: 20px; }
    
    /* Pop-up rutscht auf Mobile knapp unter den Header */
    #intro-popup { top: 85px; bottom: auto; left: 50%; transform: translateX(-50%); width: 90vw; padding: 15px 20px; box-sizing: border-box; }
    #intro-popup p { font-size: 0.85rem; }
    #intro-popup .close-btn { top: 8px; right: 10px; font-size: 1rem; }

    #fast-travel-menu { width: 100vw; padding: 0 30px; right: -100vw; justify-content: flex-start; padding-top: 80px; }
    #fast-travel-menu a { font-size: 1.4rem; margin-bottom: 10px; }
    
    .help-content { padding: 1.5rem; width: 90%; }
    .help-content h2 { font-size: 1.2rem; }
    .help-item span { font-size: 1.2rem; }
    .help-item p { font-size: 0.85rem; }
    
    #tutorial-overlay { display: none !important; } 
}

/* --- 🔥 LANDSCAPE MOBILE ANSICHT (Handy gedreht) 🔥 --- */
@media (max-height: 500px) and (orientation: landscape) {
    .ui-layer { top: 15px; left: 20px; }
    #ui-title { font-size: 1.2rem; }
    #menu-btn { top: 15px; right: 20px; }
    
    /* Pop-up zentriert oben im Querformat */
    #intro-popup { top: 15px; bottom: auto; left: 50%; transform: translateX(-50%); width: 320px; padding: 12px 15px; }
    #intro-popup p { font-size: 0.8rem; }
    
    #tutorial-overlay { display: none !important; }
    
    #fast-travel-menu { padding: 20px 30px; justify-content: flex-start; }
    #fast-travel-menu h2 { margin-bottom: 15px; font-size: 1rem; }
    #fast-travel-menu ul { gap: 10px; }
    #fast-travel-menu a { font-size: 1.2rem; }
    .menu-divider { margin: 15px 0; }
}