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

body {
    font-family: 'Orbitron', 'Arial', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gameCanvas {
    display: block;
    background: #000;
    width: 100%;
    height: 100%;
}

#ui {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    font-size: 14px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#hud {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 2px solid rgba(0, 150, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.3);
    min-width: 200px;
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.score-stat {
    margin: 0;
    flex: 1;
}

.audio-controls {
    display: flex;
    gap: 5px;
    margin: 0 10px;
}

.audio-toggle {
    background: rgba(0, 150, 255, 0.3);
    border: 1px solid rgba(0, 150, 255, 0.5);
    color: #66aaff;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    line-height: 1;
    min-width: 32px;
}

.audio-toggle:hover {
    background: rgba(0, 150, 255, 0.5);
    border-color: rgba(0, 150, 255, 0.8);
}

.autopilot-toggle {
    background: rgba(0, 150, 255, 0.3);
    border: 1px solid rgba(0, 150, 255, 0.5);
    color: #66aaff;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    margin: 0 5px;
    min-width: 100px;
}

.autopilot-toggle:hover {
    background: rgba(0, 150, 255, 0.5);
    border-color: rgba(0, 150, 255, 0.8);
}

.autopilot-toggle.active {
    background: rgba(0, 255, 0, 0.3);
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.autopilot-toggle.active #autopilotStatus {
    color: #00ff00;
}

.training-toggle {
    background: rgba(255, 165, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.5);
    color: #ffaa44;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    margin: 0 5px;
    min-width: 100px;
}

.training-toggle:hover {
    background: rgba(255, 165, 0, 0.5);
    border-color: rgba(255, 165, 0, 0.8);
}

.training-toggle.active {
    background: rgba(255, 200, 0, 0.4);
    border-color: rgba(255, 200, 0, 0.9);
    box-shadow: 0 0 10px rgba(255, 200, 0, 0.5);
}

.training-toggle.active #trainingStatus {
    color: #ffcc00;
}

.training-stats {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.training-stats h3 {
    color: #ffaa44;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.training-stats.hidden {
    display: none;
}

.hud-toggle {
    background: rgba(0, 150, 255, 0.3);
    border: 1px solid rgba(0, 150, 255, 0.5);
    color: #66aaff;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    margin-left: 10px;
}

.hud-toggle:hover {
    background: rgba(0, 150, 255, 0.5);
    border-color: rgba(0, 150, 255, 0.8);
}

.hud-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 500px;
    opacity: 1;
}

.hud-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.stat {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.bar {
    width: 150px;
    height: 22px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fill {
    height: 100%;
    transition: width 0.3s;
    border-radius: 11px;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.health-bar .fill {
    background: linear-gradient(90deg, #ff0000, #ff6666, #ff0000);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.shield-bar .fill {
    background: linear-gradient(90deg, #0066ff, #66aaff, #0066ff);
    box-shadow: 0 0 10px rgba(0, 102, 255, 0.5);
}

#weapons {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid rgba(255, 200, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 200, 0, 0.3);
}

.weapon-info {
    margin: 8px 0;
    font-size: 12px;
    font-weight: bold;
}

.cooldown-bar {
    width: 150px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cooldown-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffff00, #ffaa00);
    transition: width 0.1s;
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(255, 255, 0, 0.6);
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    z-index: 100;
    border: 3px solid #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

#gameOver.hidden {
    display: none;
}

#gameOver h2 {
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    color: #ff0000;
}

#gameOver p {
    font-size: 20px;
    margin-bottom: 10px;
}

#gameOver p.new-high-score {
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: pulse 1s ease-in-out infinite;
}

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

#gameOver button {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #0066ff, #0044aa);
    color: white;
    border: 2px solid #00aaff;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
    transition: all 0.3s;
}

#gameOver button:hover {
    background: linear-gradient(135deg, #0088ff, #0066cc);
    box-shadow: 0 0 25px rgba(0, 170, 255, 0.8);
    transform: scale(1.05);
}

#upgradeMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #0066ff;
    box-shadow: 0 0 30px rgba(0, 102, 255, 0.5);
    z-index: 100;
    min-width: 350px;
}

#upgradeMenu.hidden {
    display: none;
}

