@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&display=swap');

body {
    margin: 0;
    overflow: hidden;
    background-color: #020202;
    font-family: 'Cinzel', serif;
    /* Gothic / Roman look */
    color: #fff;
    user-select: none;
    cursor: crosshair;
}

#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 30px;
    box-sizing: border-box;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    mix-blend-mode: normal;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 10000;
}

.hud-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-right {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.hud-text {
    font-size: 20px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    font-weight: 900;
    letter-spacing: 2px;
}

#combo-disp {
    font-size: 32px;
    font-weight: 900;
    display: none;
    text-shadow: 0 0 10px currentColor;
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    100% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }
}

.xp-container {
    width: 300px;
    height: 10px;
    background: #222;
    border: 1px solid #555;
    box-shadow: inset 0 0 5px #000;
    position: relative;
}

#xp-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0ff, #f0f);
    box-shadow: 0 0 20px #f0f;
    transition: width 0.2s;
}

#perk-bar {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    justify-content: flex-end;
}

.perk-icon {
    width: 25px;
    height: 25px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    position: relative;
}

.perk-lvl {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 8px;
    background: #000;
    color: #0ff;
    padding: 0 2px;
    font-weight: bold;
    border: 1px solid #333;
}

#boss-warning {
    position: absolute;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    color: #f00;
    font-size: 80px;
    font-weight: 900;
    letter-spacing: 10px;
    text-shadow: 0 0 20px #f00;
    display: none;
    animation: strobe 0.5s infinite;
    pointer-events: none;
    z-index: 100;
    width: 100%;
    text-align: center;
}

@keyframes strobe {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

#screens {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    background: rgba(10, 10, 10, 0.95);
    padding: 40px;
    border: 1px solid #444;
    text-align: center;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    gap: 20px;
    max-width: 700px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

/* NEW GOTHIC STYLES */

/* Full Screen Flat Start */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    background: #000;
    border: none;
    box-shadow: none;
    display: flex;
    /* Ensure Flex is default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.gothic-title {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 120px;
    letter-spacing: 10px;
    color: #fff;
    text-shadow: none;
    background: none;
    -webkit-text-fill-color: #fff;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.ritual-container {
    position: relative;
    width: 350px;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ritual-container:hover {
    transform: scale(1.1);
}

/* SVG Pentagram */
.ritual-pentagram-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -195px;
    margin-left: -175px;
    transition: 0.3s;
    filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.6));
}

.ritual-pentagram-svg polygon,
.ritual-pentagram-svg circle {
    stroke: #aa0000;
    transition: 0.3s;
}

.ritual-pentagram-svg polygon {
    stroke-width: 3;
}

.ritual-pentagram-svg circle {
    stroke-width: 3;
}

.ritual-container:hover .ritual-pentagram-svg {
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.9));
}

.ritual-container:hover .ritual-pentagram-svg polygon {
    stroke: #ff0000;
    stroke-width: 4;
}

.ritual-container:hover .ritual-pentagram-svg circle {
    stroke: #ff0000;
    stroke-width: 4;
}

.ritual-rune {
    position: absolute;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 24px;
    color: #666;
    text-shadow: 0 0 5px #000;
    transition: 0.3s;
}

.ritual-container:hover .ritual-rune {
    color: #fff;
    text-shadow: 0 0 10px #f00;
}

.r-50 {
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.r-15 {
    bottom: 60px;
    left: 45px;
}

.r-30 {
    bottom: 60px;
    right: 45px;
}


/* PENTAGON GAME OVER */
#game-over-screen {
    position: absolute;
    /* Fix Centering */
    display: none;
    /* Default Hidden */
    pointer-events: auto;
    /* Allow clicks */
    background: rgba(10, 10, 10, 0.6);
    /* 40% Transparent */
    border: 3px solid #fff;
    width: 500px;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Centered */
    clip-path: none;
    /* Remove Pentagon */
    padding: 40px;
    border-radius: 0;
    max-width: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Center Text */
    text-align: center;
}

