
:root {
    --bg-body: #0f172a;
    --bg-panel: #1e293b;
    --text-main: #f1f5f9;
    --text-sub: #94a3b8;
    --border: #334155;

    --node-bg: #1e293b;
    --node-border: #64748b;
    --ptr-bg: #334155;
    --addr-text: #f87171;

    --array-bg: #064e3b;
    --array-border: #34d399;
    --stack-bg: #0c4a6e;
    --stack-border: #38bdf8;
    --queue-bg: #831843;
    --queue-border: #f472b6;
    --deque-bg: #312e81;
    --deque-border: #818cf8;
}

body {
    font-family: "Inter", sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

#sidebar {
    width: 320px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 20;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

#aux-panel {
    width: 400px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 20;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

#visual-area {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: #0f172a;

    background-image: radial-gradient(#334155 1px, transparent 1px);
    background-size: 20px 20px;
    cursor: grab;
}

#visual-area:active {
    cursor: grabbing;
}

#pan-zoom-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

#stage {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;

    z-index: 2;
}

#stage>* {
    pointer-events: auto;
}

#svg-layer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 1;
}

.node-wrapper {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.5s ease;
}

.mem-addr {
    font-family: "Fira Code", monospace;
    font-size: 0.7rem;
    color: var(--addr-text);
    margin-bottom: 4px;
}

.ll-box {
    display: flex;
    border: 2px solid var(--node-border);
    background: var(--node-bg);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 5;
}

.ll-data {
    padding: 12px 20px;
    font-weight: bold;
    font-size: 1.5rem;
    min-width: 50px;
    text-align: center;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ll-data:last-child {
    border-right: none;
}

.ll-ptr {
    background: var(--ptr-bg);
    padding: 8px 12px;
    font-family: "Fira Code", monospace;
    font-size: 0.75rem;
    color: var(--text-sub);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    gap: 2px;
}

.ptr-label {
    font-size: 0.6rem;
    font-weight: bold;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.circle-node {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--node-border);
    background: var(--node-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    z-index: 5;
}

.array-container {
    display: flex;
    gap: 5px;
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
}

.array-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.array-box {
    width: 60px;
    height: 60px;
    background: var(--array-bg);
    border: 2px solid var(--array-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.array-idx {
    font-family: "Fira Code";
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 5px;
}

.stack-container {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid var(--text-sub);
    border-right: 4px solid var(--text-sub);
    border-bottom: 4px solid var(--text-sub);
    width: 120px;
    min-height: 200px;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse;
    gap: 5px;
    border-radius: 0 0 10px 10px;
}

.stack-item {
    height: 40px;
    background: var(--stack-bg);
    border: 2px solid var(--stack-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;

}

.queue-container {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 4px dashed var(--text-sub);
    border-bottom: 4px dashed var(--text-sub);
    align-items: center;
}

.queue-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--queue-bg);
    border: 2px solid var(--queue-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;

}

.deque-container {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 4px dashed var(--text-sub);
    border-bottom: 4px dashed var(--text-sub);
    border-left: 4px dashed var(--text-sub);
    border-right: 4px dashed var(--text-sub);
    border-radius: 12px;
    align-items: center;
}

.deque-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--deque-bg);
    border: 2px solid var(--deque-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.embedded {
    position: static !important;
    transform: none !important;
    margin: 0 auto;
    width: auto;
    min-height: 0;
    border: none;
    background: transparent;
    padding: 5px;
}

.embedded .stack-item {
    width: 100%;
    height: auto;
    min-height: 40px;
    font-size: 0.8rem;
    padding: 8px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    line-height: 1.2;
    box-sizing: border-box;
    text-align: left;
    gap: 0;
}

.embedded .stack-item .st-val {
    width: 60px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 800;
    border-right: 2px solid rgba(255, 255, 255, 0.1);
    margin-right: 15px;
    padding-right: 10px;
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.embedded .stack-item .st-status {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: capitalize;
    letter-spacing: 0.5px;
}

.visited-item {
    width: 35px;
    height: 35px;
    border-radius: 4px;
    background: #10b981;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
    animation: dropIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.embedded .queue-item {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    font-size: 0.9rem;
    padding: 0;
    flex-direction: column;
    justify-content: center;
}

@keyframes dropIn {
    from {
        opactiy: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hidden {
    display: none !important;
}

#landing-view,
#home-view {
    width: 100%;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    background: radial-gradient(circle at 50% 10%, #1e293b 0%, #0f172a 100%);
    overflow-y: auto;
    color: #f8fafc;
}

.main-title {
    font-size: 3.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 60px;
    background: linear-gradient(135deg, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
}

.category-section {
    max-width: 1200px;
    margin: 0 auto 60px auto;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 24px;
}

.card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px 24px;
    height: 120px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease-out;
    backdrop-filter: blur(12px);
    gap: 15px;
}

.card h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 2;
    color: #e2e8f0;
    text-align: left;
    letter-spacing: 0.5px;
    flex: 1;
}

.card-visual {
    flex: 0 0 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
    opacity: 0.6;
    transition: opacity 0.3s, transform 0.3s;
}

.card:hover .card-visual {
    opacity: 1;
    transform: scale(1.05);
}

.vis-array {
    display: flex;
    gap: 4px;
}

.vis-array-box {
    width: 14px;
    height: 14px;
    background: var(--array-bg);
    border: 1.5px solid var(--array-border);
    border-radius: 2px;
}

.vis-stack {
    width: 34px;
    height: 48px;
    border: 2px solid var(--text-sub);
    border-top: none;
    border-radius: 0 0 6px 6px;
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-start;
    padding: 4px;
    gap: 4px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.1);
}

.vis-stack-item {
    width: 100%;
    height: 8px;
    background: var(--stack-bg);
    border: 1.5px solid var(--stack-border);
    border-radius: 1px;
}

.vis-queue {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 0;
    border-top: 2px dashed var(--text-sub);
    border-bottom: 2px dashed var(--text-sub);
    width: 100%;
    justify-content: center;
}

.vis-queue-item {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--queue-bg);
    border: 1.5px solid var(--queue-border);
}

.vis-deque {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border: 2px dashed var(--text-sub);
    border-radius: 8px;
}

.vis-sll {
    display: flex;
    align-items: center;
    gap: 2px;
}

.vis-node-box {
    width: 14px;
    height: 10px;
    background: var(--node-bg);
    border: 1.5px solid var(--node-border);
    border-radius: 2px;
    position: relative;
}

.vis-node-box::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--ptr-bg);
    border-left: 1px solid var(--node-border);
}

.vis-arrow-ptr {
    width: 8px;
    height: 2px;
    background: var(--text-sub);
    position: relative;
    margin-left: -2px;
}

.vis-arrow-ptr::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2.5px;
    border-left: 4px solid var(--text-sub);
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
}

.vis-arrow-ptr-bi {
    width: 10px;
    height: 4px;
    border-top: 1.5px solid var(--text-sub);
    border-bottom: 1.5px solid var(--text-sub);
    position: relative;
    margin: 0 -1px;
}

.vis-arrow-ptr-bi::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 1.5px;
    border-right: 3px solid var(--text-sub);
    border-top: 2.5px solid transparent;
    border-bottom: 2.5px solid transparent;
}

.vis-arrow-ptr-bi::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -4px;
    border-left: 3px solid var(--text-sub);
    border-top: 2.5px solid transparent;
    border-bottom: 2.5px solid transparent;
}