#upgradeMenu h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: #66aaff;
    text-shadow: 0 0 10px rgba(102, 170, 255, 0.8);
}

#upgradeOptions {
    margin: 20px 0;
}

.upgrade-option {
    padding: 15px;
    margin: 10px 0;
    background: rgba(0, 102, 255, 0.2);
    border: 2px solid #0066ff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(0, 102, 255, 0.3);
}

.upgrade-option:hover {
    background: rgba(0, 102, 255, 0.4);
    border-color: #00aaff;
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.6);
    transform: translateX(5px);
}

.upgrade-option h4 {
    margin-bottom: 5px;
    color: #66aaff;
    font-size: 16px;
}

.upgrade-option p {
    font-size: 12px;
    color: #aaa;
}

#closeUpgrade {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 14px;
    background: rgba(51, 51, 51, 0.8);
    color: white;
    border: 2px solid #666;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
}

#closeUpgrade:hover {
    background: rgba(68, 68, 68, 0.9);
    border-color: #888;
}

#missionBriefing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    z-index: 100;
    border: 3px solid #0066ff;
    box-shadow: 0 0 30px rgba(0, 102, 255, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#missionBriefing.hidden {
    display: none;
}

#missionBriefing h2 {
    margin-bottom: 20px;
    font-size: 28px;
    color: #66aaff;
}

#missionBriefing h3 {
    font-size: 20px;
    color: #66aaff;
    margin-bottom: 15px;
    margin-top: 0;
}

.briefing-tagline {
    color: #ccc;
    font-size: 15px;
    margin-bottom: 20px;
}

.briefing-section {
    margin: 20px auto;
    padding: 20px;
    background: rgba(0, 30, 80, 0.4);
    border: 1px solid rgba(0, 120, 255, 0.3);
    border-radius: 10px;
    text-align: left;
    max-width: 520px;
}

.briefing-section ul {
    margin: 10px 0 0 18px;
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
}

.briefing-section li {
    margin: 4px 0;
}

.instructions {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 50, 100, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(0, 150, 255, 0.3);
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.instructions-content {
    margin-bottom: 15px;
}

.instructions p {
    margin: 8px 0;
    font-size: 14px;
    color: #ccc;
    line-height: 1.5;
}

.instructions strong {
    color: #66aaff;
}

.gameplay-tips {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 150, 255, 0.3);
}

.gameplay-tips p {
    margin-bottom: 8px;
}

.gameplay-tips ul {
    margin: 8px 0;
    padding-left: 20px;
    color: #ccc;
    font-size: 14px;
}

.gameplay-tips li {
    margin: 5px 0;
    line-height: 1.4;
}

/* Show desktop instructions by default, hide mobile */
.mobile-instructions {
    display: none;
}

.desktop-instructions {
    display: block;
}

.mode-btn {
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #0066ff, #0044aa);
    color: white;
    border: 2px solid #00aaff;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
    transition: all 0.3s;
}

.mode-btn:hover {
    background: linear-gradient(135deg, #0088ff, #0066cc);
    box-shadow: 0 0 25px rgba(0, 170, 255, 0.8);
    transform: scale(1.05);
}

#missionComplete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    z-index: 100;
    border: 3px solid #00ff00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

#missionComplete.hidden {
    display: none;
}

#missionComplete h2 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #00ff00;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
}

#missionComplete p {
    font-size: 20px;
    margin: 10px 0;
}

#missionRestartBtn {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #00ff00, #00aa00);
    color: white;
    border: 2px solid #00ff88;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    transition: all 0.3s;
}

#missionRestartBtn:hover {
    background: linear-gradient(135deg, #00ff88, #00cc00);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.8);
    transform: scale(1.05);
}

#commandModule {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #00ff00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
    z-index: 100;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

#commandModule.hidden {
    display: none;
}

#commandModule h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #00ff00;
    font-size: 28px;
}

.command-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #00aa00;
}

.command-tab {
    flex: 1;
    padding: 10px 20px;
    background: rgba(0, 50, 0, 0.3);
    border: 2px solid #00aa00;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: #00ff00;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.command-tab:hover {
    background: rgba(0, 100, 0, 0.5);
}

.command-tab.active {
    background: rgba(0, 150, 0, 0.5);
    border-color: #00ff00;
    color: #00ff88;
}

