* { box-sizing: border-box; margin: 0; padding: 0; }

body.sim-page {
    background: #0f172a;
    color: white;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}

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

#bgCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    background: #1e293b;
}

nav, main {
    position: relative;
    z-index: 1;
}

.sim-main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sim-header {
    text-align: center;
    margin-bottom: 3rem;
}

.split-container {
    display: flex;
    gap: 1.5rem;
    position: relative;
    background: rgba(30, 41, 59, 1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    flex: 1;
    overflow: hidden;
}

.sim-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-title-box {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title-box h2 {
    font-size: 0.9rem;
    color: #f8fafc;
    background: #1e293b;
    display: inline-block;
    padding: 0.4rem 1.5rem;
    border-radius: 4px;
    letter-spacing: 1.5px;
    font-weight: 800;
    margin-bottom: 0.4rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.section-title-box p {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.viz-area {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 1rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* STACK VISUALS */
.viz-labels {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.label-box {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.push-label {
    background: #eab308;
    color: #422006;
}

.pop-label {
    background: #ef4444;
    color: white;
}

.stack-visual-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
}

.input-indicator {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.input-indicator .label {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
}

.input-indicator input {
    width: 40px;
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    background: transparent;
    outline: none;
}

.stack-structure {
    width: 80px;
    height: 200px;
    background: linear-gradient(to right, #334155, #475569, #334155);
    border: 3px solid #1e293b;
    border-top: none;
    border-radius: 0 0 8px 8px;
    position: relative;
    padding: 4px;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
}

.stack-item {
    width: 100%;
    height: 32px;
    background: linear-gradient(135deg, #0d9488, #0f766e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    animation: pushAnim 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

@keyframes pushAnim {
    from {
        transform: translateY(-300px);
        opacity: 0;
    }

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

.stack-item.popping {
    animation: popAnim 0.3s forwards;
}

@keyframes popAnim {
    to {
        transform: translateY(-300px);
        opacity: 0;
    }
}

/* QUEUE VISUALS */
.viz-labels-h {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.label-box-h {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enqueue-label {
    color: #22c55e;
}

.dequeue-label {
    color: #ef4444;
}

.queue-visual-wrapper {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 20px;
}

.queue-belt {
    width: 65%;
    height: 52px;
    background: rgba(51, 65, 85, 0.4);
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 15px;
    overflow: hidden;
    border: 2px solid #334155;
}

.queue-content {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    height: 100%;
}

.belt-line {
    position: absolute;
    bottom: -5px;
    width: 100%;
    left: 0;
    height: 8px;
    background: #1e293b;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 15px, #475569 15px, #475569 30px);
    z-index: -1;
}

.queue-item {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
    animation: enqueueAnim 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes enqueueAnim {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }

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

.queue-item.dequeuing {
    animation: dequeueAnim 0.3s forwards;
}

@keyframes dequeueAnim {
    to {
        transform: translateX(100px);
        opacity: 0;
    }
}

/* Color variations for queue items */
.color-0 {
    background: #ef4444;
}

.color-1 {
    background: #f97316;
}

.color-2 {
    background: #eab308;
}

.color-3 {
    background: #2563eb;
}

.color-4 {
    background: #22c55e;
}

.queue-input-display {
    margin-top: 1rem;
    background: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #64748b;
}

.queue-input-display input {
    width: 60px;
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    outline: none;
}

/* CONTROLS & STATUS */
.stack-controls,
.queue-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.btn-stack,
.btn-queue {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.btn-stack.push {
    background: #f59e0b;
    color: #422006;
}

.btn-stack.pop {
    background: #ef4444;
    color: white;
}

.btn-queue.enqueue {
    background: #22c55e;
    color: white;
}

.btn-queue.dequeue {
    background: #ef4444;
    color: white;
}

.reset {
    background: #475569;
    color: white;
}

.btn-stack:hover,
.btn-queue:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-stack:active,
.btn-queue:active {
    transform: translateY(0);
}

.data-status {
    background: rgba(15, 23, 42, 0.8);
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.status-item {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.status-item .value {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-family: 'Space Grotesk', monospace;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-item .value:empty::before {
    content: '-';
    color: #475569;
}

.info-footer {
    text-align: center;
    background: rgba(15, 23, 42, 0.3);
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.splitter {
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.1), transparent);
}
