/* Reset and Base Styles */
.is-hidden {
    display: none !important;
}

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

:root {
    --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);
    --event-log-height: 150px;
}

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;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Game Container - Full Screen Grid Layout */
.game-container {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    grid-template-rows: 1fr var(--event-log-height);
    gap: 12px;
    padding: 12px;
    grid-template-areas:
        "character area inventory"
        "character eventlog inventory";
}

/* Character Panel */
.character-panel {
    grid-area: character;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
    line-height: 1.3;
}

.character-info {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-start;
}

.character-portrait {
    flex-shrink: 0;
}

.character-portrait img {
    width: 72px;
    height: 72px;
    border: 2px solid var(--border-highlight);
    border-radius: 6px;
    object-fit: cover;
    image-rendering: pixelated;
    box-shadow: var(--shadow-sm);
}

.character-stats {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.health-stat {
    gap: 6px;
}

.health-bar-container {
    flex: 1;
    position: relative;
    height: 18px;
    background: var(--health-bg);
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    overflow: hidden;
}

.health-bar-container progress.health-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
}

.health-bar-container progress.health-bar::-webkit-progress-bar {
    background: transparent;
}

.health-bar-container progress.health-bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--health-fill), #ef4444);
    box-shadow: inset 0 0 10px rgba(220, 38, 38, 0.6);
    transition: width 0.3s ease;
}

.health-bar-container progress.health-bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--health-fill), #ef4444);
    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.7rem;
    font-weight: 700;
    color: var(--health-text);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

/* Equipment Section */
.equipment-section h3 {
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 3px;
}

.equipment-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.equipment-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 4px 6px;
    height: 40px;
    box-sizing: border-box;
}

.slot-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    min-width: 48px;
}

.slot-content {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.equipment-display {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.item-sprite-small {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-size: 256px 128px;
    image-rendering: pixelated;
}

/* Area View */
.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);
    min-height: 400px;
}

.area-image {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.2s ease;
}

.area-image.transitioning {
    opacity: 0.5;
}

.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;
}

.player-avatar img {
    width: 100%;
    height: auto;
}

/* Portal */
.portal-container {
    position: absolute;
    left: 25%;
    top: 35%;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.portal-container:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.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));
    }
}

/* Enemies */
.enemies-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none;
}

.enemy {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.enemy:nth-child(1) { top: 20%; right: 20%; z-index: 1; }
.enemy:nth-child(2) { top: 40%; right: 18%; z-index: 2; }
.enemy:nth-child(3) { top: 60%; right: 22%; z-index: 3; }
.enemy:nth-child(4) { top: 30%; right: 30%; z-index: 4; }
.enemy:nth-child(5) { top: 50%; right: 26%; z-index: 5; }

.enemy.defeated {
    pointer-events: none;
}

.enemy-sprite {
    width: 128px;
    height: 128px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    transform: scale(0.75);
    transform-origin: center bottom;
}

.enemy.alive .enemy-sprite {
    pointer-events: auto;
    cursor: pointer;
    filter: drop-shadow(0 4px 8px rgba(220, 38, 38, 0.6));
    animation: enemyIdle 2s ease-in-out infinite;
}

.enemy.defeated .enemy-sprite {
    filter: drop-shadow(0 4px 8px rgba(100, 100, 100, 0.4)) grayscale(100%);
    opacity: 0.6;
    transform: scale(0.5);
}

@keyframes enemyIdle {
    0%, 100% { transform: scale(0.75) translateY(0px); }
    50% { transform: scale(0.75) translateY(-5px); }
}

/* Combat attack animations */
.combat-fx-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 25;
    pointer-events: none;
    overflow: hidden;
}

.combat-fx-layer > * {
    position: absolute;
}

.player-avatar.is-attacking,
.enemy-sprite.is-attacking {
    animation: none !important;
}

.melee-slash {
    width: 10px;
    height: 80px;
    background: linear-gradient(
        to top,
        rgba(255, 249, 196, 0.15) 0%,
        #fde047 35%,
        #fffef0 65%,
        #ffffff 100%
    );
    border-radius: 5px;
    transform-origin: 50% 100%;
    box-shadow:
        0 0 12px rgba(255, 240, 120, 1),
        0 0 28px rgba(255, 200, 50, 0.85),
        0 0 4px rgba(255, 255, 255, 0.9) inset;
    pointer-events: none;
}

