/* Reset some default styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
} */
html,
body {
    width: 100vw;

    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    /* font-family: Arial, sans-serif;*/
    font-family: Georgia, serif;
    background-color: #1a1a1a;
    color: #f0f0f0;
}

footer {
    text-align: center;
    color: #beaa70;
    font-size: 12px;
    margin-top: 10px;
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: #2a2a2a;
    padding: 5px 0;
    border-top: 1px solid #444
}
/* Top Bar */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #2a2a2a;
    padding: 10px 20px;
    border-bottom: 3px solid #444;
}

#game-title {
    font-family: 'Pirata One', cursive;
    font-size: 40px;
    /* color: #cd8923; */
    color: #beaa70;
}

#menu-buttons .menu-button {
    background-color: #444;
    color: #f0f0f0;
    border: none;
    padding: 5px 10px;
    margin-left: 10px;
    cursor: pointer;
}

#menu-buttons .menu-button:hover {
    background-color: #555;
}

/* Main Layout */
#main-container {
    /* width: 100vh; */
    height: calc(100vh - 53px);
    overflow: hidden;

    display: grid;
    grid-template-areas:
        "character-stats dialog-panel map-panel"
        "bottom-panel bottom-panel bottom-panel";
    grid-template-columns: 1fr 3fr 1fr;
    gap: 10px;
    padding: 10px;
}

/* Character Stats Panel */
#character-stats {
    grid-area: character-stats;
    background-color: #2a2a2a;
    padding: 12px;
    border-radius: 5px;
    border: 2px solid #444;
    overflow-y: auto;
}

#character-stats h2 {
    font-size: 18px;
    color: #beaa70;
    margin-bottom: 10px;
}

.attribute-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0;

}

.attribute-btn {
    background: linear-gradient(145deg, #ff4444, #cc0000);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.attribute-btn:hover {
    background: linear-gradient(145deg, #ff5555, #dd0000);
    transform: translateY(-1px);
}

.attribute-btn:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.attribute-btn:disabled {
    background: linear-gradient(145deg, #888, #666);
    cursor: not-allowed;
    transform: none;
    animation: none;
}

#points-remaining {
    margin-top: .75em;
}

#attribute-points {
    color: #beaa70;
}

#character-name,
#level,
#character-class,
#experience,
#health,
#magic {
    color: #beaa70;
}

/* Dialog Panel */
#dialog-panel {
    position: relative;
    grid-area: dialog-panel;
    background-color: #2a2a2a;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #444;
    text-align: center;
}

#dialog-panel h2 {
    font-size: 18px;
    color: #beaa70;
    margin-bottom: 10px;
}

#dialog-content {
    margin-bottom: 20px;
}

#inventory-prompt {
    margin: 26px 0 0 35px;
}

#skills-prompt {
    width: 75px;
    position: absolute;
    font-size: 12px;
    left: -3px;
    bottom: 5px;
    text-align: center;
}

.action-button {
    background-color: #444;
    color: #f0f0f0;
    border: none;
    padding: 8px 12px;
    margin: 5px;
    cursor: pointer;
}

.action-button:hover {
    background-color: #555;
}

/* Map Panel */
#map-panel {
    grid-area: map-panel;
    background-color: #2a2a2a;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #444;
    text-align: center;
}

#map-panel h2 {
    font-size: 18px;
    color: #beaa70;
    margin-bottom: 10px;
}

#character-stats,
#dialog-panel,
#map-panel {
    height: 100%;
}

/* Bottom Panel */
#bottom-panel {
    height: 85px;
    grid-area: bottom-panel;
    display: flex;
    justify-content: space-between;
    background-color: #2a2a2a;
    gap: 10px;
    padding: 6px;
    border-radius: 5px;
    border: 2px solid #444;
    position: relative;
    overflow: visible;
}

/* Update the top bar */
#top-bar {
    height: 53px;
    /* Fixed height for top bar */
    width: 100vw;
}

#belt,
#skills {
    width: 48%;
    background-color: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #444;
}

#belt h2,
#skills h2 {
    font-size: 16px;
    color: #beaa70;
    margin-bottom: 8px;
}

#belt {
    width: 48%;
    background-color: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #444;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

#belt h2 {
    font-size: 16px;
    color: #beaa70;
    margin-bottom: 8px;
    text-align: left;
}

#belt-slots {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin: 0 0 .3em 1.2em;
    width: 100%;
    position: relative;
    left: 0;
}

.belt-slot {
    width: 50px;
    height: 50px;
    border: 2px solid #beaa70;
    position: relative;
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.5);
    margin: 0 5px 0 0;
    cursor: help;
}

