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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #87CEEB;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: white;
}

#crosshair::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

#crosshair::after {
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

#inventory {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.inventory-slot {
    width: 60px;
    height: 60px;
    background: rgba(139, 139, 139, 0.5);
    border: 3px solid rgba(85, 85, 85, 0.8);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.inventory-slot:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.6);
}

.inventory-slot.active {
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.inventory-slot span {
    position: absolute;
    bottom: 4px;
    right: 6px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

.block-preview {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.grass-block { background: linear-gradient(to bottom, #7cb342 0%, #7cb342 70%, #8d6e63 70%, #8d6e63 100%); }
.dirt-block { background: #8d6e63; }
.stone-block { background: #9e9e9e; }
.wood-block { background: linear-gradient(to right, #795548 0%, #6d4c41 50%, #795548 100%); }
.sand-block { background: #fdd835; }
.cobblestone-block { background: #757575; }
.planks-block { background: linear-gradient(to bottom, #d7ccc8 0%, #bcaaa4 50%, #d7ccc8 100%); }
.leaves-block { background: #43a047; opacity: 0.8; }
.water-block { background: #2196f3; opacity: 0.7; }

#controls-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.control-line {
    margin-bottom: 5px;
}

#position-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

#position-info div {
    margin-bottom: 5px;
}

#mobile-controls {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    display: none;
}

@media (max-width: 768px), (pointer: coarse) {
    #mobile-controls {
        display: block;
    }

    #controls-info {
        display: none;
    }
}

.joystick {
    position: absolute;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    pointer-events: all;
    touch-action: none;
}

#joystick-left {
    bottom: 40px;
    left: 40px;
}

#joystick-right {
    bottom: 40px;
    right: 40px;
}

.joystick-inner {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#mobile-buttons {
    position: absolute;
    bottom: 200px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    pointer-events: all;
    touch-action: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.mobile-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
}
