/* Copyright (c) 2025 by Paul (https://codepen.io/prisoner849/pen/ByjqVoQ) */
body {
    overflow: hidden;
    margin: 0;
}

/* ===== Floating Overlay Panel ===== */
.overlay-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: rgba(15, 15, 35, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
    padding: 20px;
    min-width: 260px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(139, 92, 246, 0.1);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #e2e8f0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.overlay-panel.collapsed {
    transform: translateY(calc(100% - 48px));
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.overlay-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.overlay-title .icon-3d {
    color: #8b5cf6;
    font-size: 18px;
}

.overlay-toggle {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #a78bfa;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.overlay-toggle:hover {
    background: rgba(139, 92, 246, 0.3);
}

.overlay-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overlay-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

.overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.btn-back {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    transform: translateX(-2px);
}

.btn-source {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-source:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45);
}

.open-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.overlay-desc .accent-text {
    color: #a78bfa;
}

/* ===== Source Code Viewer ===== */
.source-viewer {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(10, 10, 26, 0.98);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.source-viewer.active {
    opacity: 1;
    visibility: visible;
}

.source-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(15, 15, 35, 0.95);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.source-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.source-filename {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #a78bfa;
    font-weight: 600;
}

.source-badge {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    color: #34d399;
    font-weight: 600;
}

.source-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy-source,
.btn-close-source {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #94a3b8;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-copy-source:hover,
.btn-close-source:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.source-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.source-body pre {
    margin: 0;
    padding: 24px;
    font-size: 13px;
    line-height: 1.6;
}

.source-body code {
    font-family: 'JetBrains Mono', monospace;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .overlay-panel {
        bottom: 12px;
        right: 12px;
        left: 12px;
        min-width: unset;
        max-width: unset;
    }

    .source-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .source-body pre {
        padding: 16px;
        font-size: 11px;
    }
}

/* ===== Loading spinner ===== */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}