.nds-3d {
    --nds-3d-accent: var(--mdb-primary, #c53030);
    --nds-3d-ink: #262a30;
    --nds-3d-text: #4f4f4f;
    --nds-3d-muted: #6b7178;
    --nds-3d-line: rgba(38, 42, 48, 0.7);
    --nds-3d-radius: var(--mdb-border-radius-lg, 0.5rem);
    --nds-3d-badge: 1.375rem;
    margin-bottom: 1.5rem;
}

.nds-3d__title {
    position: absolute;
    top: 0.75rem;
    right: 0.875rem;
    z-index: 1;
    max-width: calc(100% - 1.75rem);
    margin: 0;
    color: var(--nds-3d-ink);
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.3;
    text-align: right;
    text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff;
    pointer-events: none;
}

.nds-3d__stage {
    position: relative;
    height: var(--nds-3d-height, 31.25rem);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--nds-3d-radius);
    background: radial-gradient(120% 95% at 50% 38%, #fcfcfc 0%, #f1f2f4 52%, #e3e5e8 100%);
    container-type: inline-size;
}

.nds-3d__canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    outline: none;
    touch-action: pan-y;
}

.nds-3d__canvas:active {
    cursor: grabbing;
}

.nds-3d__canvas.is-over-model {
    cursor: pointer;
}

.nds-3d__leaders {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.nds-3d__leaders.is-visible {
    opacity: 1;
}

.nds-3d__leader {
    stroke: var(--nds-3d-line);
    stroke-width: 1;
}

.nds-3d__leader-dot {
    fill: var(--nds-3d-ink);
}

.nds-3d__leader.is-selected {
    stroke: var(--nds-3d-accent);
}

.nds-3d__leader-dot.is-selected {
    fill: var(--nds-3d-accent);
}

.nds-3d__leader.is-dimmed,
.nds-3d__leader-dot.is-dimmed {
    opacity: 0.25;
}

.nds-3d__labels {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    animation: nds-3d-fade-in 0.3s ease-out both;
}

.nds-3d__label {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--nds-3d-ink);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    pointer-events: auto;
    cursor: pointer;
}

.nds-3d__label.is-left {
    flex-direction: row-reverse;
}

