/* --- CSS STYLES --- */
html, body { 
    margin: 0; padding: 0; 
    width: 100%; height: 100%; 
    overflow: hidden; 
    background-color: #d2b48c; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    user-select: none; 
}

canvas { touch-action: none; display: block; }

/* Portrait Mode Warning Banner */
#portrait-banner {
    display: none;
    background-color: #ffcc00;
    color: #000;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

@media screen and (orientation: portrait) {
    #portrait-banner { display: block; }
    #home-link, .pause-btn { top: 50px !important; }
}

#game-ui { display: none; position: absolute; top: 10px; left: 10px; z-index: 10; color: white; text-shadow: 1px 1px 3px black; pointer-events: none; }
#status-bar { display: flex; gap: 15px; font-size: 18px; margin-bottom: 5px; font-weight: bold; }
#health-bar-container { width: 220px; height: 22px; background-color: rgba(0,0,0,0.8); border: 2px solid white; border-radius: 4px; overflow: hidden; transition: all 0.2s ease-out; }
#health-bar { width: 100%; height: 100%; background-color: #00ff00; transition: width 0.1s, background-color 0.3s; }

.damage-flash { box-shadow: 0 0 20px 8px rgba(255, 0, 0, 0.9) !important; border-color: #ff3333 !important; transform: scale(1.02); }

#mode-indicator { font-size: 20px; font-weight: bold; color: #ffcc00; margin-top: 5px; display: none; }

#home-link { position: absolute; top: 15px; right: 15px; z-index: 20; background: #b30000; color: white; padding: 10px 15px; text-decoration: none; border-radius: 5px; font-weight: bold; border: 2px solid white; pointer-events: auto; box-shadow: 0 4px 6px rgba(0,0,0,0.5); font-size: 16px; transition: top 0.3s;}
.pause-btn { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); z-index: 20; padding: 10px 20px; font-size: 16px; display: none; transition: top 0.3s; }

#mobile-controls { 
    display: none; position: absolute; bottom: 20px; left: 0; width: 100%; 
    padding: 0 30px; box-sizing: border-box; 
    justify-content: space-between; align-items: flex-end; 
    z-index: 15; pointer-events: none; 
    touch-action: none; 
}
#d-pad-wrapper { display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.d-pad-row { display: flex; gap: 8px; justify-content: center; }

.ctrl-btn, .fake-btn { width: 70px; height: 70px; font-size: 32px; font-weight: bold; background-color: rgba(0, 0, 0, 0.7); color: white; border: 2px solid #ddd; border-radius: 12px; cursor: pointer; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 6px rgba(0,0,0,0.5); pointer-events: auto; }
.ctrl-btn:active { background-color: rgba(80, 80, 80, 0.9); transform: scale(0.95); }
#btn-shield { width: 160px; height: 80px; font-size: 22px; margin-top: 0; background-color: #0056b3; }
#btn-shield:active, .shield-active { background-color: #28a745 !important; box-shadow: inset 0 4px 6px rgba(0,0,0,0.7); }

.overlay { 
    position: absolute; 
    inset: 0; 
    background: rgba(0,0,0,0.85); 
    z-index: 30; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    touch-action: auto; 
    padding: 20px;
    box-sizing: border-box;
}

.overlay-content {
    margin: auto; 
    text-align: center;
    width: 100%;
    max-width: 600px;
    color: white;
}

h1 { font-size: 46px; color: #ffcc00; margin: 0 0 10px 0; text-shadow: 2px 2px 4px black; }
p { font-size: 20px; line-height: 1.5; margin-bottom: 10px; }
#transition-desc { font-size: 24px; color: #ddd; }
#transition-title { font-size: 54px; }
#transition-timer { font-size: 24px; color: #ffcc00; margin-top: 20px; }

.action-btn { margin-top: 20px; padding: 15px 35px; font-size: 24px; font-weight: bold; cursor: pointer; background-color: #28a745; color: white; border: 2px solid white; border-radius: 8px; box-shadow: 0 4px 8px black; transition: 0.1s; pointer-events: auto;}
.action-btn:active { transform: scale(0.95); }

.tutorial-box { background: rgba(255,255,255,0.1); padding: 15px; border-radius: 10px; border: 1px solid #555; margin-bottom: 15px; }
.fake-btn { width: 40px; height: 40px; font-size: 18px; display: inline-flex; pointer-events: none;}
.shield-fake { width: 150px; height: 40px; font-size: 16px; background-color: #0056b3; margin: 0 auto;}

#intro-screen { display: flex; }
#level-transition { display: none; background: rgba(0,0,0,0.9); }
#game-over-screen { display: none; }

@media (max-height: 600px), (max-width: 600px) {
    h1 { font-size: 32px !important; margin-bottom: 5px; }
    p { font-size: 16px; margin-bottom: 5px;}
    .tutorial-box { padding: 10px; margin-bottom: 10px; }
    .action-btn { padding: 10px 25px; font-size: 20px; margin-top: 10px;}
    #transition-desc { font-size: 18px; }
    #transition-timer { font-size: 18px; margin-top: 10px; }
    .ctrl-btn { width: 60px; height: 60px; font-size: 24px; }
    #btn-shield { width: 130px; height: 70px; font-size: 18px; }
    #mobile-controls { padding: 0 15px; bottom: 10px; }
}
