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

body {
    font-family: 'Courier New', monospace;
    background: #1a0a2e;
    color: #fff;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: radial-gradient(circle, #2d1b4e 0%, #1a0a2e 100%);
}

.screen.active {
    display: flex;
}

/* Start Screen */
#start-screen {
    background: linear-gradient(180deg, #1a0a2e 0%, #3d0a4e 50%, #1a0a2e 100%);
}

.title-container {
    margin-bottom: 2rem;
    text-align: center;
}

.game-title {
    max-width: 90%;
    width: 512px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px #ff6b00);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 20px #ff6b00); }
    to { filter: drop-shadow(0 0 30px #ff0066); }
}

.subtitle {
    font-size: 1.2rem;
    color: #ff9d00;
    text-shadow: 2px 2px #000;
    letter-spacing: 3px;
}

.pixel-btn {
    padding: 1rem 2rem;
    font-size: 1.5rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #ff6b00;
    color: #fff;
    border: 4px solid #000;
    border-radius: 0;
    cursor: pointer;
    text-shadow: 2px 2px #000;
    box-shadow: 4px 4px 0 #000;
    transition: all 0.1s;
    margin: 0.5rem;
}

.pixel-btn:hover {
    background: #ff9d00;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000;
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
}

.controls-info {
    margin-top: 2rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1.8;
}

.controls-info p {
    margin: 0.3rem 0;
}

.credits {
    position: absolute;
    bottom: 1rem;
    font-size: 0.9rem;
    color: #999;
}

/* Game Screen */
#game-screen {
    background: #000;
}

#canvas {
    display: block;
    background: #1a1a1a;
    border: 4px solid #ff6b00;
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.5);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 3px solid #ff6b00;
    z-index: 10;
}

.hud-icon {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.health-container, .score-container {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
}

#health-bar {
    width: 200px;
    height: 24px;
    background: #333;
    border: 2px solid #fff;
    margin-right: 0.5rem;
    position: relative;
}

#health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000 0%, #ff6b00 100%);
    width: 100%;
    transition: width 0.3s;
}

#score {
    color: #ff9d00;
    text-shadow: 2px 2px #000;
}

/* Message Display */
#message-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem 2rem;
    border: 3px solid #ff6b00;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    display: none;
    z-index: 100;
    animation: fadeInOut 2s;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    10%, 90% { opacity: 1; }
}

/* Inventory */
#inventory {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.inventory-slot {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-slot.active {
    border-color: #ff6b00;
    box-shadow: 0 0 10px #ff6b00;
}

.inventory-slot img {
    max-width: 90%;
    max-height: 90%;
}

/* Mobile Controls */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
}

#mobile-controls {
    position: absolute;
    bottom: 80px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 10;
}

.dpad {
    position: relative;
    width: 150px;
    height: 150px;
}

.dpad-btn {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 107, 0, 0.7);
    border: 2px solid #fff;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.dpad-btn.up { top: 0; left: 50px; }
.dpad-btn.down { bottom: 0; left: 50px; }
.dpad-btn.left { top: 50px; left: 0; }
.dpad-btn.right { top: 50px; right: 0; }

.action-btn {
    width: 80px;
    height: 80px;
    background: rgba(255, 0, 0, 0.7);
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

/* Game Over Screen */
#game-over-screen {
    background: linear-gradient(180deg, #1a0a2e 0%, #4e0a0a 50%, #1a0a2e 100%);
}

.game-over-image {
    max-width: 90%;
    width: 512px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 20px #ff0000);
}

.final-score {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

#final-score-value {
    font-size: 3rem;
    color: #ff9d00;
    text-shadow: 3px 3px #000;
}

.footer {
    position: absolute;
    bottom: 1rem;
    font-size: 0.9rem;
    color: #999;
}

.footer a {
    color: #ff9d00;
    text-decoration: none;
}

.footer a:hover {
    color: #ffc000;
}

/* Pause Screen */
#pause-screen {
    background: rgba(0, 0, 0, 0.95);
}

#pause-screen h2 {
    font-size: 3rem;
    margin-bottom: 2rem;
    color: #ff6b00;
    text-shadow: 3px 3px #000;
}

/* Responsive */
@media (max-width: 768px) {
    .pixel-btn {
        font-size: 1.2rem;
        padding: 0.8rem 1.5rem;
    }
    
    #hud {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    #health-bar {
        width: 100px;
    }
    
    .inventory-slot {
        width: 48px;
        height: 48px;
    }
}