#game-over-screen.active {
    display: flex;
    /* Show Flex when active */
}

#game-over-screen h1 {
    font-size: 64px;
    margin-bottom: 20px;
}

#game-over-screen p {
    font-size: 24px;
}

#game-over-screen .death-detail {
    font-size: 28px !important;
    margin-top: 20px !important;
}

#game-over-screen button {
    margin-top: 0;
    /* Reset */
}

/* Toggle Visibility State */
#game-over-screen.visually-hidden {
    background: transparent;
    border: none;
    clip-path: none;
    pointer-events: none;
    /* Let clicks pass through to game */
}

#game-over-screen.visually-hidden>* {
    opacity: 0;
    pointer-events: none;
}

/* Keep the button container visible/clickable */
#game-over-screen.visually-hidden>div:last-child {
    opacity: 1;
    pointer-events: auto;
    position: absolute;
    /* Keep relative to screen center or move */
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* ICON BUTTONS */
.icon-btn {
    pointer-events: auto;
    width: 50px;
    height: 50px;
    padding: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px !important;
    clip-path: none !important;
    border: 1px solid #fff;
    background: #000;
    color: #fff;
    transition: 0.2s;
}

.icon-btn:hover {
    background: #fff;
    color: #000;
    transform: scale(1.1);
}

.volume-btn {
    pointer-events: auto;
    /* Required because ui-layer is pointer-events: none */
    width: 40px;
    height: 40px;
    font-size: 20px !important;
    border-radius: 4px;
    /* Slight rounding for HUD element rather than sharp menu button */
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    /* Helps vertically center unicode symbols like ⛶ */
}

.volume-btn:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    /* Keep icon color native/white depending on OS */
}


/* NONAGON VICTORY MENU - REDESIGNED */
#victory-screen {
    position: absolute;
    display: none;
    pointer-events: none;
    /* Crucial: Let clicks pass through to canvas during victory */

    /* Sleek Banner Look */
    background: rgba(10, 10, 10, 0.85);
    border: 2px solid #0f0;
    box-shadow: 0 0 20px #0f0;

    /* Glistening Rainbow Border via Drop Shadow */
    filter: drop-shadow(0 0 5px red);
    animation: rainbow-glow 3s linear infinite;

    width: auto;
    height: auto;
    top: 15%;
    /* Top positioned */
    left: 50%;
    transform: translate(-50%, -50%);

    /* Content Layout */
    flex-direction: row;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    padding: 15px 40px;
    text-align: center;
    z-index: 100;
}

#victory-screen .icon-btn {
    pointer-events: auto;
}

@keyframes rainbow-glow {
    0% {
        filter: drop-shadow(0 0 5px red) drop-shadow(0 0 10px red);
    }

    20% {
        filter: drop-shadow(0 0 5px yellow) drop-shadow(0 0 10px yellow);
    }

    40% {
        filter: drop-shadow(0 0 5px lime) drop-shadow(0 0 10px lime);
    }

    60% {
        filter: drop-shadow(0 0 5px cyan) drop-shadow(0 0 10px cyan);
    }

    80% {
        filter: drop-shadow(0 0 5px blue) drop-shadow(0 0 10px blue);
    }

    100% {
        filter: drop-shadow(0 0 5px magenta) drop-shadow(0 0 10px magenta);
    }
}

#victory-screen.active {
    display: flex;
    /* Show Flex when active */
}

#victory-screen h1 {
    font-size: 64px;
    color: #0f0;
}

#victory-screen p {
    font-size: 28px;
}

/* ENTRY ANIMATION */
@keyframes enter-void {
    0% {
        transform: scale(1);
        filter: brightness(1);
        opacity: 1;
    }

    50% {
        filter: brightness(100%);
        background: #000;
        opacity: 1;
    }

    100% {
        transform: scale(50);
        opacity: 0;
        pointer-events: none;
    }
}

.screen {
    /* Zoom into pentagram center (below screen center because of title above) */
    transform-origin: 50% calc(50% + 80px);
}

.screen.entering {
    animation: enter-void 1.5s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}