/* --- Global Body & Cyberpunk Animated Cosmic Background --- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #f1f5f9; /* Bright silver text for dark background */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 40px;
    box-sizing: border-box;
    
    /* Immersive, dark sci-fi cosmic background */
    background: linear-gradient(-45deg, #0f172a, #1e1b4b, #042f2e, #0f172a);
    background-size: 400% 400%;
    animation: cosmicShift 15s ease infinite;
    overflow-x: hidden;
}

@keyframes cosmicShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Translucent Frosted Glass Container --- */
.app-container {
    background: rgba(15, 23, 42, 0.45); /* Dark semi-transparent base */
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    text-align: center;
    width: 100%;
    max-width: 540px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: panelFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Typography --- */
h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

.subtitle {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 28px;
}

.section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #38bdf8; /* Vivid neon blue header titles */
    margin-bottom: 16px;
    font-weight: 600;
}

/* --- Controls Section --- */
.input-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 32px;
}

#inputString {
    width: 100%;
    padding: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
}

#inputString:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
    background: #3b82f6;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Tape Elements --- */
.tape-view {
    display: flex;
    flex-direction: column; /* Matches your layout structure vertically */
    align-items: center;
    gap: 4px;
    margin: 20px 0;
}

.cell {
    font-size: 16px;
    color: #cbd5e1;
    padding: 4px 12px;
    transition: all 0.3s ease;
}

/* Highlighting bar style layout matching your request */
.active-cell {
    width: 100%;
    background: rgba(250, 204, 21, 0.15);
    border-top: 1px solid rgba(250, 204, 21, 0.4);
    border-bottom: 1px solid rgba(250, 204, 21, 0.4);
    color: #facc15; /* Glowing amber text */
    font-weight: bold;
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
    padding: 6px 12px;
}

/* --- Main Dashboard Split Grid --- */
.visualization-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 32px;
}

.visual-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
}

/* --- Stack Box Visualizer --- */
.stack-container {
    width: 70px;
    height: 140px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    display: flex;
    flex-direction: column-reverse;
    margin: 0 auto 8px auto;
    background: rgba(15, 23, 42, 0.4);
    padding: 3px;
    box-sizing: border-box;
    gap: 3px;
}

.stack-item {
    height: 24px;
    background: #10b981;
    color: white;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.stack-base-label {
    font-size: 12px;
    color: #64748b;
}

/* --- State Visualizer Node --- */
.state-node {
    width: 68px;
    height: 68px;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    margin: 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2), inset 0 0 8px rgba(59, 130, 246, 0.2);
    animation: statePulse 2.5s infinite ease-in-out;
}

@keyframes statePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
    50% { transform: scale(1.04); box-shadow: 0 0 30px rgba(59, 130, 246, 0.4); }
}

/* --- Status Card Log --- */
.status-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

#status-message {
    font-size: 14px;
    font-weight: 600;
    color: #f87171; /* High visibility neon red */
    letter-spacing: 0.05em;
    margin: 0;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}