/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Gothic Theme Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #14141f;
    --bg-panel: #1a1a2e;
    --border-primary: #2d2d44;
    --border-highlight: #4a4a6a;
    --text-primary: #e0e0e8;
    --text-secondary: #a0a0b8;
    --text-dim: #606078;
    --accent-primary: #8b5cf6;
    --accent-secondary: #6d28d9;
    --accent-hover: #a78bfa;
    --health-bg: #2d1f1f;
    --health-fill: #dc2626;
    --health-text: #fca5a5;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.8);
    --glow-accent: 0 0 20px rgba(139, 92, 246, 0.5);
}

body {
    font-family: 'Segoe UI', 'Cinzel', Georgia, serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Game Container - Full Screen */
.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* For pages with game container, prevent body scroll */
body:has(.game-container) {
    overflow: hidden;
    height: 100vh;
}

/* Event Log Overlay */
.event-log {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 350px;
    z-index: 1000;
    pointer-events: none;
}

.event-message {
    background: rgba(20, 20, 31, 0.5);
    border: 1px solid var(--border-primary);
    border-right: 3px solid var(--accent-primary);
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Main Game Layout - Desktop Grid */
.game-layout {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr 200px;
    gap: 12px;
    padding: 12px;
    grid-template-areas:
        "character area"
        "inventory area";
}

/* Character Panel */
.character-panel {
    grid-area: character;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--border-primary);
    padding-bottom: 8px;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Character Header Section - Portrait and Equipped Items Side by Side */
.character-header-section {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 8px 0;
}

.character-portrait {
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.portrait-image {
    width: 120px;
    height: 120px;
    border: 3px solid var(--border-highlight);
    border-radius: 8px;
    object-fit: cover;
    image-rendering: pixelated;
    box-shadow: var(--shadow-md);
}

.portrait-placeholder {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border: 3px solid var(--border-highlight);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.portrait-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}

/* Compact Equipped Items - Next to Portrait */
.equipped-items-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.equipment-slot-compact {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.equipment-slot-compact:hover {
    border-color: var(--border-highlight);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.slot-icon-compact {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4));
}

.equipped-item-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.6));
}

.character-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.health-bar {
    position: relative;
    height: 28px;
    background: var(--health-bg);
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    overflow: hidden;
}

.health-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--health-fill), #ef4444);
    transition: width 0.3s ease;
    box-shadow: inset 0 0 10px rgba(220, 38, 38, 0.6);
}

.health-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--health-text);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    z-index: 1;
}


/* Area View - Main Game Area */
.area-view {
    grid-area: area;
    position: relative;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.area-image {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.inline-form {
    display: inline;
}

.player-avatar {
    position: absolute;
    left: calc(50% - 15%);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    z-index: 10;
    pointer-events: none;
}

.portal-form {
    position: absolute;
    left: calc(25%);
    top: 25%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.portal-button {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portal-button:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.portal-button:active {
    transform: scale(0.95);
}

.portal-image {
    width: 100px;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.8));
    animation: portalPulse 2s ease-in-out infinite;
}

@keyframes portalPulse {
    0%, 100% {
        filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 25px rgba(139, 92, 246, 1));
    }
}

.area-location-info {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    background: rgba(10, 10, 15, 0.7);
    padding: 8px 16px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 5;
    pointer-events: none;
}

/* Navigation Buttons */
.nav-button {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid var(--border-highlight);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-md);
}

.nav-button:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: var(--accent-primary);
    box-shadow: var(--glow-accent);
    transform: scale(1.1);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-up {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.nav-up:hover {
    transform: translateX(-50%) scale(1.1);
}

.nav-down {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.nav-down:hover {
    transform: translateX(-50%) scale(1.1);
}

.nav-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-left:hover {
    transform: translateY(-50%) scale(1.1);
}

.nav-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-right:hover {
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow {
    filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.6));
}

/* Inventory Panel */
.inventory-panel {
    grid-area: inventory;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.inventory-slot:hover {
    border-color: var(--border-highlight);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.inventory-slot.empty {
    opacity: 0.5;
    cursor: default;
}

.inventory-slot.empty:hover {
    transform: none;
    box-shadow: none;
}

.slot-number {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.item-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.4));
}

/* Scrollbar Styling */
.character-panel::-webkit-scrollbar,
.inventory-panel::-webkit-scrollbar {
    width: 8px;
}

.character-panel::-webkit-scrollbar-track,
.inventory-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.character-panel::-webkit-scrollbar-thumb,
.inventory-panel::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 4px;
}