.vis-arrow-ptr-curve {
    width: 26px;
    height: 18px;
    border: 1.5px solid var(--text-sub);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    position: absolute;
    top: -14px;
    left: 4px;
}

.vis-arrow-ptr-curve::after {
    content: '';
    position: absolute;
    left: -2px;
    bottom: -1px;
    border-right: 3.5px solid transparent;
    border-left: 3.5px solid transparent;
    border-top: 4.5px solid var(--text-sub);
    transform: rotate(20deg);
}

.vis-tree {
    position: relative;
    width: 50px;
    height: 40px;
}

.vis-tree-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--node-bg);
    border: 1.5px solid var(--node-border);
    position: absolute;
}

.vis-tree-edge {
    position: absolute;
    background: var(--text-sub);
    height: 1.5px;
    transform-origin: 0 50%;
}

.vis-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.vis-grid-cell {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.vis-grid-cell.active {
    background: #3b82f6;
    border-color: #60a5fa;
}

.vis-hash {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    border: 1.5px solid #334155;
    border-radius: 4px;
    padding: 3px;
    background: rgba(0, 0, 0, 0.2);
}

.vis-hash-row {
    display: flex;
    gap: 3px;
    align-items: center;
}

.vis-hash-key {
    width: 16px;
    height: 10px;
    background: #3b82f6;
    border-radius: 2px;
}

.vis-hash-val {
    flex: 1;
    height: 10px;
    background: #10b981;
    border-radius: 2px;
}

.vis-linkedhash {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    padding: 2px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.vl-node {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 12px;
    background: var(--node-bg);
    border: 1px solid var(--node-border);
    padding: 1px;
    border-radius: 2px;
}

.vl-key {
    height: 4px;
    background: #3b82f6;
    border-radius: 1px;
}

.vl-val {
    height: 4px;
    background: #10b981;
    border-radius: 1px;
}

.vl-arrow {
    width: 6px;
    height: 1.5px;
    background: var(--text-sub);
    position: relative;
}

.vl-arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -1.5px;
    border-left: 2.5px solid var(--text-sub);
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
}

.card:hover {
    transform: translateY(-4px);
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card:hover h3 {
    color: #fff;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.card:hover::before {
    opacity: 1;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

#app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.back-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 24px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--text-sub);
}

.msg-log {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.msg {
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--border);
}

input {
    width: 100%;
    padding: 14px;
    background: #1e293b;
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
    font-family: "Fira Code", monospace;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ops-section {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
}

.ops-title {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ops-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
}

.ops-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.ops-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ops-divider {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.ops-label {
    font-size: 0.8rem;
    color: var(--text-sub);
    opacity: 0.7;
    white-space: nowrap;
}

.control-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.control-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(59, 130, 246, 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(59, 130, 246, 0.15);
}

.control-btn:hover::before {
    opacity: 1;
}

.control-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition-duration: 0.05s;
}

.control-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #60a5fa;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}

.cancel-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #f87171;
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.cancel-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #fca5a5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.traversal-btn {
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid #ec4899;
    color: #fce7f3;
    transition: all 0.2s;
}

.traversal-btn:hover {
    background: rgba(236, 72, 153, 0.3);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
    color: white;
}

.traversal-btn.active {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.6);
}

#step-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 8px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    z-index: 100;
}

