/**
 * Space Quizzed - Space Mode Specific Styles
 */

/* ========== SPACE START BUTTONS ========== */

.space-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.space-buttons.hidden {
    display: none;
}

/* Both buttons same size */
.space-buttons .space-btn {
    width: 180px;
    height: 100px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
}

.space-buttons .btn-icon {
    font-size: 2rem;
    line-height: 1;
}

.space-buttons .btn-text {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Quick Play Button - Cyan Neon */
#quick-play-btn {
    background: linear-gradient(180deg, #004444 0%, #002222 100%);
    border: 3px solid #00ffff;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

#quick-play-btn:hover {
    background: linear-gradient(180deg, #006666 0%, #003333 100%);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}

/* Galaxy Button - Magenta Neon */
#galaxy-btn {
    background: linear-gradient(180deg, #440044 0%, #220022 100%);
    border: 3px solid #ff00ff;
    color: #ff00ff;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

#galaxy-btn:hover {
    background: linear-gradient(180deg, #660066 0%, #330033 100%);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.6);
}

/* Mobile responsive */
@media (max-width: 600px) {
    .space-buttons {
        gap: 10px;
        padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
    }

    .space-buttons .space-btn {
        width: 140px;
        height: 70px;
        padding: 10px 15px;
        gap: 4px;
    }

    .space-buttons .btn-icon {
        font-size: 1.5rem;
    }

    .space-buttons .btn-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 350px) {
    .space-buttons .space-btn {
        width: 120px;
        height: 65px;
    }

    .space-buttons .btn-icon {
        font-size: 1.3rem;
    }

    .space-buttons .btn-text {
        font-size: 0.7rem;
    }
}

/* ========== GALAXY MAP SCREEN ========== */

#galaxy-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#galaxy-screen.active {
    display: flex !important;
}

.galaxy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 900px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* ========== RANK DISPLAY ========== */

.rank-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(30, 20, 50, 0.8);
    border: 2px solid #9900ff;
    border-radius: 8px;
    padding: 8px 15px;
    min-width: 150px;
}

.rank-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255, 200, 0, 0.5));
}

.rank-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.rank-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #ff00ff;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
    white-space: nowrap;
}

.rank-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(50, 50, 80, 0.8);
    border-radius: 3px;
    overflow: hidden;
}

.rank-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9900ff, #ff00ff);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.6);
}

/* Rank-up Animation */
@keyframes rankUpPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes rankUpGlow {
    0% { box-shadow: 0 0 10px rgba(255, 200, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 200, 0, 1), 0 0 50px rgba(255, 0, 255, 0.8); }
    100% { box-shadow: 0 0 10px rgba(255, 200, 0, 0.5); }
}

.rank-display.rank-up {
    animation: rankUpGlow 1s ease-out;
}

.rank-display.rank-up .rank-icon {
    animation: rankUpPulse 0.5s ease-out 3;
}

/* Rank-Up Overlay */
#rank-up-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

#rank-up-overlay.hidden {
    display: none;
}

.rank-up-content {
    text-align: center;
}

.rank-up-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.rank-up-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: rankUpPulse 0.8s ease-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.8));
}

.rank-up-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: #ff00ff;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.rank-up-subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    color: #aaccff;
    margin-bottom: 30px;
}

.galaxy-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.15em;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
}

