@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800;900&family=MedievalSharp&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050608;
    font-family: 'Cinzel', serif;
    color: #e2d9c8;
}

#game-canvas {
    width: 100vw;
    height: 100vh;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Vignette & Gothic Atmospheric Overlay */
#vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle, transparent 50%, rgba(5, 4, 8, 0.75) 90%, rgba(2, 2, 4, 0.95) 100%);
    box-shadow: inset 0 0 100px rgba(138, 11, 11, 0.2);
}

/* Damage Flash Overlay */
#damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 3;
    background: radial-gradient(circle, transparent 40%, rgba(180, 0, 0, 0.6) 100%);
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

/* HUD Top Bar */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

.player-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 260px;
}

.bar-container {
    background: rgba(10, 10, 15, 0.85);
    border: 2px solid #3c3529;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8), inset 0 0 5px rgba(0, 0, 0, 0.9);
    border-radius: 4px;
    height: 18px;
    position: relative;
    overflow: hidden;
}

.health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #7a0c0c, #c01b1b, #e63946);
    box-shadow: 0 0 8px #ff2222;
    transition: width 0.15s ease;
}

.stamina-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #1b4965, #2a9d8f, #64dfdf);
    box-shadow: 0 0 8px #48cae4;
    transition: width 0.1s ease;
}

.bar-label {
    position: absolute;
    top: 0;
    left: 8px;
    font-size: 11px;
    line-height: 16px;
    font-weight: 800;
    color: #f1faee;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 1px;
}

.wave-badge {
    text-align: center;
}

.wave-title {
    font-size: 14px;
    color: #c9a227;
    text-shadow: 0 0 8px rgba(201, 162, 39, 0.6);
    letter-spacing: 2px;
}

.kill-counter {
    font-size: 22px;
    font-weight: 900;
    color: #e2d9c8;
    text-shadow: 0 0 10px rgba(180, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Mobile Virtual Touch Controls */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: auto;
}

/* Floating Left Joystick */
#joystick-zone {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50%;
    height: 70%;
}

#joystick-base {
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(40, 35, 45, 0.4) 0%, rgba(15, 12, 20, 0.7) 100%);
    border: 2px solid rgba(200, 170, 110, 0.4);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(200, 170, 110, 0.15);
    display: none;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#joystick-knob {
    position: absolute;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: radial-gradient(circle, #c9a227 0%, #684f12 100%);
    border: 2px solid #e2d9c8;
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Right Action Buttons Cluster */
#action-cluster {
    position: absolute;
    bottom: 30px;
    right: 25px;
    width: 220px;
    height: 220px;
}

.action-btn {
    position: absolute;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    text-shadow: 0 0 4px #000;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.2);
    transition: transform 0.08s ease, filter 0.08s ease;
    user-select: none;
}

.action-btn:active {
    transform: scale(0.92);
    filter: brightness(1.3);
}

/* Primary Attack Button (Claymore Slash) */
#btn-attack {
    bottom: 10px;
    right: 15px;
    width: 88px;
    height: 88px;
    background: radial-gradient(circle, #8a0b0b 0%, #3e0404 100%);
    border: 3px solid #c9a227;
    color: #ffdd80;
    font-size: 15px;
    box-shadow: 0 0 20px rgba(138, 11, 11, 0.7), inset 0 0 15px rgba(201, 162, 39, 0.4);
}

/* Dodge Roll Button */
#btn-roll {
    bottom: 25px;
    right: 120px;
    width: 68px;
    height: 68px;
    background: radial-gradient(circle, #1f2430 0%, #0d1117 100%);
    border: 2px solid #64dfdf;
    color: #64dfdf;
    font-size: 12px;
}

/* Holy Cleave Special Button */
#btn-special {
    bottom: 115px;
    right: 40px;
    width: 66px;
    height: 66px;
    background: radial-gradient(circle, #5e450b 0%, #201702 100%);
    border: 2px solid #e0b034;
    color: #fff275;
    font-size: 12px;
}

/* Wave Banner Announcement */
#banner-announcement {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#banner-announcement.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.banner-main {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #c9a227;
    text-shadow: 0 0 20px rgba(201, 162, 39, 0.9), 2px 2px 5px #000;
}

.banner-sub {
    font-size: 14px;
    color: #e2d9c8;
    letter-spacing: 2px;
    margin-top: 6px;
    font-family: 'MedievalSharp', cursive;
}

/* Game Over / Victory Modal */
#modal-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 8, 0.92);
    z-index: 100;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    text-align: center;
}

#modal-title {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 6px;
    color: #8a0b0b;
    text-shadow: 0 0 30px rgba(138, 11, 11, 0.9);
}

.modal-stats {
    font-size: 18px;
    color: #e2d9c8;
    line-height: 1.8;
}

.restart-btn {
    padding: 14px 38px;
    font-size: 18px;
    font-family: 'Cinzel', serif;
    font-weight: 800;
    color: #ffdd80;
    background: linear-gradient(180deg, #8a0b0b 0%, #3e0404 100%);
    border: 2px solid #c9a227;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.5);
    letter-spacing: 2px;
}