.step-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: none;
    padding: 0;
}

.step-btn svg {
    width: 16px;
    height: 16px;
}

.step-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.step-btn:active:not(:disabled) {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.08);
}

.step-btn:disabled {
    background: rgba(255, 255, 255, 0.02);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.3;
    color: #475569;
}

#step-indicator {
    font-family: "Inter", sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #cbd5e1;
    min-width: 140px;
    max-width: 260px;
    text-align: center;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

#step-controls .step-separator {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
    border-radius: 1px;
}

#btnPlay {
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border: none !important;
    color: #1e1e1e !important;
    font-size: 0.8rem !important;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
    letter-spacing: 0;
}

#btnPlay:hover {
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.5) !important;
    transform: scale(1.08) !important;
}

#btnPlay:active {
    transform: scale(0.92) !important;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 56px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f59e0b;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
    transition: transform 0.15s ease;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.speed-control .speed-label {
    font-size: 0.6rem;
    color: #64748b;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#visual-queue::-webkit-scrollbar {
    display: none;
}

.tree-node {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--node-bg);
    border: 2px solid var(--node-border);
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-main);
    z-index: 5;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tree-node text {
    font-family: inherit;
    font-size: 0.9rem;
}

.bar-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px 10px 10px;
    min-height: 320px;
}

.bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.bar {
    width: 36px;
    min-height: 4px;
    background: linear-gradient(180deg, #64748b 0%, #475569 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease, background 0.3s ease, transform 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.bar-compare {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%) !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    transform: scaleX(1.08);
}

.bar-swap {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    transform: scaleY(1.05) scaleX(1.08);
}

.bar-sorted {
    background: linear-gradient(180deg, #34d399 0%, #10b981 100%) !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.bar-pivot {
    background: linear-gradient(180deg, #c084fc 0%, #a855f7 100%) !important;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.5);
    transform: scaleX(1.12);
}

.bar-merge {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.bar-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--text-sub);
    text-align: center;
}

.sort-log-panel {
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.sort-log-panel::-webkit-scrollbar {
    width: 4px;
}

.sort-log-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

#playground-card {
    background: linear-gradient(135deg, rgba(138, 88, 216, 0.15), rgba(30, 41, 59, 0.6));
    border: 1.5px solid rgba(138, 88, 216, 0.5);
    box-shadow: 0 0 15px rgba(138, 88, 216, 0.2);
    animation: pulseGlow 3s infinite alternate;
    justify-content: center;
}

#playground-card h3 {
    text-align: center;
    color: #f3e8ff;
    font-size: 1.4rem;
    letter-spacing: 1px;
}

#playground-card:hover {
    transform: translateY(-4px);
    background: linear-gradient(135deg, rgba(138, 88, 216, 0.25), rgba(30, 41, 59, 0.8));
    border-color: rgba(138, 88, 216, 0.9);
    box-shadow: 0 10px 30px rgba(138, 88, 216, 0.4);
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 10px rgba(138, 88, 216, 0.1);
        border-color: rgba(138, 88, 216, 0.3);
    }

    to {
        box-shadow: 0 0 20px rgba(138, 88, 216, 0.5);
        border-color: rgba(138, 88, 216, 0.7);
    }
}

#code-visualizer-card {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.05), rgba(30, 41, 59, 0.6));
    border: 1.5px solid rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
    animation: goldPulseGlow 3s infinite alternate;
    justify-content: center;
}

#code-visualizer-card h3 {
    text-align: center;
    color: #fef3c7;
    font-size: 1.4rem;
    letter-spacing: 1px;
}

#code-visualizer-card:hover {
    transform: translateY(-4px);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(30, 41, 59, 0.8));
    border-color: rgba(251, 191, 36, 0.9);
    box-shadow: 0 10px 30px rgba(251, 191, 36, 0.4);
}

@keyframes goldPulseGlow {
    from {
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
        border-color: rgba(251, 191, 36, 0.3);
    }

    to {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
        border-color: rgba(251, 191, 36, 0.7);
    }
}