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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ad-banner {
  width: 100%;
  margin: 8px auto;
  text-align: center;   /* centers the ad horizontally */
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 2px;
}

.ad-top {
    margin-top: 5px;
    margin-bottom: 2px;
}

.ad-bottom {
    margin-top: 2px;
}

.game-container {
    position: relative;
    border: 3px solid #333;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: #000;
    margin: 2px 0;
    flex-shrink: 0;
}

#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    border-radius: 7px;
}

.ui-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    height: 45px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.hearts-container {
    display: flex;
    align-items: center;
}

.right-stats {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

#hearts {
    font-size: 36px;
    color: #ff0000;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.level, .exp, .weapon {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.weapon {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ff0000;
}

.level {
    background: rgba(255, 215, 0, 0.8);
    color: #000;
}


.exp {
    background: rgba(0, 150, 255, 0.8);
}

.controls-left {
    position: absolute;
    top: 50%;
    left: -200px;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
}

.info-right {
    position: absolute;
    top: 50%;
    right: -250px;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
}

.controls-box {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

.controls-box h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #4CAF50;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 5px;
}

.controls-box p {
    margin: 5px 0;
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
}

.controls-box p:last-child {
    margin-bottom: 0;
}

.info-box {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    max-width: 250px;
}

.info-box h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #4CAF50;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 4px;
}

.info-section {
    margin-bottom: 10px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h4 {
    display: none;
}

.info-section:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.enemy-item, .weapon-item, .pickup-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
    gap: 10px;
}

.enemy-item span, .weapon-item span, .pickup-item span {
    font-size: 12px;
    color: #ccc;
}

.enemy-sprite, .weapon-sprite, .pickup-sprite {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 20;
}

.game-over h2 {
    font-size: 32px;
    margin-bottom: 15px;
    color: #ff6b6b;
}

.game-over p {
    font-size: 18px;
    margin-bottom: 20px;
}

#restartBtn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s;
}

#restartBtn:hover {
    background: #45a049;
}

/* Mobile responsiveness */
@media (max-width: 850px) {
    .game-container {
        transform: scale(0.8);
    }
    
    .controls-left, .info-right {
        display: none;
    }
    
    .ad-banner {
        max-width: 100%;
        margin: 3px 10px;
        min-height: 60px;
        max-height: 200px;
        padding: 3px;
    }
}

@media (max-width: 680px) {
    .game-container {
        transform: scale(0.6);
    }
    
    .controls-left, .info-right {
        display: none;
    }
    
    .ad-banner {
        max-width: 100%;
        margin: 2px;
        padding: 2px;
        min-height: 50px;
        max-height: 150px;
    }
    
    .ad-top, .ad-bottom {
        margin: 2px 0;
    }
}