.command-tab-content {
    display: block;
}

.command-tab-content.hidden {
    display: none;
}

.store-item {
    background: rgba(0, 50, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #00aa00;
    margin-bottom: 15px;
}

.store-item h3 {
    color: #00ff00;
    margin-bottom: 10px;
    font-size: 20px;
}

.store-item p {
    margin: 5px 0;
    color: #aaa;
}

#crewInfo {
    background: rgba(0, 100, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

#crewInfo p {
    margin: 5px 0;
    font-size: 18px;
}

.recruit-btn {
    margin-top: 10px;
    padding: 10px 20px;
    font-size: 16px;
    background: linear-gradient(135deg, #00ff00, #00aa00);
    color: white;
    border: 2px solid #00ff88;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.recruit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00ff88, #00cc00);
    transform: scale(1.05);
}

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

#stations {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.station {
    background: rgba(0, 50, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #00aa00;
}

.station h3 {
    color: #00ff00;
    margin-bottom: 10px;
    font-size: 20px;
}

.crew-assigned {
    margin: 10px 0;
}

.crew-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    min-height: 30px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}


.crew-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 40px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    border: 1px dashed #00aa00;
}

/* Legacy station styles for cargo ship */
#stations {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.station {
    background: rgba(0, 50, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #00aa00;
}

.station h3 {
    color: #00ff00;
    margin-bottom: 10px;
    font-size: 20px;
}

.crew-assigned {
    margin: 10px 0;
}

.crew-member {
    width: 37.5px;
    height: 37.5px;
    background: transparent;
    border-radius: 0;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: none;
    overflow: hidden;
    position: relative;
    transition: all 0.2s;
    user-select: none;
}

.crew-member:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.crew-member.dragging {
    opacity: 0.5;
}

.effect {
    color: #aaa;
    font-size: 12px;
    margin-top: 5px;
}

#availableCrew {
    background: rgba(0, 50, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

#availableCrew h3 {
    color: #00ff00;
    margin-bottom: 10px;
}

.crew-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 40px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

#closeCommandModule {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: rgba(51, 51, 51, 0.8);
    color: white;
    border: 2px solid #666;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#closeCommandModule:hover {
    background: rgba(68, 68, 68, 0.9);
    border-color: #888;
}

/* Mobile Controls - Hidden by default (desktop) */
.mobile-controls {
    display: none;
}

.mobile-weapon-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.mobile-weapon-btn {
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Orbitron', 'Arial', sans-serif;
    background: linear-gradient(135deg, rgba(255, 200, 0, 0.9), rgba(255, 150, 0, 0.9));
    color: white;
    border: 2px solid rgba(255, 220, 0, 0.8);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 200, 0, 0.5);
    transition: all 0.2s;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-weapon-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(255, 200, 0, 0.3);
}

.mobile-weapon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.9), rgba(80, 80, 80, 0.9));
    border-color: rgba(150, 150, 150, 0.8);
}

.weapon-label {
    font-size: 14px;
    font-family: 'Orbitron', 'Arial', sans-serif;
}

.weapon-ammo {
    font-size: 18px;
    font-weight: bold;
}

.mobile-command-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Orbitron', 'Arial', sans-serif;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.9), rgba(0, 200, 0, 0.9));
    color: white;
    border: 2px solid rgba(0, 255, 136, 0.8);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.5);
    transition: all 0.2s;
    z-index: 50;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-command-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 255, 0, 0.3);
}

/* Mobile Rotation Controls */
.mobile-rotation-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    z-index: 50;
}

.mobile-rotate-btn {
    width: 60px;
    height: 60px;
    background: rgba(0, 150, 255, 0.3);
    border: 2px solid rgba(0, 150, 255, 0.5);
    border-radius: 50%;
    color: #66aaff;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 150, 255, 0.3);
}

.mobile-rotate-btn:active {
    background: rgba(0, 150, 255, 0.6);
    border-color: rgba(0, 150, 255, 0.9);
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 150, 255, 0.5);
}

