*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    width: 100%; height: 100vh; overflow: hidden; 
    font-family: 'Inter', sans-serif;
    background-color: #72a1a8;
}
canvas { display: block; outline: none; }

#bg-sunny {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: #72a1a8;
    transition: opacity 3s ease; opacity: 1;
}
#bg-rainy {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: #4a6870;
    transition: opacity 3s ease; opacity: 0;
}

#tag {
    position: fixed; bottom: 30px; right: 215px;
    font-size: 11px; letter-spacing: 5px; 
    color: #ffffff; opacity: 0.4;
    text-transform: uppercase; user-select: none; pointer-events: none; z-index: 20;
}

#debug-info {
    position: fixed; top: 12px; left: 18px; z-index: 200;
    font-size: 12px; line-height: 1.6;
    color: rgba(255,255,255,0.7);
    font-family: 'Inter', monospace;
    user-select: none; pointer-events: none;
}

#weather-toggle {
    position: fixed; top: 25px; right: 25px; z-index: 100;
    padding: 10px 18px; border-radius: 20px;
    border: 1px solid rgba(180,180,180,0.3);
    background: rgba(255,255,255,0.9);
    color: #5c554e; font-family: 'Lora', serif; font-size: 13px; font-style: italic;
    cursor: pointer; outline: none; user-select: none;
    box-shadow: 0 4px 15px rgba(90,80,70,0.06);
    transition: all 0.3s ease;
}
#weather-toggle:hover {
    background: rgba(255,255,255,1);
    transform: scale(1.05);
}

#flashlight-btn {
    position: fixed; top: 78px; right: 25px; z-index: 100;
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid rgba(180,180,180,0.3);
    background: rgba(255,255,255,0.9);
    font-size: 20px; line-height: 1;
    cursor: pointer; outline: none; user-select: none;
    box-shadow: 0 4px 15px rgba(90,80,70,0.06);
    transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
#flashlight-btn:hover {
    background: rgba(255,255,255,1);
    transform: scale(1.1);
}
#flashlight-btn.active {
    background: rgba(255,245,200,0.95);
    box-shadow: 0 0 16px rgba(255,200,100,0.4);
}

#chat-bar {
    position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%);
    z-index: 100;
}
#chat-input {
    width: 300px; padding: 12px 20px; 
    border: 1px solid rgba(180,180,180,0.3);
    border-radius: 25px; outline: none; 
    background: rgba(255,255,255,0.9);
    color: #4a443f; font-family: 'Lora', serif; font-size: 15px; 
    backdrop-filter: blur(15px); text-align: center;
    box-shadow: 0 8px 32px rgba(90,80,70,0.06);
    transition: all 0.3s ease;
}
#chat-input:focus { 
    background: rgba(255,255,255,1); 
    width: 350px; 
}

.chat-label {
    position: absolute; background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px; border-radius: 15px; font-family: 'Lora', serif;
    font-style: italic; font-size: 14px; 
    color: #5c554e;
    max-width: 180px; text-align: center; pointer-events: none;
    box-shadow: 0 4px 15px rgba(90,80,70,0.06);
    transition: opacity 0.5s ease; transform: translateY(-80px);
}
.chat-label::after {
    content: ''; position: absolute; bottom: -8px; left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent; border-right: 8px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.95);
}

#mobile-controls {
    display: none;
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 120px;
    height: 120px;
    z-index: 150;
}

.control-btn {
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(180,180,180,0.2);
    background: rgba(255,255,250,0.7);
    backdrop-filter: blur(10px);
    color: #5c554e;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    box-shadow: 0 4px 10px rgba(90,80,70,0.04);
}
.control-btn:active {
    background: rgba(255,255,255,0.9);
}

#btn-up { top: 0; left: 41px; }
#btn-left { top: 41px; left: 0; }
#btn-right { top: 41px; right: 0; }
#btn-down { bottom: 0; left: 41px; }

@media (pointer: coarse) {
    #mobile-controls { display: block; }
}

@media (max-width: 600px) {
    #chat-input { width: 150px; padding: 10px 15px; font-size: 13px; }
    #chat-input:focus { width: 170px; }
    #tag { display: none; }
    #mobile-controls { bottom: 20px; left: 20px; }
}
#editor-toolbar {
    position: fixed; top: 110px; right: 25px; z-index: 100;
    display: flex; flex-direction: column; gap: 6px;
}
#editor-toolbar button {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid rgba(180,180,180,0.3);
    background: rgba(255,255,255,0.9);
    font-size: 18px; cursor: pointer;
    box-shadow: 0 4px 15px rgba(90,80,70,0.06);
    transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
}
#editor-toolbar button:hover {
    background: rgba(255,255,255,1);
    transform: scale(1.1);
}
#editor-toolbar button.active {
    background: rgba(255,245,200,0.95);
    box-shadow: 0 0 12px rgba(255,200,100,0.4);
}
#edit-toggle {
    position: fixed; top: 25px; left: 25px; z-index: 100;
    padding: 8px 14px; border-radius: 20px;
    border: 1px solid rgba(180,180,180,0.3);
    background: rgba(255,255,255,0.9);
    color: #5c554e; font-size: 13px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(90,80,70,0.06);
    transition: all 0.3s ease;
}
#edit-toggle:hover { background: rgba(255,255,255,1); transform: scale(1.05); }
#edit-toggle.active { background: #ffe0a0; }
