* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.hidden {
    display: none;
}

/* Character Selection Screen */
#character-selection {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7));
    background-size: cover;
    background-position: center;
}

/* Game Logo */
#game-logo {
    font-size: 4rem;
    font-weight: bold;
    color: #0096ff;
    text-shadow: 
        0 0 10px rgba(0, 150, 255, 0.8),
        0 0 20px rgba(0, 150, 255, 0.4),
        0 0 30px rgba(0, 150, 255, 0.2);
    margin-bottom: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Arial Black', sans-serif;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 
            0 0 10px rgba(0, 150, 255, 0.8),
            0 0 20px rgba(0, 150, 255, 0.4),
            0 0 30px rgba(0, 150, 255, 0.2);
    }
    to {
        text-shadow: 
            0 0 20px rgba(0, 150, 255, 0.8),
            0 0 30px rgba(0, 150, 255, 0.4),
            0 0 40px rgba(0, 150, 255, 0.2);
    }
}

#character-selection h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(0, 150, 255, 0.8);
}

.character-options {
    display: flex;
    justify-content: space-around;
    width: 80%;
    margin-bottom: 2rem;
}

.character-option {
    text-align: center;
    cursor: pointer;
    padding: 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.character-option:hover {
    background-color: rgba(0, 150, 255, 0.3);
    transform: scale(1.05);
}

.character-option.selected {
    background-color: rgba(0, 150, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 150, 255, 0.8);
}

.character-preview {
    width: 200px;
    height: 200px;
    margin: 0 auto 1rem;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.name-input {
    margin-bottom: 2rem;
    text-align: center;
}

.name-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.name-input input {
    padding: 0.8rem;
    font-size: 1rem;
    width: 300px;
    border-radius: 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.9);
}

#start-game {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background-color: #0096ff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-game:hover {
    background-color: #007acc;
    transform: scale(1.05);
}

/* Game Screen */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Top Left UI: Mini Map and Character Info */
#top-left-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
}

#mini-map {
    width: 200px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #000000;
    border-radius: 5px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

#mini-map canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#character-info {
    width: 250px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #000000;
    border-radius: 5px;
}

#character-name-display {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: white;
}

#character-level {
    font-size: 1rem;
    margin-bottom: 10px;
}

.stat-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.bar-label {
    width: 30px;
    font-weight: bold;
}

.bar-container {
    flex-grow: 1;
    height: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 10px;
}

.bar-fill {
    height: 100%;
    width: 100%;
    border-radius: 3px;
}

#hp-bar .bar-fill {
    background-color: #33cc33;
}

#sp-bar .bar-fill {
    background-color: #FFA500;
}

#xp-bar .bar-fill {
    background-color: #ffcc00;
    width: 0%;
}

.bar-value {
    width: 60px;
    text-align: right;
    font-size: 0.8rem;
}

/* Top Right UI: Log Book */
#top-right-ui {
    position: absolute;
    top: 20px;
    right: 20px;
}

#log-book {
    width: 450px;
    height: 240px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #000000;
    border-radius: 5px;
    overflow: hidden;
}

#log-entries {
    height: 180px;
    overflow-y: auto;
    font-size: 0.9rem;
}

#log-entries::-webkit-scrollbar {
    width: 5px;
}

#log-entries::-webkit-scrollbar-thumb {
    background-color: #0096ff;
    border-radius: 5px;
}

/* Bottom Left UI: Controls Info */
#bottom-left-ui {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

#controls-info {
    width: 200px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #000000;
    border-radius: 5px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

#controls-info ul {
    list-style-type: none;
}

#controls-info li {
    margin-bottom: 5px;
}

/* Bottom Right UI: Inventory Slots */
#bottom-right-ui {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

#inventory-slots {
    display: flex;
    gap: 10px;
}

.inventory-slot {
    width: 100px;
    height: 100px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #000000;
    border-radius: 5px;
    padding: 5px;
    display: flex;
    flex-direction: column;
}

.slot-label {
    color: white;
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 5px;
    width: 100%;
}

.slot-content {
    flex-grow: 1;
    border: 1px dashed #ffffff;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    text-align: center;
    width: 100%;
}

.slot-content.empty::after {
    content: "Empty";
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    text-align: center;
}

.slot-content:not(.empty) {
    border-style: solid;
}

/* Crosshair Styles */
#crosshair {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    pointer-events: none !important;
    z-index: 999999 !important;
}

/* Style 1: Circle */
.crosshair-style-1 {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 0, 0, 0.8); /* Red circle */
    border-radius: 50%;
}

/* Style 2: Dot */
.crosshair-style-2 {
    width: 4px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.8); /* White dot */
    border-radius: 50%;
}

/* Style 3: Cross */
.crosshair-style-3 {
    width: 24px;
    height: 24px;
    background: linear-gradient(to right, transparent 11px, rgba(0, 255, 0, 0.8) 11px, rgba(0, 255, 0, 0.8) 13px, transparent 13px),
                linear-gradient(to bottom, transparent 11px, rgba(0, 255, 0, 0.8) 11px, rgba(0, 255, 0, 0.8) 13px, transparent 13px); /* Green cross */
}

#fps-counter {
    position: relative;
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 4px;
    pointer-events: none;
}

.fps-low {
    color: #ff4444;
}

.fps-medium {
    color: #ffaa00;
}

.fps-high {
    color: #44ff44;
}

.labelRenderer, .css2dRenderer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Style for all CSS2D elements (health bars, labels, etc.) */
.css2d-element, .item-label, .health-bar-container, div[style*="position: absolute"] {
    z-index: 1 !important;
}