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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background: #000;
}

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

#css3d-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

#css3d-renderer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Fork Banner Styles */
#fork-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.95) 0%, rgba(81, 45, 168, 0.95) 100%);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

#fork-banner.minimized {
    transform: translateY(-100%);
}

.fork-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
}

.fork-emoji {
    font-size: 18px;
}

.fork-text {
    font-weight: 500;
}

.fork-text a {
    color: #ffeb3b;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.fork-text a:hover {
    color: #fff;
    text-decoration: underline;
}

.fork-details {
    text-align: center;
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.9;
}

.fork-details a {
    color: #ffeb3b;
    text-decoration: none;
}

.fork-details a:hover {
    text-decoration: underline;
}

#fork-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
    margin-left: auto;
}

#fork-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* About Button */
#about-btn {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(103, 58, 183, 0.9);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

#about-btn:hover {
    background: rgba(103, 58, 183, 1);
    transform: scale(1.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
    color: white;
}

.modal-body h3 {
    margin: 20px 0 12px 0;
    font-size: 18px;
    color: #ffeb3b;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    line-height: 1.6;
    margin-bottom: 12px;
}

.modal-body a {
    color: #ffeb3b;
    text-decoration: none;
    font-weight: 500;
}

.modal-body a:hover {
    text-decoration: underline;
}

.modal-body ul {
    margin: 12px 0;
    padding-left: 24px;
}

.modal-body li {
    margin: 8px 0;
    line-height: 1.5;
}

.fork-request-cta {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 2px dashed rgba(255, 235, 59, 0.5);
}

.fork-request-cta h3 {
    margin-top: 0 !important;
}

.fork-request-cta p {
    margin-bottom: 0;
}

/* URL overlay - keep focusable even when hidden */
#url-overlay {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    transition: opacity .12s;
    margin: 0 auto;
    max-width: 400px;
}

#url-overlay.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

#url-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#url-input:focus {
    border-color: #4CAF50;
}

#hint {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    z-index: 100;
    pointer-events: none;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    background: rgba(255, 59, 48, 0.95);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 600px) {
    #fork-banner {
        padding: 6px 12px;
    }
    
    .fork-content {
        font-size: 12px;
        gap: 8px;
    }
    
    .fork-emoji {
        font-size: 16px;
    }
    
    .fork-details {
        font-size: 11px;
    }
    
    #about-btn {
        top: 60px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 16px;
        font-size: 14px;
    }
    
    #url-overlay {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
        margin: 0;
    }
    
    #url-input {
        width: 100%;
    }
}