/* Custom tooltip styling */
.belt-slot::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.belt-slot:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Keep the indicators styled as before but adjust their size */
.hotkey-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.quantity-indicator {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
}


#gold-display {
    position: absolute;
    top: 0px;
    right: 65px;
    color: #beaa70;
    font-size: 14px;
    font-weight: bold;
}

#gold-amount {
    color: #fefbec;
}

/* Skills container styling */
#skills {
    width: 48%;
    background-color: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #444;
    position: relative;
    overflow: visible;
}

#skills-list {
    position: absolute;
    top: 4px;
    left: 6em;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 5px;
    margin-top: 5px;
    font-size: 12px;
}

/* Skill Circle styling */
.skill-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #2a2a2a;
    border: 2px solid #beaa70;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 5px;
    position: absolute;
    top: -8px;
    left: -8px;
}

.skill-circle .skill-name {
    font-size: 10px;
    text-align: center;
    color: #beaa70;
}

.skill-circle .skill-key {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #beaa70;
    color: #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

#new-skill-alert {
    position: absolute;
    top: 0px;
    /* Position above the skills box */
    left: 50%;
    transform: translateX(-50%);
    width: 45%;
    text-align: center;
    z-index: 100;
}

.new-skill-btn {
    background: linear-gradient(145deg, #ff4444, #cc0000);
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    width: 47%;
    font-weight: bold;
    animation: pulse 2s infinite;
    box-shadow: 0 4px 8px rgba(255, 68, 68, 0.3);
    margin: 16px 0 0 35px;
    position: absolute;
    left: 155px;
    top: -2px;
}

.new-skill-btn:hover {
    background: linear-gradient(145deg, #ff5555, #dd0000);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(255, 68, 68, 0.4);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}



/* Inventory */
/* Inventory Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #2a2a2a;
    padding: 20px;
    border: 2px solid #beaa70;
    border-radius: 5px;
    width: 720px;
}

.inventory-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    font-size: 24px;
    cursor: pointer;
    color: #beaa70;
}

.inventory-container {
    display: flex;
    gap: 20px;
}

.equipped-items {
    display: grid;
    grid-template-rows: repeat(4, auto);
    gap: 20px;
    width: 220px;
    text-align: center;
}

.equipment-slot {
    background-color: #1a1a1a;
    border: 1px solid #444;
    border-radius: 3px;
    height: 90px;

    width: 90px;
    position: relative;
    margin: 0 auto;
}

.equipment-slot .item {
    position: absolute;
    width: 80px !important;
    /* Force width */
    height: 80px !important;
    /* Force height */
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    /* Center the item */
    margin: 0;
}

.slot-name {
    font-size: 12px;
    color: #beaa70;
    margin-bottom: 5px;
}

.slot-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #beaa70;
    white-space: nowrap;
}

.equipment-wrapper {
    margin-bottom: 10px;
}

.legs-boots-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 0 auto;
}

.legs-boots-container .equipment-slot {
    width: 90px;
    height: 90px;
}

.inventory-grid {
    position: relative;

    display: grid;
    grid-template-columns: repeat(8, 50px);
    grid-template-rows: repeat(8, 50px);
    gap: 1px;
    background-color: #1a1a1a;
    padding: 5px;
    border: 1px solid #444;
}

.inventory-cell {
    background-color: #2a2a2a;
    border: 1px solid #444;
    width: 50px;
    height: 50px;
    position: relative;
}

.item {
    position: absolute;
    background-color: var(--item-color);
    border: 1px solid #beaa70;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-size: 12px;
    user-select: none;
    z-index: 1;

    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.item-stack-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 10px;
    z-index: 2;
}

#item-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid #beaa70;
    padding: 10px;
    border-radius: 3px;
    color: white;
    font-size: 12px;
    pointer-events: none;
    white-space: pre-line;
}


.item-context-menu {
    position: absolute;
    background-color: #2a2a2a;
    border: 1px solid #beaa70;
    border-radius: 3px;
    padding: 5px 0;
    z-index: 1001;
}

.menu-option {
    padding: 5px 15px;
    cursor: pointer;
    color: #f0f0f0;
}

.menu-option:hover {
    background-color: #444;
}

.menu-option-disabled {
    color: #666 !important;
    cursor: not-allowed !important;
}

.menu-option-disabled:hover {
    background-color: transparent !important;
}

