:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #8b4513;
    --panel-bg: rgba(0, 0, 0, 0.8);
}

@font-face {
    font-family: 'Ringbearer';
    src: url('assets/ringbearer.ttf') format('truetype');
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Times New Roman', serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    display: flex;
    width: 1200px;
    height: 800px;
    border: 2px solid var(--accent-color);
    background-color: #000;
    box-shadow: 0 0 20px rgba(139, 69, 19, 0.2);
    position: relative;
}

canvas {
    flex: 1;
    display: block;
    height: 100%;
    background: #000;
}

#ui-layer {
    position: relative;
    width: 300px;
    height: 100%;
    background-image: url('assets/parchment_ui_bg.png'), linear-gradient(rgba(26, 21, 16, 0.9), rgba(26, 21, 16, 0.9));
    background-position: center center;
    background-size: 120% 120%, cover;
    background-repeat: no-repeat;
    border-left: 2px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    pointer-events: auto;
}

#stats-panel,
#log-panel {
    padding: 15px;
    font-weight: bold;
}

#stats-panel {
    border-bottom: 1px solid #4a3728;
    flex: 0 0 auto;
}

#log-panel {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#game-log {
    flex: 1;
    overflow-y: auto;
    font-size: 0.9em;
    color: #4a3728;
    padding-right: 5px;
    font-weight: bold;
}

#game-log div {
    margin-bottom: 5px;
    border-bottom: 1px solid #332211;
    padding-bottom: 2px;
}

h2 {
    margin-top: 0;
    color: #4a3728;
    font-size: 1.3em;
    font-family: 'Ringbearer', 'Cinzel Decorative', 'Times New Roman', serif;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 5px;
    font-weight: bold;
    letter-spacing: 2px;
}

#char-info {
    color: #3a2a1a;
    font-weight: bold;
}

button {
    background: #3e2723;
    color: #e0e0e0;
    border: 1px solid #5d4037;
    padding: 5px 10px;
    cursor: pointer;
    margin-top: 5px;
    width: 100%;
    transition: background 0.2s;
    font-family: 'Times New Roman', serif;
}

button:hover {
    background: #5d4037;
    border-color: #8d6e63;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1510;
}

::-webkit-scrollbar-thumb {
    background: #4a3728;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5d4037;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #221a15;
    border: 2px solid var(--accent-color);
    padding: 20px;
    width: 60%;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.close-btn:hover {
    color: #fff;
}

.item-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #1a1510;
    margin-bottom: 5px;
    border: 1px solid #4a3728;
}

.item-entry:hover {
    border-color: #8b4513;
}

.item-entry button {
    width: auto;
    margin: 0;
    padding: 2px 8px;
    font-size: 0.8em;
}

#equipment-slots {
    margin-top: 20px;
    border-top: 1px solid #4a3728;
    padding-top: 10px;
}

.primary-btn {
    background: linear-gradient(135deg, #9e4c27, #6b2110);
    border: 2px solid #d2691e;
    color: white;
    padding: 12px 20px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px #000;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #d2691e, #a0522d);
    transform: translateY(-2px);
}

.primary-btn:active {
    transform: translateY(0);
}
    background: #654321;
    color: white;
    border: 2px solid #8b4513;
    padding: 10px;
    font-size: 1.1em;
    margin-top: 10px;
}

.primary-btn:hover {
    background: #8b4513;
    border-color: #a0522d;
}

#camp-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 50;
    display: flex;
}

.camp-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #4a3728;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.camp-header h1 {
    color: #e6b800;
    margin: 0;
    text-shadow: 2px 2px 4px #000;
}

.camp-content {
    display: flex;
    flex: 1;
    gap: 20px;
    overflow: hidden;
    min-height: 0;
}

.camp-left,
.camp-right {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: rgba(0,  0, 0, 0.3);
    border: 1px solid #4a3728;
}

.stats-box,
{
    background: rgba(26, 21, 16, 0.95);
    border: 1px solid #4a3728;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    backdrop-filter: blur(2px);
}

.stats-box h3 {
    color: #f5deb3;
    margin-top: 0;
}

/* ========================================
   ENHANCED INVENTORY STYLES
   ======================================== */

.inventory-controls {
    padding: 10px;
    border-bottom: 1px solid #444;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.3);
}

.sort-btn {
    padding: 5px 12px !important;
    font-size: 0.85em !important;
    width: auto !important;
    background: #2a2520 !important;
    border: 1px solid #4a3728 !important;
    transition: all 0.2s ease !important;
}

.sort-btn:hover {
    background: #3a3530 !important;
    border-color: #8b4513 !important;
    transform: translateY(-1px);
}

.sort-btn.auto-equip {
    background: #2a5530 !important;
    border-color: #3a7545 !important;
    margin-left: auto !important;
}