.character-panel::-webkit-scrollbar-thumb:hover,
.inventory-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Mobile Responsive Layout */
@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 50vh auto auto;
        gap: 8px;
        padding: 8px;
        grid-template-areas:
            "area"
            "character"
            "inventory";
    }

    .character-panel,
    .inventory-panel {
        max-height: 25vh;
        overflow-y: auto;
    }

    .character-header-section {
        margin: 4px 0;
    }

    .portrait-image {
        width: 80px;
        height: 80px;
    }

    .portrait-placeholder {
        width: 80px;
        height: 80px;
    }

    .portrait-icon {
        font-size: 2rem;
    }

    .equipped-items-compact {
        flex-direction: row;
        gap: 6px;
    }

    .equipment-slot-compact {
        width: 44px;
        height: 44px;
        padding: 4px;
    }

    .slot-icon-compact {
        font-size: 1.5rem;
    }

    .equipped-item-icon {
        width: 32px;
        height: 32px;
    }

    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 6px;
    }

    .nav-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .nav-up,
    .nav-down {
        top: 15px;
    }

    .nav-down {
        top: auto;
        bottom: 15px;
    }

    .nav-left,
    .nav-right {
        top: 50%;
    }

    .nav-left {
        left: 15px;
    }

    .nav-right {
        right: 15px;
    }

    .event-log {
        max-width: calc(100vw - 40px);
        right: 10px;
        top: 10px;
    }

    .event-message {
        font-size: 0.8rem;
        padding: 10px 12px;
    }

    .panel-header {
        font-size: 1rem;
    }

    .area-location-info {
        font-size: 11px;
        padding: 6px 10px;
        bottom: 10px;
        right: 10px;
    }

    .player-avatar {
        width: 60px;
    }

    .portal-image {
        width: 70px;
    }
}

/* Tablet/Medium Screen Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 250px 1fr;
        grid-template-rows: 1fr 180px;
    }

    .character-panel,
    .inventory-panel {
        padding: 12px;
    }

    .portrait-placeholder {
        width: 100px;
        height: 100px;
    }

    .portrait-icon {
        font-size: 2.5rem;
    }
}

/* Legacy styles for other pages (About, Error, etc.) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
}

.content-section {
    background: var(--bg-panel);
    padding: 3rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-primary);
    width: 100%;
    margin: 2rem 0;
}

.content-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-primary);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.content-section h2 {
    font-size: 1.75rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.content-section p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
}

.content-section p.highlight {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 1.2rem;
    margin-top: 2rem;
    text-align: center;
    padding: 1.5rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 0.5rem;
    border: 1px solid var(--border-highlight);
}

.content-section ul {
    margin-left: 2rem;
    margin-bottom: 2rem;
}

.content-section li {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.content-section li strong {
    color: var(--text-primary);
}

.content-section .cta {
    text-align: center;
    margin-top: 3rem;
}

.content-section .button {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.content-section .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.6);
    border-color: var(--accent-hover);
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.error-page h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-overlay.fade-out {
    opacity: 0;
}

.loading-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 2rem;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.loading-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    text-shadow: var(--glow-accent);
    font-family: 'Cinzel', Georgia, serif;
}

.loading-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.progress-container {
    margin: 2rem 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    transition: width 0.3s ease-out;
    border-radius: 13px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.loading-info {
    font-size: 0.9rem;
    color: var(--text-dim);
    min-height: 1.5rem;
}

/* Enemy Styles */
.enemy-container {
    position: absolute;
    z-index: 15;
}

/* Enemy positioning - staggered formation right of center */
.enemy-container.enemy-0 {
    top: 30%;
    right: 25%;
}

.enemy-container.enemy-1 {
    top: 45%;
    right: 23%;
}

.enemy-container.enemy-2 {
    top: 60%;
    right: 21%;
}

.enemy-container.enemy-3 {
    top: 75%;
    right: 19%;
}

.enemy-container.enemy-4 {
    top: 35%;
    right: 28%;
}

.enemy-form {
    display: inline-block;
}

.enemy-button {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.enemy-button:hover {
    transform: scale(1.1);
}

.enemy-button:active {
    transform: scale(0.95);
}

.enemy-sprite {
    font-size: 3rem;
    filter: drop-shadow(0 4px 8px rgba(220, 38, 38, 0.6));
    animation: enemyIdle 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enemy-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
}

@keyframes enemyIdle {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.enemy-info {
    background: rgba(20, 20, 31, 0.95);
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 150px;
    backdrop-filter: blur(8px);
}

.enemy-name {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}

.enemy-health-bar {
    height: 20px;
}

.enemy-health-bar .health-text {
    font-size: 0.75rem;
}

/* Item Styles */
.item-container {
    position: absolute;
    z-index: 15;
}

/* Item positioning - left side of room */
.item-container.item-0 {
    top: 40%;
    left: 15%;
}

.item-container.item-1 {
    top: 52%;
    left: 16%;
}

.item-container.item-2 {
    top: 64%;
    left: 17%;
}

.item-container.item-3 {
    top: 76%;
    left: 18%;
}

.item-container.item-4 {
    top: 45%;
    left: 12%;
}

.item-form {
    display: inline-block;
}

.item-button {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.item-button:hover {
    transform: scale(1.15);
}

.item-button:active {
    transform: scale(0.9);
}

.item-sprite {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.6));
    animation: itemFloat 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}

@keyframes itemFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(5deg);
    }
    75% {
        transform: translateY(-8px) rotate(-5deg);
    }
}