/* Container for the grid */
#map-grid {

    display: grid;
    grid-template-columns: repeat(9, 1fr);
    /* Changed to viewport size */
    grid-template-rows: repeat(9, 1fr);
    /* Changed to viewport size */
    gap: 1px;
    margin: 10px auto;
    background-color: #333;
    width: 100%;
    min-width: 300px;
    aspect-ratio: 1/1;
    max-width: 350px;
    /* Adjusted for smaller viewport */
}

/* Update cell styling */
.cell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1/1;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s ease;
    cursor: pointer;
}

/* Hover effects for interactable tiles */
.cell.floor:hover,
.cell.path:hover,
.cell.grass:hover,
.cell.chest-item:hover,
.cell.chest-gold:hover,
.cell.door:hover,
.cell.door-up:hover,
.cell.stairs-up:hover,
.cell.dropped-item:hover {
    box-shadow: inset 0 0 8px #beaa70;
}

/* Non-interactable tiles should not have pointer cursor */
.cell.wall,
.cell.sconce,
.cell.tree,
.cell.bush,
.cell.water {
    cursor: default;
}

.cell.wall {
    background-color: #333333;
    /* Darker color for walls */
    position: relative;
}

.cell.sconce {
    position: relative;
    background-color: #333333;
    /* Same as wall color */
}

.cell.sconce::after {
    content: '';
    position: absolute;
    width: 20%;
    height: 6%;
    background-color: #4a4a4a;
    /* Sconce base color */
    bottom: 40%;
    left: 40%;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.cell.sconce::before {
    content: '';
    position: absolute;
    width: 12%;
    height: 20%;
    background: linear-gradient(to bottom, #ff6600, #ff9955);
    bottom: 46%;
    left: 44%;
    border-radius: 50% 50% 20% 20%;
    animation: flicker 1s infinite alternate;
    box-shadow:
        0 0 10px #ff6600,
        0 0 20px #ff6600,
        0 0 30px #ff3300;
}

@keyframes flicker {

    0%,
    18%,
    22%,
    25%,
    53%,
    57%,
    100% {
        transform: scaleY(1) translateY(0);
        opacity: 0.8;
    }

    20%,
    24%,
    55% {
        transform: scaleY(0.8) translateY(1px);
        opacity: 0.6;
    }
}

/* Optional: Add a subtle glow effect on hover */
.cell.sconce:hover::before {
    animation: flicker 0.5s infinite alternate;
    box-shadow:
        0 0 15px #ff6600,
        0 0 25px #ff6600,
        0 0 35px #ff3300;
}


.cell.floor {
    background-color: #555555;
    /* Medium gray for floors */
}

/* Stairs Up Styling */
.cell.stairs-up {
    background-color: #666666;
    /* Base color for stairs */
    position: relative;
    overflow: hidden;
    /* Add subtle gradient for depth */
    background: linear-gradient(45deg, #555555, #777777);
}

/* Create the steps effect */
.cell.stairs-up::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    /* Create multiple shadow lines to simulate steps */
    background-image:
        linear-gradient(to bottom,
            transparent 0%,
            transparent 20%,
            rgba(0, 0, 0, 0.2) 20%,
            rgba(0, 0, 0, 0.2) 40%,
            rgba(0, 0, 0, 0.3) 40%,
            rgba(0, 0, 0, 0.3) 60%,
            rgba(0, 0, 0, 0.4) 60%,
            rgba(0, 0, 0, 0.4) 80%,
            rgba(0, 0, 0, 0.5) 80%);
}

/* Add side shadow for 3D effect */
.cell.stairs-up::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: linear-gradient(135deg,
            transparent 50%,
            rgba(0, 0, 0, 0.2) 50%);
}

.cell.player {
    background-color: #589358 !important;
    /* Green for the player */
    border: 2px solid #ff0000;
    /* Optional: make player more visible */
    position: relative;
    z-index: 100 !important;
    transition: all 0.2s ease-in-out;
}

.cell.npc {
    background-color: #7ed2dd;
    /* Yellow for NPC */
}


/* Enemy Styling */
.cell.enemy {
    background-color: #ff0000;
    position: relative;
    overflow: hidden;
    transition: border 0.2s ease;
}

.cell.enemy:hover {
    border: 2px solid #ffff00;
    box-sizing: border-box;
}

/* Demon Eyes */
.cell.enemy::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 20%;
    top: 30%;
    left: 20%;
    background:
        radial-gradient(circle at 30% 50%, #000000 0%, #ff4646 30%, #000 31%, #000 40%, transparent 41%), radial-gradient(circle at 70% 50%, #000000 0%, #ff5353 30%, #000 31%, #000 40%, transparent 41%);
    animation: glowEyes 2s infinite;
}

/* Demon Mouth */
.cell.enemy::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 25%;
    bottom: 20%;
    left: 15%;
    background:
        linear-gradient(to bottom,
            transparent 0%,
            #000 0%, #000 15%,
            #660000 16%, #660000 85%,
            #000 86%, #000 100%);
    clip-path: polygon(0% 0%,
            20% 50%,
            30% 0%,
            40% 50%,
            50% 0%,
            60% 50%,
            70% 0%,
            80% 50%,
            100% 0%,
            100% 100%,
            0% 100%);
    animation: mouthMove 3s infinite;
}

@keyframes glowEyes {

    0%,
    90%,
    100% {
        filter: brightness(1) drop-shadow(0 0 2px #ff0);
    }

    95% {
        filter: brightness(1.5) drop-shadow(0 0 4px #ff0);
    }
}

/*Stunned Enemies*/
.cell.enemy.stunned,
.cell.elite-enemy.stunned {
    background-color: white !important;
    animation: stunPulse 0.5s infinite;
}

@keyframes stunPulse {
    0% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.5);
    }

    100% {
        filter: brightness(1);
    }
}

/*Elite Enemy Cell*/
/* Elite Enemy Styling */
.cell.elite-enemy {
    background-color: #8b00ff;
    /* Purple color for elite enemies */
    position: relative;
    overflow: hidden;
    transition: border 0.2s ease;
}

.cell.elite-enemy:hover {
    border: 2px solid #ffff00;
    box-sizing: border-box;
}

/* Elite Enemy Eyes (similar to regular enemy but with different color) */
.cell.elite-enemy::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 20%;
    top: 30%;
    left: 20%;
    background:
        radial-gradient(circle at 30% 50%, #000000 0%, #ff00ff 30%, #000 31%, #000 40%, transparent 41%),
        radial-gradient(circle at 70% 50%, #000000 0%, #ff00ff 30%, #000 31%, #000 40%, transparent 41%);
    animation: glowEyes 2s infinite;
}



/* Update the mini version for the key */
.cell-mini.enemy {
    background-color: #ff0000;
    position: relative;
    overflow: hidden;
}

/* Optional: Add this for a more aggressive look */
.cell.enemy:hover::after {
    animation: angryMouth 0.5s infinite;
}

@keyframes angryMouth {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.2);
    }
}


