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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #f1f1f1;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 46, 0.8);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 2px solid #444;
    flex-shrink: 0;
    position: relative; /* For absolute positioning of item-message */
}

h1 {
    color: #4ecdc4;
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.game-info {
    display: flex;
    gap: 30px;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 10px;
}

#health {
    color: #ff6b6b;
    font-weight: bold;
}

#score {
    color: #ffe66d;
    font-weight: bold;
}

#level {
    color: #4ecdc4;
    font-weight: bold;
}

main {
    display: flex;
    gap: 10px;
    padding: 10px;
    flex: 1;
    overflow: hidden;
}

.stats-panel {
    width: 250px;
    background: rgba(40, 40, 60, 0.7);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #555;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: 100%;
}

.stats-panel h3 {
    color: #4ecdc4;
    margin-bottom: 15px;
    text-align: center;
}

.stats-panel p {
    margin: 10px 0;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    border-left: 3px solid #4ecdc4;
    display: flex;
    justify-content: space-between;
}

.stat-label {
    font-weight: bold;
    color: #ffe66d;
}

#game-container {
    flex: 1;
    background-color: #0f0f1a;
    overflow: hidden;
    position: relative;
    border-radius: 10px;
    border: 1px solid #555;
    min-height: 0;
    min-width: 400px;
}

#game-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.controls {
    width: 250px;
    background: rgba(40, 40, 60, 0.7);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #555;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: 100%;
}

.controls h3 {
    color: #4ecdc4;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3rem;
}

.controls p {
    margin: 10px 0;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    border-left: 3px solid #4ecdc4;
}

footer {
    text-align: center;
    padding: 15px;
    border-top: 2px solid #444;
    color: #aaa;
    flex-shrink: 0;
}

button {
    background: linear-gradient(to right, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s;
    margin: 5px;
}

button:hover {
    background: linear-gradient(to right, #44a08d, #4ecdc4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}


.overlay-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #4ecdc4;
    max-width: 500px;
    width: 90%;
}


.overlay-content h2 {
    color: #ff6b6b;
    font-size: 3rem;
    margin-bottom: 20px;
}

.overlay-content p {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: #f1f1f1;
}

.countdown-hud {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Don't block mouse events */
}

.countdown-content {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid #4ecdc4;
    border-radius: 15px;
    padding: 20px 40px;
    text-align: center;
    max-width: 300px;
    backdrop-filter: blur(4px);
}

.countdown-content h2 {
    font-size: 4rem;
    color: #4ecdc4;
    text-shadow: 0 0 15px rgba(78, 205, 196, 0.8);
    margin: 10px 0;
}

.countdown-content p {
    font-size: 1.2rem;
    color: #f1f1f1;
    margin-top: 10px;
}

.pause-hud {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Allow button clicks */
}

.pause-content {
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid #ff6b6b;
    border-radius: 15px;
    padding: 30px 40px;
    text-align: center;
    max-width: 400px;
    backdrop-filter: blur(4px);
}

.pause-content h2 {
    font-size: 2.5rem;
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
    margin-bottom: 15px;
}

.pause-content p {
    font-size: 1.2rem;
    color: #f1f1f1;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

canvas {
    display: block;
}

@media (max-width: 900px) {
    main {
        flex-direction: column;
    }

    .controls {
        width: 100%;
        max-height: 200px;
    }

    .stats-panel {
        width: 100%;
        max-height: 200px;
    }

    #game-container {
        min-width: 0;
        width: 100%;
    }

    h1 {
        font-size: 2rem;
    }

    .game-info {
        font-size: 1rem;
        gap: 15px;
        padding: 8px 15px;
    }

    .countdown-content {
        padding: 15px 30px;
        max-width: 250px;
    }

    .countdown-content h2 {
        font-size: 3rem;
    }

    .countdown-content p {
        font-size: 1rem;
    }

    .pause-content {
        padding: 20px 30px;
        max-width: 300px;
    }

    .pause-content h2 {
        font-size: 2rem;
    }

    .pause-content p {
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 10px;
        gap: 15px;
    }

    .stats-panel {
        max-height: 200px;
    }

    .controls {
        max-height: 200px;
    }

    #game-container {
        min-width: 0;
        width: 100%;
    }

    .container {
        border-radius: 0;
    }

    .countdown-content {
        padding: 10px 20px;
        max-width: 200px;
    }

    .countdown-content h2 {
        font-size: 2.5rem;
    }

    .countdown-content p {
        font-size: 0.9rem;
    }

    .pause-content {
        padding: 15px 20px;
        max-width: 250px;
    }

    .pause-content h2 {
        font-size: 1.8rem;
    }

    .pause-content p {
        font-size: 0.9rem;
    }
}

.item-message {
    position: absolute; /* Positioned within header */
    left: 50%; /* Center horizontally */
    top: 50%; /* Center vertically within header */
    transform: translate(-50%, -50%); /* Center both horizontally and vertically */
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    max-width: 400px; /* Reduced width for header placement */
}

.item-message-content {
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid #ff6b6b; /* Changed from #4ecdc4 to #ff6b6b (red) for visibility */
    border-radius: 10px;
    padding: 8px 16px;
    text-align: center;
    max-width: 300px; /* Reduced for header placement */
    backdrop-filter: blur(4px);
    color: #f1f1f1;
    font-size: 1rem; /* Slightly smaller font */
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.7);
}

@media (max-width: 900px) {
    .item-message {
        top: 50%;
    }
    .item-message-content {
        font-size: 1.1rem;
        padding: 12px 20px;
        max-width: 300px;
    }
}

@media (max-width: 600px) {
    .item-message {
        top: 50%;
    }
    .item-message-content {
        font-size: 1rem;
        padding: 10px 15px;
        max-width: 250px;
    }
}

/* Custom scrollbar styling to match game theme */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(26, 26, 46, 0.7);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #4ecdc4, #44a08d);
    border-radius: 5px;
    border: 1px solid rgba(26, 26, 46, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #44a08d, #4ecdc4);
}

::-webkit-scrollbar-corner {
    background: rgba(26, 26, 46, 0.7);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: #4ecdc4 rgba(26, 26, 46, 0.7);
}

/* Skills cooldown display */
.skills-card {
    margin-top: 25px;
    padding: 15px;
    background: rgba(40, 40, 60, 0.7);
    border-radius: 10px;
    border: 1px solid #555;
}

.skills-card h4 {
    color: #4ecdc4;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3rem;
    border-bottom: 1px solid #555;
    padding-bottom: 8px;
}

.skill-cd-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    border-left: 3px solid #4ecdc4;
    gap: 5px;
}

.skill-name {
    font-weight: bold;
    color: #ffe66d;
    font-size: 0.85rem;
    flex: 1 1 auto;
    min-width: 0; /* Allows text to shrink */
    white-space: nowrap;
    overflow: visible;
}



.skill-cd-text {
    font-size: 0.85rem;
    font-weight: bold;
    white-space: nowrap;
    margin-left: auto;
    padding-left: 10px;
    flex: 0 0 auto;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .skill-cd-item {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .skill-name {
        min-width: 0;
        white-space: nowrap;
        flex: 2 1 auto; /* More space for skill name */
        overflow: visible;
    }

    .skill-cd-text {
        font-size: 0.85rem;
        font-weight: bold;
        white-space: nowrap;
        margin-left: 0;
        padding-left: 0;
        width: auto;
        text-align: right;
        flex: 0 0 auto;
    }
}