/* Game specific styles */

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 80px auto 0; /* Added top margin for navbar */
    background-color: transparent; /* Changed to transparent to match theme */
    width: fit-content; /* Fit to canvas */
}

#game-canvas {
    border: 4px solid #2a2a3a;
    cursor: pointer;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background-color: #000; /* Ensure canvas has background */
}

#game-canvas:hover {
    cursor: crosshair;
}

/* HUD Overlay */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* Health/Mana Orbs */
.orb-container {
    position: absolute;
    bottom: 10px;
    width: 80px;
    height: 80px;
    pointer-events: auto;
}

#health-orb {
    left: 10px;
}

#mana-orb {
    right: 10px;
}

.orb {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #333;
    position: relative;
    overflow: hidden;
}

.orb-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    transition: height 0.3s ease;
}

#health-fill {
    background: linear-gradient(to top, #8b0000, #cc0000);
    height: 100%;
}

#mana-fill {
    background: linear-gradient(to top, #000080, #0000cc);
    height: 100%;
}

/* Low mana warning animation */
.low-mana-warning .orb {
    animation: mana-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 15px #4444ff, 0 0 30px #0000aa;
}

@keyframes mana-pulse {
    0%, 100% {
        box-shadow: 0 0 10px #4444ff, 0 0 20px #0000aa;
        border-color: #4444ff;
    }
    50% {
        box-shadow: 0 0 20px #6666ff, 0 0 40px #0044ff;
        border-color: #6666ff;
    }
}

/* Low health warning animation */
.low-health-warning .orb {
    animation: health-pulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 15px #ff4444, 0 0 30px #aa0000;
}

@keyframes health-pulse {
    0%, 100% {
        box-shadow: 0 0 10px #ff4444, 0 0 20px #aa0000;
        border-color: #ff4444;
    }
    50% {
        box-shadow: 0 0 25px #ff6666, 0 0 50px #ff4400;
        border-color: #ff6666;
    }
}

.orb-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    text-shadow: 1px 1px 2px black;
    font-weight: bold;
}

/* Floor indicator */
#floor-display {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #c4a777;
    font-size: 18px;
    text-shadow: 2px 2px 4px black;
}

/* Audio Controls */
#audio-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    pointer-events: auto;
    z-index: 10;
}

#mute-btn {
    width: 40px;
    height: 40px;
    background: rgba(20, 15, 10, 0.85);
    border: 2px solid #8b7355;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#mute-btn:hover {
    background: rgba(40, 30, 20, 0.95);
    border-color: #c4a060;
    transform: scale(1.05);
}

#mute-btn:active {
    transform: scale(0.95);
}

#mute-btn.muted {
    border-color: #663333;
}

/* Minimap */
#minimap {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #444;
}

/* Character info */
#char-info {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #c4a777;
    font-size: 14px;
    text-shadow: 1px 1px 2px black;
}

/* Main Menu Overlay */
#main-menu {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#main-menu h1 {
    color: #c4a777;
    font-size: 48px;
    text-shadow: 3px 3px 6px black;
    margin-bottom: 40px;
    letter-spacing: 4px;
}

.menu-button {
    background: linear-gradient(to bottom, #3a3a4a, #1a1a2e);
    color: #c4a777;
    border: 2px solid #555;
    padding: 15px 40px;
    font-size: 20px;
    font-family: 'Times New Roman', serif;
    cursor: pointer;
    margin: 10px;
    min-width: 200px;
    transition: all 0.2s;
}

.menu-button:hover {
    background: linear-gradient(to bottom, #4a4a5e, #2a2a3e);
    border-color: #c4a777;
    transform: scale(1.05);
}

/* Class Selection */
#class-select {
    display: none;
    flex-direction: column;
    align-items: center;
}

#class-select h2 {
    color: #c4a777;
    margin-bottom: 30px;
}

.class-options {
    display: flex;
    gap: 20px;
}

