/* ======================== */
/*      GLOBAL STYLES       */
/* ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: 'Press Start 2P', monospace;
    cursor: crosshair;
    user-select: none;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.hidden {
    display: none !important;
}

/* ======================== */
/*       MAIN MENU          */
/* ======================== */
#main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(180deg, rgba(5,0,13,0.55) 0%, rgba(10,0,21,0.65) 40%, rgba(5,0,13,0.75) 100%),
        url('Assets/background.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.menu-container {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    font-size: 64px;
    color: #fff;
    text-shadow:
        0 0 10px #a855f7,
        0 0 30px #a855f7,
        0 0 60px #7c3aed,
        0 0 100px #7c3aed;
    letter-spacing: 12px;
    margin-bottom: 16px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow:
            0 0 10px #a855f7,
            0 0 30px #a855f7,
            0 0 60px #7c3aed;
    }
    to {
        text-shadow:
            0 0 15px #c084fc,
            0 0 40px #a855f7,
            0 0 80px #7c3aed,
            0 0 120px #6d28d9;
    }
}

.game-subtitle {
    font-size: 14px;
    color: #a78bfa;
    letter-spacing: 6px;
    margin-bottom: 60px;
    text-transform: uppercase;
}

.menu-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    padding: 16px 48px;
    margin: 8px;
    border: 2px solid #a855f7;
    background: transparent;
    color: #e9d5ff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    width: 280px;
    margin: 8px auto;
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.3), transparent);
    transition: left 0.5s ease;
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: #c084fc;
    color: #fff;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
    transform: scale(1.05);
}

.menu-btn.secondary {
    border-color: #6b21a8;
    color: #a78bfa;
    font-size: 12px;
    padding: 12px 36px;
}

.menu-btn.secondary:hover {
    border-color: #a855f7;
    color: #e9d5ff;
}

.exit-btn {
    text-decoration: none;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.controls-info {
    margin-top: 48px;
    color: #6b21a8;
    font-size: 9px;
    line-height: 2.2;
    letter-spacing: 1px;
}

/* ======================== */
/*        MODALS            */
/* ======================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(6px);
}

.modal-content {
    background: linear-gradient(135deg, #1a0030, #0d001a);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    animation: fadeInUp 0.5s ease-out;
}

.modal-title {
    font-size: 24px;
    color: #c084fc;
    letter-spacing: 4px;
    margin-bottom: 30px;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

.about-info {
    margin-bottom: 30px;
}

.dev-label {
    font-size: 8px;
    color: #6b21a8;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.dev-name {
    font-size: 13px;
    color: #e9d5ff;
    margin-top: 4px;
}

.about-desc {
    font-size: 8px;
    color: #a78bfa;
    line-height: 2;
    margin-top: 20px;
}

.settings-group {
    margin-bottom: 24px;
    text-align: left;
}

.settings-label {
    font-size: 10px;
    color: #c084fc;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.settings-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #a855f7;
    cursor: pointer;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.volume-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #1e1b4b;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #a855f7;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #a855f7;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.volume-text {
    font-size: 10px;
    color: #a78bfa;
    min-width: 40px;
    text-align: right;
}

/* ======================== */
/*      GAME OVER SCREEN    */
/* ======================== */
#game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.game-over-title {
    font-size: 48px;
    color: #ef4444;
    text-shadow:
        0 0 10px #ef4444,
        0 0 30px #dc2626,
        0 0 60px #b91c1c;
    margin-bottom: 24px;
    animation: shake 0.6s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.final-score {
    font-size: 20px;
    color: #e9d5ff;
    margin-bottom: 40px;
}

/* ======================== */
/*          HUD             */
/* ======================== */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#hud > * {
    pointer-events: auto;
}

/* Score Display */
#score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#score-label {
    font-size: 10px;
    color: #a78bfa;
    letter-spacing: 3px;
}

#score-value {
    font-size: 28px;
    color: #fff;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
}

/* Player Info - Bottom Left */
#player-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    padding: 10px 16px;
    backdrop-filter: blur(8px);
}

#player-avatar {
    width: 72px;
    height: 72px;
    border-radius: 6px;
    border: 2px solid #a855f7;
    image-rendering: pixelated;
}