.combat-missile {
    width: 24px;
    height: 8px;
    background: linear-gradient(90deg, #f97316, #ef4444);
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
    pointer-events: none;
}

.combat-magic-stars {
    width: 32px;
    height: 32px;
    pointer-events: none;
}

.combat-magic-stars .magic-star {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #c4b5fd;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 0 0 6px rgba(196, 181, 253, 0.9);
    animation: magicSparkle 300ms ease-in-out infinite alternate;
}

.combat-magic-stars .magic-star:nth-child(1) { left: 0; top: 12px; animation-delay: 0ms; }
.combat-magic-stars .magic-star:nth-child(2) { left: 12px; top: 0; animation-delay: 50ms; }
.combat-magic-stars .magic-star:nth-child(3) { left: 24px; top: 8px; animation-delay: 100ms; }
.combat-magic-stars .magic-star:nth-child(4) { left: 8px; top: 20px; animation-delay: 150ms; }
.combat-magic-stars .magic-star:nth-child(5) { left: 20px; top: 22px; animation-delay: 200ms; }

@keyframes magicSparkle {
    0% { transform: scale(0.6) rotate(0deg); opacity: 0.6; }
    100% { transform: scale(1.2) rotate(45deg); opacity: 1; }
}

.combat-impact {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 50, 0.9) 0%, rgba(239, 68, 68, 0.4) 50%, transparent 70%);
    pointer-events: none;
}

.combat-impact-magic {
    background: radial-gradient(circle, rgba(196, 181, 253, 0.95) 0%, rgba(139, 92, 246, 0.5) 50%, transparent 70%);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.8);
}

.combat-impact.type-matchup-advantage {
    background: radial-gradient(circle, rgba(255, 230, 100, 1) 0%, rgba(251, 146, 60, 0.7) 45%, transparent 70%);
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.95), 0 0 40px rgba(245, 158, 11, 0.6);
}

.combat-impact.type-matchup-disadvantage {
    background: radial-gradient(circle, rgba(180, 190, 200, 0.7) 0%, rgba(120, 130, 145, 0.35) 50%, transparent 70%);
    box-shadow: 0 0 10px rgba(148, 163, 184, 0.4);
}

.combat-impact-magic.type-matchup-advantage {
    background: radial-gradient(circle, rgba(233, 213, 255, 1) 0%, rgba(167, 139, 250, 0.75) 45%, transparent 70%);
    box-shadow: 0 0 28px rgba(196, 181, 253, 1), 0 0 44px rgba(139, 92, 246, 0.7);
}

.combat-impact-magic.type-matchup-disadvantage {
    background: radial-gradient(circle, rgba(160, 150, 190, 0.65) 0%, rgba(100, 90, 130, 0.35) 50%, transparent 70%);
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.35);
}

.enemy-name {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    background: rgba(20, 20, 31, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-primary);
}

.enemy progress.health-bar {
    width: 90px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    overflow: hidden;
    background: var(--health-bg);
}

.enemy progress.health-bar::-webkit-progress-bar {
    background: var(--health-bg);
    border-radius: 3px;
}

.enemy progress.health-bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--health-fill), #ef4444);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.enemy progress.health-bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--health-fill), #ef4444);
    border-radius: 3px;
}

.defeated-label {
    color: #dc2626;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.attack-button {
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    padding: 4px 12px;
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    pointer-events: auto;
}

.attack-button:hover {
    background: rgba(139, 92, 246, 0.6);
    box-shadow: var(--glow-accent);
}

.attack-button:active {
    transform: scale(0.95);
}

/* Items on ground */
.items-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none;
}

.room-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.room-item:nth-child(1) { top: 40%; left: 15%; z-index: 1; }
.room-item:nth-child(2) { top: 55%; left: 17%; z-index: 2; }
.room-item:nth-child(3) { top: 70%; left: 19%; z-index: 3; }

.room-item .item-sprite {
    width: 128px;
    height: 128px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.6));
    animation: itemFloat 3s ease-in-out infinite;
    pointer-events: auto;
    cursor: pointer;
    transform: scale(0.375);
    transform-origin: center center;
    margin: -40px;
}

