body {
    margin: 0;
    overflow: hidden;
    background-color: #050B14;
    font-family: var(--font-sans);
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* Header */
.header {
    position: absolute;
    top: 100px;
    left: 24px;
    text-align: left;
    z-index: 120;
    background: rgba(10, 24, 40, 0.42);
    backdrop-filter: blur(12px);
    padding: 11px 22px;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    max-width: min(90vw, 480px);
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.header h1 {
    margin: 0 0 8px 0;
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    background: linear-gradient(135deg, #D4AF37 0%, #F4D03F 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    font-family: 'Orbitron', sans-serif;
}

.header-subtitle {
    margin: 0;
    font-size: 0.72rem;
    color: #A0A8B8;
    font-family: var(--font-mono);
    letter-spacing: 0.2px;
}

/* Focus button */
.focus-3d-toggle {
    position: absolute;
    top: 188px;
    left: 24px;
    z-index: 130;
    border: 1px solid rgba(212, 175, 55, 0.24);
    background: rgba(10, 24, 40, 0.6);
    color: #D4AF37;
    backdrop-filter: blur(8px);
    border-radius: 11px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: 'Orbitron', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.focus-3d-toggle:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(212, 175, 55, 0.5);
}

/* Instruction panel */
.instruction-panel {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 24, 40, 0.45);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    z-index: 120;
    max-width: min(84vw, 720px);
    color: #A0A8B8;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.instruction-icon {
    font-size: 1rem;
}

.instruction-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

/* Sidebar navigation */
.nav-sidebar {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 120;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-icon {
    width: 48px;
    height: 48px;
    background: rgba(10, 24, 40, 0.62);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #D4AF37;
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    z-index: 2;
}

.nav-label {
    position: absolute;
    left: 40px;
    background: rgba(10, 24, 40, 0.9);
    padding: 9px 14px 9px 18px;
    border-radius: 0 14px 14px 0;
    color: #D4AF37;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.68rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
    white-space: nowrap;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-left: none;
    z-index: 1;
    transform: translateX(-14px);
    letter-spacing: 0.8px;
}

.nav-item:hover .nav-icon {
    transform: translateX(2px) scale(1.06);
    background: rgba(212, 175, 55, 0.9);
    color: #0A1828;
    border-color: rgba(255, 255, 255, 0.85);
}

.nav-item:hover .nav-label {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.status-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 9px;
    height: 9px;
    background: #2ecc71;
    border-radius: 50%;
    border: 2px solid #0A1828;
    box-shadow: 0 0 5px #2ecc71;
}

/* Back button */
.back-btn {
    position: absolute;
    bottom: 24px;
    left: 24px;
    padding: 9px 14px;
    background: rgba(10, 24, 40, 0.55);
    border: 1px solid rgba(212, 175, 55, 0.22);
    color: #A0A8B8;
    text-decoration: none;
    border-radius: 11px;
    font-size: 0.8rem;
    transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease, opacity 0.25s ease, filter 0.25s ease;
    z-index: 120;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Orbitron', sans-serif;
}

.back-btn:hover {
    background: rgba(212, 175, 55, 0.18);
    color: #D4AF37;
    border-color: #D4AF37;
}

/* Legend / info panel */
.info-panel {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 24, 40, 0.86);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    color: #A0A8B8;
    font-family: 'Orbitron', monospace;
    font-size: 0.66rem;
    backdrop-filter: blur(10px);
    z-index: 120;
    max-width: 250px;
    max-height: 78vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.4) rgba(10, 24, 40, 0.4);
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.info-panel::-webkit-scrollbar {
    width: 6px;
}

.info-panel::-webkit-scrollbar-track {
    background: rgba(10, 24, 40, 0.4);
    border-radius: 10px;
}

.info-panel::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.4);
    border-radius: 10px;
}

.info-panel h3 {
    margin: 0 0 10px 0;
    color: #D4AF37;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.26);
    padding-bottom: 8px;
}

.legend-section {
    margin-bottom: 10px;
}

.legend-section h4 {
    margin: 0 0 7px 0;
    color: #fff;
    font-size: 0.62rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    line-height: 1.35;
}

.legend-item-content {
    flex: 1;
}

.legend-item-name {
    font-weight: 700;
    color: #fff;
    display: block;
    margin-bottom: 2px;
}

.legend-item-desc {
    font-size: 0.66rem;
    color: #8892A0;
    line-height: 1.25;
}

.dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    margin-top: 2px;
}

/* Scene labels generated by JS */
.zone-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    text-shadow: 0 0 10px currentColor;
    pointer-events: none;
    user-select: none;
    background: rgba(10, 24, 40, 0.72);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid currentColor;
    backdrop-filter: blur(8px);
}

.label {
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-size: 0.5rem;
    background: rgba(10, 24, 40, 0.82);
    backdrop-filter: blur(8px);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: auto;
    user-select: none;
    text-shadow: 0 0 8px #000;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    opacity: 0.82;
}

.label:hover {
    transform: scale(1.04);
    box-shadow: 0 0 16px currentColor;
    opacity: 1;
}

.label strong {
    display: block;
    font-size: 0.58rem;
}

.label-device,
.label-user-router,
.label-isp { border-color: #9b59b6; color: #cfa8ff; }
.label-dns,
.label-backbone,
.label-cloudflare,
.label-routers { border-color: #3498db; color: #8fd3ff; }
.label-my-router,
.label-firewall,
.label-proxy,
.label-server { border-color: #2ecc71; color: #9bf3bb; }

/* Focus mode */
body.infrastructure-focus .header,
body.infrastructure-focus .instruction-panel,
body.infrastructure-focus .info-panel,
body.infrastructure-focus .nav-sidebar,
body.infrastructure-focus .back-btn {
    opacity: 0;
    filter: blur(3px);
    pointer-events: none;
}

body.infrastructure-focus .focus-3d-toggle {
    background: rgba(212, 175, 55, 0.22);
    border-color: rgba(212, 175, 55, 0.65);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        top: 90px;
        left: 14px;
        width: min(78vw, 320px);
        padding: 10px 14px;
    }

    .header-subtitle {
        font-size: 0.67rem;
    }

    .focus-3d-toggle {
        top: 172px;
        left: 14px;
        font-size: 0.7rem;
        padding: 8px 9px;
    }

    .nav-sidebar {
        left: 50%;
        top: auto;
        bottom: 68px;
        transform: translateX(-50%);
        flex-direction: row;
        gap: 14px;
    }

    .nav-label,
    .info-panel {
        display: none;
    }

    .nav-icon {
        width: 44px;
        height: 44px;
        font-size: 0.95rem;
    }

    .back-btn {
        top: 90px;
        left: 14px;
        bottom: auto;
        padding: 8px 10px;
        font-size: 0.72rem;
    }

    .instruction-panel {
        bottom: 14px;
        width: min(92vw, 560px);
        border-radius: 12px;
        padding: 8px 10px;
    }

    .instruction-text {
        font-size: 0.67rem;
    }
}