.credits-display {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.credits-display .credits-icon {
    font-size: 1.2rem;
}

.credits-display .credits-amount {
    color: #ffffff;
}

/* Galaxy Map Canvas Container */
.galaxy-map-container {
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16/10;
    background: linear-gradient(180deg, #0a0020 0%, #050510 100%);
    border: 2px solid #3070c0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow:
        0 0 20px rgba(48, 112, 192, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

#galaxy-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Galaxy Action Buttons */
.galaxy-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.galaxy-btn {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    padding: 12px 25px;
    background: linear-gradient(180deg, #3070c0 0%, #1a3a7a 100%);
    border: 2px solid #5090e0;
    border-radius: 5px;
    color: #ffffff;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px #000;
}

.galaxy-btn:hover {
    background: linear-gradient(180deg, #5090e0 0%, #3070c0 100%);
    box-shadow: 0 0 15px rgba(80, 144, 224, 0.5);
    transform: translateY(-2px);
}

.galaxy-btn:active {
    transform: translateY(0);
}

.galaxy-btn.primary {
    background: linear-gradient(180deg, #00c8c8 0%, #008888 100%);
    border-color: #00ffff;
}

.galaxy-btn.primary:hover {
    background: linear-gradient(180deg, #00ffff 0%, #00c8c8 100%);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* Rank-locked buttons */
.galaxy-btn:disabled,
.galaxy-btn.rank-locked {
    background: linear-gradient(180deg, #404050 0%, #252530 100%);
    border-color: #505060;
    color: #808090;
    cursor: not-allowed;
    opacity: 0.7;
}

.galaxy-btn:disabled:hover,
.galaxy-btn.rank-locked:hover {
    transform: none;
    box-shadow: none;
    background: linear-gradient(180deg, #404050 0%, #252530 100%);
}

.galaxy-btn.rank-locked::after {
    content: ' 🔒';
}

/* Space UI hidden during intro/loading */
#space-joker-bar.hidden,
.orbit-progress.hidden,
.orbit-info.hidden {
    display: none !important;
}

/* ========== PLANET DETAIL POPUP ========== */

#planet-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

#planet-popup.hidden {
    display: none;
}

.planet-popup-content {
    background: linear-gradient(180deg, #1a3a7a 0%, #0a1030 100%);
    border: 3px solid #5090e0;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 0 30px rgba(80, 144, 224, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.planet-popup-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
}

.planet-popup-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #00ffff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ffff;
}

.planet-popup-description {
    color: #aaccff;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.planet-popup-status {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 20px;
}

.planet-popup-status.conquered {
    background: rgba(0, 200, 83, 0.2);
    color: #00c853;
    border: 1px solid #00c853;
}

.planet-popup-status.available {
    background: rgba(0, 255, 255, 0.2);
    color: #00ffff;
    border: 1px solid #00ffff;
}

.planet-popup-status.locked {
    background: rgba(102, 102, 102, 0.2);
    color: #666666;
    border: 1px solid #666666;
}

.planet-popup-highscore {
    font-size: 0.8rem;
    color: #ffff00;
    margin-bottom: 15px;
}

.planet-popup-requirement {
    font-size: 0.8rem;
    color: #ff6666;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 5px;
}

.planet-popup-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== WERFT/HANGAR SCREEN ========== */

#hangar-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#hangar-screen.active {
    display: flex !important;
}

.hangar-content {
    width: 100%;
    max-width: 700px;
}

.hangar-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
    text-align: center;
    margin-bottom: 30px;
}

/* Ship Display */
.ship-display {
    background: linear-gradient(180deg, #1a1a30 0%, #0a0a15 100%);
    border: 2px solid #5090e0;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ship-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.ship-icon {
    font-size: 5rem;
    margin-bottom: 15px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.ship-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    color: #ffffff;
    margin-bottom: 10px;
}

.ship-level {
    font-size: 0.8rem;
    color: #aaaaaa;
}

/* Upgrades Grid */
.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.upgrade-card {
    background: linear-gradient(180deg, #1a3a7a 0%, #0a1030 100%);
    border: 2px solid #3070c0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.upgrade-card:hover {
    border-color: #5090e0;
    box-shadow: 0 0 15px rgba(80, 144, 224, 0.3);
}

.upgrade-card.maxed {
    border-color: #00c853;
    background: linear-gradient(180deg, #0a3a2a 0%, #051510 100%);
}

.upgrade-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.upgrade-icon {
    font-size: 2rem;
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    color: #ffffff;
    margin-bottom: 5px;
}

.upgrade-level {
    font-size: 0.75rem;
    color: #00ffff;
}

.upgrade-description {
    font-size: 0.8rem;
    color: #aaccff;
    margin-bottom: 15px;
    line-height: 1.4;
}

.upgrade-buy-btn {
    width: 100%;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    padding: 12px;
    background: linear-gradient(180deg, #ffaa00 0%, #cc7700 100%);
    border: 2px solid #ffcc00;
    border-radius: 5px;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upgrade-buy-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffcc00 0%, #ffaa00 100%);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
}

.upgrade-buy-btn:disabled {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    border-color: #555;
    color: #666;
    cursor: not-allowed;
}

.upgrade-buy-btn.maxed {
    background: linear-gradient(180deg, #00aa55 0%, #006633 100%);
    border-color: #00c853;
    color: #fff;
}

/* ========== MISSION INTRO OVERLAY ========== */

#mission-intro-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease;
}

#mission-intro-overlay.transparent-bg {
    background: transparent;
    animation: none;
}

#mission-intro-overlay.hidden {
    display: none;
}

.mission-intro-content {
    text-align: center;
}

.mission-planet-icon {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.mission-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3rem;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff;
    margin-bottom: 10px;
}

.mission-planet-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: 0.1em;
    color: #ffffff;
    text-shadow: 0 0 20px #ffffff;
    margin-bottom: 30px;
}

.mission-loading {
    font-size: 0.8rem;
    color: #888;
}

/* Planet approach animation (PNG planets) */
.mission-planet-img {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.001);
    opacity: 1;
    width: 800px;
    height: 800px;
    object-fit: contain;
    border-radius: 50%;
    z-index: 2001;
    pointer-events: none;
}

.mission-planet-img.hidden {
    display: none;
}

/* Planet grows from 1px dot to half-screen (8s ease-out, starts after starfield stops) */
.mission-planet-img.approaching {
    transition: transform 8s ease-out;
    transform: translate(-50%, -50%) scale(0.5);
}

/* Planet label (typewriter name + category) */
.mission-planet-label {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2002;
    pointer-events: none;
}
.mission-planet-label.hidden { display: none; }

.mission-planet-label-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 0 20px #fff;
    text-transform: uppercase;
    margin: 0;
}
.mission-planet-label-category {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    color: #00ffff;
    text-shadow: 0 0 15px #00ffff;
    margin: 8px 0 0;
}

/* Fade-out for approach → question transition */
#mission-intro-overlay.fade-out,
.mission-planet-img.fade-out,
.mission-planet-label.fade-out {
    opacity: 0;
    transition: opacity 0.8s ease;
}

/* Stars animation for mission intro */
.mission-stars {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.mission-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: starMove 2s linear infinite;
}

@keyframes starMove {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(100vh) scale(0.5); opacity: 0; }
}

/* ========== SPACE JOKER BUTTONS ========== */

.space-joker-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
    justify-content: space-between;
}


.space-joker-btn {
    flex: 1 1 0;
    min-width: 0;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    padding: 8px 15px;
    background: linear-gradient(180deg, #330066 0%, #1a0033 100%);
    border: 2px solid #9900ff;
    border-radius: 5px;
    color: #ff00ff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.space-joker-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #660099 0%, #330066 100%);
    box-shadow: 0 0 15px rgba(153, 0, 255, 0.5);
}

.space-joker-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.space-joker-btn.active {
    background: linear-gradient(180deg, #006600 0%, #003300 100%);
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    animation: escapepod-pulse 1.5s ease-in-out infinite;
}

.space-joker-btn.active .joker-count {
    background: #00ff00;
}

@keyframes escapepod-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 0, 0.8); }
}

.space-joker-btn .joker-icon {
    font-size: 1rem;
}

.space-joker-btn .joker-count {
    background: #ff00ff;
    color: #000;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.5rem;
}

/* ========== PROBABILITY DISPLAY (Sensors upgrade) ========== */

.probability-indicator {
    position: absolute;
    top: 5px;
    right: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.5rem;
    padding: 3px 8px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.answer-btn.show-probability .probability-indicator {
    opacity: 1;
}

.probability-indicator.high {
    background: rgba(0, 200, 83, 0.3);
    color: #00c853;
    border: 1px solid #00c853;
}

.probability-indicator.medium {
    background: rgba(255, 200, 0, 0.3);
    color: #ffc800;
    border: 1px solid #ffc800;
}

.probability-indicator.low {
    background: rgba(255, 100, 100, 0.3);
    color: #ff6464;
    border: 1px solid #ff6464;
}

/* ========== SHIELD EFFECT ========== */

.shield-effect {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1500;
    animation: shieldFlash 1s ease-out;
}

@keyframes shieldFlash {
    0% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 255, 0.5) 0%, transparent 70%);
    }
    100% {
        background: transparent;
    }
}

.shield-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    animation: shieldTextAnim 1s ease-out forwards;
    z-index: 1501;
}

@keyframes shieldTextAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* ========== CREDITS POPUP (after game) ========== */

.credits-earned-popup {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: #ffff00;
    text-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
    animation: creditsPopup 2s ease-out forwards;
    z-index: 1500;
}

@keyframes creditsPopup {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ========== REACTOR INCOME BANNER ========== */

.reactor-banner {
    width: 100%;
    max-width: 900px;
    background: linear-gradient(90deg, rgba(255, 200, 0, 0.2) 0%, rgba(255, 150, 0, 0.2) 100%);
    border: 2px solid #ffcc00;
    border-radius: 8px;
    padding: 10px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    animation: reactorPulse 2s ease-in-out infinite;
}

.reactor-banner.hidden {
    display: none;
}

@keyframes reactorPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 200, 0, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 200, 0, 0.6); }
}

