.bi3d-shell {
    width: min(1360px, calc(100vw - 28px));
    margin: 0 auto;
    padding: 34px 0 72px;
    color: #e5edf6;
}

.bi3d-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    margin-bottom: 22px;
}

.bi3d-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    margin-bottom: 18px;
    color: #9fe8cf;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.bi3d-back:hover {
    color: #ffffff;
}

.bi3d-hero h1 {
    margin: 0;
    color: #f8fafc;
    font-size: clamp(34px, 5vw, 62px);
    line-height: 1.02;
    font-weight: 900;
    letter-spacing: 0;
}

.bi3d-hero p {
    max-width: 720px;
    margin: 16px 0 0;
    color: #a9b9cc;
    font-size: 16px;
    line-height: 1.8;
}

.bi3d-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(112px, 1fr));
    gap: 10px;
    min-width: min(420px, 100%);
}

.bi3d-hero-stats div {
    min-height: 84px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    padding: 15px;
    background: rgba(8, 13, 25, 0.72);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
}

.bi3d-hero-stats strong {
    display: block;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
}

.bi3d-hero-stats span {
    display: block;
    margin-top: 10px;
    color: #9fb1c5;
    font-size: 13px;
}

.bi3d-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
    gap: 18px;
    align-items: start;
}

.bi3d-viewer-panel,
.bi3d-library-panel {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(8, 13, 25, 0.82);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.bi3d-viewer-panel {
    overflow: hidden;
}

.bi3d-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 92px;
    padding: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(6, 13, 23, 0.92)),
        radial-gradient(circle at 10% 10%, rgba(52, 211, 153, 0.16), transparent 34%),
        radial-gradient(circle at 92% 16%, rgba(251, 191, 36, 0.1), transparent 30%);
}

.bi3d-selected {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.bi3d-selected img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.35));
}

.bi3d-selected span {
    display: inline-flex;
    width: fit-content;
    min-height: 24px;
    align-items: center;
    border: 1px solid rgba(52, 211, 153, 0.24);
    border-radius: 6px;
    padding: 2px 8px;
    color: #99f6e4;
    font-size: 12px;
    font-weight: 800;
}

.bi3d-selected strong {
    display: block;
    overflow: hidden;
    margin-top: 6px;
    color: #ffffff;
    font-size: 20px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi3d-selected code {
    display: block;
    overflow: hidden;
    margin-top: 5px;
    color: #9fb1c5;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi3d-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.bi3d-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #dbeafe;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.bi3d-actions button:hover,
.bi3d-actions button.is-active {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.14);
    color: #ffffff;
    transform: translateY(-1px);
}

.bi3d-canvas-shell {
    position: relative;
    min-height: 600px;
    aspect-ratio: 16 / 10;
    background:
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        radial-gradient(circle at 50% 42%, rgba(52, 211, 153, 0.18), transparent 36%),
        linear-gradient(160deg, #07111c 0%, #0b1220 48%, #10130f 100%);
    background-size: 28px 28px, 28px 28px, auto, auto;
    overflow: hidden;
    touch-action: none;
}

.bi3d-source-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) minmax(180px, 0.9fr);
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.28);
}

.bi3d-source-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 1px dashed rgba(52, 211, 153, 0.34);
    border-radius: 8px;
    background: rgba(52, 211, 153, 0.08);
    color: #bbf7d0;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.bi3d-source-drop:hover {
    border-color: rgba(52, 211, 153, 0.64);
    background: rgba(52, 211, 153, 0.14);
    color: #ffffff;
}

.bi3d-source-drop input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.bi3d-source-status {
    display: flex;
    align-items: center;
    min-height: 44px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.045);
    color: #9fb1c5;
    font-size: 13px;
    font-weight: 800;
}

.bi3d-canvas-shell::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 14%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.28), transparent);
    pointer-events: none;
}

.bi3d-canvas-shell canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.bi3d-canvas-shell.is-dragging canvas {
    cursor: grabbing;
}