#health-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.heart-icon {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

#health-bar-bg {
    width: 160px;
    height: 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #374151;
    border-radius: 3px;
    overflow: hidden;
}

#health-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

#health-bar-fill.low {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

#health-bar-fill.medium {
    background: linear-gradient(90deg, #eab308, #facc15);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}

#health-text {
    font-size: 9px;
    color: #d1d5db;
    min-width: 45px;
}

/* Skills Bar - Bottom Right */
#skills-bar {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    backdrop-filter: blur(8px);
}

.skill-slot {
    width: 48px;
    height: 48px;
    position: relative;
    border: 2px solid #4b5563;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-slot:hover {
    border-color: #a855f7;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.skill-slot img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    object-fit: cover;
}

.skill-cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.75);
    transition: height 0.1s linear;
}

.skill-key {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 7px;
    color: #9ca3af;
    text-shadow: 0 0 4px #000;
}

.skill-cooldown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #fbbf24;
    text-shadow: 0 0 6px #000;
    display: none;
}

.skill-slot.on-cooldown .skill-cooldown-text {
    display: block;
}

.skill-slot.active-skill {
    border-color: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
    animation: skillActive 0.6s ease-in-out infinite alternate;
}

@keyframes skillActive {
    from { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
    to { box-shadow: 0 0 16px rgba(34, 197, 94, 0.8); }
}

/* Quest Panel - Top Right */
#quest-panel {
    position: absolute;
    top: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 8px;
    padding: 14px 18px;
    backdrop-filter: blur(4px);
    min-width: 220px;
    pointer-events: none;
    opacity: 0.75;
    transition: opacity 0.3s ease;
}

#quest-panel:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

.quest-title {
    font-size: 10px;
    color: #a855f7;
    letter-spacing: 3px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.quest-item {
    font-size: 9px;
    color: #9ca3af;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}

.quest-item.completed {
    color: #22c55e;
    text-decoration: line-through;
}

.quest-item.completed .quest-status {
    color: #22c55e;
}

.quest-status {
    font-size: 12px;
    color: #6b7280;
}

/* Boss Health Bar - Top Center */
#boss-health-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    padding: 10px 24px;
    backdrop-filter: blur(8px);
    min-width: 300px;
    animation: bossAppear 0.5s ease-out;
}

@keyframes bossAppear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#boss-name {
    font-size: 11px;
    color: #ef4444;
    letter-spacing: 3px;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

#boss-health-bar-bg {
    width: 260px;
    height: 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #7f1d1d;
    border-radius: 3px;
    overflow: hidden;
}

#boss-health-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

#boss-health-text {
    font-size: 8px;
    color: #fca5a5;
}

/* Active Skill Indicator */
#active-skill-indicator {
    position: absolute;
    top: 70px;
    left: 20px;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.5);
    border-radius: 6px;
    padding: 6px 14px;
}

#active-skill-name {
    font-size: 9px;
    color: #4ade80;
    letter-spacing: 1px;
}

/* Shield Indicator */
#shield-indicator {
    position: absolute;
    top: 100px;
    left: 20px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 9px;
    color: #60a5fa;
    letter-spacing: 1px;
    animation: shieldPulse 1s ease-in-out infinite alternate;
}

@keyframes shieldPulse {
    from { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
    to { box-shadow: 0 0 15px rgba(59, 130, 246, 0.6); }
}

/* ======================== */
/*      DAMAGE FLASH        */
/* ======================== */
.damage-flash {
    animation: damageFlash 0.15s ease-out;
}

@keyframes damageFlash {
    0% { filter: brightness(1); }
    50% { filter: brightness(3) sepia(1) hue-rotate(-30deg) saturate(5); }
    100% { filter: brightness(1); }
}

/* Scrollbar hide */
::-webkit-scrollbar {
    display: none;
}

/* HUD Exit Button */
#hud-exit {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#hud-exit a {
    font-family: 'Press Start 2P', monospace;
    color: #ef4444;
    text-decoration: none;
    font-size: 8px;
    border: 1px solid #ef4444;
    padding: 6px 14px;
    border-radius: 0;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.5);
}

#hud-exit a:hover {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}