/* Mobile Tractor Beam Button */
.mobile-tractor-btn {
    position: fixed;
    bottom: 180px;
    right: 20px;
    padding: 12px 20px;
    margin: 0;
    background: rgba(150, 0, 255, 0.3);
    border: 2px solid rgba(150, 0, 255, 0.5);
    border-radius: 10px;
    color: #aa66ff;
    font-size: 16px;
    font-family: 'Orbitron', 'Arial', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
    -webkit-user-select: none;
    z-index: 50;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 15px rgba(150, 0, 255, 0.3);
}

.mobile-tractor-btn:active {
    background: rgba(150, 0, 255, 0.6);
    border-color: rgba(150, 0, 255, 0.9);
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(150, 0, 255, 0.5);
}

.mobile-tractor-btn.active {
    background: rgba(150, 0, 255, 0.6);
    border-color: rgba(150, 0, 255, 0.9);
    box-shadow: 0 0 20px rgba(150, 0, 255, 0.7);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) and (hover: none) {
    /* Show mobile controls on touch devices */
    .mobile-controls {
        display: block;
    }
    
    /* Show mobile instructions, hide desktop */
    .mobile-instructions {
        display: block;
    }
    
    .desktop-instructions {
        display: none;
    }
    
    /* Make UI elements larger and more touch-friendly */
    #ui {
        font-size: 16px;
    }
    
    /* Hide HUD and weapons display on mobile (they have mobile-specific controls) */
    #hud {
        display: none;
    }
    
    #weapons {
        display: none;
    }
    
    /* Hide HUD toggle on mobile since HUD is hidden */
    .hud-toggle {
        display: none;
    }
    
    .stat {
        margin: 6px 0;
        font-size: 14px;
    }
    
    .bar {
        width: 120px;
        height: 20px;
    }
    
    #weapons {
        padding: 12px;
        max-width: calc(100vw - 100px);
    }
    
    .weapon-info {
        font-size: 13px;
        margin: 6px 0;
    }
    
    .cooldown-bar {
        width: 120px;
    }
    
    /* Make buttons larger on mobile */
    #gameOver button,
    #upgradeMenu button,
    #closeUpgrade,
    .mode-btn,
    #missionRestartBtn,
    .recruit-btn,
    #closeCommandModule {
        padding: 15px 25px;
        font-size: 18px;
        min-height: 48px;
    }
    
    /* Adjust modal sizes for mobile */
    #upgradeMenu,
    #missionBriefing,
    #gameOver,
    #missionComplete {
        width: 90vw;
        max-width: 400px;
        padding: 25px;
        max-height: 85vh;
        overflow-y: auto;
        overflow-x: hidden;
        top: 50%;
        transform: translate(-50%, -50%);
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Mobile instructions styling */
    .instructions {
        padding: 15px;
        font-size: 13px;
    }
    
    .instructions p {
        font-size: 13px;
        margin: 6px 0;
    }
    
    .instructions h3 {
        font-size: 18px;
    }
    
    .gameplay-tips ul {
        font-size: 12px;
    }
    
    #commandModule {
        width: 95vw;
        max-width: 95vw;
        padding: 20px;
        max-height: 85vh;
    }
    
    #commandModule h2 {
        font-size: 24px;
    }
    
    #stations {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .station {
        padding: 12px;
    }
    
    .station h3 {
        font-size: 18px;
    }
    
    .crew-member {
        width: 45px;
        height: 45px;
        font-size: 14px;
    }
}

/* Additional mobile optimizations for very small screens */
@media (max-width: 480px) and (hover: none) {
    #ui {
        font-size: 14px;
        top: 5px;
        left: 5px;
    }
    
    #hud {
        padding: 10px;
        max-width: calc(100vw - 80px);
    }
    
    .stat {
        margin: 4px 0;
        font-size: 12px;
    }
    
    .bar {
        width: 100px;
        height: 18px;
    }
    
    #weapons {
        padding: 10px;
        max-width: calc(100vw - 80px);
    }
    
    .weapon-info {
        font-size: 11px;
    }
    
    .cooldown-bar {
        width: 100px;
    }
    
    .mobile-weapon-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-width: 80px;
    }
    
    .weapon-label {
        font-size: 12px;
    }
    
    .weapon-ammo {
        font-size: 16px;
    }
    
    .mobile-command-btn {
        padding: 12px 20px;
        font-size: 16px;
        top: 10px;
        right: 10px;
    }
}