.cell.door {
    background-color: #8b4513;
    /* Brown for doors */
}
.cell.door-up {
    background-image: url('images/doorUp.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #8b4513;
}

.cell.chest-item {
    background-image: url('images/chest.jpg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #555555;
}

/* Item Chest Styling */

/* .cell.chest {
    background-color: #b8860b;
}


.cell.chest-item {
    position: relative;
    background-color: #8b4513;
    border: 2px solid #4a3000;
    background-image: url('images/chest.webp');
}


.cell.chest-item::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 10%;
    width: 80%;
    height: 30%;
    background: linear-gradient(to bottom, #a0522d, #8b4513);
    border: 2px solid #4a3000;
    border-radius: 5px 5px 0 0;

    background-image:
        linear-gradient(90deg, transparent 47%, #ffd700 47%, #ffd700 53%, transparent 53%),
        linear-gradient(to bottom, #a0522d, #8b4513);
    background-size: 20% 100%, 100% 100%;
}


.cell.chest-item::after {
    content: '';
    position: absolute;
    top: 35%;
    left: 45%;
    width: 10%;
    height: 15%;
    background-color: #ffd700;
    border: 1px solid #b8860b;
    border-radius: 3px;

    box-shadow:

        inset 2px 2px 0 #000,

        -20px -15px 0 -8px #ffd700,
        20px -15px 0 -8px #ffd700,
        -20px 15px 0 -8px #ffd700,
        20px 15px 0 -8px #ffd700;
}


.cell.chest-item {
    position: relative;

    background-image:
        linear-gradient(90deg,
            transparent 9%,
            #ffd700 15%, #ffd700 9%,
            transparent 20%,
            transparent 83%,
            #ffd700 83%, #ffd700 85%,
            transparent 92%
        );
    border-radius: 13px 13px 0 0;
}


.cell.chest-item::before {
    content: '';
    position: absolute;
    top: 60%;
    left: 5%;
    width: 90%;
    height: 4px;
    background: #ffd700;
    border: 1px solid #000000;
} */


/* Gold Pile Styling */
.cell.chest-gold {
    position: relative;
    background:
        radial-gradient(circle at 55% 50%,
            #ffd700 0%,
            #daa520 60%,
            transparent 61%) 45% 45%/30% 30% no-repeat,
        #555555;
    /* Floor color */
}

.cell.chest-gold::before,
.cell.chest-gold::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, #ffd700, #daa520);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: shine 5s infinite;
}

/* First coin (largest) */
.cell.chest-gold::before {
    width: 35%;
    height: 35%;
    top: 25%;
    left: 35%;
    z-index: 3;
    /* Offset the animation slightly for first coin */
    animation-delay: 0.2s;
}

/* Second coin */
.cell.chest-gold::after {
    width: 30%;
    height: 30%;
    top: 40%;
    left: 25%;
    z-index: 2;

    animation-delay: 0.4s;
}

/* Shine animation */
@keyframes shine {

    0%,
    20%,
    100% {
        filter: brightness(1);
    }

    10% {
        filter: brightness(1.5);
    }
}

/* New Forest Tiles */
.cell.path {
    background-color: #8b6b4b; /* Brown dirt path */
}

.cell.grass {
    background-image: url('images/grass_tile.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

/* Ensure player always appears on top of grass */
.cell.player {
    background-color: #589358 !important;
    background-image: none !important;
    border: 2px solid #ff0000 !important;
    position: relative !important;
    z-index: 100 !important;
}



.cell.water {
    background-color: #4a8fff; /* Blue water */
    animation: ripple 2s infinite;
}

.cell.bush {
    background-color: #2d5a27; /* Darker green */
    border-radius: 50%;
}

.cell.tree {
    background-color: #1b4d1b; /* Dark forest green */
}

@keyframes ripple {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

#location {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: #beaa70;
}

/* Game Log Button */
#game-log-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    background-color: #2a2a2a;
    border: 2px solid #beaa70;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #beaa70;
    z-index: 100;
    transition: all 0.2s ease;
}

#game-log-button:hover {
    background-color: #beaa70;
    color: #000;
    transform: scale(1.1);
}

/* Game Log Modal */
.game-log-content {
    width: 600px;
    max-height: 70vh;
    overflow: hidden;
}

.game-log-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

#clear-log-btn {
    background-color: #ff4444;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

#clear-log-btn:hover {
    background-color: #ff6666;
}