.sort-btn.auto-equip:hover {
    background: #3a7545 !important;
}

/* Item Rarity Colors */
.item-broken { color: #666666 !important; }
.item-common { color: #ffffff !important; }
.item-magic { color: #4488ff !important; }
.item-rare { color: #ffff00 !important; }
.item-epic { color: #a335ee !important; }
.item-legendary { color: #ff8800 !important; }
.item-set { color: #00ff00 !important; }

/* Item Entry Enhancements */
.item-entry {
    transition: all 0.2s ease;
    position: relative;
}

.item-entry:hover {
    background: #2a2520;
    transform: translateX(3px);
}

.item-entry .equip-btn,
.item-entry .use-btn {
    background: #3a5530 !important;
    border-color: #4a7545 !important;
}

.item-entry .equip-btn:hover,
.item-entry .use-btn:hover {
    background: #4a7545 !important;
}

.item-entry .discard-btn {
    background: #553030 !important;
    border-color: #754545 !important;
}

.item-entry .discard-btn:hover {
    background: #754545 !important;
}

/* Item Tooltip */
#item-tooltip {
    position: fixed;
    background: rgba(20, 15, 10, 0.98);
    border: 2px solid #4a3728;
    border-radius: 5px;
    padding: 12px;
    max-width: 280px;
    z-index: 1001;
    pointer-events: none;
    font-size: 0.9em;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.8);
}

/* ========================================
   BUFF/DEBUFF UI STYLES
   ======================================== */

.buff-container {
    position: absolute;
    bottom: 50px;
    left: 10px;
    display: flex;
    gap: 5px;
}

.buff-icon {
    width: 32px;
    height: 32px;
    border: 2px solid #666;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.7);
    position: relative;
}

.buff-icon.buff { border-color: #4488ff; }
.buff-icon.debuff { border-color: #ff4444; }

.buff-duration {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   MINIMAP STYLES
   ======================================== */

.minimap-container {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #666;
    border-radius: 5px;
    overflow: hidden;
}

/* ========================================
   COMBO DISPLAY STYLES
   ======================================== */

.combo-display {
    position: absolute;
    top: 50px;
    right: 20px;
    font-family: 'Arial Black', sans-serif;
    font-size: 24px;
    color: #fff;
    text-shadow: 2px 2px 4px #000, 0 0 10px #ff4400;
}

.combo-display.high { color: #ffff00; }
.combo-display.max { color: #ff4400; animation: combo-pulse 0.5s infinite; }

@keyframes combo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========================================
   HEALTH GLOBE STYLES
   ======================================== */

.health-globe {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: globe-bob 1s infinite ease-in-out;
}

.health-globe.health { background: radial-gradient(circle at 30% 30%, #ff6666, #cc0000); }
.health-globe.gold { background: radial-gradient(circle at 30% 30%, #ffff66, #cc9900); }

@keyframes globe-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ========================================
   SHRINE STYLES
   ======================================== */

.shrine-glow {
    animation: shrine-pulse 2s infinite;
}

@keyframes shrine-pulse {
    0%, 100% { filter: drop-shadow(0 0 5px currentColor); }
    50% { filter: drop-shadow(0 0 15px currentColor); }
}

/* ========================================
   FLOATING TEXT STYLES
   ======================================== */

.floating-text {
    position: absolute;
    font-family: 'Arial Black', sans-serif;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
    pointer-events: none;
    animation: float-up 1.5s ease-out forwards;
}

.floating-text.damage { color: #fff; }
.floating-text.crit { color: #ff4444; font-size: 1.5em; }
.floating-text.heal { color: #44ff44; }
.floating-text.xp { color: #ffff44; }
.floating-text.gold { color: #ffd700; }

@keyframes float-up {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-40px); }
}

/* ========================================
   PARTICLE EFFECTS
   ======================================== */

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* ========================================
   MONSTER RANK INDICATORS
   ======================================== */

.monster-champion { box-shadow: 0 0 10px #4488ff; }
.monster-rare { box-shadow: 0 0 10px #ffff00; }
.monster-elite { box-shadow: 0 0 10px #ff8800; }
.monster-boss { box-shadow: 0 0 15px #ff0000; }

/* ========================================
   SCREEN SHAKE ANIMATION
   ======================================== */

.screen-shake {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-5px, 0); }
    20%, 40%, 60%, 80% { transform: translate(5px, 0); }
}

/* ========================================
   DIFFICULTY BADGE
   ======================================== */

.difficulty-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 15px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.9em;
}

.difficulty-normal { background: #666; color: #fff; }
.difficulty-hard { background: #886600; color: #fff; }
.difficulty-nightmare { background: #660066; color: #fff; }
.difficulty-inferno { background: #aa0000; color: #fff; }