.nds-3d__label-number {
    display: grid;
    flex: none;
    place-items: center;
    width: var(--nds-3d-badge);
    height: var(--nds-3d-badge);
    border: 1.5px solid var(--nds-3d-ink);
    border-radius: 50%;
    background: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.nds-3d__label-name {
    text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff;
}

.nds-3d__label:hover .nds-3d__label-number,
.nds-3d__label:focus-visible .nds-3d__label-number {
    border-color: var(--nds-3d-accent);
    color: var(--nds-3d-accent);
}

.nds-3d__label:hover .nds-3d__label-name,
.nds-3d__label.is-selected .nds-3d__label-name {
    color: var(--nds-3d-accent);
}

.nds-3d__label.is-selected .nds-3d__label-number {
    border-color: var(--nds-3d-accent);
    background: var(--nds-3d-accent);
    color: #fff;
}

.nds-3d__label.is-dimmed {
    opacity: 0.4;
}

.nds-3d__label:focus-visible {
    outline: none;
}

.nds-3d__label:focus-visible .nds-3d__label-number {
    outline: 2px solid var(--nds-3d-accent);
    outline-offset: 2px;
}

.nds-3d__card {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    width: min(20rem, calc(100% - 1.5rem));
    max-height: calc(100% - 1.5rem);
    overflow-y: auto;
    padding: 0.875rem 1rem 1rem;
    border-radius: var(--nds-3d-radius);
    background: #fff;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 10px 20px -2px rgba(0, 0, 0, 0.04);
    animation: nds-3d-fade-in 0.2s ease-out both;
}

.nds-3d__card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.nds-3d__card-number {
    display: grid;
    flex: none;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--nds-3d-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.nds-3d__card-title {
    flex: 1 1 auto;
    margin: 0;
    padding-top: 0.125rem;
    color: var(--nds-3d-ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.nds-3d__card-close {
    flex: none;
    margin-inline-start: auto;
    width: 0.75rem;
    height: 0.75rem;
    margin-top: 0.3125rem;
    background-size: 0.75rem;
}

.nds-3d__card-text {
    margin: 0.5rem 0 0;
    color: var(--nds-3d-text);
    font-size: 0.875rem;
    line-height: 1.55;
    white-space: pre-line;
}

.nds-3d__status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 1.5rem;
    color: var(--nds-3d-muted);
    font-size: 0.9375rem;
    text-align: center;
}

.nds-3d__status--static {
    background: radial-gradient(120% 95% at 50% 38%, #fcfcfc 0%, #f1f2f4 52%, #e3e5e8 100%);
}

.nds-3d:not([data-nds3d-state]) .nds-3d__toolbar {
    visibility: hidden;
}

.nds-3d[data-nds3d-state="failed"] .nds-3d__stage {
    height: auto;
}

.nds-3d[data-nds3d-state="failed"] .nds-3d__canvas,
.nds-3d[data-nds3d-state="failed"] .nds-3d__toolbar {
    display: none;
}

.nds-3d[data-nds3d-state="failed"] .nds-3d__status {
    position: static;
    padding: 1.25rem 1.5rem;
}

.nds-3d[data-nds3d-state="failed"] .nds-3d__title {
    position: static;
    max-width: none;
    padding: 0.75rem 0.875rem 0;
}

.nds-3d__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-top: 0.875rem;
}

.nds-3d__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nds-3d .hint {
    margin: 0;
    color: var(--nds-3d-muted);
    font-size: 0.8125rem;
    line-height: 1.75;
    text-align: right;
}

.nds-3d .hint span {
    display: inline-block;
    margin-right: 0.125rem;
    padding: 0 0.375rem;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-bottom-width: 2px;
    border-radius: 0.25rem;
    background: #fff;
    color: var(--nds-3d-ink);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.nds-3d__hint--touch {
    display: none;
}

.nds-3d__parts {
    margin-top: 1.25rem;
}

.nds-3d[data-nds3d-state]:not([data-nds3d-state="failed"]) .nds-3d__parts {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.nds-3d__parts-title {
    margin: 0 0 0.5rem;
    color: var(--nds-3d-ink);
    font-weight: 700;
}

.nds-3d__parts-list {
    margin: 0;
    padding-left: 1.25rem;
}

.nds-3d__part + .nds-3d__part {
    margin-top: 0.5rem;
}

.nds-3d__part-title {
    display: block;
    color: var(--nds-3d-ink);
    font-weight: 600;
}

.nds-3d__part-text {
    display: block;
    color: var(--nds-3d-text);
    font-size: 0.9375rem;
    line-height: 1.55;
}

@keyframes nds-3d-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@container (max-width: 35rem) {
    .nds-3d__label-name {
        display: none;
    }

    .nds-3d__card {
        top: auto;
        right: 0.75rem;
        bottom: 0.75rem;
        width: auto;
    }
}

@media (pointer: coarse) {
    .nds-3d__hint--mouse {
        display: none;
    }

    .nds-3d__hint--touch {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .nds-3d__actions {
        width: 100%;
    }

    .nds-3d__actions .btn {
        flex: 1 1 auto;
    }

    .nds-3d .hint {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nds-3d__leaders,
    .nds-3d__labels,
    .nds-3d__card,
    .nds-3d__label-number {
        animation: none;
        transition: none;
    }
}

@media print {
    .nds-3d__stage > :not(.nds-3d__title),
    .nds-3d__toolbar {
        display: none;
    }

    .nds-3d__stage {
        height: auto;
        overflow: visible;
        border: 0;
        background: none;
    }

    .nds-3d__title {
        position: static;
        max-width: none;
        margin-bottom: 0.5rem;
        text-align: left;
        text-shadow: none;
    }

    .nds-3d[data-nds3d-state]:not([data-nds3d-state="failed"]) .nds-3d__parts {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }
}
