/* Space Trading Adventure - Ultra-Clean Sci-Fi Aesthetic */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
}

/* HUD Overlay */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

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

/* Glassmorphism Panel Base */
.hud-panel {
    background: rgba(10, 20, 40, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(100, 150, 255, 0.1);
    padding: 16px;
}

/* Status Bar */
#status-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 24px;
    padding: 12px 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-item .label {
    color: #8AB4F8;
    font-size: 14px;
    font-weight: 500;
}

.status-item .value {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(138, 180, 248, 0.5);
}

/* Controls Help */
#controls-help {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
}

.help-title {
    font-size: 14px;
    font-weight: 700;
    color: #8AB4F8;
    margin-bottom: 8px;
}

.help-item {
    font-size: 12px;
    color: #B8D4FF;
    margin-bottom: 4px;
}

/* Discovery Card */
#discovery-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#discovery-card.discovery-hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    pointer-events: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.3);
}

.card-header h2 {
    font-size: 24px;
    color: #8AB4F8;
    text-shadow: 0 0 15px rgba(138, 180, 248, 0.6);
}

.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    line-height: 1;
}

.close-btn:hover {
    opacity: 1;
}

.planet-visual {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    box-shadow: 0 0 40px rgba(138, 180, 248, 0.5);
}

.planet-stats {
    margin-bottom: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(100, 150, 255, 0.1);
}

.stat-label {
    color: #8AB4F8;
    font-size: 14px;
}

.stat-value {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.planet-description {
    color: #B8D4FF;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Market HUD */
#market-hud {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#market-hud.market-hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
    pointer-events: none;
}

.market-section {
    margin-bottom: 20px;
}

.market-section h3 {
    color: #8AB4F8;
    font-size: 16px;
    margin-bottom: 12px;
}

.trade-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trade-item {
    background: rgba(20, 40, 80, 0.6);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trade-info {
    flex: 1;
}

.trade-resource {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.trade-price {
    font-size: 12px;
    color: #8AB4F8;
}

.trade-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.trade-input {
    width: 60px;
    padding: 4px 8px;
    background: rgba(10, 20, 40, 0.8);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    text-align: center;
}

.trade-btn {
    padding: 6px 12px;
    background: rgba(100, 150, 255, 0.2);
    border: 1px solid rgba(100, 150, 255, 0.4);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.trade-btn:hover {
    background: rgba(100, 150, 255, 0.4);
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.3);
}

.trade-btn:active {
    transform: scale(0.95);
}

/* Action Buttons */
.action-btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-content p {
    font-size: 18px;
    color: #8AB4F8;
    margin-bottom: 30px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(138, 180, 248, 0.2);
    border-top-color: #8AB4F8;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

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

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

#start-screen.hidden {
    display: none;
}

.start-content {
    text-align: center;
    padding: 40px;
    background: rgba(10, 20, 40, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.start-content h1 {
    font-size: 56px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 18px;
    color: #8AB4F8;
    margin-bottom: 30px;
}

#player-name {
    width: 300px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: rgba(10, 20, 40, 0.8);
    border: 2px solid rgba(100, 150, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    text-align: center;
    transition: border-color 0.3s;
}

#player-name:focus {
    outline: none;
    border-color: rgba(100, 150, 255, 0.6);
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.2);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 20, 40, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 150, 255, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 150, 255, 0.7);
}



/* Mobile-specific styles added to existing CSS */

.mobile-hint {
    font-size: 16px;
    color: #FFD700;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

/* Larger touch targets for mobile */
@media (max-width: 768px) {
    .action-btn {
        padding: 16px 32px;
        font-size: 18px;
        min-height: 56px;
    }
    
    .close-btn {
        font-size: 40px;
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .trade-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .trade-input {
        width: 70px;
        padding: 8px 12px;
        font-size: 16px;
        min-height: 44px;
    }
    
    #player-name {
        width: 90%;
        max-width: 350px;
        padding: 16px 24px;
        font-size: 18px;
        min-height: 56px;
    }
    
    /* Status bar adjustments */
    #status-bar {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 12px;
    }
    
    .status-item {
        font-size: 13px;
    }
    
    .status-item .value {
        font-size: 14px;
    }
    
    /* Controls help - make smaller on mobile */
    #controls-help {
        padding: 8px 12px;
        top: 10px;
        right: 10px;
    }
    
    .help-title {
        font-size: 12px;
    }
    
    .help-item {
        font-size: 11px;
    }
    
    /* Discovery card - full screen on small devices */
    #discovery-card {
        width: 95%;
        max-width: 500px;
    }
    
    /* Market HUD - adjust for mobile */
    #market-hud {
        width: 95%;
        right: 2.5%;
        max-width: 450px;
    }
    
    .card-header h2 {
        font-size: 20px;
    }
    
    /* Prevent text selection on touch */
    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    input, textarea {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* Tablet landscape optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    #status-bar {
        padding: 14px 18px;
    }
    
    #discovery-card {
        width: 70%;
        max-width: 600px;
    }
    
    #market-hud {
        width: 450px;
    }
}

/* Touch-friendly scrollbars on mobile */
@media (pointer: coarse) {
    ::-webkit-scrollbar {
        width: 12px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(100, 150, 255, 0.7);
        border-radius: 6px;
    }
}
