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

html, body {
    width: 100%;
    height: 100%;
    background-color: #1b0f1e;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

#layout {
    width: 100vw;
    height: 100dvh;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1b0f1e;
}

#gameContainer {
    position: relative;
    width: 98vw;
    height: 96vh;
    max-width: 3840px;
    max-height: 2160px;
    background-color: #1b0f1e;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #1b0f1e;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 32px;
    z-index: 10;
}

.screen.hidden {
    display: none;
}

.title {
    font-size: clamp(72px, 10vw, 140px);
    color: #f5a8b0;
    text-shadow: 5px 5px 0px #000000;
    letter-spacing: 14px;
    font-weight: bold;
    text-align: center;
}

.subtitle {
    font-size: clamp(24px, 3.5vw, 42px);
    color: #ffffff;
    letter-spacing: 20px;
    text-align: center;
}

.btn {
    background-color: #1b0f1e;
    color: #f5a8b0;
    border: 3px solid #f5a8b0;
    padding: 20px 80px;
    font-size: clamp(28px, 3.8vw, 44px);
    font-family: 'Courier New', monospace;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 10px;
}

.btn:hover {
    background-color: #f5a8b0;
    color: #000000;
}

.btn:active {
    background-color: #cc7a29;
}

.controls-info {
    text-align: center;
    color: #eeeeee;
    font-size: clamp(18px, 2vw, 26px);
    line-height: 2.2;
    margin-top: 32px;
}

.hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}

.hud.hidden {
    display: none;
}

.hud-top {
    display: flex;
    align-items: center;
    gap: 40px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 14px 40px;
    border: 3px solid #f5a8b0;
}

.hud-item {
    color: #f5a8b0;
    font-size: clamp(28px, 3.2vw, 40px);
    font-weight: bold;
    text-shadow: 4px 4px 0px #000000;
}

.hud-progress {
    width: 320px;
    height: 16px;
    background-color: #1a1a1a;
    border: 3px solid #f5a8b0;
}

.hud-progress-bar {
    height: 100%;
    background-color: #f5a8b0;
    width: 10%;
}

#levelCompleteScreen h2 {
    font-size: clamp(56px, 8vw, 92px);
    color: #f5a8b0;
    text-shadow: 6px 6px 0px #000000;
    letter-spacing: 12px;
}

.complete-msg {
    color: #ffffff;
    font-size: clamp(24px, 3.4vw, 36px);
}

.final-stats {
    color: #f5a8b0;
    font-size: clamp(36px, 5vw, 54px);
    font-weight: bold;
    text-shadow: 4px 4px 0px #000000;
}

#victoryScreen p {
    color: #ffffff;
    font-size: clamp(26px, 4vw, 42px);
}

.death-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f5a8b0;
    font-size: clamp(42px, 6.5vw, 80px);
    font-weight: bold;
    text-shadow: 6px 6px 0px #000000;
    z-index: 9;
    pointer-events: none;
    animation: deathAnim 1.4s forwards;
    letter-spacing: 8px;
    text-align: center;
    white-space: nowrap;
}

.death-message.hidden {
    display: none;
}

@keyframes deathAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
}

.gameover-img {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 60%;
    height: auto;
    z-index: 15;
    pointer-events: none;
}

.gameover-img.hidden {
    display: none !important;
}