.log-count {
    color: #beaa70;
    font-size: 12px;
}

.log-entries {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    padding-right: 10px;
}

.log-entry {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.log-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.log-entry-type {
    background-color: #beaa70;
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.log-entry-time {
    color: #888;
    font-size: 11px;
}

.log-entry-message {
    color: #f0f0f0;
}

/* Different log entry type colors */
.log-entry-type.combat { background-color: #ff4444; color: white; }
.log-entry-type.pickup { background-color: #44ff44; color: black; }
.log-entry-type.gold { background-color: #ffd700; color: black; }
.log-entry-type.level { background-color: #ffd700; color: #000; }

.log-entry-type.death {
    background-color: #8b0000;
    color: #fff;
}
.log-entry-type.npc { background-color: #44aaff; color: black; }
.log-entry-type.system { background-color: #888888; color: white; }

.no-entries {
    text-align: center;
    color: #888;
    font-style: italic;
    margin: 50px 0;
}

/* Scrollbar styling for log entries */
.log-entries::-webkit-scrollbar {
    width: 6px;
}

.log-entries::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.log-entries::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.log-entries::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Toast Notifications */
.toast-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background-color: #2a2a2a;
    color: #f0f0f0;
    padding: 12px 24px;
    border-radius: 4px;
    margin-top: 10px;
    border: 1px solid #444;
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards, fadeOut 0.3s 2s forwards;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Inventory Item Styling */
.inventory-item {
    background-color: #444;
    padding: 5px 10px;
    margin: 5px;
    border-radius: 3px;
    display: inline-block;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(8, 50px);
    grid-template-rows: repeat(8, 50px);
    gap: 1px;
    background-color: #1a1a1a;
    padding: 5px;
    border: 1px solid #444;
    position: relative;
}

.inventory-cell {
    background-color: #2a2a2a;
    border: 1px solid #444;
    width: 50px;
    height: 50px;
}

.item {
    background-color: var(--item-color);
    border: 1px solid #beaa70;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-size: 12px;
    padding: 2px;
    user-select: none;
}

.damage-number {
    color: yellow;
    font-weight: bold;
    font-size: 20px;
    pointer-events: none;
    z-index: 1000;
    position: absolute;

    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    font-family: 'Arial', sans-serif;
}

.damage-number.miss {
    font-style: italic;
    letter-spacing: 1px;
}

.damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 0, 0, 0.2);
    pointer-events: none;
    z-index: 999;
}




/* Main container */
#enemy-health-container {
    text-align: center;
    width: 100%;
    padding: 5px;
    margin-bottom: 10px;
    min-height: 30px;

}

/* Wrapper for the entire health bar component */
.enemy-health-bar-wrapper {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 3px;
    width: 13em;
    margin: 0 auto;
}

/* Enemy name styling */
.enemy-name {
    color: #ff6666;
    margin-right: 10px;
    width: 80px;
}

/* Container for the actual health bar */
.status-bar-container {
    position: relative;
    flex-grow: 1;
    height: 24px;
    background-color: #333;
    border: 1px solid #000;
    border-radius: 3px;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The enemy health bar itself*/
.enemy-health-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(to right, #ff3333, #ff6666);
    transition: width 0.3s ease-in-out;
    z-index: 1;
}

/* Player specific health bar */
.player-health-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(to right, #ff3333, #ff6666);
    transition: width 0.3s ease-in-out;
    z-index: 1;
}

.status-text {
    position: relative;
    width: 100%;
    text-align: center;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
}



/* NPC Speech */
.npc-name {
    color: #ffffff;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
    opacity: 0.8;
    border-top: 1px solid rgba(190, 170, 112, 0.3);
    padding-top: 5px;
}

.speech-bubble {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    border: 2px solid #beaa70;
    border-radius: 10px;
    padding: 15px;
    width: 55%;
    z-index: 999;
}

.speech-text {
    color: #f0f0f0;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    min-height: 60px;
    font-family: 'Georgia', serif;
}

.speech-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.speech-btn {
    background-color: #beaa70;
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 5px 15px;
    cursor: pointer;
    font-weight: bold;
}

.speech-btn:disabled {
    background-color: #666;
    cursor: not-allowed;
}

.speech-btn:hover:not(:disabled) {
    background-color: #d4c190;
}

.speech-close-btn {
    position: absolute;
    right: -10px;
    top: -10px;
    width: 24px;
    height: 24px;
    background-color: #beaa70;
    color: #000;
    border: 2px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s;
}

.speech-close-btn:hover {
    background-color: #d4c190;
}

/* Interaction Bubble */
.interaction-bubble {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #beaa70;
    border-radius: 15px;
    padding: 5px 15px;
    color: #beaa70;
    cursor: pointer;
    font-size: 14px;
    z-index: 999;
    transition: transform 0.2s, background-color 0.2s;
}

.interaction-bubble:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.9);
}


/*Environment Styles*/
.cell.door {
    background-color: #8b4513;
    /* Brown for doors */
    position: relative;
}

.cell.door::after {
    content: '';
    position: absolute;
    width: 20%;
    height: 20%;
    background-color: #ffd700;
    /* Yellow/gold color for handle */
    border-radius: 50%;
    right: 25%;
    top: 25%;
    transform: translateY(-50%);
    border: 1px solid #b8860b;
    /* Darker gold border */
    box-shadow: inset -1px -1px 2px rgba(0, 0, 0, 0.3);
    /* Add some depth */
}


/* Map Key */
/* Key styling */
.key-grid {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.key-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 35px;
}

.cell-mini {
    width: 30px;
    height: 30px;
    border: 1px solid #444;
    border-radius: 2px;
}

/* Apply the same colors as the main cells */
.cell-mini.floor {
    background-color: #555555;
}

.cell-mini.wall {
    background-color: #333333;
}

.cell-mini.player {
    background-color: #589358;
    border: 2px solid #ff0000;
}

.cell-mini.npc {
    background-color: #7ed2dd;
}

.cell-mini.enemy {
    background-color: #ff0000;
}

.cell-mini.door {
    background-color: #8b4513;
    position: relative;
    transform: rotate(90deg);
}

.cell-mini.door::after {
    content: '';
    position: absolute;
    width: 20%;
    height: 20%;
    background-color: #ffd700;
    border-radius: 50%;
    right: 25%;
    top: 25%;
    transform: translateY(-50%);
    border: 1px solid #b8860b;
}


/* Mini Chest Item styling */
.cell-mini.chest-item {
    width: 30px;
    height: 30px;
}

/* Mini Gold styling */
.cell-mini.chest-gold {
    width: 30px;
    height: 30px;
}

/*Health and Magic Status Bars*/
.status-bars {
    display: flex;
    justify-content: space-around;
    flex-direction: row;
    padding: 10px;
    margin-bottom: 10px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.health-status,
.magic-status {
    width: 30%;
    position: relative;
}

.status-bar-container {
    width: 100%;
    height: 13px;
    background-color: #333;
    border: 1px solid #000;
    border-radius: 3px;
    overflow: hidden;
}

.status-bar {
    height: 100%;
    transition: width 0.3s ease-in-out;
}

.health-bar {
    background: linear-gradient(to right, #ff3333, #ff6666);
}

.magic-bar {
    background: linear-gradient(to right, #3333ff, #6666ff);
    transform-origin: left center;
    position: absolute;
    left: 0;
    width: 100%;
}

.status-text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: -14px;
    color: #fff;
    text-shadow: 1px 1px 1px #000;
    font-size: 13px;
    font-weight: bold;
}

.enemy-status-text {
    position: absolute;
    top: -3px;
    font-size: 12px;
}

.player-status-text {
    top: -16px;
    font-size: 13px;
}

.xp-status {
    position: relative;
    height: 16px;
    width: 200px;
    margin: 0 auto;
}

.xp-bar {
    background: linear-gradient(to right, #ffffff, #e0e0e0);
    height: 15px;
    width: 100%;
    transition: width 0.3s ease-in-out;
    position: absolute;
    left: 0;
    top: 0;
}

#stats,
#attributes {
    font-size: 14px;
}

/* Detail Stats Display */
#detail-stats {
    background-color: #1a1a1a;
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
}

#detail-stats p {
    margin: 3px 0;
}

#detail-stats span {
    color: #beaa70;
}

/* Skills Display - removed duplicate .new-skill-btn rules */

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Skill Modal */
.skill-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.95);
    border: 2px solid #beaa70;
    border-radius: 10px;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    z-index: 1000;
}

.skill-header {
    color: #ffffff;
    text-align: center;
    margin-bottom: 15px;
}

.skill-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 5px;
}