.class-card {
    background: rgba(30, 30, 40, 0.9);
    border: 2px solid #444;
    padding: 20px;
    width: 180px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.class-card:hover {
    border-color: #c4a777;
    transform: translateY(-5px);
}

.class-card h3 {
    color: #c4a777;
    margin-bottom: 10px;
}

.class-card p {
    color: #888;
    font-size: 12px;
}

.class-card .stats {
    margin-top: 15px;
    font-size: 11px;
    color: #666;
    text-align: left;
}

/* Loading screen */
#loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.9); /* Semi-transparent to show theme */
    display: flex;
    justify-content: center;
    align-items: center;
    color: #c4a777;
    font-size: 24px;
    z-index: 200;
    backdrop-filter: blur(10px);
}

/* ==================== MINIMAP STYLES ==================== */

/* Minimap container */
#minimap {
    position: absolute;
    top: 10px;
    right: 10px;
    pointer-events: auto;
    z-index: 50;
}

.minimap-canvas {
    border: 2px solid #444455;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.minimap-controls {
    display: flex;
    gap: 4px;
    margin-top: 5px;
    justify-content: center;
}

.minimap-btn {
    width: 28px;
    height: 28px;
    background: rgba(30, 30, 35, 0.9);
    border: 1px solid #444455;
    border-radius: 4px;
    color: #c4a777;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.minimap-btn:hover {
    background: rgba(60, 60, 70, 0.9);
    border-color: #c4a777;
}

.minimap-coords {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 4px;
}

.minimap-area {
    font-size: 12px;
    color: #c4a777;
    text-align: center;
    margin-top: 2px;
}

/* ==================== FULL MAP OVERLAY ==================== */

.fullmap-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.fullmap-overlay.hidden {
    display: none !important;
}

.fullmap-container {
    background: rgba(20, 20, 25, 0.95);
    border: 2px solid #444455;
    border-radius: 8px;
    padding: 15px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.fullmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444455;
}

.fullmap-header h2 {
    color: #c4a777;
    margin: 0;
    font-size: 18px;
}

.fullmap-controls {
    display: flex;
    gap: 8px;
}

.fullmap-btn {
    width: 32px;
    height: 32px;
    background: rgba(40, 40, 50, 0.9);
    border: 1px solid #555566;
    border-radius: 4px;
    color: #c4a777;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.fullmap-btn:hover {
    background: rgba(70, 70, 85, 0.9);
    border-color: #c4a777;
}

.fullmap-content {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 1px solid #333344;
    border-radius: 4px;
}

.fullmap-canvas {
    cursor: grab;
}

.fullmap-canvas:active {
    cursor: grabbing;
}

.fullmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444455;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #999;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.fullmap-info {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: #888;
}

/* Utility class */
.hidden {
    display: none !important;
}

/* Full map hint text */
.fullmap-hint {
    color: #888;
    font-size: 12px;
    flex-grow: 1;
    text-align: center;
}

/* ==================== DEATH SCREEN OVERLAY ==================== */

.death-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.death-overlay.hidden {
    display: none !important;
}

.death-content {
    text-align: center;
    padding: 40px 60px;
    background: linear-gradient(180deg, rgba(30, 10, 10, 0.95) 0%, rgba(15, 5, 5, 0.98) 100%);
    border: 2px solid #8b0000;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(139, 0, 0, 0.5), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.death-title {
    font-size: 48px;
    color: #cc0000;
    text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000;
    margin: 0 0 20px 0;
    letter-spacing: 4px;
    animation: deathPulse 2s infinite;
}

@keyframes deathPulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000; }
    50% { opacity: 0.8; text-shadow: 0 0 30px #ff0000, 0 0 60px #ff0000; }
}

.death-message {
    color: #888;
    font-size: 18px;
    margin-bottom: 30px;
    font-style: italic;
}

.death-recap {
    background: rgba(139, 0, 0, 0.3);
    padding: 15px 25px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #8b0000;
}

