#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #020617;
    transform-origin: top left;
}

.bst-nav {
    position: relative !important;
}

.bst-main {
    flex: 1;
    padding: 10px 18px 20px !important;
    max-width: none !important;
    overflow: hidden;
}

.bst-layout {
    display: grid !important;
    grid-template-columns: 1fr 280px !important;
    flex: 1;
    gap: 0.8rem !important;
    min-height: 0;
    overflow: hidden;
}

.tree-canvas-wrap {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.tree-canvas-wrap::-webkit-scrollbar { width: 6px; }
.tree-canvas-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.bst-sidebar {
    position: relative !important;
    top: 0 !important;
    max-height: 100% !important;
    overflow-y: auto;
    padding-right: 4px;
    flex: 1;
    min-height: 0;
}
.bst-sidebar::-webkit-scrollbar { width: 4px; }
.bst-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* HEAP SPECIFIC STYLES */
.array-view-wrap {
    padding: .8rem 1rem;
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.array-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .72rem;
    font-weight: 700;
    color: #0ea5e9;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.array-container {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
    min-height: 48px;
    padding: .3rem 0;
}
.array-box {
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .8rem;
    font-weight: 700;
    color: #94a3b8;
    position: relative;
    transition: all .3s;
}
.array-idx {
    position: absolute;
    bottom: -14px;
    font-size: .6rem;
    color: #64748b;
    font-weight: 400;
}
.array-box.active {
    background: rgba(14, 165, 233, 0.15);
    border-color: #0ea5e9;
    color: #0ea5e9;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
    transform: translateY(-2px);
}
.array-box.swap {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
    color: #f59e0b;
    z-index: 2;
}
.array-box.target {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
}

/* Tree node states for Heap */
.bst-node-circle.state-heap-swap {
    stroke: #f59e0b;
    fill: rgba(245, 158, 11, 0.2);
    stroke-width: 3px;
}
.bst-node-circle.state-heap-ok {
    stroke: #10b981;
    fill: rgba(16, 185, 129, 0.2);
    stroke-width: 2.5px;
}
.bst-node-circle.state-heap-leaf {
    stroke: #64748b;
    fill: rgba(15, 23, 42, 0.8);
    opacity: 0.8;
}

/* Animations */
@keyframes heapify-up {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.heap-node-anim {
    animation: heapify-up 0.5s ease-in-out;
}

/* Speed mode updates */
.mode-toggle #mode-max.active { background: #0ea5e9; color: #fff; }
.mode-toggle #mode-min.active { background: #0ea5e9; color: #fff; }

.prop-desc code {
    background: rgba(255,255,255,0.05);
    padding: 1px 4px;
    border-radius: 4px;
    color: #0ea5e9;
    font-family: inherit;
}