.skill-info {
    flex-grow: 1;
}

.skill-name {
    color: #beaa70;
    font-weight: bold;
}

.skill-description {
    font-size: 12px;
    color: #999;
}

.skill-stats {
    font-size: 12px;
    color: #666;
}

.skill-button {
    background-color: #beaa70;
    color: #000;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.skill-button:disabled {
    background-color: #666;
    cursor: not-allowed;
}

/* Skill Display in Bottom Panel */
.skill-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #2a2a2a;
    border: 2px solid #beaa70;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 5px;
    position: relative;
    cursor: help;
}

.skill-tooltip {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #beaa70;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

.skill-circle .skill-name {
    font-size: 10px;
    text-align: center;
}

.skill-circle .skill-key {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #beaa70;
    color: #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Up Arrow Icon Styling */
.up-arrow {
    color: #4CAF50;
    font-weight: bold;
    font-size: 16px;
}

/* Combat Styles */
.attack-swoosh {
    position: absolute;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
    transform-origin: center;
    pointer-events: none;
    opacity: 0;
    z-index: 1000;
    animation: swoosh 0.3s ease-out forwards;
}

@keyframes swoosh {
    0% {
        opacity: 0.8;
        transform: scale(0.5) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: scale(1.5) rotate(45deg);
    }
}

/* Level Up Animation */
.level-up-announcement {
    position: absolute;
    /* Changed from fixed to absolute */
    bottom: 20%;
    /* Keep this to position it above the bottom of the panel */
    left: -100%;
    background-color: rgba(42, 42, 42, 0.9);
    color: #beaa70;
    padding: 15px 40px;
    border-radius: 50px;
    border: 3px solid #beaa70;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    z-index: 1000;
    transform: translateX(0);
    animation: slideInOut 2.5s ease-in-out forwards;
    box-shadow: 0 0 20px rgba(190, 170, 112, 0.3);
}

@keyframes slideInOut {
    0% {
        left: -100%;
    }

    20% {
        left: 50%;
        transform: translateX(-50%);
    }

    80% {
        left: 50%;
        transform: translateX(-50%);
    }

    100% {
        left: 100%;
    }
}

/* Death Screen */
/* Death Screen */
.death-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: background-color 2s;
}

.death-screen.fade-in {
    background-color: rgba(0, 0, 0, 0.95);
}

.death-message {
    color: #ff0000;
    font-size: 36px;
    margin-bottom: 20px;
    opacity: 0;
    transition: opacity 1s;
}

.death-submessage {
    color: #ffffff;
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0;
    transition: opacity 1s;
}

.play-again-btn {
    background: linear-gradient(145deg, #b06c07, #8e5706);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 20px;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 1s;
}

.play-again-btn:hover {
    background: linear-gradient(145deg, #c27708, #9e6207);
}

.show-element {
    opacity: 1 !important;
    /* Added !important to ensure it stays visible */
}

/*Help Modal*/
.help-modal {
    background: #1a1a1a;
    color: #fff;
    /* padding: 15px; */
    max-width: 300px;
    max-height: 600px;
    margin: 20px auto;
    padding: 15px 50px;
    border-radius: 8px;
    font-family: 'Georgia', serif;
    font-size: 12px;
    overflow-y: auto;
    position: relative;
    /* Added this */
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    cursor: pointer;
    color: #beaa70;
    font-size: 20px;
    z-index: 1001;
}

/* Add hover effect for better visibility */
.close-btn:hover {
    color: #fff;
}

/* Adjust top margin of first h2 to account for close button */
.help-modal h2:first-of-type {
    margin-top: 5px;
    color: #beaa70;
}

/* Custom bullet points for help modal */
.help-modal ul {
    list-style: none;
    padding-left: 20px;
}

.help-modal ul li {
    position: relative;
    margin-bottom: 8px;
    padding-left: 20px;
}

.help-modal ul li::before {
    content: '⚔️';
    position: absolute;
    left: -5px;
    top: 0;
    color: #beaa70;
    font-size: 14px;
}

/* Different themed bullets for different sections */
.help-modal h3:nth-of-type(1) + ul li::before { content: '🎮'; } /* Controls */
.help-modal h3:nth-of-type(2) + ul li::before { content: '⚔️'; } /* Combat */
.help-modal h3:nth-of-type(3) + ul li::before { content: '⭐'; } /* Leveling Up */
.help-modal h3:nth-of-type(4) + ul li::before { content: '🔮'; } /* Stats */


@media screen and (max-width: 600px) {

    html,
    body {
        overflow-y: scroll;
    }

    /* Main Layout adjustments */
    #main-container {
        grid-template-areas:
            "character-stats"
            "dialog-panel"
            "map-panel"
            "bottom-panel";
        grid-template-columns: 1fr;
        padding: 5px;
        gap: 5px;
    }

    /* Top bar adjustments */
    #top-bar {
        padding: 5px 10px;
        height: 43px;
    }

    #game-title {
        font-size: 18px;
    }

    .menu-button {
        padding: 3px 8px;
        font-size: 12px;
    }

    /* Panel adjustments */
    #character-stats,
    #dialog-panel,
    #map-panel,
    #bottom-panel {
        padding: 8px;
        font-size: 12px;
        text-align: center;
    }

    /* Map grid adjustments */
    #map-grid {
        max-width: 300px;
        margin: 5px auto;
    }

    /* Bottom panel adjustments */
    #bottom-panel {
        flex-direction: column;
        gap: 10px;

    }

    #inventory,
    #skills {
        width: 100%;
    }

    /* Inventory modal adjustments */
    .modal-content {
        width: 95%;
        padding: 10px;
    }

    .inventory-grid {
        grid-template-columns: repeat(6, 40px);
        grid-template-rows: repeat(6, 40px);
    }

    .inventory-cell {
        width: 40px;
        height: 40px;
    }

    /* Status bars adjustments */
    .status-bars {
        flex-direction: column;
        gap: 5px;
        padding-top: 0.1em;
        font-size: 12px;
        font-weight: bold;
    }

    .health-status,
    .magic-status {
        width: 100%;
    }

    /* Text size adjustments */
    .status-text {
        font-size: 12px;
    }

    h2 {
        font-size: 16px;
    }
}

/* Dropped Item Styling */
.cell.dropped-item {
    position: relative;
    background-color: #555555; /* Floor background */
}

/* Different item type styling */
.cell.dropped-item.dropped-weapon {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23cccccc"><path d="M6.92 5L5 6.92l9.89 9.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L6.92 5zM2.27 2.27c-.39.39-.39 1.02 0 1.41l2.05 2.05L2 8.05v2.83L8.05 8.5l1.41 1.41L7.05 12.33 12.33 7.05 9.91 4.63l2.05-2.05c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0l-8.28 8.28z"/></svg>');
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
}

.cell.dropped-item.dropped-armor,
.cell.dropped-item.dropped-helm,
.cell.dropped-item.dropped-legs,
.cell.dropped-item.dropped-boots {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%238b4513"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/></svg>');
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
}

.cell.dropped-item.dropped-consumable {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ff4444"><circle cx="12" cy="12" r="10"/><path fill="%23ffffff" d="M8 12h8v2H8z"/></svg>');
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center;
}

/* Add a subtle glow effect to make dropped items more noticeable */
.cell.dropped-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: inset 0 0 8px rgba(190, 170, 112, 0.3);
    pointer-events: none;
}