.reactor-icon {
    font-size: 1.5rem;
}

.reactor-text {
    font-family: 'Rajdhani', sans-serif;
    color: #ffcc00;
}

.collect-btn {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    padding: 8px 20px;
    background: linear-gradient(180deg, #ffcc00 0%, #ff9900 100%);
    border: none;
    border-radius: 5px;
    color: #000;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.collect-btn:hover {
    background: linear-gradient(180deg, #ffdd33 0%, #ffaa00 100%);
    transform: scale(1.05);
}

/* ========== JOKER INVENTORY BAR ========== */

.joker-inventory-bar {
    width: 100%;
    max-width: 900px;
    background: rgba(30, 20, 50, 0.8);
    border: 1px solid #6600cc;
    border-radius: 8px;
    padding: 8px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    font-family: 'Rajdhani', sans-serif;
}

.inventory-label {
    color: #9966ff;
    font-weight: bold;
}

.inventory-item {
    color: #cc99ff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.inventory-item span {
    background: rgba(153, 0, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.inventory-capacity {
    color: #888;
    margin-left: auto;
    font-size: 0.85rem;
}

/* ========== JOKER SHOP SCREEN ========== */

#joker-shop-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#joker-shop-screen.active {
    display: flex !important;
}

.shop-content {
    width: 100%;
    max-width: 700px;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.shop-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    color: #ff9900;
    text-shadow: 0 0 10px #ff9900;
}

.shop-info {
    background: rgba(30, 30, 60, 0.8);
    border: 1px solid #5090e0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    text-align: center;
}

.shop-info p {
    color: #aaccff;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.inventory-status {
    font-family: 'Rajdhani', sans-serif;
    color: #ff00ff;
    font-size: 1rem;
}

.workshop-discount {
    color: #00ff00;
    margin-left: 10px;
}

.workshop-discount.hidden {
    display: none;
}

/* Joker Shop Grid */
.joker-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.joker-shop-card {
    background: linear-gradient(180deg, #2a1a4a 0%, #1a0a30 100%);
    border: 2px solid #9900ff;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    text-align: center;
}

.joker-shop-card:hover {
    border-color: #cc33ff;
    box-shadow: 0 0 20px rgba(153, 0, 255, 0.4);
}

.joker-shop-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.joker-shop-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: #ff00ff;
    margin-bottom: 8px;
}

.joker-shop-desc {
    color: #cc99ff;
    font-size: 0.85rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

.joker-shop-price {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    color: #ffcc00;
    margin-bottom: 5px;
}

.joker-shop-price.discounted {
    text-decoration: line-through;
    color: #888;
    font-size: 0.9rem;
}

.joker-shop-price-new {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: #00ff00;
    margin-bottom: 10px;
}

.joker-shop-owned {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.joker-buy-btn {
    width: 100%;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    padding: 12px;
    background: linear-gradient(180deg, #9900ff 0%, #6600aa 100%);
    border: 2px solid #cc33ff;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.joker-buy-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #cc33ff 0%, #9900ff 100%);
    box-shadow: 0 0 15px rgba(204, 51, 255, 0.5);
}

.joker-buy-btn:disabled {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    border-color: #555;
    color: #666;
    cursor: not-allowed;
}

/* ========== ENHANCED HANGAR/WERFT ========== */

.hangar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.credits-display.small {
    font-size: 0.9rem;
}

.credits-display.small .credits-icon {
    font-size: 1rem;
}

.ship-display {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
}

.ship-info {
    text-align: left;
}

/* Ship Parts Grid (new style) */
.ship-parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.ship-part-card {
    background: linear-gradient(180deg, #1a3a7a 0%, #0a1030 100%);
    border: 2px solid #3070c0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.ship-part-card:hover {
    border-color: #5090e0;
    box-shadow: 0 0 15px rgba(80, 144, 224, 0.3);
}

.ship-part-card.maxed {
    border-color: #00c853;
    background: linear-gradient(180deg, #0a3a2a 0%, #051510 100%);
}

.ship-part-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.ship-part-icon {
    font-size: 2.5rem;
}

.ship-part-info {
    flex: 1;
}

.ship-part-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    color: #ffffff;
    margin-bottom: 5px;
}

.ship-part-level {
    font-size: 0.8rem;
    color: #00ffff;
}

.ship-part-level-bar {
    display: flex;
    gap: 4px;
    margin-top: 5px;
}

.level-pip {
    width: 20px;
    height: 6px;
    background: #333;
    border-radius: 3px;
}

.level-pip.filled {
    background: linear-gradient(90deg, #00ffff, #00cccc);
    box-shadow: 0 0 5px #00ffff;
}

.ship-part-desc {
    font-size: 0.85rem;
    color: #aaccff;
    margin-bottom: 10px;
    line-height: 1.4;
}

.ship-part-effect {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    color: #00ff00;
    margin-bottom: 15px;
    padding: 8px;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 5px;
}

.ship-part-effect.inactive {
    color: #888;
    background: rgba(128, 128, 128, 0.1);
}

.ship-part-buy-btn {
    width: 100%;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    padding: 12px;
    background: linear-gradient(180deg, #ffaa00 0%, #cc7700 100%);
    border: 2px solid #ffcc00;
    border-radius: 5px;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.ship-part-buy-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffcc00 0%, #ffaa00 100%);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
}

.ship-part-buy-btn:disabled {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    border-color: #555;
    color: #666;
    cursor: not-allowed;
}

.ship-part-buy-btn.maxed {
    background: linear-gradient(180deg, #00aa55 0%, #006633 100%);
    border-color: #00c853;
    color: #fff;
}

/* ========== ENHANCED PLANET POPUP ========== */

.planet-popup-details {
    margin-bottom: 15px;
}

.planet-popup-details p {
    font-size: 0.85rem;
    color: #aaccff;
    margin-bottom: 5px;
}

.planet-popup-tier {
    color: #00ffff !important;
}

.planet-popup-level {
    color: #ff6666 !important;
}

.planet-popup-travel-cost {
    color: #ffcc00 !important;
}

.planet-popup-status.current {
    background: rgba(255, 255, 0, 0.2);
    color: #ffff00;
    border: 1px solid #ffff00;
}

/* ========== HIDE SETTINGS BAR FOR SPACE QUIZZED ========== */

/* Hide settings bar completely in Space Quizzed mode */
body.pack-space .settings-bar {
    display: none !important;
}

/* Hide starfield switcher on galaxy screen (doesn't need it there) */
body:has(#galaxy-screen.active) #starfield-switcher {
    display: none !important;
}

/* ========== MOBILE RESPONSIVE ========== */

@media (max-width: 600px) {
    #galaxy-screen {
        padding: 10px;
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        justify-content: flex-start;
        min-height: 100dvh;
        box-sizing: border-box;
    }

    .galaxy-header {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        text-align: left;
        margin-bottom: 8px;
        gap: 8px;
    }

    .galaxy-title {
        font-size: 1.1rem;
        order: 2;
        flex: 1;
        text-align: center;
    }

    .credits-display {
        font-size: 0.75rem;
        order: 3;
    }

    /* Mobile Rank Display */
    .rank-display {
        order: 1;
        width: 100%;
        padding: 6px 10px;
        min-width: auto;
    }

    .rank-icon {
        font-size: 1.2rem;
    }

    .rank-name {
        font-size: 0.8rem;
    }

    .rank-progress-bar {
        height: 4px;
    }

    /* Mobile Rank-Up Overlay */
    .rank-up-icon {
        font-size: 4rem;
    }

    .rank-up-name {
        font-size: 1.8rem;
    }

    .rank-up-title {
        font-size: 1rem;
    }

    .galaxy-map-container {
        aspect-ratio: unset;
        /* Fixed height calculation for immediate sizing */
        height: calc(100dvh - 180px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        min-height: 280px;
        max-height: 600px;
    }

    .galaxy-actions {
        margin-top: 15px;
        gap: 10px;
    }

    .galaxy-btn {
        font-size: 0.75rem;
        padding: 10px 18px;
    }

    .planet-popup-content {
        padding: 20px;
    }

    .planet-popup-icon {
        font-size: 3rem;
    }

    .planet-popup-name {
        font-size: 1.1rem;
    }

    .hangar-title {
        font-size: 1.2rem;
    }

    .ship-icon {
        font-size: 4rem;
    }

    .upgrades-grid {
        grid-template-columns: 1fr;
    }

    .upgrade-name {
        font-size: 0.85rem;
    }

    .mission-planet-icon {
        font-size: 4rem;
    }

    .mission-planet-img {
        width: 400px;
        height: 400px;
    }

    .mission-text {
        font-size: 1rem;
    }

    .mission-planet-name {
        font-size: 1.5rem;
    }

    .mission-planet-label-name {
        font-size: 1.4rem;
    }
    .mission-planet-label-category {
        font-size: 0.9rem;
    }

    /* Mobile: Reactor Banner */
    .reactor-banner {
        padding: 8px 15px;
        gap: 10px;
        font-size: 0.85rem;
    }

    .reactor-icon {
        font-size: 1.2rem;
    }

    .collect-btn {
        padding: 6px 15px;
        font-size: 0.8rem;
    }

    /* Mobile: Joker Inventory */
    .joker-inventory-bar {
        padding: 6px 10px;
        gap: 8px;
        font-size: 0.8rem;
    }

    .inventory-item span {
        padding: 1px 6px;
        font-size: 0.75rem;
    }

    /* Mobile: Shop */
    .shop-title {
        font-size: 1.3rem;
    }

    .joker-shop-grid {
        grid-template-columns: 1fr;
    }

    .joker-shop-card {
        padding: 15px;
    }

    .joker-shop-icon {
        font-size: 2.5rem;
    }

    /* Mobile: Hangar */
    .hangar-header {
        flex-direction: column;
        gap: 10px;
    }

    .ship-parts-grid {
        grid-template-columns: 1fr;
    }

    .ship-part-card {
        padding: 15px;
    }

    .ship-part-icon {
        font-size: 2rem;
    }

    .ship-part-name {
        font-size: 1rem;
    }
}

/* Extra tall phones (iPhone Pro Max etc) - flex: 1 handles this now */

/* ========== CONTACT SELECTION POPUP (Phone Joker Purchase) ========== */

#contact-selection-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

#contact-selection-popup.hidden {
    display: none;
}

.contact-selection-content {
    background: linear-gradient(180deg, #1a1a40 0%, #0a0a20 100%);
    border: 3px solid #00ffff;
    border-radius: 15px;
    padding: 25px;
    max-width: 700px;
    width: 95%;
    text-align: center;
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.contact-selection-content h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    margin-bottom: 10px;
}

.contact-selection-info {
    color: #aaccff;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.selection-counter {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
    margin-bottom: 20px;
}

.selection-counter #selected-count {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Carousel Container */
.contact-carousel {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.carousel-arrow {
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.carousel-arrow:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.carousel-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-viewport {
    overflow: hidden;
    flex: 1;
    /* Desktop: 3 Karten à ~180px + gaps */
    max-width: 580px;
}

.carousel-track {
    display: flex;
    gap: 15px;
    transition: transform 0.3s ease;
}

/* Contact Card im Carousel */
.carousel-contact-card {
    flex: 0 0 180px;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: linear-gradient(180deg, #2a1a4a 0%, #1a0a30 100%);
    border: 2px solid var(--species-color, #666);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
}

.carousel-contact-card:hover {
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.carousel-contact-card.selected {
    border-color: #ffff00;
    box-shadow: 0 0 25px rgba(255, 255, 0, 0.6);
    background: linear-gradient(180deg, #3a2a2a 0%, #2a1a1a 100%);
}

.carousel-contact-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #ffff00;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Selection Order Number */
.carousel-contact-card .selection-order {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    background: #00ffff;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    font-family: 'Rajdhani', sans-serif;
}

.carousel-contact-card .contact-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 10px;
    border: 3px solid var(--species-color, #666);
    position: relative;
    background: #111;
}

.carousel-contact-card .contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-contact-card .contact-avatar .species-icon {
    position: absolute;
    bottom: -5px;
    right: -5px;
    font-size: 1.2rem;
    background: #1a1a40;
    border-radius: 50%;
    padding: 2px;
}

.carousel-contact-card .contact-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    color: #ffffff;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
    line-height: 1.2;
}

.carousel-contact-card .contact-specialty {
    font-size: 0.75rem;
    color: var(--species-color, #aaa);
    text-align: center;
    margin-bottom: 8px;
}

.carousel-contact-card .contact-accuracy {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.7rem;
    color: #888;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

/* Selection Actions */
.selection-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

#contact-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(180deg, #333 0%, #222 100%);
    border-color: #555;
}

/* ========== HIVEMIND PIE CHART (Simon/Senso Style) ========== */

.hivemind-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.hivemind-pie {
    width: 200px;
    height: 200px;
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.3));
}

.pie-slice {
    transition: d 0.15s ease-out;
}

.hivemind-legend {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 15px 40px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.legend-letter {
    color: #ffffff;
    font-weight: bold;
    min-width: 20px;
}

.legend-percent {
    color: var(--legend-color, #fff);
    font-weight: bold;
    min-width: 45px;
    text-align: right;
    text-shadow: 0 0 10px var(--legend-color, #fff);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .hivemind-pie {
        width: 160px;
        height: 160px;
    }

    .hivemind-legend {
        gap: 12px;
    }

    .legend-item {
        font-size: 0.95rem;
    }
}

/* ========== MOBILE CONTACT CAROUSEL ========== */

@media (max-width: 600px) {
    .contact-selection-content {
        padding: 15px;
        max-width: 95%;
    }

    .contact-selection-content h3 {
        font-size: 1.2rem;
    }

    .carousel-arrow {
        display: none;
    }

    .carousel-viewport {
        width: 100%;
        max-width: none;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 10px 0;
    }

    .carousel-viewport::-webkit-scrollbar {
        display: none;
    }

    .carousel-track {
        padding: 0 calc(50% - 90px);
        scroll-snap-align: center;
    }

    .carousel-contact-card {
        flex: 0 0 160px;
        height: 220px;
        scroll-snap-align: center;
    }

    .carousel-contact-card .contact-avatar {
        width: 70px;
        height: 70px;
    }

    .carousel-contact-card .contact-name {
        font-size: 0.85rem;
    }

    .selection-actions {
        flex-direction: column;
        gap: 10px;
    }

    .selection-actions .galaxy-btn {
        width: 100%;
    }
}

/* Landscape mobile */
@media (max-height: 500px) {
    #galaxy-screen {
        padding: 5px 10px;
        padding-left: max(5px, env(safe-area-inset-left));
        padding-right: max(5px, env(safe-area-inset-right));
    }

    .galaxy-header {
        margin-bottom: 5px;
    }

    .galaxy-map-container {
        height: calc(100dvh - 100px);
        aspect-ratio: unset;
        max-height: none;
    }

    .galaxy-actions {
        margin-top: 5px;
    }

    .galaxy-btn {
        padding: 8px 15px;
        font-size: 0.7rem;
    }
}

/* ========== MOBILE SPACE JOKER BAR ========== */
@media (max-width: 600px) {
    .space-joker-bar {
        gap: 4px;
        margin-bottom: 5px;
        padding: 0;
    }

    .space-joker-btn {
        flex: 1 1 0;
        padding: 5px 6px;
        font-size: 0.7rem;
        min-width: 0;
        justify-content: center;
    }

    /* Hide joker text on small screens, show only icon + count */
    .space-joker-btn > span:not(.joker-icon):not(.joker-count) {
        display: none;
    }

    .space-joker-btn .joker-icon {
        font-size: 1.2rem;
    }

    .space-joker-btn .joker-count {
        font-size: 0.6rem;
        padding: 1px 5px;
    }
}

/* Even smaller screens - tighter joker bar */
@media (max-width: 380px) {
    .space-joker-bar {
        gap: 4px;
    }

    .space-joker-btn {
        padding: 5px 8px;
    }

    .space-joker-btn .joker-icon {
        font-size: 1rem;
    }
}

/* ========== TOAST NOTIFICATION ========== */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(180deg, #3070c0 0%, #1a3a7a 100%);
    border: 2px solid #5090e0;
    border-radius: 10px;
    padding: 15px 25px;
    color: #ffffff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========== AI LOADING OVERLAY (fullscreen during generation) ========== */

.ai-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 16, 0.95);
    backdrop-filter: blur(8px);
}

.ai-loading-overlay.hidden {
    display: none;
}

.ai-loading-content {
    text-align: center;
    max-width: 360px;
    padding: 40px;
}

.ai-loading-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: ai-icon-pulse 2s ease-in-out infinite;
}

@keyframes ai-icon-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

.ai-loading-content h2 {
    color: var(--retro-cyan, #00ffff);
    font-size: 1.4rem;
    margin: 0 0 8px;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.ai-loading-planet {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin: 0 0 24px;
}

.ai-banner-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.ai-banner-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--retro-cyan, #00ffff), var(--retro-magenta, #ff00ff));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ai-banner-status {
    color: var(--retro-cyan, #00ffff);
    font-size: 1.1rem;
    font-weight: bold;
}

/* ========== DESKTOP 1.5x GALAXY SCREEN ========== */
@media (min-width: 769px) {
    #galaxy-screen {
        padding: 30px;
    }

    .galaxy-header {
        max-width: 1350px;
        margin-bottom: 30px;
        gap: 22px;
    }

    .galaxy-title {
        font-size: 3rem;
    }

    .rank-display {
        padding: 12px 22px;
        min-width: 225px;
        gap: 15px;
    }

    .rank-icon {
        font-size: 2.25rem;
    }

    .rank-name {
        font-size: 1.35rem;
    }

    .rank-progress-bar {
        height: 9px;
    }

    .credits-display {
        font-size: 1.65rem;
        gap: 15px;
    }

    .credits-display .credits-icon {
        font-size: 1.8rem;
    }

    .galaxy-map-container {
        max-width: 1350px;
    }

    .galaxy-actions {
        gap: 22px;
        margin-top: 30px;
    }

    .galaxy-btn {
        font-size: 1.5rem;
        padding: 18px 38px;
    }
}

/* ========== STATS POPUP ========== */

.stats-content {
    max-width: 420px;
    text-align: left;
}

.stats-content h3 {
    text-align: center;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-bottom: 20px;
}

.stats-section {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-full {
    grid-column: 1 / -1;
}

.stats-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #00ffff;
    opacity: 0.6;
    margin-bottom: 4px;
}

.stats-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #eee;
}

.stats-highlight {
    color: #ffff00;
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.5);
    font-size: 1.3rem;
}

.stats-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 6px 0;
    overflow: hidden;
}

.stats-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #ff00ff);
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 0;
}

.stats-jokers {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.stats-joker-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.9rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    color: #ddd;
}

.stats-content .main-btn-wrapper {
    margin-top: 10px;
}

/* ==================== HORST MESSAGE COMPONENT ==================== */

.horst-message-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1800;
    animation: horstMsgFadeIn 0.4s ease-out;
    padding: 20px;
}

.horst-message-overlay.no-bg {
    background: transparent;
}

.horst-message-overlay.hidden {
    display: none;
}

.horst-message-overlay.fade-out {
    animation: horstMsgFadeOut 0.3s ease-in forwards;
}

@keyframes horstMsgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes horstMsgFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.horst-message-box {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 600px;
    width: 100%;
}

.horst-portrait-frame {
    flex-shrink: 0;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 3px solid var(--neon-cyan, #00f0ff);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.1);
    overflow: hidden;
    background: #0a0a1a;
}

.horst-portrait-frame.speaking {
    animation: horstSpeakGlow 1.2s ease-in-out infinite alternate;
}

@keyframes horstSpeakGlow {
    0% {
        border-color: var(--neon-cyan, #00f0ff);
        box-shadow: 0 0 15px rgba(0, 240, 255, 0.5), 0 0 30px rgba(0, 240, 255, 0.2);
    }
    100% {
        border-color: var(--neon-magenta, #ff00ff);
        box-shadow: 0 0 15px rgba(255, 0, 255, 0.5), 0 0 30px rgba(255, 0, 255, 0.2);
    }
}

.horst-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.horst-speech-bubble {
    position: relative;
    background: rgba(10, 10, 30, 0.9);
    border: 2px solid var(--neon-magenta, #ff00ff);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
    flex: 1;
}

.horst-speech-bubble.hidden {
    display: none;
}

/* Speech bubble arrow pointing to portrait */
.horst-speech-bubble::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid var(--neon-magenta, #ff00ff);
}

.horst-speech-bubble::after {
    content: '';
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 10px solid rgba(10, 10, 30, 0.9);
}

.horst-speech-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.6rem;
    font-weight: 500;
    color: #e0e0e0;
    line-height: 1.4;
    margin: 0;
}

.horst-speech-text .typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--neon-cyan, #00f0ff);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: typingBlink 0.6s step-end infinite;
}

@keyframes typingBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Mobile: portrait above text */
@media (max-width: 600px) {
    .horst-message-box {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .horst-portrait-frame {
        width: 120px;
        height: 120px;
    }

    .horst-speech-bubble::before,
    .horst-speech-bubble::after {
        display: none;
    }

    .horst-speech-text {
        font-size: 1.3rem;
    }
}