.bi3d-canvas-hint {
    position: absolute;
    left: 16px;
    bottom: 16px;
    max-width: calc(100% - 32px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(2, 6, 23, 0.72);
    color: #b6c5d6;
    font-size: 12px;
    pointer-events: none;
}

.bi3d-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) minmax(190px, 0.8fr) minmax(190px, 0.8fr);
    gap: 12px;
    padding: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.28);
}

.bi3d-control-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.bi3d-control-group button,
.bi3d-tabs button {
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.bi3d-control-group button:hover,
.bi3d-control-group button.is-active,
.bi3d-tabs button:hover,
.bi3d-tabs button.is-active {
    border-color: rgba(52, 211, 153, 0.44);
    background: rgba(52, 211, 153, 0.13);
    color: #ffffff;
}

.bi3d-controls label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 30px;
    gap: 10px;
    align-items: center;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.045);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
}

.bi3d-controls input[type="range"] {
    width: 100%;
    accent-color: #34d399;
}

.bi3d-controls b {
    color: #ffffff;
    font-size: 13px;
    text-align: right;
}

.bi3d-library-panel {
    position: sticky;
    top: 78px;
    padding: 14px;
}

.bi3d-search {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 46px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    color: #94a3b8;
}

.bi3d-search .mcfun-iconpark {
    position: absolute;
    left: 13px;
    pointer-events: none;
}

.bi3d-search input {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px 0 43px;
    background: transparent;
    color: #ffffff;
    font-size: 14px;
    outline: none;
}

.bi3d-search input::placeholder {
    color: #718096;
}

.bi3d-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.bi3d-tabs span {
    margin-left: 4px;
    color: #9fb1c5;
    font-size: 12px;
}

.bi3d-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin-top: 10px;
    border: 1px dashed rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: rgba(251, 191, 36, 0.07);
    color: #fde68a;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.bi3d-upload:hover {
    border-color: rgba(251, 191, 36, 0.52);
    background: rgba(251, 191, 36, 0.12);
    color: #ffffff;
}

.bi3d-upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.bi3d-library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    margin-top: 12px;
}

.bi3d-library-head strong {
    color: #ffffff;
    font-size: 13px;
}

.bi3d-library-head a {
    color: #9fe8cf;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.bi3d-library-head a:hover {
    color: #ffffff;
}

.bi3d-asset-list {
    display: grid;
    gap: 8px;
    max-height: 614px;
    margin-top: 6px;
    padding-right: 4px;
    overflow: auto;
}

.bi3d-asset-button {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 58px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.045);
    color: inherit;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.bi3d-asset-button:hover,
.bi3d-asset-button.is-active {
    border-color: rgba(52, 211, 153, 0.42);
    background: rgba(52, 211, 153, 0.11);
    transform: translateY(-1px);
}

.bi3d-asset-button img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.34));
}

.bi3d-asset-button strong,
.bi3d-asset-button span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi3d-asset-button strong {
    color: #f8fafc;
    font-size: 14px;
    line-height: 1.25;
}

.bi3d-asset-button span {
    margin-top: 4px;
    color: #9fb1c5;
    font-size: 12px;
}

.bi3d-empty {
    min-height: 120px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    padding: 24px 14px;
    color: #9fb1c5;
    font-size: 14px;
    text-align: center;
}

@media (max-width: 1120px) {
    .bi3d-hero,
    .bi3d-workbench,
    .bi3d-controls,
    .bi3d-source-panel {
        grid-template-columns: 1fr;
    }

    .bi3d-library-panel {
        position: relative;
        top: auto;
    }

    .bi3d-asset-list {
        max-height: 440px;
    }
}

@media (max-width: 720px) {
    .bi3d-shell {
        width: min(100vw - 18px, 1360px);
        padding-top: 22px;
    }

    .bi3d-hero-stats {
        grid-template-columns: 1fr;
    }

    .bi3d-viewer-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .bi3d-actions {
        width: 100%;
    }

    .bi3d-actions button {
        flex: 1;
    }

    .bi3d-canvas-shell {
        min-height: 420px;
        aspect-ratio: 1 / 1.08;
    }

    .bi3d-control-group,
    .bi3d-tabs {
        grid-template-columns: 1fr;
    }
}