.death-cause {
    color: #ff6666;
    font-size: 18px;
    margin: 0;
}

.death-cause span {
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
}

.death-stats {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 30px;
    border-radius: 4px;
    margin-bottom: 30px;
    border: 1px solid #333;
}

.death-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.death-stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: #888;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    color: #c4a777;
    font-size: 18px;
    font-weight: bold;
}

.death-stats p {
    color: #aaa;
    font-size: 16px;
    margin: 8px 0;
}

.death-stats span {
    color: #c4a777;
    font-weight: bold;
}

.death-button {
    display: block;
    width: 100%;
    padding: 15px 30px;
    margin-top: 15px;
    background: linear-gradient(180deg, #8b0000 0%, #5c0000 100%);
    border: 2px solid #aa0000;
    border-radius: 4px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.death-button:hover {
    background: linear-gradient(180deg, #aa0000 0%, #770000 100%);
    border-color: #cc0000;
    transform: scale(1.02);
}

.death-button.secondary {
    background: linear-gradient(180deg, #333 0%, #222 100%);
    border-color: #444;
}

.death-button.secondary:hover {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    border-color: #555;
}

/* ==================== FLOATING DAMAGE NUMBERS ==================== */

.damage-number {
    position: absolute;
    font-weight: bold;
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    z-index: 100;
}

.damage-number.physical {
    color: #ffffff;
}

.damage-number.critical {
    color: #ff4444;
    font-size: 1.3em;
}

.damage-number.magic {
    color: #88aaff;
}

.damage-number.fire {
    color: #ff8844;
}

.damage-number.poison {
    color: #44ff44;
}

.damage-number.heal {
    color: #44ff88;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* ==================== GOLD DISPLAY ==================== */

#gold-container {
    position: absolute;
    top: 35px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(20, 15, 10, 0.85);
    border: 1px solid #8b7355;
    border-radius: 4px;
    font-size: 14px;
    color: #ffcc00;
    text-shadow: 1px 1px 2px black;
}

.gold-icon {
    font-size: 16px;
}

#gold-display {
    font-weight: bold;
    min-width: 40px;
}

/* ==================== XP BAR ==================== */

#xp-bar-container {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    pointer-events: none;
}

#xp-bar {
    width: 100%;
    height: 8px;
    background: rgba(20, 15, 10, 0.85);
    border: 1px solid #8b7355;
    border-radius: 4px;
    overflow: hidden;
}

#xp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #4488ff, #88ccff);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 5px rgba(68, 136, 255, 0.5);
}

#xp-text {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #88aacc;
    margin-top: 2px;
    text-shadow: 1px 1px 2px black;
}

/* ==================== LEVEL UP FLASH ==================== */

@keyframes levelUpFlash {
    0% {
        opacity: 0;
        box-shadow: inset 0 0 100px rgba(255, 204, 0, 0);
    }
    20% {
        opacity: 1;
        box-shadow: inset 0 0 100px rgba(255, 204, 0, 0.5);
    }
    100% {
        opacity: 0;
        box-shadow: inset 0 0 100px rgba(255, 204, 0, 0);
    }
}

.level-up-flash {
    animation: levelUpFlash 1s ease-out forwards;
}

/* ==================== MODAL STYLES ==================== */

.modal {
    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;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #8b0000;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.5);
}

.modal-content h2 {
    color: #ffcc00;
    text-align: center;
    margin-bottom: 20px;
    font-size: 28px;
    text-shadow: 2px 2px 4px black;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

/* ==================== SETTINGS MODAL ==================== */

.settings-content {
    min-width: 450px;
}

.settings-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(139, 0, 0, 0.3);
}

.settings-section h3 {
    color: #ff6666;
    font-size: 16px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.5);
    padding-bottom: 8px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    color: #cccccc;
}

.setting-row label {
    flex: 1;
    font-size: 14px;
}

.setting-row input[type="range"] {
    width: 150px;
    margin: 0 10px;
    accent-color: #8b0000;
}

