/* FPS & Coordinates HUD */
#hud-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(20, 20, 30, 0.85);
    border-radius: 10px;
    padding: 10px 18px;
    z-index: 9999;
    font-size: 1em;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    min-width: 120px;
    text-align: right;
    user-select: none;
}
#fps-counter {
    color: #67eaff;
    font-weight: bold;
    margin-bottom: 2px;
    font-size: 1.05em;
}
#coord-display {
    color: #ffe066;
    font-size: 0.98em;
    letter-spacing: 0.5px;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
    cursor: none;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

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

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: rgba(102, 126, 234, 0.8);
    box-shadow: 0 0 10px rgba(102, 126, 234, 1);
}

#crosshair::before {
    width: 2px;
    height: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#crosshair::after {
    width: 20px;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

#panel-indicator {
    position: fixed;
    top: calc(50% + 20px);
    left: 50%;
    transform: translateX(-50%);
    color: #00ff00;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 5px #00ff00;
    display: none;
    z-index: 101;
    pointer-events: none;
}

#cannot-break-indicator {
    position: fixed;
    top: calc(50% + 18px);
    left: 50%;
    transform: translateX(-50%);
    color: #ff0000;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
    display: none;
    z-index: 10000;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 5px;
}

.controls-info {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    z-index: 60;
    font-size: 0.9em;
}

.controls-info h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.controls-info p {
    margin: 5px 0;
    color: #ccc;
}

.controls-info kbd {
    background: rgba(102, 126, 234, 0.3);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(102, 126, 234, 0.5);
    font-family: monospace;
}

.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 200;
    cursor: default;
}

.start-screen h1 {
    font-size: 4em;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

.start-screen p {
    font-size: 1.3em;
    margin-bottom: 30px;
    color: #aaa;
}

.start-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    width: 300px;
}

.start-inputs input[type="text"] {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    color: white;
    font-size: 1.1em;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

.start-inputs input[type="text"]:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
}

.start-inputs input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.color-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.color-picker label {
    color: #aaa;
    font-size: 1.1em;
}

.color-picker input[type="color"] {
    width: 80px;
    height: 40px;
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker input[type="color"]:hover {
    border-color: #667eea;
}

.skin-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skin-input label,
.skin-type-selector > label {
    color: #aaa;
    font-size: 0.95em;
    text-align: center;
}

.skin-type-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ccc;
    font-size: 0.95em;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.radio-group label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.radio-group input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.skin-input label {
    color: #aaa;
    font-size: 0.9em;
}

.skin-input input[type="text"] {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    color: white;
    font-size: 0.9em;
    outline: none;
    transition: all 0.3s ease;
}

.skin-input input[type="text"]:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
}

.skin-input input[type="file"] {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    color: white;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skin-input input[type="file"]:hover {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
}

.skin-input input[type="file"]::file-selector-button {
    padding: 8px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin-right: 10px;
}

.skin-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    margin: 10px 0;
    position: relative;
}

#skin-preview-canvas {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.skin-preview-container::before {
    content: "Upload skin for 3D preview\A🖱️ Click and drag to rotate • 🖱️ Scroll to zoom";
    white-space: pre;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8em;
    text-align: center;
    pointer-events: none;
    z-index: 1;
}

.skin-preview-container.has-preview::before {
    display: none;
}

.skin-preview-container.has-preview {
    cursor: grab;
}

.skin-preview-container.has-preview:active {
    cursor: grabbing;
}

.start-btn {
    padding: 20px 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.start-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.7);
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
    }
    to {
        filter: drop-shadow(0 0 20px rgba(118, 75, 162, 0.8));
    }
}

#press-f-hint {
    display: none !important;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.85; transform: translate(-50%, -50%) scale(1.05); }
}

/* Item Name Display */
#item-name {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#item-name.show {
    opacity: 1;
}

/* Hotbar */
#hotbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px;
    border-radius: 4px;
    z-index: 100;
}

.hotbar-slot {
    width: 50px;
    height: 50px;
    background: rgba(139, 139, 139, 0.8);
    border: 2px solid #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    position: relative;
    transition: all 0.2s;
}

.hotbar-slot.selected {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.hotbar-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #3f3f3f;
}

.hotbar-slot .item-icon {
    font-size: 20px;
}

#mining-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: none;
    z-index: 1000;
    pointer-events: none;
}

#mining-progress-bar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        #667eea 0deg,
        #667eea var(--progress, 0deg),
        rgba(102, 126, 234, 0.2) var(--progress, 0deg),
        rgba(102, 126, 234, 0.2) 360deg
    );
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: bold;
}

/* Chat System */
#chat-container {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 400px;
    max-height: 300px;
    z-index: 500;
    font-family: 'Minecraft', monospace, 'Segoe UI', sans-serif;
    pointer-events: none;
}

