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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    max-width: 100vw;
    max-height: 100vh;
    background-color: #1a1a1a;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
}

#header {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#header h1 {
    color: #ffd700;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#pi-user-info {
    color: #fff;
    font-size: 14px;
}

#pi-signin-btn {
    background: #7b3ff2;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
    pointer-events: auto;
}

#pi-signin-btn:hover {
    background: #6930d8;
}

#resource-display {
    position: absolute;
    top: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    min-width: 150px;
}

.resource-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0;
    color: #fff;
    font-size: 18px;
}

.resource-icon {
    font-size: 24px;
    margin-right: 10px;
}

#dialog-box {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    pointer-events: auto;
    z-index: 20;
}

#dialog-content {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
    min-height: 60px;
}

#dialog-continue {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#dialog-continue:hover {
    background: #ffed4e;
}

#upgrade-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ffd700;
    border-radius: 10px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
    z-index: 20;
}

#upgrade-panel h2 {
    color: #ffd700;
    margin-bottom: 20px;
    text-align: center;
}

.upgrade-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    color: #fff;
}

.upgrade-item h3 {
    color: #ffd700;
    margin-bottom: 5px;
}

.upgrade-cost {
    font-size: 14px;
    color: #aaa;
    margin: 5px 0;
}

.upgrade-button {
    background: #4caf50;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
}

.upgrade-button:hover {
    background: #45a049;
}

.upgrade-button:disabled {
    background: #666;
    cursor: not-allowed;
}

#close-upgrade {
    background: #f44336;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    width: 100%;
    font-weight: bold;
}

#close-upgrade:hover {
    background: #da190b;
}

#start-screen,
#game-complete {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    z-index: 30;
    pointer-events: auto;
}

#start-screen h1,
#game-complete h1 {
    color: #ffd700;
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

#start-screen p,
#game-complete p {
    font-size: 20px;
    margin-bottom: 30px;
}

#start-button,
#restart-button {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#start-button:hover,
#restart-button:hover {
    background: #ffed4e;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

/* Mobile controls */
@media (max-width: 768px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    #header h1 {
        font-size: 18px;
    }

    #resource-display {
        top: 60px;
        right: 10px;
        padding: 10px;
        min-width: 120px;
    }

    .resource-item {
        font-size: 16px;
    }

    .resource-icon {
        font-size: 20px;
    }
}
