* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    overflow: hidden;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: white;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#gameWrapper {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    position: relative;
}

#gameContainer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 150, 255, 0.4);
    background: rgba(10, 15, 30, 0.85);
}

#header {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-bottom: 2px solid #00f7ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#gameTitle {
    font-size: 28px;
    font-weight: 700;
    color: #00f7ff;
    text-shadow: 0 0 10px rgba(0, 247, 255, 0.7);
}

#stats {
    display: flex;
    gap: 20px;
}

.statBox {
    background: rgba(20, 30, 48, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 100px;
    border: 1px solid #4a4a8a;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.statLabel {
    font-size: 14px;
    color: #a0a0f0;
    margin-bottom: 5px;
}

.statValue {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

#mainContent {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#sidebar {
    width: 250px;
    background: rgba(10, 15, 30, 0.85);
    padding: 20px;
    border-right: 1px solid #2a2a5a;
    display: flex;
    flex-direction: column;
    gap: 25px;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
}

.panel {
    background: rgba(20, 30, 48, 0.8);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #4a4a8a;
}

.panelTitle {
    font-size: 18px;
    color: #00f7ff;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(0, 247, 255, 0.5);
}

.moduleType {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(40, 50, 80, 0.5);
    border: 1px solid transparent;
}

.moduleType:hover {
    background: rgba(60, 80, 140, 0.6);
    transform: translateY(-2px);
    border-color: #00f7ff;
}

.moduleType.selected {
    background: rgba(80, 120, 200, 0.7);
    border-color: #00f7ff;
    box-shadow: 0 0 10px rgba(0, 247, 255, 0.5);
}

.modulePreview {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 1px solid #333;
}

.moduleInfo {
    flex: 1;
}

.moduleName {
    font-weight: 600;
    font-size: 16px;
}

.moduleDesc {
    font-size: 12px;
    color: #a0a0f0;
    margin-top: 3px;
}

#gameCanvas {
    flex: 1;
    background: rgba(5, 8, 22, 0.9);
}

#controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.controlItem {
    background: rgba(40, 50, 80, 0.5);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    border: 1px solid #4a4a8a;
}

.key {
    display: inline-block;
    background: rgba(0, 0, 0, 0.6);
    padding: 3px 8px;
    border-radius: 4px;
    margin: 0 3px;
    border: 1px solid #555;
    font-weight: 600;
    color: #00f7ff;
}

#buildModeIndicator {
    position: absolute;
    top: 100px;
    right: 20px;
    background: rgba(200, 50, 50, 0.9);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.7);
    display: none;
    z-index: 10;
}

#gameOver {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    display: none;
}

#gameOver h1 {
    font-size: 48px;
    color: #ff3366;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 50, 100, 0.7);
}

#finalScore {
    font-size: 36px;
    margin-bottom: 30px;
}

#restartButton {
    background: linear-gradient(to right, #ff3366, #ff6699);
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(255, 50, 100, 0.7);
    transition: all 0.3s ease;
}

#restartButton:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 50, 100, 0.9);
}

#hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #00f7ff;
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.hud-label {
    font-size: 14px;
    color: #a0a0f0;
    margin-bottom: 5px;
}

.hud-value {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.hud-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.hud-fill {
    height: 100%;
    border-radius: 4px;
}

#powerBar .hud-fill {
    background: linear-gradient(to right, #00f7ff, #0077ff);
}

#healthBar .hud-fill {
    background: linear-gradient(to right, #00ff9d, #00b36b);
}

#scrapCount {
    color: #ffcc00;
}

#tutorial {
    position: absolute;
    top: 80px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    max-width: 300px;
    border: 1px solid #00f7ff;
    font-size: 14px;
    line-height: 1.5;
    z-index: 10;
    resize: none;
    min-width: 200px;
    min-height: 80px;
    width: 300px;
    height: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#tutorial-dragbar {
    cursor: move;
    background: rgba(0,0,0,0.2);
    padding: 4px 0 4px 10px;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    user-select: none;
}

#tutorial-content {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    overflow: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#tutorial-content h3 {
    display: none;
}

#tutorial-content ul {
    flex: 1 1 auto;
    width: 100%;
    margin: 0;
    padding-left: 20px;
    box-sizing: border-box;
    overflow: auto;
    word-break: break-word;
}

#tutorial-content li {
    margin-bottom: 8px;
    word-break: break-word;
}

#tutorial-resize {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    z-index: 11;
}

#tutorial-resize:after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-right: 2px solid #00f7ff;
    border-bottom: 2px solid #00f7ff;
    border-radius: 0 0 4px 0;
    box-sizing: border-box;
}

#tutorial h3 {
    color: #00f7ff;
    margin-bottom: 10px;
}

#tutorial ul {
    padding-left: 20px;
}

#tutorial li {
    margin-bottom: 8px;
}

.highlight {
    color: #ffcc00;
    font-weight: bold;
}