#chat-messages {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    margin-bottom: 5px;
    display: none;
}

#chat-messages.visible {
    display: block;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-message {
    padding: 3px 5px;
    margin: 2px 0;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 14px;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.system {
    color: #ffff55;
}

#chat-input-container {
    display: none;
    pointer-events: auto;
}

#chat-input-container.active {
    display: block;
}

#chat-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

#chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Loading Screen - Futuristic 3D Style */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0f1729 0%, #000000 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    overflow: hidden;
}

/* Animated Particle Background */
.loading-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(102, 126, 234, 0.4), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(118, 75, 162, 0.4), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(102, 126, 234, 0.3), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(144, 238, 144, 0.3), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 15% 90%, rgba(102, 126, 234, 0.2), transparent);
    background-size: 200% 200%, 180% 180%, 150% 150%, 220% 220%, 190% 190%, 160% 160%, 210% 210%;
    background-position: 0% 0%, 20% 20%, 40% 40%, 60% 60%, 80% 80%, 30% 30%, 70% 70%;
    animation: particleFloat 20s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes particleFloat {
    0%, 100% {
        background-position: 0% 0%, 20% 20%, 40% 40%, 60% 60%, 80% 80%, 30% 30%, 70% 70%;
    }
    50% {
        background-position: 100% 100%, 80% 80%, 60% 60%, 40% 40%, 20% 20%, 70% 70%, 30% 30%;
    }
}

.loading-content {
    text-align: center;
    padding: 60px 80px;
    max-width: 700px;
    position: relative;
    z-index: 1;
}

.mc-logo {
    font-size: 4.5em;
    font-weight: bold;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(102, 126, 234, 0.8),
        0 0 20px rgba(102, 126, 234, 0.6),
        0 0 30px rgba(102, 126, 234, 0.4),
        4px 4px 0px #3a3a3a;
    margin-bottom: 10px;
    letter-spacing: 6px;
    font-family: 'Courier New', monospace;
    animation: logoGlow 2s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(102, 126, 234, 0.8),
            0 0 20px rgba(102, 126, 234, 0.6),
            0 0 30px rgba(102, 126, 234, 0.4),
            4px 4px 0px #3a3a3a;
    }
    50% {
        text-shadow: 
            0 0 20px rgba(102, 126, 234, 1),
            0 0 30px rgba(102, 126, 234, 0.8),
            0 0 40px rgba(102, 126, 234, 0.6),
            4px 4px 0px #3a3a3a;
    }
}

.mc-subtitle {
    font-size: 1.3em;
    color: #ffff00;
    text-shadow: 
        0 0 10px rgba(255, 255, 0, 0.6),
        2px 2px 0px #666600;
    margin-bottom: 40px;
    font-weight: bold;
    animation: subtitlePulse 3s ease-in-out infinite;
}

@keyframes subtitlePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.loading-status {
    margin-bottom: 20px;
}

#loading-status-text {
    color: #ffffff;
    font-size: 1.2em;
    margin: 10px 0;
    text-shadow: 
        0 0 10px rgba(144, 238, 144, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: statusFade 1.5s ease-in-out infinite;
}

@keyframes statusFade {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#loading-text {
    color: #ffffff;
    font-size: 1.1em;
    margin-top: 15px;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
}

/* 3D Chunk Grid Container */
.chunk-grid-container {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

/* Chunk Grid with 3D Effect */
.chunk-grid {
    display: grid;
    grid-template-columns: repeat(11, 14px);
    grid-template-rows: repeat(11, 14px);
    gap: 2px;
    transform-style: preserve-3d;
    animation: gridRotate 20s linear infinite;
}

@keyframes gridRotate {
    0% {
        transform: rotateX(20deg) rotateY(0deg);
    }
    50% {
        transform: rotateX(20deg) rotateY(180deg);
    }
    100% {
        transform: rotateX(20deg) rotateY(360deg);
    }
}

.chunk-cell {
    width: 14px;
    height: 14px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    transform-style: preserve-3d;
}

.chunk-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.2) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.chunk-cell.loaded {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #90ee90 100%);
    border-color: #90ee90;
    box-shadow: 
        0 0 10px rgba(144, 238, 144, 0.8),
        0 0 20px rgba(102, 126, 234, 0.6),
        inset 0 0 10px rgba(255, 255, 255, 0.3);
    transform: translateZ(20px) scale(1.1);
    animation: cellPulse 0.6s ease-out;
}

.chunk-cell.loaded::before {
    opacity: 1;
}

@keyframes cellPulse {
    0% {
        transform: translateZ(0px) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translateZ(30px) scale(1.2);
        box-shadow: 
            0 0 20px rgba(144, 238, 144, 1),
            0 0 30px rgba(102, 126, 234, 0.8);
    }
    100% {
        transform: translateZ(20px) scale(1.1);
        opacity: 1;
    }
}