.item-name {
    background: rgba(20, 20, 31, 0.95);
    border: 2px solid var(--accent-primary);
    border-radius: 4px;
    padding: 4px 10px;
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* Inventory Item Styles */
.inventory-slot-form {
    display: contents;
}

.inventory-item-button {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    padding: 8px;
    width: 100%;
    height: 100%;
}

.inventory-item-button:hover {
    border-color: var(--border-highlight);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.item-name-small {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
}

.inventory-item-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Health Bar Animations */
.health-fill {
    transition: width 0.5s ease-out;
}

.health-fill.player-health,
.health-fill.enemy-health {
    animation: healthBarPulse 0.5s ease-out;
}

@keyframes healthBarPulse {
    0% {
        box-shadow: inset 0 0 10px rgba(220, 38, 38, 0.6);
    }
    50% {
        box-shadow: inset 0 0 20px rgba(220, 38, 38, 1), 0 0 10px rgba(220, 38, 38, 0.8);
    }
    100% {
        box-shadow: inset 0 0 10px rgba(220, 38, 38, 0.6);
    }
}

/* Damage/Healing Floating Text */
@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

@keyframes healFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

.damage-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 68, 68, 0.6);
    z-index: 100;
    pointer-events: none;
    animation: damageFloat 1.5s ease-out forwards;
}

.heal-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: #44ff44;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(68, 255, 68, 0.6);
    z-index: 100;
    pointer-events: none;
    animation: healFloat 1.5s ease-out forwards;
}

/* Combat Flash Effect */
@keyframes combatFlash {
    0% {
        box-shadow: inset 0 0 0 rgba(220, 38, 38, 0);
    }
    50% {
        box-shadow: inset 0 0 50px rgba(220, 38, 38, 0.8);
    }
    100% {
        box-shadow: inset 0 0 0 rgba(220, 38, 38, 0);
    }
}

.area-image.combat-flash {
    animation: combatFlash 0.3s ease-out;
}

/* Event Log Enhanced Styling */
.event-message {
    animation: slideInRight 0.3s ease-out, fadeOutDelay 0.5s ease-out 9.5s forwards;
}

@keyframes fadeOutDelay {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.game-over-content {
    text-align: center;
    background: var(--bg-panel);
    border: 3px solid #dc2626;
    border-radius: 12px;
    padding: 3rem 4rem;
    box-shadow: var(--shadow-lg), 0 0 50px rgba(220, 38, 38, 0.5);
    animation: scaleIn 0.3s ease-out 0.2s backwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.game-over-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: #dc2626;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(220, 38, 38, 0.8);
    font-family: 'Cinzel', Georgia, serif;
}

.game-over-message {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.new-game-button {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.new-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.6);
    border-color: var(--accent-hover);
}

.new-game-button:active {
    transform: translateY(0);
}

/* Defeated Enemy Skeleton */
.defeated-enemy-container {
    position: absolute;
    z-index: 15;
    animation: fadeInSkeleton 0.5s ease-out;
}

@keyframes fadeInSkeleton {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-45deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Defeated enemy positioning (same as living enemies) */
.defeated-enemy-container.defeated-0 {
    top: 30%;
    right: 25%;
}

.defeated-enemy-container.defeated-1 {
    top: 45%;
    right: 23%;
}

.defeated-enemy-container.defeated-2 {
    top: 60%;
    right: 21%;
}

.defeated-enemy-container.defeated-3 {
    top: 75%;
    right: 19%;
}

.defeated-enemy-container.defeated-4 {
    top: 35%;
    right: 28%;
}

.defeated-enemy-sprite {
    font-size: 4rem;
    filter: drop-shadow(0 4px 8px rgba(220, 38, 38, 0.6)) grayscale(0.5);
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skeleton-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
}

.defeated-enemy-label {
    background: rgba(20, 20, 31, 0.95);
    border: 2px solid #dc2626;
    border-radius: 4px;
    padding: 4px 10px;
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(8px);
    margin-top: 8px;
}