.setting-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #8b0000;
    cursor: pointer;
}

.setting-row span {
    min-width: 40px;
    text-align: right;
    color: #ffcc00;
    font-size: 13px;
}

/* ==================== HELP MODAL ==================== */

.help-content {
    min-width: 550px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.control-section {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(139, 0, 0, 0.3);
}

.control-section h3 {
    color: #ff6666;
    font-size: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.5);
    padding-bottom: 6px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    color: #cccccc;
    font-size: 13px;
}

.control-row .key {
    background: linear-gradient(to bottom, #333 0%, #222 100%);
    color: #ffcc00;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid #555;
    min-width: 60px;
    text-align: center;
}

/* ==================== MENU BUTTON STYLES ==================== */

.menu-button.secondary {
    background: linear-gradient(to bottom, #333 0%, #222 100%);
    border-color: #555;
}

.menu-button.secondary:hover {
    background: linear-gradient(to bottom, #444 0%, #333 100%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.menu-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ==================== PAUSE MODAL ==================== */

.pause-content {
    min-width: 300px;
    text-align: center;
}

.pause-content h2 {
    font-size: 36px;
    letter-spacing: 4px;
    margin-bottom: 30px;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.pause-buttons .menu-button {
    width: 200px;
}

/* ==================== ENHANCED LOADING SCREEN ==================== */

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a12 0%, #1a1a2e 50%, #0a0a12 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    max-width: 400px;
}

.loading-title {
    color: #c4a777;
    font-size: 32px;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(196, 167, 119, 0.5);
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.loading-bar {
    width: 300px;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #8b7355;
    border-radius: 4px;
    margin: 0 auto 20px;
    overflow: hidden;
}

.loading-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #8b0000, #cc0000, #8b0000);
    background-size: 200% 100%;
    animation: loadingShimmer 1.5s ease-in-out infinite;
    transition: width 0.3s ease;
}

@keyframes loadingShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-text {
    color: #888;
    font-size: 14px;
    margin-bottom: 15px;
}

.loading-tip {
    color: #c4a777;
    font-size: 12px;
    font-style: italic;
    opacity: 0.8;
}

/* ==================== FLOOR TRANSITION ==================== */

.floor-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.floor-transition.hidden {
    opacity: 0;
    pointer-events: none;
}

.floor-transition.fade-out {
    opacity: 0;
}

.floor-transition-content {
    text-align: center;
    animation: floorSlideIn 0.5s ease-out;
}

@keyframes floorSlideIn {
    0% {
        transform: translateY(-30px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.floor-transition-title {
    color: #c4a777;
    font-size: 48px;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(196, 167, 119, 0.6);
    margin-bottom: 10px;
}

.floor-transition-floor {
    color: #ff6666;
    font-size: 28px;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.floor-transition-bar {
    width: 250px;
    height: 4px;
    background: rgba(139, 0, 0, 0.3);
    margin: 0 auto;
    border-radius: 2px;
    overflow: hidden;
}

.floor-transition-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #8b0000, #ff4444);
    animation: floorProgress 1.2s ease-out forwards;
}

@keyframes floorProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ==================== ORB LABELS ==================== */

.orb-label {
    display: block;
    text-align: center;
    color: #888;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 4px;
    text-shadow: 1px 1px 2px black;
}

/* Potion Count Display */
.potion-count {
    position: absolute;
    top: -5px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    pointer-events: none;
}

.health-potion-count {
    right: -5px;
    border-color: rgba(255, 50, 50, 0.4);
}

.health-potion-count .potion-icon {
    filter: hue-rotate(-40deg) saturate(1.5);
}

.mana-potion-count {
    left: -5px;
    border-color: rgba(50, 100, 255, 0.4);
}

.mana-potion-count .potion-icon {
    filter: hue-rotate(180deg) saturate(1.5);
}

.potion-icon {
    font-size: 10px;
}

.potion-num {
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

.potion-count.empty .potion-num {
    color: #ff4444;
}
