body {
    margin: 0;
    padding: 0;
    background-color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

#gameContainer {
    position: relative;
    display: flex;
    border: 2px solid #3498db;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background-color: #34495e;
    padding: 10px;
    width: 1220px;
    height: 620px;
    margin-top: 10px;
    margin-bottom: 0;
}

#gameCanvas {
    background-color: #1a252f;
    display: block;
    width: 1000px;
    height: 600px;
    margin: 0;
}

#flyingAd {
    position: absolute;
    top: 10px;
    left: -1000px;
    z-index: 10;
    pointer-events: none;
    transition: left 5s linear;
    height: 60px; /* Adjustable based on ad size */
}

#sidebar {
    width: 200px;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    padding: 10px;
    border-right: 2px solid #00ffff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: inset 0 0 20px rgba(0, 255, 255, 0.1);
}

#sidebar button {
    background: linear-gradient(145deg, #0f3460, #1e3c72);
    border: none;
    padding: 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

#sidebar button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.2);
    background: linear-gradient(145deg, #1e3c72, #2a5298);
}

#sidebar button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#sidebar button:hover::before {
    left: 100%;
}

.icon {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
    display: block;
    margin: 0 auto;
}

#pageHeader {
    width: 100%;
    text-align: center;
    padding: 10px 0;
    background: transparent;
}

#logo {
    display: block;
    margin: 0 auto;
    width: 400px;
    height: auto;
    pointer-events: none;
}

#bottomButtons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    padding: 10px;
}

.futuristic-btn {
    background: linear-gradient(145deg, #0f3460, #1e3c72);
    color: #00ffff;
    border: none;
    padding: 15px 30px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
}

.futuristic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.2);
    background: linear-gradient(145deg, #1e3c72, #2a5298);
}

.futuristic-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.futuristic-btn:hover::before {
    left: 100%;
}

#pageFooter {
    background: #34495e;
    width: 100%;
    padding: 20px;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid #2c3e50;
}

#pageFooter #bottomButtons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #34495e;
    margin: auto;
    padding: 0;
    border: 2px solid #00ffff;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(145deg, #1e3c72, #2a5298);
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #00ffff;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #00ffff;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
}

.close:hover,
.close:focus {
    color: red;
    text-decoration: none;
}

.modal-body {
    padding: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 10px;
    color: white;
    font-weight: bold;
}

.modal-body input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #00ffff;
    border-radius: 5px;
    background-color: #2c3e50;
    color: white;
    box-sizing: border-box;
}

.modal-body input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

#message.success {
    color: #27ae60;
    background-color: rgba(39, 174, 96, 0.1);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #27ae60;
}

#message.error {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #e74c3c;
}

@media (max-width: 1300px) {
    #gameContainer {
        width: calc(100vw - 40px);
        max-width: 1220px;
    }
}

/* Inventory modal specific overrides */
#inventoryModal .modal-content {
    max-width: 800px;
    width: 90%;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* 6 columns x 5 rows = 30 slots */
    gap: 12px;
    justify-items: center;
}

.inventory-grid .slot {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #8d6e63, #a98274); /* cube-ish leather tone */
    border: 3px solid #f5e6c8; /* light frame like the reference */
    border-radius: 12px;
    box-shadow: 0 4px 0 rgba(0,0,0,0.4), inset 0 0 6px rgba(0,0,0,0.3);
}

@media (max-width: 600px) {
    .inventory-grid .slot {
        width: 56px;
        height: 56px;
    }
    #inventoryModal .modal-content {
        max-width: 95%;
    }
}

/* In-game lower-right buttons */
#inGameButtons {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20; /* Above canvas, below modal */
}

.in-game-btn {
    background: linear-gradient(145deg, #0f3460, #1e3c72);
    color: #00ffff;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    outline: none;
}

.in-game-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.6), inset 0 0 18px rgba(0, 255, 255, 0.2);
    background: linear-gradient(145deg, #1e3c72, #2a5298);
}

.in-game-btn:active {
    transform: translateY(0);
}

.in-game-btn .icon-planet {
    display: inline-flex;
    line-height: 0;
    filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
}

/* Galaxy modal sizing and inner UI */
.modal-content.galaxy {
    max-width: 1100px;
    width: 95%;
}

.galaxy-canvas-container {
    width: 100%;
    height: 600px;
    background: radial-gradient(ellipse at center, #0b1220 0%, #060a12 100%);
    border: 1px solid #00ffff;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.galaxy-info {
    color: #00ffff;
    font-weight: 600;
    margin-bottom: 10px;
    min-height: 22px;
    text-shadow: 0 0 8px rgba(0,255,255,0.4);
}

@media (max-width: 1024px) {
    .galaxy-canvas-container {
        height: 480px;
    }
}

@media (max-width: 600px) {
    #inGameButtons {
        right: 10px;
        bottom: 10px;
        gap: 8px;
    }
    .in-game-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    .galaxy-canvas-container {
        height: 360px;
    }
}

/* Planet details panel in Galaxy modal */
.planet-details {
    margin: 8px 0 12px;
    padding: 12px 14px;
    border: 1px solid #00ffff;
    border-radius: 12px;
    background: rgba(10, 20, 35, 0.85);
    color: #e6faff;
    box-shadow: inset 0 0 12px rgba(0, 255, 255, 0.08), 0 2px 12px rgba(0, 0, 0, 0.4);
}

.planet-details .name {
    font-size: 18px;
    font-weight: 700;
    color: #00ffff;
    margin-bottom: 6px;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

.planet-details .desc {
    font-size: 14px;
    line-height: 1.5;
    color: #d6f1ff;
    margin-bottom: 10px;
}

/* Dock button styling */
.dock-btn {
    background: linear-gradient(145deg, #0f3460, #1e3c72);
    color: #00ffff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1);
    font-weight: 700;
    font-size: 14px;
    outline: none;
}

.dock-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.6), inset 0 0 18px rgba(0, 255, 255, 0.2);
    background: linear-gradient(145deg, #1e3c72, #2a5298);
}

.dock-btn:active {
    transform: translateY(0);
}