@keyframes itemFloat {
    0%, 100% { transform: scale(0.375) translateY(0px); }
    50% { transform: scale(0.375) translateY(-6px); }
}

.room-item .item-name {
    font-size: 0.75rem;
    background: rgba(20, 20, 31, 0.95);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    padding: 2px 8px;
    color: var(--accent-primary);
    font-weight: 600;
    white-space: nowrap;
}

.pickup-button {
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    padding: 3px 10px;
    color: var(--text-primary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.pickup-button:hover {
    background: rgba(139, 92, 246, 0.6);
    box-shadow: var(--glow-accent);
}

/* Location Info */
.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 */
.navigation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

.nav-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.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: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
}

.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-north {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#nav-north:hover {
    transform: translateX(-50%) scale(1.1);
}

#nav-south {
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
}

#nav-south:hover {
    transform: translateX(-50%) scale(1.1);
}

#nav-west {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

#nav-west:hover {
    transform: translateY(-50%) scale(1.1);
}

#nav-east {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

#nav-east:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Inventory Panel */
.inventory-panel {
    grid-area: inventory;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    min-width: 0;
}

.inventory-panel h3 {
    font-size: 1rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 6px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.inventory-item {
    aspect-ratio: 1;
    min-width: 0;
    overflow: hidden;
    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: 6px;
}

.inventory-item:hover {
    border-color: var(--border-highlight);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.inventory-item .item-sprite {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-size: 256px 128px;
    image-rendering: pixelated;
}

.inventory-item .item-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.key-hint {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.6rem;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Event Log Panel */
.event-log-panel {
    grid-area: eventlog;
    background: var(--bg-panel);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    height: var(--event-log-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.event-log-panel h3 {
    font-size: 0.85rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.event-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: rgba(20, 20, 31, 0.5);
    border-left: 3px solid var(--accent-primary);
    border-radius: 2px;
    animation: slideInRight 0.3s ease-out;
    transition: opacity 0.5s ease;
}

.log-entry.faded {
    opacity: 0.3;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Floating Damage */
.floating-damage {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transform: translateY(0);
    transition: all 1.5s ease-out;
}

.floating-damage.animate {
    opacity: 1;
    transform: translateY(-60px);
    animation: damageFloat 1.5s ease-out forwards;
}

.floating-damage.damage.type-matchup-advantage {
    color: #fbbf24;
    font-size: 1.75rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 14px rgba(251, 191, 36, 0.85);
}

.floating-damage.damage.type-matchup-disadvantage {
    color: #94a3b8;
    font-size: 1.25rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 6px rgba(148, 163, 184, 0.5);
}

.floating-damage.animate.type-matchup-advantage {
    animation: damageFloatAdvantage 1.5s ease-out forwards;
}

.floating-damage.animate.type-matchup-disadvantage {
    animation: damageFloatDisadvantage 1.5s ease-out forwards;
}

.floating-damage.damage {
    color: #ff4444;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 68, 68, 0.6);
}

.floating-damage.healing {
    color: #44ff44;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(68, 255, 68, 0.6);
}

@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 damageFloatAdvantage {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.45);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.9);
    }
}

@keyframes damageFloatDisadvantage {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.05);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.65);
    }
}

/* 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-content h1 {
    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-stats {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.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);
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 2px solid var(--border-highlight);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-primary);
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-md);
    max-width: 250px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip .tooltip-title {
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.tooltip .tooltip-desc {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    :root {
        --event-log-height: 120px;
    }

    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 40vh auto var(--event-log-height);
        gap: 8px;
        padding: 8px;
        grid-template-areas:
            "character"
            "area"
            "inventory"
            "eventlog";
    }

    .character-panel {
        max-height: 200px;
        flex-direction: row;
        padding: 10px;
        gap: 12px;
    }

    .character-portrait img {
        width: 60px;
        height: 60px;
    }

    .equipment-section {
        margin-top: 0;
    }

    .inventory-panel {
        max-height: 150px;
    }

    .inventory-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .nav-button {
        width: 48px;
        height: 48px;
        font-size: 0.75rem;
    }

    .player-avatar {
        width: 50px;
    }

    .portal-image {
        width: 60px;
    }
}
